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


C# Serialiser.Deserialise方法代碼示例

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

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

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

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

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

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

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


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