當前位置: 首頁>>代碼示例>>C#>>正文


C# Serialiser.Serialise方法代碼示例

本文整理匯總了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;
		}
開發者ID:Belxjander,項目名稱:Asuna,代碼行數:15,代碼來源:dfa.cs

示例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;
 }
開發者ID:hdinh,項目名稱:OmahaBot,代碼行數:22,代碼來源:dfa.cs

示例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};");
		}
開發者ID:Belxjander,項目名稱:Asuna,代碼行數:15,代碼來源:lexer.cs

示例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};");
		}
開發者ID:Belxjander,項目名稱:Asuna,代碼行數:13,代碼來源:parser.cs

示例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;
		}
開發者ID:Belxjander,項目名稱:Asuna,代碼行數:15,代碼來源:parser.cs

示例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");
                    }
            }
        }
開發者ID:Belxjander,項目名稱:Asuna,代碼行數:27,代碼來源:serialise.cs

示例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;
 }
開發者ID:Ezakhiel,項目名稱:Donate-Money-For-Unicorns-ubbse2015,代碼行數:18,代碼來源:lexer.cs

示例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;
 }
開發者ID:montyaahad,項目名稱:PokerBot,代碼行數:24,代碼來源:serialise.cs

示例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");
 }
開發者ID:montyaahad,項目名稱:PokerBot,代碼行數:17,代碼來源:serialise.cs


注:本文中的Tools.Serialiser.Serialise方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。