コード例 #1
0
        private UnknownC0 a(BinaryReader A_0)
        {
            if (A_0.BaseStream.Position == A_0.BaseStream.Length)
            {
                return(null);
            }

            UnknownE e = new UnknownE();

            e.read(A_0);
            if (!e.isBlank())
            {
                VLTOtherValue ce = e.ce1;
                UnknownC0     c;

                switch (ce)
                {
                case VLTOtherValue.VLTMAGIC:
                    c = new UnknownBA();
                    break;

                case VLTOtherValue.TABLE_START:
                    c = new UnknownDH();
                    break;

                case VLTOtherValue.TABLE_END:
                    c = new UnknownA8();
                    break;

                case VLTOtherValue.d:
                case VLTOtherValue.e:
                default:
                    c = new UnknownA4();
                    break;
                }

                c.e1 = e;
                c.read(A_0);
                e.seekToNextBlock(A_0.BaseStream);
                return(c);
            }

            return(null);
        }
コード例 #2
0
        public void am(RootRecord A_0, UnknownB0 A_1)
        {
            UnknownA8 a   = A_1.a(VLTOtherValue.TABLE_END) as UnknownA8;
            int       num = a.genht1[A_0.position].i2;

            A_1.ms1.Seek(num, SeekOrigin.Begin);
            BinaryReader a_ = new BinaryReader(A_1.ms1);

            this.genht1 = new Dictionary <uint, aclzz>(A_0.i3);
            for (int i = 0; i < A_0.i3; ++i)
            {
                UnknownDE.aclzz a2 = new UnknownDE.aclzz();
                a2.s1  = UnknownAP.a(a_);
                a2.i1  = A_0.ia1[i];
                a2.ui1 = JenkinsHash.getHash32(a2.s1);
                this.genht1.Add(a2.ui1, a2);
                HashTracker.addHashFromVLTDB(a2.s1);
            }
            this.genht2 = new Dictionary <uint, VLTClass>();
        }
コード例 #3
0
        public void a(ClassRecord A_0, UnknownB0 A_1)
        {
            this.b01         = A_1;
            this.classRecord = A_0;
            this.classHash   = A_0.hash;
            UnknownA8 a81 = (A_1.a(VLTOtherValue.TABLE_END) as UnknownA8);
            int       num = a81.genht1[A_0.position].i2;

            A_1.ms1.Seek(num, SeekOrigin.Begin);
            BinaryReader br = new BinaryReader(A_1.ms1);

            this.fields = new VLTClass.aclz1[this.classRecord.i2];
            for (int i = 0; i < this.classRecord.i2; ++i)
            {
                VLTClass.aclz1 a = new VLTClass.aclz1();
                a.read(br);
                HashTracker.getValueForHash(a.hash);
                this.fields[i] = a;
            }
            this.dqb1 = new VLTClass.bie(this);
        }
