Ejemplo n.º 1
0
        public static void Serialize <T>(List <T> list, Core.Utils.MyBinaryWriter writer, List <T> lastList = null,
                                         bool writeAll = false) where T : IPatchClass <T>, new()
        {
            BitArrayWrapper bitArray  = GetDiffBitArray(lastList, list, writeAll);
            var             count     = list == null ? 0 : list.Count;
            var             lastCount = lastList == null ? 0 : lastList.Count;

            writer.Write(bitArray);

            for (int i = 0; i < count; i++)
            {
                if (bitArray[i] == false)
                {
                    continue;
                }
                var last = i >= lastCount || writeAll ? default(T) : lastList[i];
                PatchPropertySerializer.Write(list[i], last, writer);
            }

            bitArray.ReleaseReference();
        }
Ejemplo n.º 2
0
 private static void Serialize <T>(T curr, T last, MyBinaryWriter writer) where T : class, IPatchClass <T>, new()
 {
     PatchPropertySerializer.Write(curr, last, writer);
 }