예제 #1
0
        private List <TOCEntryNode> LoadTOCAsEntries(string path)
        {
            BitConverter.IsLittleEndian = true;
            FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
            int        memsize    = (int)fileStream.Length;

            byte[] memory = new byte[memsize];
            int    count;
            int    sum = 0;

            while ((count = fileStream.Read(memory, sum, memsize - sum)) > 0)
            {
                sum += count;
            }
            fileStream.Close();
            List <TOCEntryNode> retval = new List <TOCEntryNode>();


            if (memsize > 0)
            {
                List <Inventory> content  = new List <Inventory>();
                Inventory        temp     = new Inventory();
                MemoryStream     myStream = new MemoryStream(memory);
                if (myStream.ReadValueU32() == 0x3AB70C13)
                {
                    myStream.Seek(8, SeekOrigin.Begin);
                    uint jumpSize = myStream.ReadValueU32();
                    myStream.Seek(jumpSize * 8, SeekOrigin.Current);
                    uint blockSize;
                    do
                    {
                        temp = new Inventory();
                        long position = myStream.Position;
                        uint value    = myStream.ReadValueU32();
                        blockSize = value & 0xFFFF;
                        uint offset   = (uint)myStream.Position;
                        uint fileSize = myStream.ReadValueU32();
                        myStream.Seek(20, SeekOrigin.Current);


                        string filePath = myStream.ReadStringZ();

                        myStream.Seek(position + blockSize, SeekOrigin.Begin);

                        temp.name   = filePath;
                        temp.offset = offset;
                        temp.size   = fileSize;
                        content.Add(temp);
                    } while (blockSize != 0);
                }
                myStream.Close();
                for (int i = 0; i < content.Count(); i++)
                {
                    TOCEntryNode entry = new TOCEntryNode(content[i].offset, content[i].name, content[i].size);
                    retval.Add(entry);
                    //retval.Add(content[i].offset.ToString("X") + " : " + content[i].name + " (bytes)" + content[i].size.ToString());
                }
            }
            return(retval);
        }
예제 #2
0
        private void EntryCompare()
        {
            int count = 0;

            while (true)
            {
                if (count < FirstTreeView.Nodes.Count && count < SecondTreeView.Nodes.Count)
                {
                    TOCEntryNode firstentry  = (TOCEntryNode)FirstTreeView.Nodes[count];
                    TOCEntryNode secondentry = (TOCEntryNode)SecondTreeView.Nodes[count];
                    firstentry.Companion  = secondentry;
                    secondentry.Companion = firstentry;

                    Checker(true);

                    firstentry.DoColour();
                    secondentry.DoColour();
                }
                else if (count >= FirstTreeView.Nodes.Count && count >= SecondTreeView.Nodes.Count)
                {
                    break;
                }
                count++;
            }
        }
예제 #3
0
            internal void DoColour()
            {
                Font font = TreeView.DefaultFont;

                if (!GoodCompanion)
                {
                    ForeColor = Color.Gold;
                    Console.WriteLine("Bad companion");
                }

                if (!GoodOffset)
                {
                    font = new Font(font, FontStyle.Italic);
                    Console.WriteLine("Bad offset");
                }

                if (!GoodName)
                {
                    BackColor = Color.Blue;
                    Console.WriteLine("Bad name");
                }

                if (!GoodSize)
                {
                    ForeColor = Color.Red;
                    Console.WriteLine("Bad size");
                }

                if (!GoodProperSize)
                {
                    ForeColor = Color.Green;
                    Console.WriteLine("bad actual size. Actual: " + ActualSize + "  Read: " + size);
                }

                if (GoodAll())
                {
                    ForeColor = new TOCEntryNode().ForeColor;
                    Console.WriteLine("Bad all");
                }
            }
예제 #4
0
            internal void DoColour()
            {
                Font font = TreeView.DefaultFont;
                if (!GoodCompanion)
                {
                    ForeColor = Color.Gold;
                    Console.WriteLine("Bad companion");
                }

                if (!GoodOffset)
                {
                    font = new Font(font, FontStyle.Italic);
                    Console.WriteLine("Bad offset");
                }

                if (!GoodName)
                {
                    BackColor = Color.Blue;
                    Console.WriteLine("Bad name");
                }

                if (!GoodSize)
                {
                    ForeColor = Color.Red;
                    Console.WriteLine("Bad size");
                }

                if (!GoodProperSize)
                {
                    ForeColor = Color.Green;
                    Console.WriteLine("bad actual size. Actual: " + ActualSize + "  Read: " + size);
                }

                if (GoodAll())
                {
                    ForeColor = new TOCEntryNode().ForeColor;
                    Console.WriteLine("Bad all");
                }
            }
예제 #5
0
        private List<TOCEntryNode> LoadTOCAsEntries(string path)
        {
            BitConverter.IsLittleEndian = true;
            FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
            int memsize = (int)fileStream.Length;
            byte[] memory = new byte[memsize];
            int count;
            int sum = 0;
            while ((count = fileStream.Read(memory, sum, memsize - sum)) > 0) sum += count;
            fileStream.Close();
            List<TOCEntryNode> retval = new List<TOCEntryNode>();


            if (memsize > 0)
            {
                List<Inventory> content = new List<Inventory>();
                Inventory temp = new Inventory();
                MemoryStream myStream = new MemoryStream(memory);
                if (myStream.ReadValueU32() == 0x3AB70C13)
                {
                    myStream.Seek(8, SeekOrigin.Begin);
                    uint jumpSize = myStream.ReadValueU32();
                    myStream.Seek(jumpSize * 8, SeekOrigin.Current);
                    uint blockSize;
                    do
                    {
                        temp = new Inventory();
                        long position = myStream.Position;
                        uint value = myStream.ReadValueU32();
                        blockSize = value & 0xFFFF;
                        uint offset = (uint)myStream.Position;
                        uint fileSize = myStream.ReadValueU32();
                        myStream.Seek(20, SeekOrigin.Current);


                        string filePath = myStream.ReadStringZ();

                        myStream.Seek(position + blockSize, SeekOrigin.Begin);

                        temp.name = filePath;
                        temp.offset = offset;
                        temp.size = fileSize;
                        content.Add(temp);

                    } while (blockSize != 0);
                }
                myStream.Close();
                for (int i = 0; i < content.Count(); i++)
                {
                    TOCEntryNode entry = new TOCEntryNode(content[i].offset, content[i].name, content[i].size);
                    retval.Add(entry);
                    //retval.Add(content[i].offset.ToString("X") + " : " + content[i].name + " (bytes)" + content[i].size.ToString());
                }
            }
            return retval;
        }