Beispiel #1
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         if (IffFile.TargetTS1)
         {
             //version 138
             io.WriteUInt32(138);
             var fields = VERSION_142_Fields.Concat(VERSION_138b_Extra_Fields);
             foreach (var prop in fields)
             {
                 io.WriteUInt16((ushort)GetPropertyByName <int>(prop));
             }
             for (int i = fields.Count(); i < 108; i++)
             {
                 io.WriteUInt16(0);
             }
         }
         else
         {
             //tso version 142
             io.WriteUInt32(142);
             foreach (var prop in VERSION_142_Fields)
             {
                 io.WriteUInt16((ushort)GetPropertyByName <int>(prop));
             }
             for (int i = VERSION_142_Fields.Length; i < 105; i++)
             {
                 io.WriteUInt16(0);
             }
         }
     }
     return(true);
 }
Beispiel #2
0
        public override bool Write(IffFile iff, Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteInt32(0);
                io.WriteInt32(0x49);
                io.WriteCString("HBGN", 4);

                for (int i = 0; i < NeighborhoodData.Length; i++)
                {
                    io.WriteInt16(NeighborhoodData[i]);
                }

                io.WriteInt32(NeighborhoodData.Length);
                foreach (var item in InventoryByID)
                {
                    io.WriteInt32(1);
                    io.WriteInt16(item.Key);
                    io.WriteInt32(item.Value.Count);
                    foreach (var invent in item.Value)
                    {
                        invent.SerializeInto(io);
                    }
                }
            }
            return(true);
        }
Beispiel #3
0
        public override bool Write(IffFile iff,Stream stream)
        {
            using (var io = IoWriter.FromStream(stream,ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteInt32(0);
                io.WriteInt32(10); //version
                io.WriteCString("TOLS",4);
                io.WriteUInt32((uint)Chronological.Count);
                foreach (var slot in Chronological)
                {
                    io.WriteUInt16(slot.Type);
                    io.WriteFloat(slot.Offset.X);
                    io.WriteFloat(slot.Offset.Y);
                    io.WriteFloat(slot.Offset.Z);

                    io.WriteInt32(slot.Standing);
                    io.WriteInt32(slot.Sitting);
                    io.WriteInt32(slot.Ground);
                    io.WriteInt32((int)slot.Rsflags);
                    io.WriteInt32(slot.SnapTargetSlot);

                    io.WriteInt32(slot.MinProximity);
                    io.WriteInt32(slot.MaxProximity);
                    io.WriteInt32(slot.OptimalProximity);
                    io.WriteInt32(slot.MaxSize);
                    io.WriteInt32(slot.I10);

                    io.WriteFloat(slot.Gradient);
                    io.WriteInt32(slot.Height);
                    io.WriteInt32((int)slot.Facing);
                    io.WriteInt32(slot.Resolution);
                }
            }
            return(true);
        }
Beispiel #4
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteUInt16((ushort)Interactions.Length);
         io.WriteUInt16(8); //version. don't save to high version cause we can't write out using the complex io proxy.
         for (int i = 0; i < Interactions.Length; i++)
         {
             var action = Interactions[i];
             io.WriteUInt16(action.ActionFunction);
             io.WriteUInt16(action.TestFunction);
             io.WriteUInt32((uint)action.MotiveEntries.Length);
             io.WriteUInt32((uint)action.Flags);
             io.WriteUInt32(action.TTAIndex);
             io.WriteUInt32(action.AttenuationCode);
             io.WriteFloat(action.AttenuationValue);
             io.WriteUInt32(action.AutonomyThreshold);
             io.WriteInt32(action.JoiningIndex);
             for (int j = 0; j < action.MotiveEntries.Length; j++)
             {
                 var mot = action.MotiveEntries[j];
                 io.WriteInt16(mot.EffectRangeMinimum);
                 io.WriteInt16(mot.EffectRangeMaximum);
                 io.WriteUInt16(mot.PersonalityModifier);
             }
             //TODO: write out TSOFlags
         }
     }
     return(true);
 }
