本文整理汇总了C#中Tools.Serialiser类的典型用法代码示例。如果您正苦于以下问题:C# Serialiser类的具体用法?C# Serialiser怎么用?C# Serialiser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Serialiser类属于Tools命名空间,在下文中一共展示了Serialiser类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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};");
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:13,代码来源:parser.cs
示例2: EmitDfa
public void EmitDfa(TextWriter outFile)
{
Console.WriteLine("Serializing the lexer");
Serialiser f = new Serialiser(outFile);
f.Serialise(m_encoding);
f.Serialise(toupper);
f.Serialise(cats);
f.Serialise(m_gencat);
f.Serialise(usingEOF);
f.Serialise(starts);
f.Serialise(tokens);
outFile.WriteLine("0};");
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:lexer.cs
示例3: 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);
return null;
}
t.m_name = (string)s.Deserialise();
return t;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:dfa.cs
示例4: GetDfa
// Deserializing
public void GetDfa()
{
if (tokens.Count>0)
return;
Serialiser f = new Serialiser(arr);
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();
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:15,代码来源:lexer.cs
示例5: Serialise
/// <exclude/>
public static object Serialise(object o,Serialiser s)
{
if (s==null)
return new CSymbol();
CSymbol c = (CSymbol)o;
if (s.Encode)
{
s.Serialise(c.yytext);
s.Serialise(c.m_yynum);
s.Serialise((int)c.m_symtype);
return null;
}
c.yytext = (string)s.Deserialise();
c.m_yynum = (int)s.Deserialise();
c.m_symtype = (SymType)s.Deserialise();
return c;
}
开发者ID:hdinh,项目名称:OmahaBot,代码行数:18,代码来源:parser.cs
示例6: 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;
}
开发者ID:hdinh,项目名称:OmahaBot,代码行数:22,代码来源:dfa.cs
示例7: Serialise
public new static object Serialise(object o,Serialiser s)
{
if (s==null)
return new ParserOldAction();
ParserOldAction p = (ParserOldAction)o;
if (s.Encode)
{
ParserAction.Serialise(p,s);
s.Serialise(p.m_action);
return null;
}
ParserAction.Serialise(p,s);
p.m_action = (int)s.Deserialise();
return p;
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:15,代码来源:parser.cs
示例8: IntSerialise
static object IntSerialise(object o,Serialiser s)
{
if (s.Encode)
{
s._Write((int)o);
return null;
}
return s._Read();
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:9,代码来源:serialise.cs
示例9: BoolSerialise
static object BoolSerialise(object o,Serialiser s)
{
if (s.Encode)
{
s._Write(((bool)o)?1:0);
return null;
}
int v = s._Read();
return v!=0;
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:10,代码来源:serialise.cs
示例10: UnicodeCategorySerialise
static object UnicodeCategorySerialise(object o,Serialiser s)
{
if (s.Encode)
{
s._Write((int)o);
return null;
}
return (UnicodeCategory)s._Read();
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:9,代码来源:serialise.cs
示例11: 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;
}
开发者ID:Ezakhiel,项目名称:Donate-Money-For-Unicorns-ubbse2015,代码行数:18,代码来源:lexer.cs
示例12: SymtypeSerialise
static object SymtypeSerialise(object o,Serialiser s)
{
if (s.Encode)
{
s._Write((int)o);
return null;
}
return (CSymbol.SymType)s._Read();
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:9,代码来源:serialise.cs
示例13: StringSerialise
static object StringSerialise(object o,Serialiser s)
{
if (s==null)
return "";
Encoding e = new UnicodeEncoding();
if (s.Encode)
{
byte[] b = e.GetBytes((string)o);
s._Write(b.Length);
for (int j=0;j<b.Length;j++)
s._Write((int)b[j]);
return null;
}
int ln = s._Read();
byte[] bb = new byte[ln];
for (int k=0;k<ln;k++)
bb[k] = (byte)s._Read();
string r = e.GetString(bb,0,ln);
return r;
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:20,代码来源:serialise.cs
示例14: NullSerialise
static object NullSerialise(object o,Serialiser s)
{
return null;
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:4,代码来源:serialise.cs
示例15: 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");
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:17,代码来源:serialise.cs
示例16: CharSerialise
static object CharSerialise(object o,Serialiser s)
{
Encoding e = new UnicodeEncoding();
if (s.Encode)
{
byte[] b = e.GetBytes(new string((char)o,1));
s._Write((int)b[0]);
s._Write((int)b[1]);
return null;
}
byte[] bb = new byte[2];
bb[0] = (byte)s._Read();
bb[1] = (byte)s._Read();
string r = e.GetString(bb,0,2);
return r[0];
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:16,代码来源:serialise.cs
示例17: 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);
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:13,代码来源:parser.cs
示例18: 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;
}
开发者ID:montyaahad,项目名称:PokerBot,代码行数:24,代码来源:serialise.cs
注:本文中的Tools.Serialiser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论