Пример #1
0
 public virtual void writeSerializable(object o)
 {
     #if !COMPACT
     if(o == null)
     {
         writeSize(0);
         return;
     }
     try
     {
         StreamWrapper w = new StreamWrapper(this);
         IFormatter f = new BinaryFormatter();
         f.Serialize(w, o);
         w.Close();
     }
     catch(System.Exception ex)
     {
         throw new Ice.MarshalException("cannot serialize object:", ex);
     }
     #else
     throw new Ice.MarshalException("serialization not supported");
     #endif
 }
Пример #2
0
 public virtual object readSerializable()
 {
     #if !COMPACT
     int sz = readAndCheckSeqSize(1);
     if(sz == 0)
     {
         return null;
     }
     try
     {
         StreamWrapper w = new StreamWrapper(sz, this);
         IFormatter f = new BinaryFormatter();
         return f.Deserialize(w);
     }
     catch(System.Exception ex)
     {
         throw new Ice.MarshalException("cannot deserialize object:", ex);
     }
     #else
     throw new Ice.MarshalException("serialization not supported");
     #endif
 }