コード例 #1
0
ファイル: Item.cs プロジェクト: joshb910/CharacterEditor
        public void Read(BinaryReader reader)
        {
            Type = reader.ReadByte();
            Subtype = reader.ReadByte();
            reader.Skip(2);
            Modifier = reader.ReadInt16();
            reader.Skip(2);
            unknown1 = reader.ReadInt32();
            Rarity = reader.ReadByte();
            Material = reader.ReadByte();
            Flags = reader.ReadByte();
            reader.Skip(1);
            Level = reader.ReadInt16();
            reader.Skip(2);

            for (int i = 0; i < AttributeCount; ++i)
            {
                ItemAttribute attribute = new ItemAttribute();
                attribute.Read(reader);

                Attributes.Add(attribute);
            }

            // AttributesUsed is calculated on write
            reader.Skip(4);

            // TODO Ignore recipes for now
            if (Type == 2)
                Subtype = 0;
        }
コード例 #2
0
ファイル: FpkFile.cs プロジェクト: engrin/GzsTool
        public override void Read(Stream input)
        {
            BinaryReader reader = new BinaryReader(input, Encoding.Default, true);
            uint magicNumber1 = reader.ReadUInt32(); // foxf
            ushort magicNumber2 = reader.ReadUInt16(); // pk
            FpkType = (FpkType) reader.ReadByte(); // ' ' or 'd'
            byte magicNumber3 = reader.ReadByte(); // w
            ushort magicNumber4 = reader.ReadUInt16(); // in
            uint fileSize = reader.ReadUInt32();
            reader.Skip(18);
            uint magicNumber5 = reader.ReadUInt32(); // 2
            uint fileCount = reader.ReadUInt32();
            uint referenceCount = reader.ReadUInt32();
            reader.Skip(4);

            for (int i = 0; i < fileCount; i++)
            {
                Entries.Add(FpkEntry.ReadFpkEntry(input));
            }

            for (int i = 0; i < referenceCount; i++)
            {
                References.Add(FpkReference.ReadFpkReference(input));
            }
        }
コード例 #3
0
        public DownloadHandler(BinaryReader stream, BackgroundWorkerEx worker)
        {
            worker?.ReportProgress(0, "Loading \"download\"...");

            stream.Skip(2); // DL

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            byte b3 = stream.ReadByte();

            int numFiles = stream.ReadInt32BE();

            short numTags = stream.ReadInt16BE();

            int numMaskBytes = (numFiles + 7) / 8;

            for (int i = 0; i < numFiles; i++)
            {
                MD5Hash key = stream.Read<MD5Hash>();

                //byte[] unk = stream.ReadBytes(0xA);
                stream.Skip(0xA);

                //var entry = new DownloadEntry() { Index = i, Unk = unk };
                var entry = new DownloadEntry() { Index = i };

                DownloadData.Add(key, entry);

                worker?.ReportProgress((int)((i + 1) / (float)numFiles * 100));
            }

            for (int i = 0; i < numTags; i++)
            {
                DownloadTag tag = new DownloadTag();
                string name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);

                tag.Bits = new BitArray(bits);

                Tags.Add(name, tag);
            }
        }
コード例 #4
0
		public void Read(BinaryReader reader)
		{
			OffsetX = reader.ReadByte();
			OffsetY = reader.ReadByte();
			OffsetZ = reader.ReadByte();
			Material = reader.ReadByte();
			Level = reader.ReadInt16();
			reader.Skip(2);
		}
コード例 #5
0
        public void Read(Stream inputStream)
        {
            BinaryReader reader = new BinaryReader(inputStream, Encoding.Default, true);
            string magicNumber = reader.ReadString(4);
            short endianess = reader.ReadInt16();
            byte entryCount = reader.ReadByte();
            reader.Skip(1);
            short headerSize = reader.ReadInt16();
            inputStream.AlignRead(16);
            List<FfntEntryHeader> ffntEntryHeaders = new List<FfntEntryHeader>();

            for (int i = 0; i < entryCount; i++)
            {
                ffntEntryHeaders.Add(FfntEntryHeader.ReadFfntEntryHeader(inputStream));
            }

            foreach (var header in ffntEntryHeaders)
            {
                Entries.Add(header.ReadData(inputStream));
            }
        }
コード例 #6
0
ファイル: DownloadHandler.cs プロジェクト: Kruithne/W3DT
        public DownloadHandler(BinaryReader stream)
        {
            stream.Skip(2); // DL

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            byte b3 = stream.ReadByte();

            int numFiles = stream.ReadInt32BE();

            short numTags = stream.ReadInt16BE();

            int numMaskBytes = numFiles / 8 + (numFiles % 8 > 0 ? 1 : 0);

            for (int i = 0; i < numFiles; i++)
            {
                byte[] key = stream.ReadBytes(0x10);
                byte[] unk = stream.ReadBytes(0xA);
                DownloadEntry entry = new DownloadEntry() { Index = i, Unk = unk };

                DownloadData.Add(key, entry);
            }

            for (int i = 0; i < numTags; i++)
            {
                DownloadTag tag = new DownloadTag();
                string name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);

                tag.Bits = new BitArray(bits);

                Tags.Add(name, tag);
            }
        }
