本文整理汇总了C#中Tools.Serialiser.Deserialise方法的典型用法代码示例。如果您正苦于以下问题:C# Serialiser.Deserialise方法的具体用法?C# Serialiser.Deserialise怎么用?C# Serialiser.Deserialise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools.Serialiser
的用法示例。
在下文中一共展示了Serialiser.Deserialise方法的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: GetDfa
// Deserializing
public void GetDfa()
{
if (tokens.Count>0)
return;
Serialiser f = new Serialiser(arr);
f.VersionCheck();
m_encoding = (Encoding)f.Deserialise();
toupper = (bool)f.Deserialise();
cats = (Hashtable)f.Deserialise();
m_gencat = (UnicodeCategory)f.Deserialise();
usingEOF = (bool)f.Deserialise();
starts = (Hashtable)f.Deserialise();
Dfa.SetTokens(this,starts);
tokens = (Hashtable)f.Deserialise();
reswds = (Hashtable)f.Deserialise();
}
示例4: Serialise
public static object Serialise(object o, Serialiser s)
{
if (s==null)
return new ParseState();
ParseState p = (ParseState)o;
if (s.Encode)
{
s.Serialise(p.m_state);
s.Serialise(p.m_accessingSymbol);
s.Serialise(p.m_changed);
return true;
}
p.m_state = (int)s.Deserialise();
p.m_accessingSymbol = (CSymbol)s.Deserialise();
p.m_changed = (bool)s.Deserialise();
return p;
}
示例5: 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");
}
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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");
}
示例9: GetParser
public void GetParser(Lexer m_lexer)
{
Serialiser b = new Serialiser(arr);
b.VersionCheck();
m_startSymbol = (CSymbol)b.Deserialise();
m_startSymbol.kids = new ObjectList(); // 4.2a
m_accept = (ParseState)b.Deserialise();
m_states = (Hashtable)b.Deserialise();
literals = (Hashtable)b.Deserialise();
symbolInfo = (Hashtable)b.Deserialise();
m_concrete = (bool)b.Deserialise();
GetEOF(m_lexer);
}