コード例 #4
0
            // This is where our problems with Carbon and up appear to stem from.
            public void a(RowRecord A_0, UnknownB0 A_1)
            {
                BinaryReader binaryReader  = new BinaryReader(A_1.ms1);
                BinaryReader binaryReader2 = new BinaryReader(A_1.ms2);
                UnknownDR    dr            = new UnknownDR(this.vltClass.classRecord.i2);
                UnknownA8    a             = A_1.a(VLTOtherValue.TABLE_END) as UnknownA8;

                int num;

                if (a.genht1.ContainsKey(A_0.position))
                {
                    num = a.genht1[A_0.position].i2;
                }
                else
                {
                    // NOTE: THIS IS A BUG, IT SHOULD NOT HAPPEN.
                    //       The ONLY reason I'm checking ContainsKey instead of using exception handling,
                    //       is because exception handling causes huge slowdowns in Visual Studio debugging.
                    if (BuildConfig.DEBUG)
                    {
                        ++numFails;
                        Console.WriteLine("VLTClass.a(): num fail (num" + numFails + ",b" + b8Fails + ")");
                    }
                    return;
                }

                dr.b01 = A_1;
                dr.dq1 = this.vltClass;
                dr.c1  = A_0;
                for (int i = 0; i < this.vltClass.classRecord.i2; ++i)
                {
                    VLTClass.aclz1 a2 = this.vltClass.fields[i];
                    BinaryReader   binaryReader3;
                    if (!a2.c())
                    {
                        binaryReader3 = binaryReader;
                        binaryReader3.BaseStream.Seek(num + a2.us1, SeekOrigin.Begin);
                    }
                    else
                    {
                        binaryReader3 = null;
                        for (int j = 0; j < A_0.i1; ++j)
                        {
                            if (A_0.caa1[j].hash == a2.hash)
                            {
                                if (A_0.caa1[j].a())
                                {
                                    binaryReader3 = binaryReader2;
                                    binaryReader3.BaseStream.Seek(A_0.caa1[j].position, SeekOrigin.Begin);
                                }
                                else
                                {
                                    binaryReader3 = binaryReader;
                                    binaryReader3.BaseStream.Seek(a.genht1[A_0.caa1[j].position].i2, SeekOrigin.Begin);
                                }
                            }
                        }
                        if (binaryReader3 == null)
                        {
                            continue;
                        }
                    }
                    Type type = TypeMap.instance.getTypeForKey(a2.ui2);
                    if (type == null)
                    {
                        type = typeof(VLTRawType);
                    }
                    VLTBaseType bb;
                    if (a2.isArray())
                    {
                        bb = new VLTArrayType(a2, type);
                    }
                    else
                    {
                        bb      = VLTBaseType.a(type);
                        bb.size = a2.len;
                        if (bb is VLTRawType)
                        {
                            (bb as VLTRawType).len = a2.len;
                        }
                    }
                    bb.ui1         = (uint)binaryReader3.BaseStream.Position;
                    bb.isVltOffset = (binaryReader3 == binaryReader2);
                    bb.typeHash    = a2.ui2;
                    bb.ui3         = a2.hash;
                    bb.dr1         = dr;
                    bb.read(binaryReader3);
                    dr.a(i, bb);
                }
                this.drList.Add(dr);
            }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: MWisBest/OpenNFSTools
        /*
         * private void e( object A_0, EventArgs A_1 )
         * {
         *      if( this.tvFields.SelectedNode != null )
         *      {
         *              TreeNode treeNode = this.tvFields.SelectedNode;
         *              if( treeNode.Parent != null )
         *              {
         *                      treeNode = treeNode.Parent;
         *              }
         *              VLTBaseType bb = treeNode.Tag as VLTBaseType;
         *              this.a( bb.dr1, bb.ui3 );
         *      }
         * }
         */

        // TODO: opt
        private void tv_AfterSelect(object A_0, TreeViewEventArgs A_1)
        {
            object tag = A_1.Node.Tag;

            if (tag is VLTClass)
            {
                this.classGrid.Visible = true;
                this.pnlData.Visible   = false;
                VLTClass  dq        = tag as VLTClass;
                DataSet   dataSet   = new DataSet("VLT");
                DataTable dataTable = dataSet.Tables.Add("Fields");
                dataTable.Columns.Add("Name", typeof(string));
                dataTable.Columns.Add("Type", typeof(string));
                dataTable.Columns.Add("Length", typeof(ushort));
                dataTable.Columns.Add("Count", typeof(short));

                foreach (VLTClass.aclz1 a in dq)
                {
                    DataRow dataRow = dataTable.NewRow();
                    dataRow[0] = HashTracker.getValueForHash(a.hash);
                    dataRow[1] = HashTracker.getValueForHash(a.ui2);
                    dataRow[2] = a.len;
                    dataRow[3] = a.count;
                    dataTable.Rows.Add(dataRow);
                }

                this.classGrid.DataSource = dataSet;
                this.classGrid.DataMember = "Fields";

                // This gets rid of the extra row in the table that appears when viewing a root node (e.x. junkman, pvehicle)
                CurrencyManager currencyManager = (CurrencyManager)this.BindingContext[dataSet, "Fields"];
                ((DataView)currencyManager.List).AllowNew    = false;
                ((DataView)currencyManager.List).AllowEdit   = false;
                ((DataView)currencyManager.List).AllowDelete = false;

                UnknownA8 a2 = dq.b01.a(VLTOtherValue.TABLE_END) as UnknownA8;
                this.classGrid.Update();
            }
            else if (tag is UnknownDR)
            {
                this.lblFieldType.Text   = "";
                this.lblFieldOffset.Text = "";
                this.dataGrid.DataSource = null;
                this.dataGrid.Update();
                this.classGrid.Visible = false;
                this.pnlData.Visible   = true;
                string   text     = "";
                string   text2    = "";
                TreeNode treeNode = null;
                if (this.tvFields.SelectedNode != null)
                {
                    if (this.tvFields.SelectedNode.Parent != null && this.tvFields.SelectedNode.Parent.Tag == null)
                    {
                        text  = this.tvFields.SelectedNode.Parent.Text;
                        text2 = this.tvFields.SelectedNode.Text;
                    }
                    else
                    {
                        text = this.tvFields.SelectedNode.Text;
                    }
                }
                UnknownDR dr  = tag as UnknownDR;
                VLTClass  dq2 = dr.dq1;
                this.tvFields.BeginUpdate();
                this.tvFields.Nodes.Clear();
                int num = 0;

                foreach (VLTClass.aclz1 a3 in dq2)
                {
                    VLTBaseType bb = dr.bba1[num++];
                    if (!a3.c() || dr.booa1[num - 1])
                    {
                        if (a3.isArray())
                        {
                            VLTArrayType m     = bb as VLTArrayType;
                            string       text3 = string.Concat(new object[]
                            {
                                HashTracker.getValueForHash(a3.hash),
                                " [",
                                m.getMaxEntryCount(),
                                "/",
                                m.getCurrentEntryCount(),
                                "]"
                            });
                            TreeNode treeNode2 = this.tvFields.Nodes.Add(text3);
                            treeNode2.Tag = bb;
                            for (int i = 0; i < m.getMaxEntryCount(); ++i)
                            {
                                TreeNode treeNode3 = treeNode2.Nodes.Add("[" + i + "]");
                                treeNode3.Tag = m.genlist[i];
                                if (treeNode2.Text == text && treeNode3.Text == text2)
                                {
                                    treeNode = treeNode3;
                                }
                            }
                            if (treeNode2.Text == text && treeNode == null)
                            {
                                treeNode = treeNode2;
                            }
                        }
                        else
                        {
                            TreeNode treeNode4 = this.tvFields.Nodes.Add(HashTracker.getValueForHash(a3.hash));
                            treeNode4.Tag = bb;
                            if (treeNode4.Text == text)
                            {
                                treeNode = treeNode4;
                            }
                        }
                    }
                }

                if (this.tvFields.Nodes.Count > 0)
                {
                    if (treeNode == null)
                    {
                        this.tvFields.SelectedNode = this.tvFields.Nodes[0];
                    }
                    else
                    {
                        this.tvFields.SelectedNode = treeNode;
                    }
                }
                this.tvFields.EndUpdate();
                UnknownA8 a4 = dr.b01.a(VLTOtherValue.TABLE_END) as UnknownA8;
            }
            else
            {
                this.classGrid.Visible = false;
                this.pnlData.Visible   = false;
            }
        }