Beispiel #5
0
        public override bool Write(IffFile iff, Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteInt32(0);
                io.WriteUInt32(9);
                io.WriteCString("IMAF", 4);
                io.WriteInt32(HouseNumber);
                io.WriteInt32(FamilyNumber);
                io.WriteInt32(Budget);
                io.WriteInt32(ValueInArch);
                io.WriteInt32(FamilyFriends);
                io.WriteInt32(Unknown);
                io.WriteInt32(FamilyGUIDs.Length);
                foreach (var guid in FamilyGUIDs)
                {
                    io.WriteUInt32(guid);
                }

                for (int i = 0; i < 4; i++)
                {
                    io.WriteInt32(0);
                }
            }
            return(true);
        }
Beispiel #6
0
        public override bool Write(IffFile iff, Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteInt16(-4);
                io.WriteByte(20);

                foreach (var set in LanguageSets)
                {
                    if (set?.Strings == null)
                    {
                        io.WriteInt16(0);
                    }
                    else
                    {
                        io.WriteUInt16((ushort)set.Strings.Length);

                        foreach (var str in set.Strings)
                        {
                            io.WriteByte((byte)(str.LanguageCode - 1));
                            io.WriteVariableLengthPascalString(str.Value);
                            io.WriteVariableLengthPascalString(str.Comment);
                        }
                    }
                }

                return(true);
            }
        }
Beispiel #7
0
        public void WriteChunk(IoWriter io,IffChunk c)
        {
            var typeString = CHUNK_TYPES.FirstOrDefault(x => x.Value == c.GetType()).Key;

            io.WriteCString((typeString == null) ? c.ChunkType : typeString,4);

            byte[] data;
            using (var cstr = new MemoryStream())
            {
                if (c.Write(this,cstr))
                {
                    data = cstr.ToArray();
                }
                else
                {
                    data = c.OriginalData;
                }
            }

            //todo: exporting PIFF as IFF SHOULD NOT DO THIS
            c.OriginalData = data; //if we revert, it is to the last save.
            c.RuntimeInfo  = ChunkRuntimeState.Normal;

            io.WriteUInt32((uint)data.Length + 76);
            io.WriteUInt16(c.ChunkID);
            io.WriteUInt16(c.ChunkFlags);
            io.WriteCString(c.ChunkLabel,64);
            io.WriteBytes(data);
        }
Beispiel #8
0
        public override bool Write(IffFile iff, Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteInt32(0);
                io.WriteInt32(5); //version
                io.WriteCString("PRPT", 4);
                io.WriteInt32(ParamNames.Length);
                io.WriteInt32(LocalNames.Length);
                foreach (var param in ParamNames)
                {
                    io.WritePascalString(param);
                }
                foreach (var local in LocalNames)
                {
                    io.WritePascalString(local);
                }

                for (int i = 0; i < ParamNames.Length; i++)
                {
                    io.WriteByte(0);
                }

                io.WriteInt32(0);
                io.WriteInt32(0);
            }
            return(true);
        }
Beispiel #9
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteUInt16((ushort)Interactions.Length);
         io.WriteUInt16(10); //version. we save version 10 which uses the IO proxy
         //...but we can't write out to that yet so write with compression code 0
         io.WriteByte(0);
         for (int i = 0; i < Interactions.Length; i++)
         {
             var action = Interactions[i];
             io.WriteUInt16(action.ActionFunction);
             io.WriteUInt16(action.TestFunction);
             io.WriteUInt32((uint)action.MotiveEntries.Length);
             io.WriteUInt32((uint)action.Flags);
             io.WriteUInt32(action.TTAIndex);
             io.WriteUInt32(action.AttenuationCode);
             io.WriteFloat(action.AttenuationValue);
             io.WriteUInt32(action.AutonomyThreshold);
             io.WriteInt32(action.JoiningIndex);
             for (int j = 0; j < action.MotiveEntries.Length; j++)
             {
                 var mot = action.MotiveEntries[j];
                 io.WriteInt16(mot.EffectRangeMinimum);
                 io.WriteInt16(mot.EffectRangeMaximum);
                 io.WriteUInt16(mot.PersonalityModifier);
             }
             io.WriteUInt32((uint)action.Flags2);
         }
     }
     return(true);
 }
