Exemple #1
0
        public void Save(string filePath)
        {
            this.Path = filePath;
            BinaryWriter bw = new BinaryWriter(File.Open(filePath, FileMode.Create));

            bw.Write((short)this.listDDS.Count);
            int totalElementCount = 0;

            this.listDDS.ForEach(delegate(TSI.DDS dds)
            {
                RoseFile.WriteSString(ref bw, dds.Path);
                bw.Write(dds.ColourKey);
                totalElementCount += dds.ListDDS_element.Count;
            });
            bw.Write((short)totalElementCount);
            this.listDDS.ForEach(delegate(TSI.DDS dds)
            {
                bw.Write((short)dds.ListDDS_element.Count);
                dds.ListDDS_element.ForEach(delegate(TSI.DDS.DDSElement dds_element)
                {
                    bw.Write(dds_element.OwnerId);
                    bw.Write(dds_element.X);
                    bw.Write(dds_element.Y);
                    bw.Write(dds_element.Width + dds_element.X);
                    bw.Write(dds_element.Height + dds_element.Y);
                    bw.Write(dds_element.Color);
                    RoseFile.WriteFString(ref bw, dds_element.Name, 32);
                });
            });
            bw.Close();
        }
Exemple #2
0
        public void Load(string path, ClientType type)
        {
            BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open));
            int          num          = binaryReader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                int        num2 = binaryReader.ReadInt32();
                LIT.Object item = default(LIT.Object);
                item.objectID = binaryReader.ReadInt32();
                for (int j = 0; j < num2; j++)
                {
                    LIT.Object.Part item2 = default(LIT.Object.Part);
                    item2.name             = RoseFile.ReadBString(ref binaryReader);
                    item2.partID           = binaryReader.ReadInt32();
                    item2.ddsName          = RoseFile.ReadBString(ref binaryReader);
                    item2.ddsID            = binaryReader.ReadInt32();
                    item2.ddsDivisionSize  = binaryReader.ReadInt32();
                    item2.ddsDivisionCount = binaryReader.ReadInt32();
                    item2.ddsPartID        = binaryReader.ReadInt32();
                    item.listParts.Add(item2);
                }
                this.listObject.Add(item);
            }
            int num3 = binaryReader.ReadInt32();

            for (int i = 0; i < num3; i++)
            {
                string item3 = RoseFile.ReadBString(ref binaryReader);
                this.listDDSName.Add(item3);
            }
            binaryReader.Close();
        }
Exemple #3
0
        public void Save(string mypath)
        {
            BinaryWriter binaryWriter = new BinaryWriter(File.Open(mypath, FileMode.Create));

            RoseFile.WriteFString(ref binaryWriter, this.formatCode, 4);
            binaryWriter.Write(0);
            binaryWriter.Write(this.rowCount);
            binaryWriter.Write(this.columnCount);
            binaryWriter.Write(this.RowHeight);
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                binaryWriter.Write(this.column[i].width);
            }
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                RoseFile.WriteSString(ref binaryWriter, this.column[i].title);
            }
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                RoseFile.WriteSString(ref binaryWriter, this.cell[i, 0]);
            }
            long position = binaryWriter.BaseStream.Position;

            binaryWriter.BaseStream.Seek(4L, SeekOrigin.Begin);
            binaryWriter.Write((int)position);
            binaryWriter.Seek((int)position, SeekOrigin.Begin);
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                for (int j = 0; j < this.columnCount - 1; j++)
                {
                    RoseFile.WriteSString(ref binaryWriter, this.cell[i, j + 1]);
                }
            }
            binaryWriter.Close();
        }
Exemple #4
0
        public void Load(string Path, ClientType myClientType)
        {
            this.path       = Path;
            this.clientType = myClientType;
            BinaryReader binaryReader = new BinaryReader(File.Open(this.path, FileMode.Open));
            string       text         = RoseFile.ReadFString(ref binaryReader, 7);

            if (text == "ZMD0003")
            {
                this.version = 3;
            }
            else
            {
                if (!(text == "ZMD0002"))
                {
                    throw new Exception("Wrong file header " + text + " on " + this.path);
                }
                this.version = 2;
            }
            int num = binaryReader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                ZMD.Bone bone = new ZMD.Bone();
                bone.Dummy     = false;
                bone.parentid  = binaryReader.ReadInt32();
                bone.name      = RoseFile.ReadZString(ref binaryReader);
                bone.position  = RoseFile.ReadVector3(ref binaryReader);
                bone.position /= 100f;
                bone.rotation  = RoseFile.ReadVector4(ref binaryReader);
                bone.matrix    = Matrix.CreateFromQuaternion(new Quaternion(bone.rotation.X, bone.rotation.Y, bone.rotation.Z, bone.rotation.W));
                bone.matrix   *= Matrix.CreateTranslation(bone.position);
                this.listBone.Add(bone);
            }
            int num2 = binaryReader.ReadInt32();

            this.DummyOffset = num;
            for (int i = 0; i < num2; i++)
            {
                ZMD.Bone bone2 = new ZMD.Bone();
                bone2.Dummy     = true;
                bone2.name      = RoseFile.ReadZString(ref binaryReader);
                bone2.parentid  = binaryReader.ReadInt32();
                bone2.position  = RoseFile.ReadVector3(ref binaryReader);
                bone2.position /= 100f;
                bone2.matrix    = Matrix.Identity;
                if (this.version == 3)
                {
                    bone2.rotation = RoseFile.ReadVector4(ref binaryReader);
                    bone2.matrix   = Matrix.CreateFromQuaternion(new Quaternion(bone2.rotation.X, bone2.rotation.Y, bone2.rotation.Z, bone2.rotation.W));
                }
                bone2.matrix *= Matrix.CreateTranslation(bone2.position);
                this.listBone.Add(bone2);
            }
            binaryReader.Close();
            this.TransformChildren(0);
        }
