Exemplo n.º 1
0
        public static SimpleObjectSerializer Serialize(object o, Stream s)
        {
            var os = new SimpleObjectSerializer(o);

            os.SerializeTo(s);
            return(os);
        }
Exemplo n.º 2
0
        public bool Serialize(SimpleObjectSerializer serializer)
        {
            serializer.Writer.Write((UInt16)Count);
            if (Count == 0)
            {
                return(true);
            }

            if (compacter == null)
            {
                var chars = new List <char>();
                foreach (var s in list)
                {
                    foreach (var c in s)
                    {
                        if (!chars.Contains(c))
                        {
                            chars.Add(c);
                        }
                    }
                }

                compacter = new StringCompacter(chars);
            }

            serializer.Writer.Write(new string(compacter.GetChars()));
            foreach (var s in list)
            {
                serializer.Writer.Write(compacter.Serialize(s));
            }

            return(true);
        }
Exemplo n.º 3
0
            internal void Serialize(SimpleObjectSerializer s)
            {
                var w = s.Writer;

                if (Strings.Count > 0)
                {
                    w.Write(TypeCodeCompressedStringCollection);
                    Strings.Serialize(s);
                }
                if (types.Count > 0)
                {
                    w.Write(TypeCodeTypeCollection);
                    w.Write((UInt16)types.Count);
                    for (int i = 0; i < types.Count; i++)
                    {
                        w.Write((UInt16)types[i].StringIndex);
                    }
                }
            }
Exemplo n.º 4
0
        public static byte[] Serialize(object o, SimpleObjectFieldSerializationMode FieldMode)
        {
            var os = new SimpleObjectSerializer(o, FieldMode);

            return(os.Serialize());
        }
Exemplo n.º 5
0
        public static byte[] Serialize(object o)
        {
            var os = new SimpleObjectSerializer(o);

            return(os.Serialize());
        }
Exemplo n.º 6
0
 bool ICustomSerializer.Initialize(SimpleObjectSerializer s)
 {
     return(true);
 }