Beispiel #10
0
        public void Save(Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteCString("FSOm", 4);
                io.WriteInt32(CURRENT_VERSION);
                io.WriteInt32(ReconstructVersion);
                io.WritePascalString(Name);

                io.WriteInt32(Geoms.Count);
                foreach (var g in Geoms)
                {
                    io.WriteInt32(g.Count);
                    foreach (var m in g.Values)
                    {
                        m.Save(io);
                    }
                }

                io.WriteInt32((int)MaskType);
                if (DepthMask != null)
                {
                    DepthMask.Save(io);
                }

                var b = Bounds.Value;
                io.WriteFloat(b.Min.X);
                io.WriteFloat(b.Min.Y);
                io.WriteFloat(b.Min.Z);
                io.WriteFloat(b.Max.X);
                io.WriteFloat(b.Max.Y);
                io.WriteFloat(b.Max.Z);
            }
        }
Beispiel #11
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteNullTerminatedString(Name);
     }
     return(true);
 }
Beispiel #12
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         if (IffFile.TargetTS1)
         {
             io.WriteUInt32(1000);
             uint length = 0;
             if (Frames != null)
             {
                 length = (uint)Frames.Length;
             }
             io.WriteUInt32(length);
             DefaultPaletteID = Frames?.FirstOrDefault()?.PaletteID ?? DefaultPaletteID;
             io.WriteUInt32(DefaultPaletteID);
             // begin offset table
             var offTableStart = stream.Position;
             for (int i = 0; i < length; i++)
             {
                 io.WriteUInt32(0);                              //filled in later
             }
             var offsets = new uint[length];
             int offInd  = 0;
             if (Frames != null)
             {
                 foreach (var frame in Frames)
                 {
                     offsets[offInd++] = (uint)stream.Position;
                     frame.Write(io, true);
                 }
             }
             io.Seek(SeekOrigin.Begin, offTableStart);
             foreach (var off in offsets)
             {
                 io.WriteUInt32(off);
             }
             io.Seek(SeekOrigin.End, 0);
         }
         else
         {
             io.WriteUInt32(1001);
             io.WriteUInt32(DefaultPaletteID);
             if (Frames == null)
             {
                 io.WriteUInt32(0);
             }
             else
             {
                 io.WriteUInt32((uint)Frames.Length);
                 foreach (var frame in Frames)
                 {
                     frame.Write(io, false);
                 }
             }
         }
         return(true);
     }
 }
        public void WritePatchFile(Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteCString("TSOp", 4);
                io.WriteInt32(0); //version

                //generate patches for the files that are the same
                var patches = new List <Tuple <string, byte[]> >();
                Console.Write("Progress: ");
                var progress = 0;
                foreach (var file in SameFiles)
                {
                    Console.Write($"\rProgress: {progress++}/{SameFiles.Count}");

                    var srcDat = File.ReadAllBytes(Path.Combine(SourcePath, file));
                    var dstDat = File.ReadAllBytes(Path.Combine(DestPath, file));

                    var same = srcDat.Length == dstDat.Length && srcDat.SequenceEqual(dstDat);
                    if (!same)
                    {
                        using (var outips = new MemoryStream()) {
                            BsDiff.Create(srcDat, dstDat, outips);
                            patches.Add(new Tuple <string, byte[]>(file, outips.ToArray()));
                        }
                    }
                }
                Console.WriteLine();
                Console.WriteLine($"Done generating patches ({patches.Count}). Inserting additions and deletions...");

                io.WriteCString("IPS_", 4);
                io.WriteInt32(patches.Count);
                foreach (var piff in patches)
                {
                    io.WriteVariableLengthPascalString(piff.Item1);
                    io.WriteInt32(piff.Item2.Length);
                    io.WriteBytes(piff.Item2);
                }

                io.WriteCString("ADD_", 4);
                io.WriteInt32(AddFiles.Count);
                foreach (var add in AddFiles)
                {
                    io.WriteVariableLengthPascalString(add);
                    var data = File.ReadAllBytes(Path.Combine(DestPath, add));
                    io.WriteInt32(data.Length);
                    io.WriteBytes(data);
                }

                io.WriteCString("DEL_", 4);
                io.WriteInt32(RemovedFiles.Count);
                foreach (var del in RemovedFiles)
                {
                    io.WriteVariableLengthPascalString(del);
                }
            }
        }
