Example #1
0
 public void SerializeAs(Stream stream, object obj, Type type)
 {
     using (LiteBinaryWriter writer = new LiteBinaryWriter(stream, Encoding.Default, _serializationContext))
     {
         writer.WriteObjectAs(type, obj);
     }
 }
Example #2
0
        public override void Write(LiteBinaryWriter writer, object graph)
        {
//			Type enumType = Enum.GetUnderlyingType(ActualType);
//			ILiteSerializationSurrogate typeSurr = writer.Context.SurrogateSelector.GetSurrogateForType(enumType);
//			writer.Write(typeSurr.TypeHandle);
//			typeSurr.Write(writer, graph);
        }
 public override void WriteTo(LiteBinaryWriter writer, object obj)
 {
     Int32[] array = (Int32[])obj;
     writer.Write(array.Length);
     for (int i = 0; i < array.Length; i++)
     {
         writer.Write(array[i]);
     }
 }
Example #4
0
        public override void WriteTo(LiteBinaryWriter writer, object obj)
        {
            Array array = (Array)obj;

            writer.Write(array.Length);
            for (int i = 0; i < array.Length; i++)
            {
                writer.WriteObject(array.GetValue(i));
            }
        }
Example #5
0
        public override void WriteTo(LiteBinaryWriter writer, object obj)
        {
            IList list = (IList)obj;

            writer.Write(list.Count);
            for (int i = 0; i < list.Count; i++)
            {
                writer.WriteObject(list[i]);
            }
        }
        public override void WriteTo(LiteBinaryWriter writer, object obj)
        {
            IDictionary dict = (IDictionary)obj;

            writer.Write(dict.Count);
            for (IDictionaryEnumerator i = dict.GetEnumerator(); i.MoveNext();)
            {
                writer.WriteObject(i.Key);
                writer.WriteObject(i.Value);
            }
        }
Example #7
0
        public sealed override void Write(LiteBinaryWriter writer, object obj)
        {
            int cookie = writer.SerializationContext.GetCookie(obj);

            if (cookie != LiteSerializationContext.InvalidCookie)
            {
                writer.Write(cookie);
                return;
            }

            cookie = writer.SerializationContext.CacheObjectForWrite(obj);
            writer.Write(cookie);
            WriteTo(writer, obj);
        }
Example #8
0
        public override void Write(LiteBinaryWriter writer, object obj)
        {
            int cookie = writer.SerializationContext.GetCookie(obj);

            if (cookie != LiteSerializationContext.InvalidCookie)
            {
                writer.Write(cookie);
                return;
            }

            cookie = writer.SerializationContext.CacheObjectForWrite(obj);
            writer.Write(cookie);
            _formatter.Serialize(writer.BaseStream, obj);
        }
 public override void Write(LiteBinaryWriter writer, object obj)
 {
     writer.Write((DateTime)obj);
 }
Example #10
0
 public override void Write(LiteBinaryWriter writer, object obj)
 {
     writer.Write((String)obj);
 }
Example #11
0
 public override void Write(LiteBinaryWriter writer, object obj)
 {
     writer.Write((Decimal)obj);
 }
Example #12
0
 public virtual void Write(LiteBinaryWriter writer, object obj)
 {
 }
Example #13
0
 public abstract void WriteTo(LiteBinaryWriter writer, object obj);
 public override void WriteTo(LiteBinaryWriter writer, object obj)
 {
     ((ILiteSerializable)obj).Serialize(writer);
 }
Example #15
0
 public override void Write(LiteBinaryWriter writer, object obj)
 {
     writer.Write((Int16)obj);
 }
Example #16
0
 public override void Write(LiteBinaryWriter writer, object obj)
 {
     writer.Write((Boolean)obj);
 }