コード例 #1
0
        public static SimpleObjectSerializer Serialize(object o, Stream s)
        {
            var os = new SimpleObjectSerializer(o);

            os.SerializeTo(s);
            return(os);
        }
コード例 #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);
        }
コード例 #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);
                    }
                }
            }
コード例 #4
0
        public static byte[] Serialize(object o, SimpleObjectFieldSerializationMode FieldMode)
        {
            var os = new SimpleObjectSerializer(o, FieldMode);

            return(os.Serialize());
        }
コード例 #5
0
        public static byte[] Serialize(object o)
        {
            var os = new SimpleObjectSerializer(o);

            return(os.Serialize());
        }
コード例 #6
0
 bool ICustomSerializer.Initialize(SimpleObjectSerializer s)
 {
     return(true);
 }