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); }
internal void Deserialize(BinaryReader reader) { list.Clear(); compacter = null; int cnt = reader.ReadUInt16(); if (cnt > 0) { var chars = reader.ReadString(); compacter = new StringCompacter(chars); for (int i = 0; i < cnt; i++) { list.Add(compacter.Deserialize(reader)); } } }