Exemple #5
0
 public void save(ref BinaryWriter bw)
 {
     RoseFile.WriteZString(ref bw, this.path);
     bw.Write(this.is_skin);
     bw.Write(this.alpha_enabled);
     bw.Write(this.two_sided);
     bw.Write(this.alpha_test_enabled);
     bw.Write(this.alpha_ref_enabled);
     bw.Write(this.z_write_enabled);
     bw.Write(this.z_test_enabled);
     bw.Write(this.blending_mode);
     bw.Write(this.specular_enabled);
     bw.Write(this.alpha);
     bw.Write(this.glow_type);
     bw.Write(this.red);
     bw.Write(this.green);
     bw.Write(this.blue);
 }
Exemple #6
0
 public void read(ref BinaryReader br)
 {
     this.path               = RoseFile.ReadZString(ref br);
     this.is_skin            = br.ReadInt16();
     this.alpha_enabled      = br.ReadInt16();
     this.two_sided          = br.ReadInt16();
     this.alpha_test_enabled = br.ReadInt16();
     this.alpha_ref_enabled  = br.ReadInt16();
     this.z_write_enabled    = br.ReadInt16();
     this.z_test_enabled     = br.ReadInt16();
     this.blending_mode      = br.ReadInt16();
     this.specular_enabled   = br.ReadInt16();
     this.alpha              = br.ReadSingle();
     this.glow_type          = br.ReadInt16();
     this.red   = br.ReadSingle();
     this.green = br.ReadSingle();
     this.blue  = br.ReadSingle();
 }
Exemple #7
0
        public void Load(string filePath, ClientType clientType)
        {
            this.Path       = filePath;
            this.clientType = clientType;
            BinaryReader binaryReader = new BinaryReader(File.Open(filePath, FileMode.Open));
            short        num          = binaryReader.ReadInt16();

            this.listDDS = new List <TSI.DDS>((int)num);
            for (int i = 0; i < (int)num; i++)
            {
                TSI.DDS dDS = new TSI.DDS();
                dDS.Path      = RoseFile.ReadSString(ref binaryReader);
                dDS.ColourKey = binaryReader.ReadInt32();
                this.listDDS.Add(dDS);
            }
            short num2 = binaryReader.ReadInt16();

            for (int i = 0; i < (int)num; i++)
            {
                short num3 = binaryReader.ReadInt16();
                this.listDDS[i].ListDDS_element = new List <TSI.DDS.DDSElement>((int)num3);
                for (int j = 0; j < (int)num3; j++)
                {
                    TSI.DDS.DDSElement dDSElement = new TSI.DDS.DDSElement();
                    dDSElement.OwnerId = binaryReader.ReadInt16();
                    dDSElement.X       = binaryReader.ReadInt32();
                    dDSElement.Y       = binaryReader.ReadInt32();
                    dDSElement.Width   = binaryReader.ReadInt32() - dDSElement.X;
                    dDSElement.Height  = binaryReader.ReadInt32() - dDSElement.Y;
                    dDSElement.Color   = binaryReader.ReadInt32();
                    dDSElement.Name    = RoseFile.ReadFString(ref binaryReader, 32);
                    this.listDDS[i].ListDDS_element.Add(dDSElement);
                }
            }
            binaryReader.Close();
        }
Exemple #8
0
        public void Load(string mypath, ClientType myclientType)
        {
            this.path       = mypath;
            this.clientType = myclientType;
            BinaryReader binaryReader = new BinaryReader(File.Open(mypath, FileMode.Open));

            this.formatCode = new string(binaryReader.ReadChars(4));
            int num = binaryReader.ReadInt32();

            this.rowCount    = binaryReader.ReadInt32();
            this.columnCount = binaryReader.ReadInt32();
            this.column      = new STB.Column[this.columnCount + 1];
            this.cell        = new string[this.rowCount, this.columnCount];
            this.RowHeight   = binaryReader.ReadInt32();
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                this.column[i].width = binaryReader.ReadInt16();
            }
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                this.column[i].title = RoseFile.ReadSString(ref binaryReader);
            }
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                this.cell[i, 0] = RoseFile.ReadSString(ref binaryReader);
            }
            binaryReader.BaseStream.Seek((long)num, SeekOrigin.Begin);
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                for (int j = 0; j < this.columnCount - 1; j++)
                {
                    this.cell[i, j + 1] = RoseFile.ReadSString(ref binaryReader);
                }
            }
            binaryReader.Close();
        }
