예제 #1
0
        public void WriteTo(BinaryWriter writer)
        {
            FileValidation.WriteTo(writer, Metadata);

            if (Data != null)
            {
                writer.Write((uint)Data.LongLength);
                if (Data.Length > 0)
                {
                    writer.Write(Data);
                }
            }
            else
            {
                writer.Write(0U);
            }
        }
예제 #2
0
        private byte[] WritePatches(Patch patch)
        {
            using (var ms = new MemoryStream())
                using (var writer = new BinaryWriter(ms))
                {
                    FileValidation.WriteTo(writer, patch.Item1);

                    var patchInfos = patch.Item2;
                    if (patchInfos != null)
                    {
                        writer.Write(patchInfos.Length);
                        foreach (var patchInfo in patchInfos)
                        {
                            patchInfo.WriteTo(writer);
                        }
                    }
                    else
                    {
                        writer.Write(0);
                    }

                    return(ms.ToArray());
                }
        }