コード例 #7
0
        private void Read(Stream input)
        {
            BinaryReader reader = new BinaryReader(input, Encoding.Default, true);
            StringOffset = reader.ReadInt32();
            reader.Skip(4);
            StringLength = reader.ReadInt32();
            reader.Skip(4);

            long endPosition = input.Position;
            input.Position = StringOffset;
            Value = reader.ReadString(StringLength);
            input.Position = endPosition;
        }
コード例 #8
0
ファイル: Item.cs プロジェクト: nopehight/CharacterEditor
        public void Read(BinaryReader reader)
        {
            Type = reader.ReadByte();
            Subtype = reader.ReadByte();
            reader.Skip(2);
            Modifier = reader.ReadInt16();
            reader.Skip(2);
            RecipeType = reader.ReadByte();
            reader.Skip(3);
            Rarity = reader.ReadByte();
            Material = reader.ReadByte();
            Flags = (ItemFlags)reader.ReadByte();
            reader.Skip(1);
            Level = reader.ReadInt16();
            reader.Skip(2);

            for (int i = 0; i < AttributeCount; ++i)
            {
                ItemAttribute attribute = new ItemAttribute();
                attribute.Read(reader);

                Attributes.Add(attribute);
            }

            // AttributesUsed is calculated on write
            reader.Skip(4);

            ActualModifier = Modifier;
        }
コード例 #9
0
ファイル: EncodingHandler.cs プロジェクト: Kruithne/W3DT
        public EncodingHandler(BinaryReader stream)
        {
            stream.Skip(2); // EN
            byte b1 = stream.ReadByte();
            byte checksumSizeA = stream.ReadByte();
            byte checksumSizeB = stream.ReadByte();
            ushort flagsA = stream.ReadUInt16();
            ushort flagsB = stream.ReadUInt16();
            int numEntriesA = stream.ReadInt32BE();
            int numEntriesB = stream.ReadInt32BE();
            byte b4 = stream.ReadByte();
            int stringBlockSize = stream.ReadInt32BE();

            stream.Skip(stringBlockSize);
            stream.Skip(numEntriesA * 32);

            long chunkStart = stream.BaseStream.Position;

            for (int i = 0; i < numEntriesA; ++i)
            {
                ushort keysCount;

                while ((keysCount = stream.ReadUInt16()) != 0)
                {
                    int fileSize = stream.ReadInt32BE();
                    MD5Hash hash = stream.Read<MD5Hash>();

                    EncodingEntry entry = new EncodingEntry();
                    entry.Size = fileSize;

                    // how do we handle multiple keys?
                    for (int ki = 0; ki < keysCount; ++ki)
                    {
                        MD5Hash key = stream.Read<MD5Hash>();

                        // use first key for now
                        if (ki == 0)
                            entry.Key = key;
                        else
                            Log.Write("Multiple encoding keys for MD5 hash {0} -> {1}", hash.ToHexString(), key.ToHexString());
                    }

                    EncodingData.Add(hash, entry);
                }

                // each chunk is 4096 bytes, and zero padding at the end
                long remaining = CHUNK_SIZE - ((stream.BaseStream.Position - chunkStart) % CHUNK_SIZE);

                if (remaining > 0)
                    stream.BaseStream.Position += remaining;
            }

            for (int i = 0; i < numEntriesB; ++i)
            {
                byte[] firstKey = stream.ReadBytes(16);
                byte[] blockHash = stream.ReadBytes(16);
            }

            long chunkStart2 = stream.BaseStream.Position;

            for (int i = 0; i < numEntriesB; ++i)
            {
                byte[] key = stream.ReadBytes(16);
                int stringIndex = stream.ReadInt32BE();
                byte unk1 = stream.ReadByte();
                int fileSize = stream.ReadInt32BE();

                // each chunk is 4096 bytes, and zero padding at the end
                long remaining = CHUNK_SIZE - ((stream.BaseStream.Position - chunkStart2) % CHUNK_SIZE);

                if (remaining > 0)
                    stream.BaseStream.Position += remaining;
            }
        }
コード例 #10
0
ファイル: DdsFileHeader.cs プロジェクト: kkkkyue/FtexTool
 public static DdsFileHeader Read(Stream inputStream)
 {
     DdsFileHeader result = new DdsFileHeader();
     BinaryReader reader = new BinaryReader(inputStream, Encoding.Default, true);
     result.Size = reader.ReadInt32();
     result.Flags = (DdsFileHeaderFlags) reader.ReadInt32();
     result.Height = reader.ReadInt32();
     result.Width = reader.ReadInt32();
     result.PitchOrLinearSize = reader.ReadInt32();
     result.Depth = reader.ReadInt32();
     result.MipMapCount = reader.ReadInt32();
     // int Reserved1[11];
     reader.Skip(44);
     result.PixelFormat = DdsPixelFormat.ReadDdsPixelFormat(inputStream);
     result.Caps = (DdsSurfaceFlags) reader.ReadInt32();
     result.Caps2 = (DdsCubemap) reader.ReadInt32();
     result.Caps3 = reader.ReadInt32();
     result.Caps4 = reader.ReadInt32();
     // int Reserved2;
     reader.Skip(4);
     return result;
 }