Exemple #9
0
        public void Save(string path)
        {
            BinaryWriter binaryWriter = new BinaryWriter(File.Open(path, FileMode.Create));

            RoseFile.WriteFString(ref binaryWriter, "ZMO0002", 8);
            binaryWriter.Write(this.FPS);
            binaryWriter.Write(this.frameCount);
            binaryWriter.Write(this.channelCount);
            for (int i = 0; i < this.channelCount; i++)
            {
                binaryWriter.Write((int)this.listChannel[i].trackType);
                binaryWriter.Write(this.listChannel[i].trackID);
            }
            for (int i = 0; i < this.frameCount; i++)
            {
                for (int j = 0; j < this.channelCount; j++)
                {
                    if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_NORMAL)
                    {
                        RoseFile.WriteVector3(ref binaryWriter, this.listChannel[j].normal[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_ROTATION)
                    {
                        RoseFile.WriteVector4(ref binaryWriter, this.listChannel[j].rotation[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_POSITION)
                    {
                        RoseFile.WriteVector3(ref binaryWriter, this.listChannel[j].position[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_ALPHA)
                    {
                        binaryWriter.Write(this.listChannel[j].alpha[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV1)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV2)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV3)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV4)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_TEXTUREANIM)
                    {
                        binaryWriter.Write(this.listChannel[j].textureAnim[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_SCALE)
                    {
                        binaryWriter.Write(this.listChannel[j].scale[i]);
                    }
                }
            }
            binaryWriter.Write(ZMO.unknowData);
            binaryWriter.Close();
        }
Exemple #10
0
        public void Load(string mypath, ClientType myclientType)
        {
            this.path = mypath;
            BinaryReader binaryReader = new BinaryReader(File.Open(mypath, FileMode.Open));
            string       text         = RoseFile.ReadFString(ref binaryReader, 8);

            if (!text.Equals("ZMO0002\0"))
            {
                throw new Exception("wrong file header");
            }
            this.FPS          = binaryReader.ReadInt32();
            this.frameCount   = binaryReader.ReadInt32();
            this.channelCount = binaryReader.ReadInt32();
            for (int i = 0; i < this.channelCount; i++)
            {
                ZMO.Channel channel = new ZMO.Channel();
                channel.trackType = (ZMO.TrackType)binaryReader.ReadInt32();
                channel.trackID   = binaryReader.ReadInt32();
                if (channel.trackType == ZMO.TrackType.TRACK_TYPE_NORMAL)
                {
                    channel.normal = new List <Vector3>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_ROTATION)
                {
                    channel.rotation = new List <Vector4>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_POSITION)
                {
                    channel.position = new List <Vector3>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_ALPHA)
                {
                    channel.alpha = new List <float>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_UV1)
                {
                    channel.uv1 = new List <Vector2>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_UV2)
                {
                    channel.uv2 = new List <Vector2>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_UV3)
                {
                    channel.uv3 = new List <Vector2>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_UV4)
                {
                    channel.uv4 = new List <Vector2>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_TEXTUREANIM)
                {
                    channel.textureAnim = new List <float>();
                }
                else if (channel.trackType == ZMO.TrackType.TRACK_TYPE_SCALE)
                {
                    channel.scale = new List <float>();
                }
                this.listChannel.Add(channel);
            }
            for (int i = 0; i < this.frameCount; i++)
            {
                for (int j = 0; j < this.channelCount; j++)
                {
                    if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_NORMAL)
                    {
                        this.listChannel[j].normal[i] = RoseFile.ReadVector3(ref binaryReader);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_ROTATION)
                    {
                        this.listChannel[j].rotation[i] = RoseFile.ReadVector4(ref binaryReader);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_POSITION)
                    {
                        this.listChannel[j].position.Add(RoseFile.ReadVector3(ref binaryReader));
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_ALPHA)
                    {
                        this.listChannel[j].alpha[i] = binaryReader.ReadSingle();
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV1)
                    {
                        this.listChannel[j].uv1[i] = RoseFile.ReadVector2(ref binaryReader);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV2)
                    {
                        this.listChannel[j].uv2[i] = RoseFile.ReadVector2(ref binaryReader);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV3)
                    {
                        this.listChannel[j].uv3[i] = RoseFile.ReadVector2(ref binaryReader);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV4)
                    {
                        this.listChannel[j].uv4[i] = RoseFile.ReadVector2(ref binaryReader);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_TEXTUREANIM)
                    {
                        this.listChannel[j].textureAnim[i] = binaryReader.ReadSingle();
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_SCALE)
                    {
                        this.listChannel[j].scale[i] = binaryReader.ReadSingle();
                    }
                }
            }
            binaryReader.Close();
        }
Exemple #11
0
        public void Load(string path, ClientType clientType)
        {
            BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open));
            int          num          = binaryReader.ReadInt32();

            int[] array  = new int[num];
            int[] array2 = new int[num];
            for (int i = 0; i < num; i++)
            {
                array[i]  = binaryReader.ReadInt32();
                array2[i] = binaryReader.ReadInt32();
            }
            for (int i = 0; i < num; i++)
            {
                binaryReader.BaseStream.Seek((long)array2[i], SeekOrigin.Begin);
                if (array[i] == 0)
                {
                    ZON.BasicInfoBlock basicInfoBlock = new ZON.BasicInfoBlock();
                    basicInfoBlock.zoneType   = binaryReader.ReadInt32();
                    basicInfoBlock.zoneWidth  = binaryReader.ReadInt32();
                    basicInfoBlock.zoneHeight = binaryReader.ReadInt32();
                    basicInfoBlock.gridCount  = binaryReader.ReadInt32();
                    basicInfoBlock.gridSize   = binaryReader.ReadSingle();
                    basicInfoBlock.xCount     = binaryReader.ReadInt32();
                    basicInfoBlock.yCount     = binaryReader.ReadInt32();
                    basicInfoBlock.zones      = new ZON.BasicInfoBlock.Zone[basicInfoBlock.zoneWidth, basicInfoBlock.zoneHeight];
                    for (int j = 0; j < basicInfoBlock.zoneWidth; j++)
                    {
                        for (int k = 0; k < basicInfoBlock.zoneHeight; k++)
                        {
                            basicInfoBlock.zones[j, k].useMap = binaryReader.ReadByte();
                            basicInfoBlock.zones[j, k].x      = binaryReader.ReadSingle();
                            basicInfoBlock.zones[j, k].y      = binaryReader.ReadSingle();
                        }
                    }
                    this.listBasicBlock.Add(basicInfoBlock);
                }
                else if (array[i] == 1)
                {
                    ZON.EventPointBlock eventPointBlock = new ZON.EventPointBlock();
                    eventPointBlock.listEntry = new List <ZON.EventPointBlock.Entry>();
                    int num2 = binaryReader.ReadInt32();
                    for (int j = 0; j < num2; j++)
                    {
                        ZON.EventPointBlock.Entry item = default(ZON.EventPointBlock.Entry);
                        item.vect = RoseFile.ReadVector3(ref binaryReader);
                        item.name = RoseFile.ReadBString(ref binaryReader);
                        eventPointBlock.listEntry.Add(item);
                    }
                    this.listEventBlock.Add(eventPointBlock);
                }
                else if (array[i] == 2)
                {
                    ZON.TextureBlock textureBlock = new ZON.TextureBlock();
                    int num2 = binaryReader.ReadInt32();
                    textureBlock.texturePath = new string[num2];
                    for (int j = 0; j < num2; j++)
                    {
                        textureBlock.texturePath[j] = RoseFile.ReadBString(ref binaryReader);
                    }
                    this.listTextureBlock.Add(textureBlock);
                }
                else if (array[i] == 3)
                {
                    ZON.TileListBlock tileListBlock = new ZON.TileListBlock();
                    tileListBlock.listTileEntry = new List <ZON.TileListBlock.TileEntry>();
                    int num2 = binaryReader.ReadInt32();
                    for (int j = 0; j < num2; j++)
                    {
                        ZON.TileListBlock.TileEntry item2 = default(ZON.TileListBlock.TileEntry);
                        item2.base1       = binaryReader.ReadInt32();
                        item2.base2       = binaryReader.ReadInt32();
                        item2.offest1     = binaryReader.ReadInt32();
                        item2.offest2     = binaryReader.ReadInt32();
                        item2.isBlending  = binaryReader.ReadInt32();
                        item2.orientation = binaryReader.ReadInt32();
                        item2.tileType    = binaryReader.ReadInt32();
                        tileListBlock.listTileEntry.Add(item2);
                    }
                    this.listTileBlock.Add(tileListBlock);
                }
                else if (array[i] == 4)
                {
                }
            }
            binaryReader.Close();
        }
Exemple #12
0
        public void Load(string Path, ClientType myClientType)
        {
            this.path       = Path;
            this.clientType = myClientType;
            BinaryReader binaryReader = new BinaryReader(File.Open(this.path, FileMode.Open));

            binaryReader.BaseStream.Seek(8L, SeekOrigin.Begin);
            int num = binaryReader.ReadInt32();

            binaryReader.BaseStream.Seek(24L, SeekOrigin.Current);
            this.boneCount  = binaryReader.ReadInt16();
            this.boneLookUp = new short[(int)this.boneCount];
            for (int i = 0; i < (int)this.boneCount; i++)
            {
                this.boneLookUp[i] = binaryReader.ReadInt16();
            }
            this.vertCount = binaryReader.ReadInt16();
            this.vertex    = new ObjectVertex[(int)this.vertCount];
            if ((num & 2) > 0)
            {
                for (int i = 0; i < (int)this.vertCount; i++)
                {
                    this.vertex[i].Position = RoseFile.ReadVector3(ref binaryReader);
                }
            }
            if ((num & 4) > 0)
            {
                binaryReader.BaseStream.Seek((long)(12 * this.vertCount), SeekOrigin.Current);
            }
            if ((num & 8) > 0)
            {
                binaryReader.BaseStream.Seek((long)(4 * this.vertCount), SeekOrigin.Current);
            }
            if ((num & 16) > 0 && (num & 32) > 0)
            {
                this.vertexWeight = new ZMS.Weight[(int)this.vertCount];
                this.vertexBoneID = new ZMS.BoneID[(int)this.vertCount];
                for (int i = 0; i < (int)this.vertCount; i++)
                {
                    this.vertexWeight[i].Weight1 = binaryReader.ReadSingle();
                    this.vertexWeight[i].Weight2 = binaryReader.ReadSingle();
                    this.vertexWeight[i].Weight3 = binaryReader.ReadSingle();
                    this.vertexWeight[i].Weight4 = binaryReader.ReadSingle();
                    this.vertexBoneID[i].BoneId1 = binaryReader.ReadInt16();
                    this.vertexBoneID[i].BoneId2 = binaryReader.ReadInt16();
                    this.vertexBoneID[i].BoneId3 = binaryReader.ReadInt16();
                    this.vertexBoneID[i].BoneId4 = binaryReader.ReadInt16();
                }
            }
            if ((num & 64) > 0)
            {
                binaryReader.BaseStream.Seek((long)(12 * this.vertCount), SeekOrigin.Current);
            }
            if ((num & 128) > 0)
            {
                for (int i = 0; i < (int)this.vertCount; i++)
                {
                    this.vertex[i].TextureCoordinate = RoseFile.ReadVector2(ref binaryReader);
                }
            }
            if ((num & 256) > 0)
            {
                binaryReader.BaseStream.Seek((long)(8 * this.vertCount), SeekOrigin.Current);
            }
            if ((num & 512) > 0)
            {
            }
            if ((num & 1024) > 0)
            {
            }
            this.faceCount = binaryReader.ReadInt16();
            this.indices   = new short[(int)(this.faceCount * 3)];
            for (int i = 0; i < (int)this.faceCount; i++)
            {
                this.indices[i * 3]     = binaryReader.ReadInt16();
                this.indices[i * 3 + 1] = binaryReader.ReadInt16();
                this.indices[i * 3 + 2] = binaryReader.ReadInt16();
            }
            this.vertexBuffer = new VertexBuffer(this.graphics, (int)(20 * this.vertCount), BufferUsage.WriteOnly);
            this.vertexBuffer.SetData <ObjectVertex>(this.vertex);
            this.indexBuffer = new IndexBuffer(this.graphics, typeof(short), this.indices.Length, BufferUsage.None);
            this.indexBuffer.SetData <short>(this.indices);
            binaryReader.Close();
        }
Exemple #13
0
        public void Load(string mypath, ClientType myclientType)
        {
            this.path       = mypath;
            this.clientType = myclientType;
            BinaryReader binaryReader = new BinaryReader(new FileStream(this.path, FileMode.Open));

            this.type       = RoseFile.ReadBString(ref binaryReader);
            this.entryCount = binaryReader.ReadInt32();
            this.entry      = new STL.STLEntry[this.entryCount];
            for (int i = 0; i < this.entryCount; i++)
            {
                this.entry[i].string_ID = RoseFile.ReadBString(ref binaryReader);
                this.entry[i].ID        = binaryReader.ReadUInt32();
            }
            if (this.clientType == ClientType.JROSE)
            {
                this.languageCount = 1;
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].text    = new string[1];
                    this.entry[j].comment = new string[1];
                    this.entry[j].quest1  = new string[1];
                    this.entry[j].quest2  = new string[1];
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].text[0] = RoseFile.ReadBString(ref binaryReader);
                    if (this.type == "QEST01" || this.type == "ITST01")
                    {
                        this.entry[j].comment[0] = RoseFile.ReadBString(ref binaryReader);
                        if (this.type == "QEST01")
                        {
                            this.entry[j].quest1[0] = RoseFile.ReadBString(ref binaryReader);
                            this.entry[j].quest2[0] = RoseFile.ReadBString(ref binaryReader);
                        }
                    }
                }
            }
            else
            {
                this.languageCount  = binaryReader.ReadInt32();
                this.languageOffset = new uint[this.languageCount];
                for (int i = 0; i < this.languageCount; i++)
                {
                    this.languageOffset[i] = binaryReader.ReadUInt32();
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].Offset  = new uint[this.languageCount];
                    this.entry[j].text    = new string[this.languageCount];
                    this.entry[j].comment = new string[this.languageCount];
                    this.entry[j].quest1  = new string[this.languageCount];
                    this.entry[j].quest2  = new string[this.languageCount];
                }
                for (int i = 0; i < this.languageCount; i++)
                {
                    binaryReader.BaseStream.Seek((long)((ulong)this.languageOffset[i]), SeekOrigin.Begin);
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        this.entry[j].Offset[i] = binaryReader.ReadUInt32();
                    }
                }
                for (int i = 0; i < this.languageCount; i++)
                {
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        binaryReader.BaseStream.Seek((long)((ulong)this.entry[j].Offset[i]), SeekOrigin.Begin);
                        this.entry[j].text[i] = RoseFile.ReadBString(ref binaryReader);
                        if (this.type == "QEST01" || this.type == "ITST01")
                        {
                            this.entry[j].comment[i] = RoseFile.ReadBString(ref binaryReader);
                            if (this.type == "QEST01")
                            {
                                this.entry[j].quest1[i] = RoseFile.ReadBString(ref binaryReader);
                                this.entry[j].quest2[i] = RoseFile.ReadBString(ref binaryReader);
                            }
                        }
                    }
                }
            }
            binaryReader.Close();
        }
