Ejemplo n.º 1
0
        private void ReadImports(BinaryReader reader, GpkPackage package)
        {
            logger.Debug("Reading Imports at {0}....", package.Header.ImportOffset);
            reader.BaseStream.Seek(package.Header.ImportOffset, SeekOrigin.Begin);

            for (int i = 0; i < package.Header.ImportCount; i++)
            {
                GpkImport import = new GpkImport();
                long      package_class_index = reader.ReadInt64();
                long      class_index         = reader.ReadInt64();

                import.PackageRef = reader.ReadInt32();
                long object_index = reader.ReadInt32();
                import.Unk = reader.ReadInt32();

                import.ClassPackage = package.GetString(package_class_index);
                import.ClassName    = package.GetString(class_index);
                import.ObjectName   = package.GetString(object_index);

                import.UID = GenerateUID(package, import);
                package.ImportList.Add(i, import);

                logger.Debug("Import {0}: ClassPackage {1} Class: {2} Object: {3}", i, import.ClassPackage, import.ClassName, import.ObjectName);
                stat.progress++;
            }
        }
Ejemplo n.º 2
0
        private void treeMain_AfterSelect(object sender, TreeViewEventArgs e)
        {
            ResetGUI();

            if (e.Node.Level == 0)
            {
                boxGeneralButtons.Enabled = true;
                boxDataButtons.Enabled    = true;

                selectedPackage = loadedGpkPackages[Convert.ToInt32(e.Node.Name)];
                boxInfo.Text    = selectedPackage.ToString();
            }
            else if (e.Node.Level == 1 && Settings.Default.ViewMode == "class")
            {
                selectedPackage = loadedGpkPackages[Convert.ToInt32(e.Node.Parent.Name)];
                selectedClass   = e.Node.Text;

                boxDataButtons.Enabled = true;
            }
            else if (e.Node.Level == 2)
            {
                GpkPackage package  = loadedGpkPackages[Convert.ToInt32(e.Node.Parent.Parent.Name)];
                Object     selected = package.GetObjectByUID(e.Node.Name);

                if (selected is GpkImport)
                {
                    GpkImport imp = (GpkImport)selected;
                    boxInfo.Text = imp.ToString();
                }
                else if (selected is GpkExport)
                {
                    GpkExport exp = (GpkExport)selected;
                    boxInfo.Text = exp.ToString();


                    boxGeneralButtons.Enabled  = true;
                    boxDataButtons.Enabled     = true;
                    boxPropertyButtons.Enabled = true;
                    selectedExport             = exp;
                    selectedPackage            = package;

                    DrawGrid(package, exp);
                }
            }
        }
Ejemplo n.º 3
0
        public static string GenerateUID(GpkPackage package, GpkImport import)
        {
            string proposedName = import.ClassPackage + "." + import.ObjectName;

            int counter = 0;

            do
            {
                string tmpName = proposedName;
                if (counter > 0)
                {
                    tmpName += ("_" + counter);
                }

                if (package.UidList.ContainsKey(tmpName) == false)
                {
                    package.UidList.Add(tmpName, "");
                    return(tmpName);
                }

                counter++;
            } while (true);
        }