コード例 #11
0
ファイル: FoxFile.cs プロジェクト: kkkkyue/FoxTool
        private void Read(Stream input)
        {
            BinaryReader reader = new BinaryReader(input, Encoding.Default, true);
            uint magicNumber1 = reader.ReadUInt32();
            uint magicNumber2 = reader.ReadUInt32();
            int entityCount = reader.ReadInt32();
            int stringTableOffset = reader.ReadInt32();
            int offsetData = reader.ReadInt32();
            reader.Skip(12);
            for (int i = 0; i < entityCount; i++)
            {
                FoxEntity entity = FoxEntity.ReadFoxEntity(input);
                _entities.Add(entity);
            }

            FoxStringLookupLiteral stringLookupLiteral;
            while ((stringLookupLiteral = FoxStringLookupLiteral.ReadFoxStringLookupLiteral(input)) != null)
            {
                _stringLookupLiterals.Add(stringLookupLiteral);
            }
            input.AlignRead(16);
            reader.Skip(2);
            string eof = reader.ReadString(3);
            input.AlignRead(16);
        }
コード例 #12
0
ファイル: RpMovement.cs プロジェクト: Everlight/DesertProject
        public override void Process(ClientConnection client, byte[] data)
        {
            using (var stream = new MemoryStream(data))
            using (var reader = new BinaryReader(stream))
            {
                int type = reader.ReadInt32();
                reader.ReadInt16();
                float start_x = reader.ReadSingle();
                float start_y = reader.ReadSingle();
                float start_z = reader.ReadSingle();              
                reader.ReadInt64();//zeros

                float x1 = reader.ReadSingle();
                float y1 = reader.ReadSingle();
                float z1 = reader.ReadSingle();

                float cosinus = reader.ReadSingle();
                float unk2 = reader.ReadSingle();
                float sinus = reader.ReadSingle();
                float unk4 = reader.ReadSingle();

                float x2 = reader.ReadSingle();
                float y2 = reader.ReadSingle();
                float z2 = reader.ReadSingle();

                float x3 = reader.ReadSingle();
                float y3 = reader.ReadSingle();
                float z3 = reader.ReadSingle();

                float x4 = reader.ReadSingle();
                float y4 = reader.ReadSingle();
                float z4 = reader.ReadSingle();

                float x5 = reader.ReadSingle();
                float y5 = reader.ReadSingle();
                float z5 = reader.ReadSingle();

                float x6 = reader.ReadSingle();
                float y6 = reader.ReadSingle();
                float z6 = reader.ReadSingle();

                float x7 = reader.ReadSingle();
                float y7 = reader.ReadSingle();
                float z7 = reader.ReadSingle();

                float x8 = reader.ReadSingle();
                float y8 = reader.ReadSingle();
                float z8 = reader.ReadSingle();

                float x9 = reader.ReadSingle();
                float y9 = reader.ReadSingle();
                float z9 = reader.ReadSingle();

                reader.Skip(94); //zeros

                var cHeading = Math.Acos(cosinus);
                var sHeading = Math.Asin(sinus);

                var heading = start_x * cosinus - start_y * sinus; 

                var movementAcion = new MovementAction(
                    new Position(new Vector3(start_x, start_y, start_z))
                {
                    Cosinus = cosinus, Sinus = sinus, Heading = (short) heading
                }, new Position(new Vector3(0,0,0)), (short) heading, 120, 1);

                Core.Act(s => s.WorldProcessor.ObjectMoved(client.ActivePlayer, movementAcion));

                //Log.Debug("\n----------------\n" +
                //          $"Type {type} cHeading {cHeading} sHeading {sHeading} calculated heading {heading}\n" +
                //          $"Cos {cosinus} Sin {sinus}\n" +
                //          $"x-{start_x} y-{start_y} z-{start_z}\n" +
                //          $"x-{x1} y-{y1} z-{z1}\n" +
                //          $"x-{x2} y-{y2} z-{z2}\n" +
                //          $"x-{x3} y-{y3} z-{z3}\n" +
                //          $"x-{x4} y-{y4} z-{z4}\n" +
                //          $"x-{x5} y-{y5} z-{z5}\n" +
                //          $"x-{x6} y-{y6} z-{z6}\n" +
                //          $"x-{x7} y-{y7} z-{z7}\n" +
                //          $"x-{x8} y-{y8} z-{z8}\n" +
                //          $"x-{x9} y-{y9} z-{z9}\n" +
                //          $"----------------");
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: elfinlazz/rewpa
        public Area(string path)
        {
            this.Props = new List<Prop>();
            this.Events = new List<Event>();

            using (var fs = new FileStream(path, FileMode.Open))
            using (var br = new BinaryReader(fs))
            {
                Version = br.ReadInt16();
                if (Version < 202)
                    throw new Exception("Invalid file version.");

                br.Skip(0x02); // Unk
                br.Skip(0x04); // Unk
                AreaId = br.ReadInt16();
                var regionId = br.ReadInt16(); // Unk
                Server = br.ReadUnicodeString();
                Name = br.ReadUnicodeString();
                br.Skip(0x10); // Unk
                var eventCount = br.ReadInt32();
                var propCount = br.ReadInt32();
                br.Skip(0x14); // Unk
                X1 = br.ReadSingle();
                br.Skip(0x04); // Unk
                Y1 = br.ReadSingle();
                br.Skip(0x0C); // Unk
                X2 = br.ReadSingle();
                br.Skip(0x04); // Unk
                Y2 = br.ReadSingle();
                br.Skip(0x0C); // Unk
                if (Version == 203)
                    br.Skip(0x04); // Unk

                var ver = br.ReadInt16();
                br.Skip(0x02); // Unk
                var propCountCheck = br.ReadInt32();
                if (ver < 202 || propCount != propCountCheck)
                    throw new Exception("Reading error.");

                for (int i = 0; i < propCount; ++i)
                {
                    var prop = new Prop();

                    prop.ClassId = br.ReadInt32();
                    prop.PropId = br.ReadInt64();
                    prop.Name = br.ReadUnicodeString();
                    prop.X = br.ReadSingle();
                    prop.Y = br.ReadSingle();
                    br.Skip(0x04); // Unk (Z?)
                    var shapeCount = br.ReadByte();
                    br.Skip(0x04); // Unk

                    for (int j = 0; j < shapeCount; ++j)
                    {
                        var dirX1 = br.ReadSingle();
                        var dirX2 = br.ReadSingle();
                        var dirY1 = br.ReadSingle();
                        var dirY2 = br.ReadSingle();
                        var lenX = br.ReadSingle();
                        var lenY = br.ReadSingle();
                        br.Skip(0x04); // Unk
                        var posX = br.ReadSingle();
                        var posY = br.ReadSingle();
                        br.Skip(0x10); // Unk

                        prop.Shape.AddRange(GetShapeLines(dirX1, dirX2, dirY1, dirY2, lenX, lenY, posX, posY));
                    }

                    prop.Solid = (br.ReadByte() != 0);
                    br.ReadByte(); // Unk
                    prop.Scale = br.ReadSingle();
                    prop.Direction = br.ReadSingle();
                    br.Skip(0x40); // Unk
                    br.ReadUnicodeString(); // title
                    br.ReadUnicodeString(); // state
                    var parameterCount = br.ReadByte();
                    for (int k = 0; k < parameterCount; ++k)
                    {
                        var def = br.ReadByte();
                        var eventType = br.ReadInt32();
                        var signalType = br.ReadInt32();
                        var name = br.ReadUnicodeString();
                        var xml = br.ReadUnicodeString();

                        // Add identical parameters only once
                        var exists = false;
                        foreach (var param in prop.Parameters)
                        {
                            if (param.EventType == eventType && param.SignalType == signalType && param.Name == name && param.XML == xml)
                            {
                                exists = true;
                                break;
                            }
                        }

                        if (!exists)
                            prop.Parameters.Add(new PropParameter(eventType, signalType, name, xml));
                    }

                    // Filter Tir anniversary props
                    // TODO: Use prop db to check for the feature?
                    if ((Name == "field_Tir_S_aa" || Name == "field_Tir_S_ba") && prop.ClassId > 44000)
                        continue;

                    this.Props.Add(prop);
                }

                for (int i = 0; i < eventCount; ++i)
                {
                    var ev = new Event();
                    this.Events.Add(ev);

                    ev.EventId = br.ReadInt64();
                    ev.Name = br.ReadUnicodeString();
                    ev.X = br.ReadSingle();
                    ev.Y = br.ReadSingle();
                    br.Skip(0x04); // Unk (Z?)
                    var shapeCount = br.ReadByte();
                    br.Skip(0x04); // Unk

                    for (int j = 0; j < shapeCount; ++j)
                    {
                        var dirX1 = br.ReadSingle();
                        var dirX2 = br.ReadSingle();
                        var dirY1 = br.ReadSingle();
                        var dirY2 = br.ReadSingle();
                        var lenX = br.ReadSingle();
                        var lenY = br.ReadSingle();
                        br.Skip(0x04); // Unk
                        var posX = br.ReadSingle();
                        var posY = br.ReadSingle();
                        br.Skip(0x10); // Unk

                        ev.Shape.AddRange(GetShapeLines(dirX1, dirX2, dirY1, dirY2, lenX, lenY, posX, posY));
                    }

                    ev.EventType = br.ReadInt32();
                    var parameterCount = br.ReadByte();
                    for (int k = 0; k < parameterCount; ++k)
                    {
                        var def = br.ReadByte();
                        var eventType = br.ReadInt32();
                        var signalType = br.ReadInt32();
                        var name = br.ReadUnicodeString();
                        var xml = br.ReadUnicodeString();

                        ev.Parameters.Add(new PropParameter(eventType, signalType, name, xml));
                    }
                }
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: elfinlazz/rewpa
        public Region(string path)
        {
            this.Areas = new List<Area>();

            using (var fs = new FileStream(path, FileMode.Open))
            using (var br = new BinaryReader(fs))
            {
                Version = br.ReadInt32();
                br.ReadInt32(); // Unk
                RegionId = br.ReadInt32();
                GroupId = br.ReadInt32();
                ClientName = br.ReadUnicodeString();
                CellSize = br.ReadInt32();
                Sight = br.ReadByte();
                var areaCount = br.ReadInt32();
                br.Skip(0x40); // Unk
                Scene = br.ReadUnicodeString();
                br.Skip(0x2D); // Unk
                Camera = br.ReadUnicodeString();
                Light = br.ReadUnicodeString();
                br.Skip(0x0C); // Unk

                for (int i = 0; i < areaCount; ++i)
                {
                    var areaName = br.ReadUnicodeString();
                    var area = new Area(Path.Combine(Path.GetDirectoryName(path), areaName + ".area"));
                    Areas.Add(area);
                }

                br.Skip(0x1B); // Unk
                XML = br.ReadUnicodeString();
            }

            Name = ClientName;
            //Name = Name.Replace("Tin_Beginner_Tutorial", "tir_beginner");
            //Name = Name.Replace("Uladh_Cobh_to_Belfast", "cobh_to_belfast");
            //Name = Name.Replace("Uladh_Belfast_to_Cobh", "belfast_to_cobh");
            //Name = Name.Replace("Cobh_to_Belfast", "cobh_to_belfast_ocean");
            //Name = Name.Replace("Belfast_to_Cobh", "belfast_to_cobh_ocean");
            //Name = Name.Replace("MonsterRegion", "monster_region");
            //Name = Name.Replace("Uladh_main", "tir");
            //Name = Name.Replace("Uladh_TirCho_", "tir_");
            //Name = Name.Replace("Uladh_Dunbarton", "dunbarton");
            //Name = Name.Replace("Uladh_Dun_to_Tircho", "dugald_aisle");
            //Name = Name.Replace("Ula_Tirnanog", "tnn");
            //Name = Name.Replace("Ula_DgnHall_Dunbarton_before1", "rabbie_altar");
            //Name = Name.Replace("Ula_DgnHall_Dunbarton_before2", "math_altar");
            //Name = Name.Replace("MiscShop", "general");
            //Name = Name.Replace("tir_ChiefHouse", "tir_duncan");
            //Name = Name.Replace("Uladh_Dungeon_Black_Wolfs_Hall1", "ciar_altar");
            //Name = Name.Replace("Uladh_Dungeon_Black_Wolfs_Hall2", "ciar_entrance");
            //Name = Name.Replace("Uladh_Dungeon_Beginners_Hall1", "alby_altar");
            //Name = Name.Replace("Uladh_Cobh_harbor", "cobh");
            //Name = Name.Replace("Ula_DgnHall_Dunbarton_after", "rabbie_entrance");
            //Name = Name.Replace("Ula_hardmode_DgnHall_TirChonaill_before", "alby_hard_altar");
            //Name = Name.Replace("Ula_DgnArena_Tircho_Lobby", "alby_arena_lobby");
            //Name = Name.Replace("Ula_DgnArena_Tircho_Arena", "alby_arena");
            //Name = Name.Replace("Ula_Dun_to_Bangor", "gairech");
            //Name = Name.Replace("Ula_Bangor", "bangor");
            //Name = Name.Replace("Ula_DgnHall_Bangor_before1", "barri_altar");
            //Name = Name.Replace("Ula_DgnHall_Bangor_before2", "barri_entrance_test");
            //Name = Name.Replace("Ula_DgnHall_Bangor_after", "barri_entrance");
            //Name = Name.Replace("tnn_ChiefHouse", "tnn_duncan");
            //Name = Name.Replace("Ula_DgnHall_Tirnanog_before1", "albey_altar");
            //Name = Name.Replace("Ula_DgnHall_Tirnanog_before2", "albey_altar_test");
            //Name = Name.Replace("Ula_DgnHall_Tirnanog_after", "albey_altar_entrance");
            //Name = Name.Replace("Sidhe_Sneachta_S", "sidhe_north");
            //Name = Name.Replace("Sidhe_Sneachta_N", "sidhe_south");
            //Name = Name.Replace("Ula_DgnHall_Danu_before", "fiodh_altar");
            //Name = Name.Replace("Ula_DgnHall_Danu_after", "fiodh_entrance");
            //Name = Name.Replace("Ula_", "");
            //Name = Name.Replace("Emainmacha", "emain_macha");
            //Name = Name.Replace("DgnHall_Coill_before", "coill_altar");
            //Name = Name.Replace("DgnHall_Coill_after", "coill_entrance");
            //Name = Name.Replace("emain_macha_Ceo", "ceo");
            //Name = Name.Replace("DgnHall_Runda_before", "rundal_altar");
            //Name = Name.Replace("DgnHall_Runda_after", "rundal_entrance");
            //Name = Name.Replace("emain_macha_OidTobar_Hall", "ceo_cellar");
            //Name = Name.Replace("Studio_Runda", "studio_rundal_boss");
            //Name = Name.Replace("dunbarton_SchoolHall_before", "dunbarton_school_altar");
            //Name = Name.Replace("dunbarton_School_LectureRoom", "dunbarton_school_library");
            //Name = Name.Replace("Dgnhall_Peaca_before", "peaca_altar");
            //Name = Name.Replace("Dgnhall_Peaca_after", "peaca_entrance");
            //Name = Name.Replace("DgnHall_Tirnanog_G3_before", "baol_altar");
            //Name = Name.Replace("DgnHall_Tirnanog_G3_after", "baol_entrance");
            //Name = Name.Replace("Private_Wedding_waitingroom", "emain_macha_wedding_waiting");
            //Name = Name.Replace("Private_Wedding_ceremonialhall", "emain_macha_wedding_ceremony");
            //Name = Name.Replace("Dugald_Aisle_UserHouse", "dugald_userhouse");
            //Name = Name.Replace("tnn_G3_Gairech_Hill", "tnn_gairech");
            //Name = Name.Replace("Dugald_Aisle_UserCastleTest1", "user_castle_test_1");
            //Name = Name.Replace("Dugald_Aisle_UserCastleTest2", "user_castle_test_2");
            //Name = Name.Replace("tnn_G3", "tnn_bangor");
            //Name = Regex.Replace(Name, "_TestRegion([0-9]+)", "test_region_$1");
            //Name = Regex.Replace(Name, "dugald_userhouse_int_([0-9]+)", "user_house_int_$1");
            //Name = Name.Replace("Dugald_Aisle_UserCastle_", "user_castle_");
            //Name = Name.Replace("Dugald_Aisle_ModelHouse", "model_house");
            //Name = Name.Replace("DgnArena_Dunbarton_Arena", "rabbie_battle_arena");
            //Name = Name.Replace("DgnArena_Dunbarton_Lobby", "rabbie_battle_arena_lobby");
            //Name = Name.Replace("DgnArena_Dunbarton_waitingroom", "rabbie_battle_arena_waiting");
            //Name = Name.Replace("Iria_Harbor_01", "iria_harbor");
            //Name = Name.Replace("Iria_SW_ruins_DG_before", "rano_ruins_altar");
            //Name = Name.Replace("Iria_SW_ruins_DG_after", "rano_ruins_entrance");
            //Name = Name.Replace("ArenaTest0", "arena_test_0");
            //Name = Name.Replace("Loginstage_0", "login_stage_0");
            //Name = Name.Replace("Iria_NN_dragoncave01", "renes");
            //Name = Name.Replace("hardmode_DgnHall_TirChonaill_after", "alby_hard_entrance");
            //Name = Name.Replace("hardmode_DgnHall_Ciar_before", "ciar_hard_altar");
            //Name = Name.Replace("hardmode_DgnHall_Ciar_after", "ciar_hard_entrance");
            //Name = Name.Replace("hardmode_rundal_altar", "rundal_hard_altar");
            //Name = Name.Replace("hardmode_rundal_entrance", "rundal_hard_entrance");
            //Name = Name.Replace("Uladh_Cobh", "cobh");
            //Name = Name.Replace("Dunbarton_LectureRoom", "dunbarton_school_library");
            //Name = Name.Replace("OidTobar_Hall", "ceo_cellar");
            //Name = Name.Replace("Dugald_Aisle_Town", "dugald_residential");
            //Name = Name.Replace("_Keep", "_castle_entrance");
            //Name = Name.Replace("Dugald_Aisle", "dugald");
            //Name = Name.Replace("keep_DgnHall_after", "dungeon_altar");
            //Name = Name.Replace("keep_DgnHall_before", "dungeon_entrance");
            //Name = Name.Replace("Studio_keep_DG", "studio_residential");
            //Name = Name.Replace("Housing_CharDummyStage", "housing_dummy");
            //Name = Name.Replace("Private_giant_Wedding_ceremonialhall", "vales_wedding_ceremony");
            //Name = Name.Replace("Private_giant_Wedding_waitingroom", "vales_wedding_waiting");
            //Name = Name.Replace("Private_Promotion_testRoom_waiting", "advancement_test_waiting");
            //Name = Name.Replace("Private_Promotion_testRoom", "advancement_test");
            //Name = Regex.Replace(Name, "_town$", "_residential");
            //Name = Name.Replace("Soulstream", "soul_stream");
            //Name = Name.Replace("soul_stream_region", "soul_stream_battle");
            //Name = Name.Replace("taillteann_main_field", "taillteann");
            //Name = Name.Replace("Taillteann_E_field", "sliab_cuilin");
            //Name = Name.Replace("Taillteann_SE_field", "abb_neagh");
            //Name = Name.Replace("Tara_N_Field", "comb_valley");
            //Name = Name.Replace("Tara_main_field", "tara");
            //Name = Name.Replace("Tara_SE_Field", "blago_prairie");
            //Name = Name.Replace("Tara_tournament_field", "tara_jousting");
            //Name = Name.Replace("Tara_cloth", "tara_clothing");
            //Name = Regex.Replace(Name, "_misc$", "_general");
            //Name = Name.Replace("Falias_main_field", "falias");
            //Name = Name.Replace("Avon_main_field", "avon");
            //Name = Name.Replace("JP_Nekojima_islet", "nekojima");
            //Name = Name.Replace("JP_Nekojima_dungeon_hall_after", "nekojima_dungeon_entrance");
            //Name = Name.Replace("JP_Nekojima", "nekojima");
            //Name = Name.Replace("TirnanogDG", "Tirnanog_DG");
            //Name = Name.Replace("Tirnanog", "tnn");
            //Name = Name.Replace("Nao_tutorial", "soul_stream");
            //Name = Name.Replace("G1_GoddessStage", "morrighan");
            //Name = Name.Replace("Event_moonsurface", "event_moon");
            //Name = Name.Replace("pvp_event", "event_pvp");
            //Name = Name.Replace("Event", "event");
            //Name = Name.Replace("event_impdream", "event_imp_dream");
            //Name = Name.Replace("Iria_SW_main_field", "rano");
            //Name = Name.Replace("Iria_Uladh_Ocean_fishingboat_float", "rano_fishing_boat");
            //Name = Name.Replace("Iria_to_fishingboat", "rano_to_fishingboat");
            //Name = Name.Replace("fishingboat_to_Iria", "fishingboat_to_rano");
            //Name = Name.Replace("Iria_SE_main_field", "connous");
            //Name = Name.Replace("Iria_SE_Desert_underground", "ant_tunnel");
            //Name = Name.Replace("Iria_SE", "filia");
            //Name = Name.Replace("Iria_NW", "physis");
            //Name = Name.Replace("Iria_SW", "rano");
            //Name = Name.Replace("MineField", "mine_field");
            //Name = Name.Replace("monsterraid01", "monster_raid");
            //Name = Name.Replace("ElfArena", "arena");
            //Name = Name.Replace("Iria_Elf", "elf");
            //Name = Name.Replace("physis_main_field", "physis");
            //Name = Name.Replace("physis_tunnel_S", "physis_tunnel_south");
            //Name = Name.Replace("physis_tunnel_N", "physis_tunnel_north");
            //Name = Name.Replace("physis_tunnel_Outside", "solea");
            //Name = Name.Replace("physis_Tutorial", "giant_tutorial");
            //Name = Name.Replace("Studio", "studio");
            //Name = Name.Replace("_mineB", "_mine_B");
            //Name = Name.Replace("Iria_C", "courcle");
            //Name = Name.Replace("Iria_NN", "zardine");
            //Name = Name.Replace("_main_field", "");
            //Name = Name.Replace("Belfast_human", "belfast");
            //Name = Name.Replace("Qwest", "quest");
            //Name = Name.Replace("Belfast_Skatha", "scathach");
            //Name = Name.Replace("physis_glacier01_DG", "par");
            //Name = Name.Replace("par_after", "par_altar");
            //Name = Name.Replace("par_before", "par_entrance");
            //Name = Name.Replace("Test01", "test_01");
            //Name = Name.Replace("Test02", "test_02");
            //Name = Name.Replace("Tara_keep_RG", "tara_castle");
            //Name = Name.Replace("Tara_town_RG", "tara_residential");
            //Name = Name.Replace("_TestRegion", "gm_island");
            //Name = Regex.Replace(Name, "_Cloth$", "_clothing");
            //Name = Name.Replace("filia_Desert_01_DG_after", "longa_altar");
            //Name = Name.Replace("filia_Desert_01_DG_before", "longa_entrance");
            //Name = Name.Replace("Private_igloo_01", "igloo");
            //Name = Name.Replace("BlockRegion", "block_region");
            //Name = Name.Replace("soul_stream_past_region", "soul_stream_past");
            //Name = Name.Replace("soul_stream_future_region", "soul_stream_future");
            //Name = Name.Replace("RE_Nekojima_islet", "doki_doki_island");
            //Name = Name.Replace("DramaIriaS2", "drama_iria_s2");

            //Name = Name.ToLower();
        }
コード例 #15
0
ファイル: CngBuilder.cs プロジェクト: holytshirt/Jwt4Net
        public override CngKey Build(BinaryReader reader)
        {
            // skip NULL
            reader.Require(Asn1Token.Null);
            reader.ReadLengthField();

            reader.Require(Asn1Token.BitString);
            // length
            reader.ReadLengthField();
            // unused buts
            reader.Skip();

            reader.Require(Asn1Token.Sequence);
            reader.ReadLengthField();

            // Modulus
            reader.Require(Asn1Token.Integer);
            var modLength = reader.ReadLengthField();
            // if the first byte is zero, skip it.
            if (reader.Peek() == 0x00)
            {
                modLength--;
                reader.Skip();
            }
            var modulus = reader.ReadBytes(modLength);

            // Exponent
            reader.Require(Asn1Token.Integer);
            var expLength = reader.ReadLengthField();
            var exponent = reader.ReadBytes(expLength);

            var parameters = new RSAParameters()
            {
                Exponent = exponent,
                Modulus = modulus
            };
            var cng = new RSACng();
            cng.ImportParameters(parameters);

            return cng.Key;
        }
コード例 #16
0
ファイル: FpkEntry.cs プロジェクト: engrin/GzsTool
 private void Read(Stream input)
 {
     BinaryReader reader = new BinaryReader(input, Encoding.Default, true);
     DataOffset = reader.ReadUInt32();
     reader.Skip(4);
     DataSize = reader.ReadInt32();
     reader.Skip(4);
     FpkString fileName = FpkString.ReadFpkString(input);
     Md5Hash = reader.ReadBytes(16);
     fileName.ResolveString(Md5Hash);
     FilePathFpkString = fileName;
 }
コード例 #17
0
ファイル: Character.cs プロジェクト: joshb910/CharacterEditor
        public void Read(BinaryReader reader)
        {
            EntityId = reader.ReadInt32();
            PositionX = reader.ReadInt64();
            PositionY = reader.ReadInt64();
            PositionZ = reader.ReadInt64();
            Pitch = reader.ReadSingle();
            Roll = reader.ReadSingle();
            Yaw = reader.ReadSingle();

            Health = reader.ReadSingle();
            Experience = reader.ReadInt32();
            Level = reader.ReadInt32();
            Class = (ClassType)reader.ReadByte();
            Specialization = reader.ReadByte();
            unknown1 = reader.ReadUInt32();
            unknown2 = reader.ReadUInt32();

            for (int i = 0; i < EquipmentCount; ++i)
            {
                Item item = new Item();
                item.Read(reader);

                Equipment.Add(item);
            }

            Name = reader.ReadLongString();
            Race = reader.ReadInt32();
            Gender = reader.ReadByte();
            reader.Skip(3);
            Face = reader.ReadInt32();
            Hair = reader.ReadInt32();
            HairColor = Utility.FromAbgr(reader.ReadInt32());

            int inventoryCount = reader.ReadInt32();
            for (int i = 0; i < inventoryCount; ++i)
            {
                Inventory inventory = new Inventory();
                inventory.Read(reader);

                Inventories.Add(inventory);
            }

            Coins = reader.ReadInt32();
            PlatinumCoins = reader.ReadInt32();

            int craftingRecipeCount = reader.ReadInt32();
            for (int i = 0; i < craftingRecipeCount; ++i)
            {
                Item item = new Item();
                item.Read(reader);

                CraftingRecipes.Add(item);
            }

            int worldCount = reader.ReadInt32();
            for (int i = 0; i < worldCount; ++i)
            {
                World world = new World();
                world.Read(reader);

                Worlds.Add(world);
            }

            int lastWorldSeed = reader.ReadInt32();
            string lastWorldName = reader.ReadLongString();

            LastWorld = Worlds.FirstOrDefault(w => w.Seed == lastWorldSeed && w.Name == lastWorldName);

            unknown3 = reader.ReadUInt32();
            reader.Skip(4);
            PetMasterSkillLevel = reader.ReadInt32();
            PetRidingSkillLevel = reader.ReadInt32();
            ClimbingSkillLevel = reader.ReadInt32();
            HangGlidingSkillLevel = reader.ReadInt32();
            SwimmingSkillLevel = reader.ReadInt32();
            SailingSkillLevel = reader.ReadInt32();
            TierOneSkillLevel = reader.ReadInt32();
            TierTwoSkillLevel = reader.ReadInt32();
            TierThreeSkillLevel = reader.ReadInt32();
            unknown4 = reader.ReadInt32();
            unknown5 = reader.ReadInt32();
        }
コード例 #18
0
ファイル: EncodingHandler.cs プロジェクト: aeo24/WoWMap
        public EncodingHandler(BinaryReader stream, BackgroundWorkerEx worker)
        {
            worker?.ReportProgress(0, "Loading \"encoding\"...");

            stream.Skip(2); // EN
            byte b1 = stream.ReadByte();
            byte checksumSizeA = stream.ReadByte();
            byte checksumSizeB = stream.ReadByte();
            ushort flagsA = stream.ReadUInt16();
            ushort flagsB = stream.ReadUInt16();
            int numEntriesA = stream.ReadInt32BE();
            int numEntriesB = stream.ReadInt32BE();
            byte b4 = stream.ReadByte();
            int stringBlockSize = stream.ReadInt32BE();

            stream.Skip(stringBlockSize);
            //string[] strings = Encoding.ASCII.GetString(stream.ReadBytes(stringBlockSize)).Split(new[] { '\0' }, StringSplitOptions.RemoveEmptyEntries);

            stream.Skip(numEntriesA * 32);
            //for (int i = 0; i < numEntriesA; ++i)
            //{
            //    byte[] firstHash = stream.ReadBytes(16);
            //    byte[] blockHash = stream.ReadBytes(16);
            //}

            long chunkStart = stream.BaseStream.Position;

            for (int i = 0; i < numEntriesA; ++i)
            {
                ushort keysCount;

                while ((keysCount = stream.ReadUInt16()) != 0)
                {
                    int fileSize = stream.ReadInt32BE();
                    byte[] md5 = stream.ReadBytes(16);

                    EncodingEntry entry = new EncodingEntry();
                    entry.Size = fileSize;

                    // how do we handle multiple keys?
                    for (int ki = 0; ki < keysCount; ++ki)
                    {
                        byte[] key = stream.ReadBytes(16);

                        // use first key for now
                        if (ki == 0)
                            entry.Key = key;
                        else
                            Logger.WriteLine("Multiple encoding keys for MD5 {0}: {1}", md5.ToHexString(), key.ToHexString());
                    }

                    //Encodings[md5] = entry;
                    EncodingData.Add(md5, entry);
                }

                // each chunk is 4096 bytes, and zero padding at the end
                long remaining = CHUNK_SIZE - ((stream.BaseStream.Position - chunkStart) % CHUNK_SIZE);

                if (remaining > 0)
                    stream.BaseStream.Position += remaining;

                worker?.ReportProgress((int)((i + 1) / (float)numEntriesA * 100));
            }

            stream.Skip(numEntriesB * 32);
            //for (int i = 0; i < numEntriesB; ++i)
            //{
            //    byte[] firstKey = stream.ReadBytes(16);
            //    byte[] blockHash = stream.ReadBytes(16);
            //}

            long chunkStart2 = stream.BaseStream.Position;

            for (int i = 0; i < numEntriesB; ++i)
            {
                byte[] key = stream.ReadBytes(16);
                int stringIndex = stream.ReadInt32BE();
                byte unk1 = stream.ReadByte();
                int fileSize = stream.ReadInt32BE();

                // each chunk is 4096 bytes, and zero padding at the end
                long remaining = CHUNK_SIZE - ((stream.BaseStream.Position - chunkStart2) % CHUNK_SIZE);

                if (remaining > 0)
                    stream.BaseStream.Position += remaining;
            }

            // string block till the end of file
        }