本文整理汇总了C#中Tools.Serialiser.Serialise方法的典型用法代码示例。如果您正苦于以下问题:C# Serialiser.Serialise方法的具体用法?C# Serialiser.Serialise怎么用?C# Serialiser.Serialise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools.Serialiser
的用法示例。
在下文中一共展示了Serialiser.Serialise方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialise
public static object Serialise(object o,Serialiser s)
{
if (s==null)
return new TokClassDef();
TokClassDef t = (TokClassDef)o;
if (s.Encode)
{
s.Serialise(t.m_name);
s.Serialise(t.m_yynum);
return null;
}
t.m_name = (string)s.Deserialise();
t.m_yynum = (int)s.Deserialise();
return t;
}
示例2: Serialise
/// <exclude/>
public static object Serialise(object o,Serialiser s)
{
if (s==null)
return new Dfa();
Dfa d = (Dfa)o;
if (s.Encode)
{
s.Serialise(d.m_state);
s.Serialise(d.m_map);
s.Serialise(d.m_actions);
s.Serialise(d.m_tokClass);
s.Serialise(d.m_reswds);
return null;
}
d.m_state = (int)s.Deserialise();
d.m_map = (Hashtable)s.Deserialise();
d.m_actions = (Action)s.Deserialise();
d.m_tokClass = (string)s.Deserialise();
d.m_reswds = (int)s.Deserialise();
return d;
}
示例3: EmitDfa
public void EmitDfa(TextWriter outFile)
{
Console.WriteLine("Serializing the lexer");
Serialiser f = new Serialiser(outFile);
f.VersionCheck();
f.Serialise(m_encoding);
f.Serialise(toupper);
f.Serialise(cats);
f.Serialise(m_gencat);
f.Serialise(usingEOF);
f.Serialise(starts);
f.Serialise(tokens);
f.Serialise(reswds);
outFile.WriteLine("0};");
}
示例4: Emit
public void Emit(TextWriter m_outFile)
{
Serialiser b = new Serialiser(m_outFile);
b.VersionCheck();
Console.WriteLine("Serialising the parser");
b.Serialise(m_startSymbol);
b.Serialise(m_accept);
b.Serialise(m_states);
b.Serialise(literals);
b.Serialise(symbolInfo);
b.Serialise(m_concrete);
m_outFile.WriteLine("0};");
}
示例5: Serialise
public new static object Serialise(object o,Serialiser s)
{
if (s==null)
return new ParserShift();
ParserShift p = (ParserShift)o;
if (s.Encode)
{
ParserEntry.Serialise(p,s);
s.Serialise(p.m_next);
return null;
}
ParserEntry.Serialise(p,s);
p.m_next = (ParseState)s.Deserialise();
return p;
}
示例6: EncodingSerialise
static object EncodingSerialise(object o, Serialiser s)
{
if (s.Encode)
{
Encoding e = (Encoding)o;
s.Serialise(e.WebName);
return null;
}
string str = (string)s.Deserialise();
switch (str)
{
case "us-ascii": return Encoding.ASCII;
case "utf-16": return Encoding.Unicode;
case "utf-7": return Encoding.UTF7;
case "utf-8": return Encoding.UTF8;
default:
try
{
return Encoding.GetEncoding(str); // 4.7f
}
catch (Exception)
{
throw new Exception("Unknown encoding");
}
}
}
示例7: Serialise
/// <exclude/>
public static object Serialise(object o,Serialiser s)
{
if (s==null)
return new Charset();
Charset c = (Charset)o;
if (s.Encode)
{
s.Serialise((int)c.m_cat);
s.Serialise(c.m_generic);
s.Serialise(c.m_chars);
return null;
}
c.m_cat = (UnicodeCategory)s.Deserialise();
c.m_generic = (char)s.Deserialise();
c.m_chars = (Hashtable)s.Deserialise();
return c;
}
示例8: HashtableSerialise
static object HashtableSerialise(object o,Serialiser s)
{
if (s==null)
return new Hashtable();
Hashtable h = (Hashtable)o;
if (s.Encode)
{
s._Write(h.Count);
foreach (DictionaryEntry d in h)
{
s.Serialise(d.Key);
s.Serialise(d.Value);
}
return null;
}
int ct = s._Read();
for (int j=0;j<ct;j++)
{
object k = s.Deserialise();
object v = s.Deserialise();
h[k] = v;
}
return h;
}
示例9: EncodingSerialise
static object EncodingSerialise(object o,Serialiser s)
{
if (s.Encode)
{
Encoding e = (Encoding)o;
s.Serialise(e.WebName);
return null;
}
switch((string)s.Deserialise())
{
case "us-ascii": return Encoding.ASCII;
case "utf-16": return Encoding.Unicode;
case "utf-7": return Encoding.UTF7;
case "utf-8": return Encoding.UTF8;
}
throw new Exception("Unknown encoding");
}