Ejemplo n.º 1
0
        }         //DisplayManifestInfo

        public void DisplayNavWorldInfo()
        {
            int navWorldCount = navWorlds.Count;

            for (int i = 0; i < navWorldCount; i++)
            {
                NavWorld navWorld = navWorlds[i];

                Console.WriteLine($"\nNavWorld: {i}");
                Console.WriteLine("================================================================");
                Console.WriteLine($"Subsection 1 Offset: 0x{navWorld.subsection1Offset.ToString("x")}");
                Console.WriteLine($"Subsection 2 Offset: 0x{navWorld.subsection2Offset.ToString("x")}");
                Console.WriteLine($"Subsection 4 Offset: 0x{navWorld.subsection4Offset.ToString("x")}");
                Console.WriteLine($"Subsection 3 Offset: 0x{navWorld.subsection3Offset.ToString("x")}");
                Console.WriteLine($"u1: 0x{navWorld.u1.ToString("x")}");
                Console.WriteLine($"u2: 0x{navWorld.u2.ToString("x")}");
                Console.WriteLine($"Subsection 5 Offset: 0x{navWorld.subsection5Offset.ToString("x")}");
                Console.WriteLine($"u3: 0x{navWorld.u3.ToString("x")}");
                Console.WriteLine($"Subsection 6 Offset: 0x{navWorld.subsection6Offset.ToString("x")}");
                Console.WriteLine($"Subsection 1 Entry Count: 0x{navWorld.subsection1EntryCount.ToString("x")}");
                Console.WriteLine($"Subsection 4 Entry Count: 0x{navWorld.subsection4EntryCount.ToString("x")}");
                Console.WriteLine($"Subsection 5 Entry Count: 0x{navWorld.subsection5EntryCount.ToString("x")}");

                int count = navWorld.navWorldSubsection1Entries.Length;

                for (int j = 0; j < count; j++)
                {
                    NavWorldSubsection1Entry entry = navWorld.navWorldSubsection1Entries[j];

                    Console.WriteLine($"\nSubsection 1 Entry: {j}");
                    Console.WriteLine("----------------------------------------------------------------");
                    Console.WriteLine($"u1a: 0x{entry.u1a.ToString("x")}");
                    Console.WriteLine($"u1b: 0x{entry.u1b.ToString("x")}");
                    Console.WriteLine($"u1: 0x{entry.u1.ToString("x")}");
                    Console.WriteLine($"u2a: 0x{entry.u2a.ToString("x")}");
                    Console.WriteLine($"u2b: 0x{entry.u2b.ToString("x")}\n");
                } //for

                count = navWorld.navWorldSubsection2Entries.Length;

                for (int j = 0; j < count; j++)
                {
                    NavWorldSubsection2Entry entry = navWorld.navWorldSubsection2Entries[j];

                    Console.WriteLine($"\nSubsection 2 Entry: {j}");
                    Console.WriteLine("----------------------------------------------------------------");
                    Console.WriteLine($"u1: 0x{entry.u1.ToString("x")}");
                    Console.WriteLine($"u2: 0x{entry.u2.ToString("x")}");
                    Console.WriteLine($"u3: 0x{entry.u3.ToString("x")}");
                    Console.WriteLine($"u4: 0x{entry.u4.ToString("x")}\n");
                } //for

                count = navWorld.navWorldSubsection3Entries.Length;

                Console.WriteLine($"\nSubsection 3 Entries");
                Console.WriteLine("----------------------------------------------------------------");

                for (int j = 0; j < count; j++)
                {
                    Console.Write($"0x{navWorld.navWorldSubsection3Entries[j].ToString("x")}, ");
                } //for

                Console.WriteLine($"\n");

                count = navWorld.navWorldSubsection4Entries.Length;

                for (int j = 0; j < count; j++)
                {
                    NavWorldSubsection4Entry entry = navWorld.navWorldSubsection4Entries[j];

                    Console.WriteLine($"\nSubsection 4 Entry: {j}");
                    Console.WriteLine("----------------------------------------------------------------");
                    Console.WriteLine($"u1: 0x{entry.u1.ToString("x")}");
                    Console.WriteLine($"u2: 0x{entry.u2.ToString("x")}");
                    Console.WriteLine($"u3: 0x{entry.u3.ToString("x")}");
                    Console.WriteLine($"u4: 0x{entry.u4.ToString("x")}\n");
                } //for

                count = navWorld.navWorldSubsection5Entries.Length;

                for (int j = 0; j < count; j++)
                {
                    NavWorldSubsection5Entry entry = navWorld.navWorldSubsection5Entries[j];

                    Console.WriteLine($"\nSubsection 5 Entry: {j}");
                    Console.WriteLine("----------------------------------------------------------------");
                    Console.WriteLine($"u1: 0x{entry.u1.ToString("x")}");
                    Console.WriteLine($"u2: 0x{entry.u2.ToString("x")}\n");
                } //for

                count = navWorld.navWorldSubsection6Entries.Length;

                Console.WriteLine($"\nSubsection 6 Entries");
                Console.WriteLine("----------------------------------------------------------------");

                for (int j = 0; j < count; j++)
                {
                    Console.Write($"0x{navWorld.navWorldSubsection6Entries[j].ToString("x")}, ");
                } //for

                Console.WriteLine($"\n");
            } //for
        }     //DisplayNavWorldInfo