Beispiel #14
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteInt32(Version);
         Params.Save(io);
     }
     return(true);
 }
Beispiel #15
0
        public override bool Write(IffFile iff, Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                if (IffFile.TargetTS1)
                {
                    // TS1 format - null terminated string
                    io.WriteInt16(-3);
                    var total = (short)LanguageSets.Sum(x => x?.Strings?.Length ?? 0);
                    io.WriteInt16(total);
                    foreach (var set in LanguageSets)
                    {
                        if (set?.Strings != null)
                        {
                            foreach (var str in set.Strings)
                            {
                                io.WriteByte((byte)(str.LanguageCode));
                                io.WriteNullTerminatedString(str.Value);
                                io.WriteNullTerminatedString(str.Comment);
                            }
                        }
                    }
                    for (int i = 0; i < total; i++)
                    {
                        io.WriteByte(0xA3);
                    }
                }
                else
                {
                    // TSO format - variable length pascal
                    io.WriteInt16(-4);
                    io.WriteByte(20);

                    foreach (var set in LanguageSets)
                    {
                        if (set?.Strings == null)
                        {
                            io.WriteInt16(0);
                        }
                        else
                        {
                            io.WriteUInt16((ushort)set.Strings.Length);

                            foreach (var str in set.Strings)
                            {
                                io.WriteByte((byte)(str.LanguageCode - 1));
                                io.WriteVariableLengthPascalString(str.Value);
                                io.WriteVariableLengthPascalString(str.Comment);
                            }
                        }
                    }
                }

                return(true);
            }
        }
Beispiel #16
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteInt32(Version);
         io.WriteInt32(Data.Length);
         io.WriteBytes(Data);
     }
     return(true);
 }
Beispiel #17
0
 public void Write(IoWriter io)
 {
     io.WriteUInt32(Direction);
     io.WriteUInt32(Zoom);
     io.WriteUInt32((uint)Sprites.Length);
     foreach (var spr in Sprites)
     {
         spr.Write(io);
     }
 }
Beispiel #18
0
 public void Write(IoWriter io)
 {
     io.WriteUInt32(SpriteID);
     io.WriteUInt32(SpriteFrameIndex);
     io.WriteInt32((int)SpriteOffset.X);
     io.WriteInt32((int)SpriteOffset.Y);
     io.WriteFloat(ObjectOffset.Z);
     io.WriteUInt32((uint)Flags);
     io.WriteFloat(ObjectOffset.X);
     io.WriteFloat(ObjectOffset.Y);
 }
Beispiel #19
0
        public void Write(IoWriter io)
        {
            io.WriteInt32(Flags);
            io.WriteInt32(Unknown);
            io.WriteVariableLengthPascalString(Label);
            io.WriteVariableLengthPascalString(Comment);

            io.WriteByte(RangeEnabled);
            io.WriteInt16(LowRange);
            io.WriteInt16(HighRange);
        }
Beispiel #20
0
 public void Save(IoWriter io)
 {
     foreach (var rotation in Rotations)
     {
         io.WriteByte((byte)(rotation ? 1 : 0));
     }
     io.WriteByte((byte)(DoorFix ? 1 : 0));
     io.WriteByte((byte)(CounterFix ? 1 : 0));
     io.WriteInt32(StartDGRP);
     io.WriteInt32(EndDGRP);
     io.WriteByte((byte)(BlenderTweak ? 1 : 0));
     io.WriteByte((byte)(Simplify ? 1 : 0));
 }
