public static void ReadFilePointers_ittxt(FileReader reader, List <FilePointer> allpointers, List <FilePointer> stringpointers)
        {
            reader.Stream.Position = 0x14;

            var recordpositions = LinqUtil.Pump(() => reader.ReadFilePointer16(), x => x.Value != 0).ToList();

            foreach (var position_record in recordpositions)
            {
                allpointers.Add(position_record);

                reader.Stream.Position = position_record.Value + 4;

                var ptr1 = reader.ReadFilePointer16();
                var ptr2 = reader.ReadFilePointer16();

                if (allpointers.Exists(x => x.Position == ptr1.Position && x.Value == ptr1.Value) == false)
                {
                    allpointers.Add(ptr1);
                }
                if (allpointers.Exists(x => x.Position == ptr2.Position && x.Value == ptr2.Value) == false)
                {
                    allpointers.Add(ptr2);
                }

                if (stringpointers.Exists(x => x.Position == ptr1.Position && x.Value == ptr1.Value) == false)
                {
                    stringpointers.Add(ptr1);
                }
                if (stringpointers.Exists(x => x.Position == ptr2.Position && x.Value == ptr2.Value) == false)
                {
                    stringpointers.Add(ptr2);
                }
            }
        }
Exemple #2
0
        public static void ReadFilePointers_magic_ZoK(FileReader reader, Int32 recordcount, List <FilePointer> allpointers, List <FilePointer> stringpointers)
        {
            reader.Stream.Position = 0x0;

            var recordpositions = LinqUtil.Pump(() => reader.ReadFilePointer16(), x => x.Value != 0).ToList();

            foreach (var position_record in recordpositions)
            {
                allpointers.Add(position_record);

                reader.Stream.Position = position_record.Value;

                var key = reader.ReadUInt16();
                if (key == 0)
                {
                    continue;
                }

                reader.Stream.Position = position_record.Value + 28;

                var ptr1 = reader.ReadFilePointer16();
                var ptr2 = reader.ReadFilePointer16();

                if (ptr1.Value >= reader.Length)
                {
                    continue;
                }
                if (ptr2.Value >= reader.Length)
                {
                    continue;
                }

                if (allpointers.Contains(ptr1) == false)
                {
                    allpointers.Add(ptr1);
                }
                if (allpointers.Contains(ptr2) == false)
                {
                    allpointers.Add(ptr2);
                }

                if (stringpointers.Contains(ptr1) == false)
                {
                    stringpointers.Add(ptr1);
                }
                if (stringpointers.Contains(ptr2) == false)
                {
                    stringpointers.Add(ptr2);
                }
            }
        }
        public static void ReadFilePointers_fish(FileReader reader, List <FilePointer> allpointers, List <FilePointer> stringpointers)
        {
            reader.Position = 0;

            void Foo1()
            {
                reader.Position = 6;

                var ptr = reader.ReadFilePointer16();

                allpointers.Add(ptr);

                reader.Position = ptr.Value;

                var list = LinqUtil.Pump(() => reader.ReadFilePointer16(), 5).ToList();

                allpointers.AddRange(list);
                stringpointers.AddRange(list);
            }

            void Foo2()
            {
                reader.Position = 8;

                var ptr = reader.ReadFilePointer16();

                allpointers.Add(ptr);

                reader.Position = ptr.Value;

                var list = LinqUtil.Pump(() => reader.ReadFilePointer16(), 5).ToList();

                allpointers.AddRange(list);
            }

            void Foo3()
            {
                reader.Position = 10;

                var ptr = reader.ReadFilePointer16();

                allpointers.Add(ptr);

                reader.Position = ptr.Value;

                var list = LinqUtil.Pump(() => reader.ReadFilePointer16(), 120).ToList();

                allpointers.AddRange(list);
                stringpointers.AddRange(list);
            }

            void Foo4()
            {
                reader.Position = 12;

                for (var i = 0; i != 31; ++i)
                {
                    var num           = reader.ReadUInt16();
                    var stringpointer = reader.ReadFilePointer16();

                    allpointers.Add(stringpointer);
                    stringpointers.Add(stringpointer);

                    reader.Position += 56;
                }
            }

            Foo1();
            Foo2();
            Foo3();
            Foo4();
        }