Ejemplo n.º 2
0
        }     //ReadEntries

        private void ReadNavWorld(BinaryReader reader)
        {
            NavWorld navWorld      = new NavWorld();
            long     startPosition = reader.BaseStream.Position;

            navWorld.subsection1Offset = reader.ReadUInt32();
            navWorld.subsection2Offset = reader.ReadUInt32();
            navWorld.subsection4Offset = reader.ReadUInt32();
            navWorld.subsection3Offset = reader.ReadUInt32();
            navWorld.u1 = reader.ReadUInt32();
            navWorld.u2 = reader.ReadUInt32();
            navWorld.subsection5Offset = reader.ReadUInt32();
            navWorld.u3 = reader.ReadUInt32();
            navWorld.subsection6Offset     = reader.ReadUInt32();
            navWorld.subsection1EntryCount = reader.ReadUInt16();
            navWorld.subsection4EntryCount = reader.ReadUInt16();
            reader.BaseStream.Position    += 6;
            navWorld.subsection5EntryCount = reader.ReadUInt16();

            int count = navWorld.subsection1EntryCount;

            navWorld.navWorldSubsection1Entries = new NavWorldSubsection1Entry[count];
            navWorld.navWorldSubsection2Entries = new NavWorldSubsection2Entry[count];

            reader.BaseStream.Position = startPosition + navWorld.subsection1Offset;

            for (int i = 0; i < count; i++)
            {
                NavWorldSubsection1Entry navWorldSubsection1Entry = navWorld.navWorldSubsection1Entries[i];

                navWorldSubsection1Entry.u1a = reader.ReadByte();
                navWorldSubsection1Entry.u1b = reader.ReadByte();
                navWorldSubsection1Entry.u1  = reader.ReadInt16();
                navWorldSubsection1Entry.u2a = reader.ReadByte();
                navWorldSubsection1Entry.u2b = reader.ReadByte();

                navWorld.navWorldSubsection1Entries[i] = navWorldSubsection1Entry;
            } //for

            reader.BaseStream.Position = startPosition + navWorld.subsection2Offset;

            for (int i = 0; i < count; i++)
            {
                NavWorldSubsection2Entry navWorldSubsection2 = navWorld.navWorldSubsection2Entries[i];

                navWorldSubsection2.u1 = reader.ReadInt16();
                navWorldSubsection2.u2 = reader.ReadInt16();
                navWorldSubsection2.u3 = reader.ReadByte();
                navWorldSubsection2.u4 = reader.ReadByte();

                navWorld.navWorldSubsection2Entries[i] = navWorldSubsection2;
            } //for

            count = navWorld.navWorldSubsection2Entries[count - 1].u1 + navWorld.navWorldSubsection2Entries[count - 1].u3 * 2 + navWorld.navWorldSubsection2Entries[count - 1].u4;
            navWorld.navWorldSubsection3Entries = new ushort[count];

            reader.BaseStream.Position = startPosition + navWorld.subsection3Offset;

            for (int i = 0; i < count; i++)
            {
                navWorld.navWorldSubsection3Entries[i] = reader.ReadUInt16();
            } //for

            count = navWorld.subsection4EntryCount;
            navWorld.navWorldSubsection4Entries = new NavWorldSubsection4Entry[count];

            reader.BaseStream.Position = startPosition + navWorld.subsection4Offset;

            for (int i = 0; i < count; i++)
            {
                NavWorldSubsection4Entry navWorldSubsection4Entry = navWorld.navWorldSubsection4Entries[i];

                navWorldSubsection4Entry.u1 = reader.ReadInt16();
                navWorldSubsection4Entry.u2 = reader.ReadInt16();
                navWorldSubsection4Entry.u3 = reader.ReadByte();
                navWorldSubsection4Entry.u4 = reader.ReadByte();

                navWorld.navWorldSubsection4Entries[i] = navWorldSubsection4Entry;
            } //for

            count = navWorld.subsection5EntryCount;
            navWorld.navWorldSubsection5Entries = new NavWorldSubsection5Entry[count];

            reader.BaseStream.Position = startPosition + navWorld.subsection5Offset;

            for (int i = 0; i < count; i++)
            {
                NavWorldSubsection5Entry navWorldSubsection5Entry = navWorld.navWorldSubsection5Entries[i];

                navWorldSubsection5Entry.u1 = reader.ReadByte();
                navWorldSubsection5Entry.u2 = reader.ReadByte();

                navWorld.navWorldSubsection5Entries[i] = navWorldSubsection5Entry;
            } //for

            count = navWorld.subsection1EntryCount;
            navWorld.navWorldSubsection6Entries = new short[count];

            reader.BaseStream.Position = startPosition + navWorld.subsection6Offset;

            for (int i = 0; i < count; i++)
            {
                navWorld.navWorldSubsection6Entries[i] = reader.ReadInt16();
            } //for

            navWorlds.Add(navWorld);
        } //ReadNavWorld