Beispiel #21
0
        public void Write(Stream stream)
        {
            using (var io = IoWriter.FromStream(stream,ByteOrder.BIG_ENDIAN))
            {
                io.WriteCString("IFF FILE 2.5:TYPE FOLLOWED BY SIZE\0 JAMIE DOORNBOS & MAXIS 1",60);
                io.WriteUInt32(0); //todo: resource map offset

                var chunks = ListAll();
                foreach (var c in chunks)
                {
                    WriteChunk(io,c);
                }
            }
        }
Beispiel #22
0
        // Start is called before the first frame update
        void Start()
        {
            this.root     = GameObject.Find("Robot");
            this.myObject = GameObject.Find("Robot/" + this.transform.name);
            this.parts    = myObject.GetComponentInChildren <Hakoniwa.Assets.EV3.IEV3Parts>();

            this.isConnected = false;
            this.InitActuator();
            this.InitSensor();
            this.writer = this.myObject.GetComponentInChildren <IoWriter>();
            this.reader = this.myObject.GetComponentInChildren <IoReader>();
            this.reader.Initialize();
            this.reader.SetCallback(UdpServerCallback);
        }
Beispiel #23
0
        public override bool Write(IffFile iff, Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteByte((byte)Constants.Length);
                io.WriteByte(Flags);
                foreach (var c in Constants)
                {
                    io.WriteUInt16(c);
                }

                return(true);
            }
        }
Beispiel #24
0
        public override bool Write(IffFile iff, Stream stream)
        {
            using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.WriteUInt16(20004);
                io.WriteUInt32((uint)Images.Length);

                foreach (var img in Images)
                {
                    img.Write(io);
                }
            }
            return(true);
        }
Beispiel #25
0
        private void ImportAnimButton_Click(object sender, EventArgs e)
        {
            if (ImportMode)
            {
                var animContent = Content.Content.Get().AvatarAnimations;
                var selected    = AnimationImportBox.CheckedItems.Cast <AvatarToolAnimation>().ToList();
                var dupes       = selected.Where(x =>
                {
                    var existing = animContent.Get(x.ToString() + ".anim");
                    return(existing != null);
                });
                if (dupes.Count() > 0)
                {
                    var result = MessageBox.Show($"The following animations are already present in the game: \r\n{String.Join(", ", dupes.Select(x => x.ToString()))}\r\nDo you want to overwrite them?",
                                                 "Duplicate Animations", MessageBoxButtons.YesNo);
                    if (result == DialogResult.No)
                    {
                        return;
                    }
                }

                //import the animations to the runtime AND content folder
                //TODO: ts1
                var provider = (animContent as Content.Framework.TSOAvatarContentProvider <Animation>);
                foreach (var anim in selected)
                {
                    using (var mem = new MemoryStream())
                    {
                        using (var writer = IoWriter.FromStream(mem, ByteOrder.BIG_ENDIAN))
                        {
                            anim.Anim.Write(writer, false);
                            provider.CreateFile(anim.ToString() + ".anim", anim.Anim, mem.ToArray(), false);
                        }
                    }
                }

                MessageBox.Show($"Successfully imported animations: \r\n{String.Join(", ", selected.Select(x => x.ToString()))}",
                                "Imported Animations!", MessageBoxButtons.OK);
            }
            else
            {
                //remove animations from export list
                var selected = AnimationImportBox.CheckedItems.Cast <AvatarToolAnimation>().ToList();
                foreach (var item in selected)
                {
                    SceneAnimations.Remove(item);
                    AnimationImportBox.Items.Remove(item);
                }
            }
        }
