Ejemplo n.º 1
0
        public DomType Load(GomBinaryReader reader)
        {
            DomEnum result = new DomEnum();

            LoaderHelper.ParseShared(reader, result);

            reader.BaseStream.Position = 0x12;
            var nameOffset = reader.ReadInt16();

            reader.BaseStream.Position = 0x18;
            var numVals   = reader.ReadInt16();
            var valOffset = reader.ReadInt16();

            // Read in names
            reader.BaseStream.Position = nameOffset;
            for (var i = 0; i < numVals; i++)
            {
                var name = reader.ReadNullTerminatedString();
                result.AddName(name);
            }

            // Read in values
            reader.BaseStream.Position = valOffset;
            for (var i = 0; i < numVals; i++)
            {
                var val = reader.ReadInt16();
                result.AddValue(val);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public DomType Load(GomBinaryReader reader)
        {
            DomClass result = new DomClass();

            LoaderHelper.ParseShared(reader, result);

            reader.BaseStream.Position = 0x2A;
            short numComponents   = reader.ReadInt16();
            short componentOffset = reader.ReadInt16();
            short numFields       = reader.ReadInt16();
            short fieldsOffset    = reader.ReadInt16();

            if (numComponents > 0)
            {
                reader.BaseStream.Position = componentOffset;
                for (var i = 0; i < numComponents; i++)
                {
                    result.ComponentIds.Add(reader.ReadUInt64());
                }
            }

            if (numFields > 0)
            {
                reader.BaseStream.Position = fieldsOffset;
                for (var i = 0; i < numFields; i++)
                {
                    result.FieldIds.Add(reader.ReadUInt64());
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public DomType Load(GomBinaryReader reader)
        {
            DomField result = new DomField();

            LoaderHelper.ParseShared(reader, result);

            reader.BaseStream.Position = 0x12;
            short typeOffset = reader.ReadInt16();

            reader.BaseStream.Position = typeOffset;
            result.GomType             = reader.ReadGomType();

            return(result);
        }
Ejemplo n.º 4
0
        public DomType Load(GomBinaryReader reader)
        {
            GomObject result = new GomObject();

            LoaderHelper.ParseShared(reader, result);

            reader.BaseStream.Position = 0x12;
            short headerEnd = reader.ReadInt16();

            reader.BaseStream.Position = 0x18;
            //result.Offset20 = reader.ReadInt32();

            result.ClassId = reader.ReadUInt64();         // Offset 0x18

            result.Offset20 = reader.ReadInt32();         // 0x20

            result.NumGlommed       = reader.ReadInt16(); // 0x24
            result.Offset26         = reader.ReadInt16(); // 0x26
            result.ObjectSizeInFile = reader.ReadInt32(); // 0x28
            result.Offset2C         = reader.ReadInt16(); // 0x2C
            result.Offset2E         = reader.ReadInt16(); // 0x2E
            result.Offset30         = reader.ReadByte();  // 0x30
            result.Offset31         = reader.ReadByte();  // 0x31

            reader.BaseStream.Position = headerEnd;

            if (headerEnd != reader.BaseStream.Length)
            {
                //InflaterInputStream istream = new InflaterInputStream(reader.BaseStream);
                //string outFileName = result.Name;
                //outFileName = outFileName.Replace('/', '_');
                //outFileName = outFileName.Replace('.', '\\');
                //outFileName = outFileName + ".node";
                //string path = System.IO.Path.Combine("c:\\code\\swtorfiles\\prototypes\\", outFileName);
                //if (path.Contains("\\con\\"))
                //{
                //    path = path.Replace("\\con\\", "\\_con\\");
                //}
                ////path = String.Format("c:\\code\\swtorfiles\\prototypes\\{1}", result.Id, result.Name);
                //string dir = System.IO.Path.GetDirectoryName(path);

                //if (!outDirs.Contains(dir))
                //{
                //    try
                //    {
                //        System.IO.Directory.CreateDirectory(dir);
                //        outDirs.Add(dir);
                //    }
                //    catch (System.IO.IOException)
                //    {
                //        Console.WriteLine("Cannot create directory {0} for {1}", dir, path);
                //        return result;
                //    }
                //}

                //using (var fs = System.IO.File.Open(path, System.IO.FileMode.Create, System.IO.FileAccess.Write))
                //{
                //    ICSharpCode.SharpZipLib.Core.StreamUtils.Copy(istream, fs, outBuff);
                //}

                // Copy the compressed data to the instance
                int compressedLength = (int)(reader.BaseStream.Length - reader.BaseStream.Position);
                var buff             = reader.ReadBytes(compressedLength);

                adlerCalc.Update(buff);
                result.Checksum = adlerCalc.Value;
                adlerCalc.Reset();

                result.IsCompressed = true;
                result.DataLength   = compressedLength;
                result.DataBuffer   = buff;
            }
            else
            {
                result.DataLength = 0;
            }

            // Gom.AddObject(result);

            return(result);
        }