Exemple #14
0
        public void Save(string mypath)
        {
            BinaryWriter binaryWriter = new BinaryWriter(File.Open(mypath, FileMode.Create));

            RoseFile.WriteBString(ref binaryWriter, this.type);
            binaryWriter.Write(this.entryCount);
            for (int i = 0; i < this.entryCount; i++)
            {
                RoseFile.WriteBString(ref binaryWriter, this.entry[i].string_ID);
                binaryWriter.Write(this.entry[i].ID);
            }
            if (this.clientType == ClientType.JROSE)
            {
                for (int i = 0; i < this.languageCount; i++)
                {
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        RoseFile.WriteBString(ref binaryWriter, this.entry[j].text[i]);
                        if (this.type == "QEST01" || this.type == "ITST01")
                        {
                            RoseFile.WriteBString(ref binaryWriter, this.entry[j].comment[i]);
                            if (this.type == "QEST01")
                            {
                                RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest1[i]);
                                RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest2[i]);
                            }
                        }
                    }
                }
            }
            else
            {
                binaryWriter.Write(this.languageCount);
                long position = binaryWriter.BaseStream.Position;
                for (int i = 0; i < this.languageCount; i++)
                {
                    binaryWriter.Write(1);
                }
                uint value = Convert.ToUInt32(binaryWriter.BaseStream.Position);
                for (int j = 0; j < this.entryCount; j++)
                {
                    binaryWriter.Write(1);
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].Offset[1] = Convert.ToUInt32(binaryWriter.BaseStream.Position);
                    RoseFile.WriteBString(ref binaryWriter, this.entry[j].text[1]);
                    if (this.type == "QEST01" || this.type == "ITST01")
                    {
                        RoseFile.WriteBString(ref binaryWriter, this.entry[j].comment[1]);
                        if (this.type == "QEST01")
                        {
                            RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest1[1]);
                            RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest2[1]);
                        }
                    }
                }
                binaryWriter.BaseStream.Seek(position, SeekOrigin.Begin);
                for (int i = 0; i < this.languageCount; i++)
                {
                    binaryWriter.Write(value);
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    binaryWriter.Write(this.entry[j].Offset[1]);
                }
            }
            binaryWriter.Close();
        }