Beispiel #26
0
        public void Save(Stream stream)
        {
            var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN);

            io.WriteCString("FSOf", 4);
            io.WriteInt32(CURRENT_VERSION);

            io.WriteByte((byte)(Compressed ? 1 : 0));

            MemoryStream target     = null;
            GZipStream   compressed = null;
            var          cio        = io;

            if (Compressed)
            {
                //target = new MemoryStream();
                compressed = new GZipStream(stream, CompressionMode.Compress);
                cio        = IoWriter.FromStream(compressed, ByteOrder.LITTLE_ENDIAN);
            }

            cio.WriteInt32(TexCompressionType);
            cio.WriteInt32(FloorWidth);
            cio.WriteInt32(FloorHeight);
            cio.WriteInt32(WallWidth);
            cio.WriteInt32(WallHeight);
            cio.WriteByte((byte)((NightFloorTextureData == null)?0:1)); //has night tex?

            cio.WriteInt32(FloorTextureData.Length);
            cio.WriteBytes(FloorTextureData);
            cio.WriteInt32(WallTextureData.Length);
            cio.WriteBytes(WallTextureData);

            if (NightFloorTextureData != null)
            {
                cio.WriteInt32(NightFloorTextureData.Length);
                cio.WriteBytes(NightFloorTextureData);
                cio.WriteInt32(NightWallTextureData.Length);
                cio.WriteBytes(NightWallTextureData);
                cio.WriteUInt32(NightLightColor.PackedValue);
            }

            WriteVerts(FloorVertices, FloorIndices, cio);
            WriteVerts(WallVertices, WallIndices, cio);

            if (Compressed)
            {
                compressed.Close();
            }
        }
Beispiel #27
0
 /// <summary>
 /// Writes a NBRS chunk to a stream.
 /// </summary>
 /// <param name="iff">An Iff instance.</param>
 /// <param name="stream">A destination stream.</param>
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteUInt32(0);
         io.WriteUInt32(0x49);
         io.WriteCString("SRBN", 4);
         io.WriteInt32(Entries.Count);
         foreach (var n in NeighbourByID.Values)
         {
             n.Save(io);
         }
     }
     return(true);
 }
Beispiel #28
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteInt32(0);
         io.WriteInt32(1);
         io.WriteCString("EERT", 4);
         io.WriteInt32(Entries.Count);
         foreach (var entry in Entries)
         {
             entry.Write(io);
         }
     }
     return(true);
 }
Beispiel #29
0
        public void Save(IoWriter io)
        {
            io.WriteInt32(Unknown1);
            io.WriteInt32(Version);
            if (Version == 0xA)
            {
                io.WriteInt32(Unknown3);
            }
            io.WriteNullTerminatedString(Name);
            if (Name.Length % 2 == 0)
            {
                io.WriteByte(0);
            }
            io.WriteInt32(MysteryZero);
            io.WriteInt32(PersonMode);
            if (PersonMode > 0)
            {
                var size = (Version == 0x4) ? 0xa0 : 0x200;
                int pdi  = 0;
                for (int i = 0; i < size; i += 2)
                {
                    if (pdi >= 88)
                    {
                        io.WriteInt16(0);
                    }
                    else
                    {
                        io.WriteInt16(PersonData[pdi++]);
                    }
                }
            }

            io.WriteInt16(NeighbourID);
            io.WriteUInt32(GUID);
            io.WriteInt32(UnknownNegOne);

            io.WriteInt32(Relationships.Count);
            foreach (var rel in Relationships)
            {
                io.WriteInt32(1); //keycount (1)
                io.WriteInt32(rel.Key);
                io.WriteInt32(rel.Value.Count);
                foreach (var val in rel.Value)
                {
                    io.WriteInt32(val);
                }
            }
        }
Beispiel #30
0
 public override bool Write(IffFile iff, Stream stream)
 {
     using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.WriteUInt32(0);
         io.WriteUInt32((uint)Colors.Length);
         io.WriteBytes(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 });
         foreach (var col in Colors)
         {
             io.WriteByte(col.R);
             io.WriteByte(col.G);
             io.WriteByte(col.B);
         }
         return(true);
     }
 }