Exemple #1
0
 public void Serialise(object o)
 {
     if (o == null)
     {
         this._Write(Serialiser.SerType.Null);
     }
     else if (o is Encoding)
     {
         this._Write(Serialiser.SerType.Encoding);
         Serialiser.EncodingSerialise(o, this);
     }
     else
     {
         Type type = o.GetType();
         if (type.IsClass)
         {
             object ob = this.obs[o];
             if (ob != null)
             {
                 this._Write((int)ob);
                 return;
             }
             int i = ++this.id;
             this._Write(i);
             this.obs[o] = (object)i;
         }
         object tp = Serialiser.tps[(object)type];
         if (tp == null)
         {
             throw new Exception("unknown type " + type.FullName);
         }
         Serialiser.SerType t = (Serialiser.SerType)tp;
         this._Write(t);
         object obj = ((Serialiser.ObjectSerialiser)Serialiser.srs[(object)t])(o, this);
     }
 }