Exemplo n.º 1
0
        public static IEditableVariable CopyViaBuffer(IEditableVariable source, IEditableVariable destination)
        {
            using (MemoryStream ms = new MemoryStream())
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    source.Write(bw);

                    ms.Position = 0;

                    using (BinaryReader reader = new BinaryReader(ms))
                    {
                        destination.Read(reader, (uint)ms.Length);
                    }
                }

            return(destination);
        }
Exemplo n.º 2
0
        public override void Read(BinaryReader file, uint size)
        {
            var typeId   = file.ReadUInt16();
            var typename = cr2w.Names[typeId].Str;

            var varsize = file.ReadUInt32() - 4;

            if (varsize > 0)
            {
                Variant = CR2WTypeManager.Create(typename, nameof(Variant), cr2w, this);
                Variant.Read(file, varsize);
                Variant.IsSerialized = true;
            }
            else
            {
                // do nothing I guess?
            }
        }