コード例 #6
0
        public void a(Stream A_0, Stream A_1)
        {
            byte[] array = new byte[A_0.Length];
            A_0.Read(array, 0, array.Length);               // array.Length --> .vlt FileSize
            this.ms2       = new MemoryStream(array);
            this.genc0list = new List <UnknownC0>();
            BinaryReader a_ = new BinaryReader(this.ms2);
            UnknownC0    c;

            while ((c = this.a(a_)) != null)
            {
                this.genc0list.Add(c);
            }

            this.Trim();

            UnknownDH dh = this.a(VLTOtherValue.TABLE_START) as UnknownDH;

            for (int i = 0; i < dh.asa1.Length; ++i)
            {
                dh.asa1[i].b(a_);                   // TODO read vs b? b, DEFINITELY b
            }
            if (A_1 == null)
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(this.directory);
                UnknownBA     ba            = this.a(VLTOtherValue.VLTMAGIC) as UnknownBA;
                string        text          = ba.sa1[1];
                FileInfo[]    files         = directoryInfo.GetFiles(text);
                if (files.Length == 0)
                {
                    throw new Exception("Required file " + text + " was not found.");
                }
                A_1   = new FileStream(files[0].FullName, FileMode.Open, FileAccess.ReadWrite);
                array = new byte[A_1.Length];
                A_1.Read(array, 0, array.Length);
                A_1.Close();
            }
            else
            {
                array = new byte[A_1.Length];
                A_1.Read(array, 0, array.Length);
            }
            this.ms1 = new MemoryStream(array);
            a_       = new BinaryReader(this.ms1);
            this.ms1.Seek(0L, SeekOrigin.Begin);
            c = this.a(a_);
            c.e1.seekToDataStart(this.ms1);
            if (c.e1.ce1 == VLTOtherValue.BINMAGIC)
            {
                long num = this.ms1.Position + c.e1.dataSize();
                while (this.ms1.Position < num)
                {
                    string text2 = UnknownAP.a(a_);
                    if (text2 != "")
                    {
                        HashTracker.addHashFromVLTDB(text2);
                    }
                }
            }
            UnknownA8 a = this.a(VLTOtherValue.TABLE_END) as UnknownA8;

            a.a(this.ms1);
        }