Exemple #15
0
 public void read(ref BinaryReader br)
 {
     this.path = RoseFile.ReadZString(ref br);
 }
Exemple #16
0
 public void save(ref BinaryWriter bw)
 {
     RoseFile.WriteZString(ref bw, this.path);
 }
Exemple #17
0
        public void Load(string path, ClientType type)
        {
            BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open));
            int          num          = binaryReader.ReadInt32();

            IFO.BlockType[] array  = new IFO.BlockType[num];
            int[]           array2 = new int[num];
            for (int i = 0; i < num; i++)
            {
                array[i]  = (IFO.BlockType)binaryReader.ReadInt32();
                array2[i] = binaryReader.ReadInt32();
            }
            for (int i = 0; i < num; i++)
            {
                binaryReader.BaseStream.Seek((long)array2[i], SeekOrigin.Begin);
                if (array[i] == IFO.BlockType.ECONOMY_DATA)
                {
                    IFO.EconomyDataBlock economyDataBlock = new IFO.EconomyDataBlock();
                    economyDataBlock.width    = binaryReader.ReadInt32();
                    economyDataBlock.height   = binaryReader.ReadInt32();
                    economyDataBlock.mapCellX = binaryReader.ReadInt32();
                    economyDataBlock.mapCellY = binaryReader.ReadInt32();
                    economyDataBlock.unused   = new float[4, 4];
                    binaryReader.BaseStream.Seek(64L, SeekOrigin.Current);
                    economyDataBlock.name = RoseFile.ReadBString(ref binaryReader);
                    this.listEconomyBlock.Add(economyDataBlock);
                }
                else if (array[i] == IFO.BlockType.DECORATIONS)
                {
                    IFO.DecorationBlock item = default(IFO.DecorationBlock);
                    int num2 = binaryReader.ReadInt32();
                    item.listDecoration = new List <IFO.BasicEntry>();
                    for (int j = 0; j < num2; j++)
                    {
                        IFO.BasicEntry basicEntry = new IFO.BasicEntry();
                        basicEntry.data         = RoseFile.ReadBString(ref binaryReader);
                        basicEntry.warpID       = binaryReader.ReadInt16();
                        basicEntry.eventID      = binaryReader.ReadInt16();
                        basicEntry.objectType   = binaryReader.ReadInt32();
                        basicEntry.objectID     = binaryReader.ReadInt32();
                        basicEntry.mapPositionX = binaryReader.ReadInt32();
                        basicEntry.mapPositionY = binaryReader.ReadInt32();
                        basicEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                        basicEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                        basicEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                        item.listDecoration.Add(basicEntry);
                    }
                    this.listDecorationBlock.Add(item);
                }
                else if (array[i] == IFO.BlockType.NPC_SPAWNS)
                {
                    IFO.NpcBlock npcBlock = new IFO.NpcBlock();
                    int          num2     = binaryReader.ReadInt32();
                    npcBlock.listNPC = new List <IFO.NpcBlock.NpcEntry>();
                    for (int j = 0; j < num2; j++)
                    {
                        IFO.NpcBlock.NpcEntry npcEntry = new IFO.NpcBlock.NpcEntry();
                        npcEntry.data          = RoseFile.ReadBString(ref binaryReader);
                        npcEntry.warpID        = binaryReader.ReadInt16();
                        npcEntry.eventID       = binaryReader.ReadInt16();
                        npcEntry.objectType    = binaryReader.ReadInt32();
                        npcEntry.objectID      = binaryReader.ReadInt32();
                        npcEntry.mapPositionX  = binaryReader.ReadInt32();
                        npcEntry.mapPositionY  = binaryReader.ReadInt32();
                        npcEntry.rotation      = RoseFile.ReadVector4(ref binaryReader);
                        npcEntry.position      = RoseFile.ReadVector3(ref binaryReader);
                        npcEntry.scale         = RoseFile.ReadVector3(ref binaryReader);
                        npcEntry.aiPartenIndex = binaryReader.ReadInt32();
                        npcEntry.conFilePath   = RoseFile.ReadBString(ref binaryReader);
                        npcBlock.listNPC.Add(npcEntry);
                    }
                    this.listNpcBlock.Add(npcBlock);
                }
                else if (array[i] == IFO.BlockType.BUILDINGS)
                {
                    IFO.BuildingBlock buildingBlock = new IFO.BuildingBlock();
                    int num2 = binaryReader.ReadInt32();
                    buildingBlock.listBuilding = new List <IFO.BasicEntry>();
                    for (int j = 0; j < num2; j++)
                    {
                        IFO.BasicEntry basicEntry = new IFO.BasicEntry();
                        basicEntry.data         = RoseFile.ReadBString(ref binaryReader);
                        basicEntry.warpID       = binaryReader.ReadInt16();
                        basicEntry.eventID      = binaryReader.ReadInt16();
                        basicEntry.objectType   = binaryReader.ReadInt32();
                        basicEntry.objectID     = binaryReader.ReadInt32();
                        basicEntry.mapPositionX = binaryReader.ReadInt32();
                        basicEntry.mapPositionY = binaryReader.ReadInt32();
                        basicEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                        basicEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                        basicEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                        buildingBlock.listBuilding.Add(basicEntry);
                    }
                    this.listBuildingBlock.Add(buildingBlock);
                }
                else if (array[i] == IFO.BlockType.SOUND_EFFECTS)
                {
                    IFO.SoundEffectBlock soundEffectBlock = new IFO.SoundEffectBlock();
                    int num2 = binaryReader.ReadInt32();
                    soundEffectBlock.listSoundEffect = new List <IFO.SoundEffectBlock.SoundEffectEntry>();
                    for (int j = 0; j < num2; j++)
                    {
                        IFO.SoundEffectBlock.SoundEffectEntry soundEffectEntry = new IFO.SoundEffectBlock.SoundEffectEntry();
                        soundEffectEntry.data         = RoseFile.ReadBString(ref binaryReader);
                        soundEffectEntry.warpID       = binaryReader.ReadInt16();
                        soundEffectEntry.eventID      = binaryReader.ReadInt16();
                        soundEffectEntry.objectType   = binaryReader.ReadInt32();
                        soundEffectEntry.objectID     = binaryReader.ReadInt32();
                        soundEffectEntry.mapPositionX = binaryReader.ReadInt32();
                        soundEffectEntry.mapPositionY = binaryReader.ReadInt32();
                        soundEffectEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                        soundEffectEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                        soundEffectEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                        soundEffectEntry.soundPath    = RoseFile.ReadBString(ref binaryReader);
                        soundEffectEntry.range        = binaryReader.ReadInt32();
                        soundEffectEntry.interval     = binaryReader.ReadInt32();
                        soundEffectBlock.listSoundEffect.Add(soundEffectEntry);
                    }
                    this.listSoundEffectBlock.Add(soundEffectBlock);
                }
                else if (array[i] == IFO.BlockType.EFFECTS)
                {
                    IFO.EffectBlock effectBlock = new IFO.EffectBlock();
                    int             num2        = binaryReader.ReadInt32();
                    effectBlock.listEffect = new List <IFO.EffectBlock.EffectEntry>();
                    for (int j = 0; j < num2; j++)
                    {
                        IFO.EffectBlock.EffectEntry effectEntry = new IFO.EffectBlock.EffectEntry();
                        effectEntry.data         = RoseFile.ReadBString(ref binaryReader);
                        effectEntry.warpID       = binaryReader.ReadInt16();
                        effectEntry.eventID      = binaryReader.ReadInt16();
                        effectEntry.objectType   = binaryReader.ReadInt32();
                        effectEntry.objectID     = binaryReader.ReadInt32();
                        effectEntry.mapPositionX = binaryReader.ReadInt32();
                        effectEntry.mapPositionY = binaryReader.ReadInt32();
                        effectEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                        effectEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                        effectEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                        effectEntry.effectPath   = RoseFile.ReadBString(ref binaryReader);
                        effectBlock.listEffect.Add(effectEntry);
                    }
                    this.listEffectBlock.Add(effectBlock);
                }
                else if (array[i] == IFO.BlockType.ANIMATABLES)
                {
                    IFO.AnimatablesBlock animatablesBlock = new IFO.AnimatablesBlock();
                    int num2 = binaryReader.ReadInt32();
                    animatablesBlock.listAnimatable = new List <IFO.BasicEntry>();
                    for (int j = 0; j < num2; j++)
                    {
                        IFO.BasicEntry basicEntry = new IFO.BasicEntry();
                        basicEntry.data         = RoseFile.ReadBString(ref binaryReader);
                        basicEntry.warpID       = binaryReader.ReadInt16();
                        basicEntry.eventID      = binaryReader.ReadInt16();
                        basicEntry.objectType   = binaryReader.ReadInt32();
                        basicEntry.objectID     = binaryReader.ReadInt32();
                        basicEntry.mapPositionX = binaryReader.ReadInt32();
                        basicEntry.mapPositionY = binaryReader.ReadInt32();
                        basicEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                        basicEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                        basicEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                        animatablesBlock.listAnimatable.Add(basicEntry);
                    }
                    this.listAnimatablesBlock.Add(animatablesBlock);
                }
                else if (array[i] == IFO.BlockType.WATERBIG)
                {
                    IFO.WaterBigBlock waterBigBlock = new IFO.WaterBigBlock();
                    int num3 = binaryReader.ReadInt32();
                    int num4 = binaryReader.ReadInt32();
                    waterBigBlock.waterCells = new IFO.WaterBigBlock.WaterCell[num3, num4];
                    for (int j = 0; j < num3; j++)
                    {
                        for (int k = 0; k < num4; k++)
                        {
                            waterBigBlock.waterCells[j, k].use        = binaryReader.ReadByte();
                            waterBigBlock.waterCells[j, k].height     = binaryReader.ReadSingle();
                            waterBigBlock.waterCells[j, k].waterType  = binaryReader.ReadInt32();
                            waterBigBlock.waterCells[j, k].waterIndex = binaryReader.ReadInt32();
                            waterBigBlock.waterCells[j, k].reserved   = binaryReader.ReadInt32();
                        }
                    }
                    this.listWaterBigBlock.Add(waterBigBlock);
                }
                else if (array[i] != IFO.BlockType.MONSTER_SPAWNS)
                {
                    if (array[i] == IFO.BlockType.WATER_PLANES)
                    {
                        IFO.WaterPlaneBlock waterPlaneBlock = new IFO.WaterPlaneBlock();
                        waterPlaneBlock.basic = binaryReader.ReadSingle();
                        int num2 = binaryReader.ReadInt32();
                        waterPlaneBlock.watersEntries = new IFO.WaterPlaneBlock.WaterEntry[num2];
                        for (int j = 0; j < num2; j++)
                        {
                            waterPlaneBlock.watersEntries[j]       = new IFO.WaterPlaneBlock.WaterEntry();
                            waterPlaneBlock.watersEntries[j].start = RoseFile.ReadVector3(ref binaryReader);
                            waterPlaneBlock.watersEntries[j].end   = RoseFile.ReadVector3(ref binaryReader);
                        }
                        this.listWaterPlaneBlock.Add(waterPlaneBlock);
                    }
                    else if (array[i] == IFO.BlockType.WARP_GATES)
                    {
                        IFO.WarpGateBlock warpGateBlock = new IFO.WarpGateBlock();
                        int num2 = binaryReader.ReadInt32();
                        warpGateBlock.listWarpGate = new List <IFO.BasicEntry>();
                        for (int j = 0; j < num2; j++)
                        {
                            IFO.BasicEntry basicEntry = new IFO.BasicEntry();
                            basicEntry.data         = RoseFile.ReadBString(ref binaryReader);
                            basicEntry.warpID       = binaryReader.ReadInt16();
                            basicEntry.eventID      = binaryReader.ReadInt16();
                            basicEntry.objectType   = binaryReader.ReadInt32();
                            basicEntry.objectID     = binaryReader.ReadInt32();
                            basicEntry.mapPositionX = binaryReader.ReadInt32();
                            basicEntry.mapPositionY = binaryReader.ReadInt32();
                            basicEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                            basicEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                            basicEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                            warpGateBlock.listWarpGate.Add(basicEntry);
                        }
                        this.listWarpGateBlock.Add(warpGateBlock);
                    }
                    else if (array[i] == IFO.BlockType.COLLISION_BLOCK)
                    {
                        IFO.CollisionBlock collisionBlock = new IFO.CollisionBlock();
                        int num2 = binaryReader.ReadInt32();
                        collisionBlock.listCollision = new List <IFO.BasicEntry>();
                        for (int j = 0; j < num2; j++)
                        {
                            IFO.BasicEntry basicEntry = new IFO.BasicEntry();
                            basicEntry.data         = RoseFile.ReadBString(ref binaryReader);
                            basicEntry.warpID       = binaryReader.ReadInt16();
                            basicEntry.eventID      = binaryReader.ReadInt16();
                            basicEntry.objectType   = binaryReader.ReadInt32();
                            basicEntry.objectID     = binaryReader.ReadInt32();
                            basicEntry.mapPositionX = binaryReader.ReadInt32();
                            basicEntry.mapPositionY = binaryReader.ReadInt32();
                            basicEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                            basicEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                            basicEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                            collisionBlock.listCollision.Add(basicEntry);
                        }
                        this.listCollisionBlock.Add(collisionBlock);
                    }
                    else if (array[i] == IFO.BlockType.TRIGGERS)
                    {
                        IFO.TriggerBlock triggerBlock = new IFO.TriggerBlock();
                        int num2 = binaryReader.ReadInt32();
                        triggerBlock.listTrigger = new List <IFO.TriggerBlock.TriggerEntry>();
                        for (int j = 0; j < num2; j++)
                        {
                            IFO.TriggerBlock.TriggerEntry triggerEntry = new IFO.TriggerBlock.TriggerEntry();
                            triggerEntry.data         = RoseFile.ReadBString(ref binaryReader);
                            triggerEntry.warpID       = binaryReader.ReadInt16();
                            triggerEntry.eventID      = binaryReader.ReadInt16();
                            triggerEntry.objectType   = binaryReader.ReadInt32();
                            triggerEntry.objectID     = binaryReader.ReadInt32();
                            triggerEntry.mapPositionX = binaryReader.ReadInt32();
                            triggerEntry.mapPositionY = binaryReader.ReadInt32();
                            triggerEntry.rotation     = RoseFile.ReadVector4(ref binaryReader);
                            triggerEntry.position     = RoseFile.ReadVector3(ref binaryReader);
                            triggerEntry.scale        = RoseFile.ReadVector3(ref binaryReader);
                            triggerEntry.qsdTrigger   = RoseFile.ReadBString(ref binaryReader);
                            triggerEntry.luaTrigger   = RoseFile.ReadBString(ref binaryReader);
                            triggerBlock.listTrigger.Add(triggerEntry);
                        }
                        this.listTriggerBlock.Add(triggerBlock);
                    }
                }
            }
            binaryReader.Close();
        }