示例#1
0
 public chkBoxData(string t, string n, Templates.SplitEntry split = null, Templates.SplitEntryMDL mdl = null)
 {
     type     = t;
     dispName = n;
     if (split != null)
     {
         splitEntry = split;
         dispName  += " (" + split.SourceFile + ")";
     }
     if (mdl != null)
     {
         mdlEntry  = mdl;
         dispName += " (" + mdl.ModelFile + ")";
     }
 }
示例#2
0
        private void splitFiles(Templates.SplitEntry splitData, SonicRetro.SAModel.SAEditorCommon.UI.ProgressDialog progress, string gameFolder, string iniFolder, string outputFolder)
        {
            string datafilename;

            switch (splitData.SourceFile)
            {
            case ("system/chrmodels.dll"):
                if (File.Exists(Path.Combine(gameFolder, "system/chrmodels_orig.dll")))
                {
                    datafilename = Path.Combine(gameFolder, "system/chrmodels_orig.dll");
                }
                else
                {
                    datafilename = Path.Combine(gameFolder, splitData.SourceFile);
                }
                break;

            case ("DLL"):
                if (File.Exists(Path.Combine(gameFolder, "resource/gd_PC/DLL/Win32/Data_DLL_orig.dll")))
                {
                    datafilename = Path.Combine(gameFolder, "resource/gd_PC/DLL/Win32/Data_DLL_orig.dll");
                }
                else
                {
                    datafilename = Path.Combine(gameFolder, "resource/gd_PC/DLL/Win32/Data_DLL.dll");
                }
                break;

            default:
                datafilename = Path.Combine(gameFolder, splitData.SourceFile);
                break;
            }
            string inifilename       = Path.Combine(iniFolder, (splitData.IniFile.ToLower() + ".ini"));
            string projectFolderName = (outputFolder + "\\");

            string splitItem;

            if (splitData.CmnName != null)
            {
                splitItem = splitData.CmnName;
            }
            else
            {
                splitItem = splitData.IniFile;
            }

            progress.StepProgress();
            progress.SetStep("Splitting " + splitItem + " from " + splitData.SourceFile);

            #region Validating Inputs
            if (!File.Exists(datafilename))
            {
                MessageBox.Show((datafilename + " is missing.\n\nPress OK to abort."), "Split Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                throw new Exception(SA_Tools.Split.SplitERRORVALUE.NoSourceFile.ToString());
                //return (int)ERRORVALUE.NoSourceFile;
            }

            if (!File.Exists(inifilename))
            {
                MessageBox.Show((inifilename + " is missing.\n\nPress OK to abort."), "Split Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                throw new Exception(SA_Tools.Split.SplitERRORVALUE.NoDataMapping.ToString());
                //return (int)ERRORVALUE.NoDataMapping;
            }
            #endregion

            // switch on file extension - if dll, use dll splitter
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(datafilename);
            string             ext      = fileInfo.Extension;

            switch (ext.ToLower())
            {
            case ".dll":
                SA_Tools.SplitDLL.SplitDLL.SplitDLLFile(datafilename, inifilename, projectFolderName);
                break;

            case ".nb":
                SA_Tools.Split.SplitNB.SplitNBFile(datafilename, false, projectFolderName, 0, inifilename);
                break;

            default:
                SA_Tools.Split.Split.SplitFile(datafilename, inifilename, projectFolderName);
                break;
            }
        }