Пример #1
0
        public static NMSTemplate LoadNMSFileOLD(string filepath)
        {
            int         load_mode = 0;
            NMSTemplate template;

            string exmlpath = Path.ChangeExtension(filepath, "exml");

            exmlpath = exmlpath.ToUpper(); //Make upper case

            if (File.Exists(exmlpath))
            {
                load_mode = 0;
            }
            else
            {
                load_mode = 1;
            }


            //Load Exml
            try
            {
                if (load_mode == 0)
                {
                    string xml = File.ReadAllText(exmlpath);
                    template = EXmlFile.ReadTemplateFromString(xml);
                }
                else
                {
                    if (!File.Exists(filepath))
                    {
                        throw new FileNotFoundException("File not found\n " + filepath);
                    }
                    libMBIN.MBINFile mbinf = new libMBIN.MBINFile(filepath);
                    mbinf.Load();
                    template = mbinf.GetData();
                    mbinf.Dispose();
                }
            } catch (Exception ex)
            {
                if (ex is System.IO.DirectoryNotFoundException || ex is System.IO.FileNotFoundException)
                {
                    Util.showError("File " + filepath + " Not Found...", "Error");
                }
                else if (ex is System.Reflection.TargetInvocationException)
                {
                    Util.showError("libMBIN failed to decompile the file. Try to update the libMBIN.dll (File->updateLibMBIN). If the issue persists contact the developer", "Error");
                }
                return(null);
            }

            return(template);
        }
Пример #2
0
        public void OpenGEOMDATAFilewithlibMBIN()
        {
            string filepath = "E:\\SteamLibrary1\\steamapps\\common\\No Man's Sky\\GAMEDATA\\MODELS\\COMMON\\CHARACTERS\\ASTRONAUT\\ASTRONAUT01.GEOMETRY.MBIN.PC";

            //string filepath = "E:\\SteamLibrary1\\steamapps\\common\\No Man's Sky\\GAMEDATA\\MODELS\\COMMON\\CHARACTERS\\ASTRONAUT\\ASTRONAUT01.SCENE.EXML";

            //Try to read EXML
            //TkSceneNodeData t = (TkSceneNodeData)libMBIN.EXmlFile.ReadTemplate(filepath);
            //Console.WriteLine("All Good Loading", t.Name);

            try {
                libMBIN.MBINFile mbinf = new libMBIN.MBINFile(filepath);
                mbinf.Load();
                NMSTemplate template = mbinf.GetData();
                mbinf.Dispose();
                Console.WriteLine("All Good Loading");
            } catch (Exception ex)
            {
                Console.WriteLine("Something Went Wrong");
                Assert.Fail();
            }
        }
Пример #3
0
        // =====================
        // = Main Program Loop =
        // =====================

        public TreeView ParseMbin(string mbinPath)
        {
            // going to use the type from the Tuple created in loadMbin
            NMSTemplate template = null;

            using (libMBIN.MBINFile mbin = new libMBIN.MBINFile(mbinPath))
            {
                mbin.Load();               // load the header information from the file
                template = mbin.GetData(); // populate the data struct.
            }

            if (template != null)
            {
                TreeViewItem root = new TreeViewItem();
                mainTree.Items.Add(root);
                IterateFields(template, template.GetType(), root);
                return(mainTree);
            }
            else
            {
                MessageBox.Show($"Unable to load file!\n{mbinPath}", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
        }