private void DrawCreateTab()
        {
            c_RootPath       = PathField(rootPathGUI, c_RootPath, true);
            c_PrevRoot       = PathField(prevRootGUI, c_PrevRoot, true);
            c_PrevOutputPath = PathField(prevOutputPathGUI, c_PrevOutputPath, true);
            c_OutputPath     = PathField(outputPathGUI, c_OutputPath, true);

            c_Name    = EditorGUILayout.TextField("Project name: ", c_Name);
            c_Version = EditorGUILayout.TextField("Project version: ", c_Version);

            c_CreateRepair    = EditorGUILayout.Toggle("Create repair patch: ", c_CreateRepair);
            c_CreateInstaller = EditorGUILayout.Toggle("Create installer patch: ", c_CreateInstaller);

            GUI.enabled = false;
            EditorGUILayout.Toggle(createIncrementalGUI, !string.IsNullOrEmpty(c_PrevRoot));

            if (!string.IsNullOrEmpty(c_PrevOutputPath))
            {
                GUI.enabled = true;
            }

            c_SkipUnchangedPatchFiles = EditorGUILayout.Toggle(skipUnchangedPatchFilesGUI, c_SkipUnchangedPatchFiles);
            GUI.enabled = true;

            c_RepairComp      = (CompressionFormat)EditorGUILayout.EnumPopup("Repair patch compression: ", c_RepairComp);
            c_IncrementalComp = (CompressionFormat)EditorGUILayout.EnumPopup("Incremental patch compression: ", c_IncrementalComp);
            c_InstallerComp   = (CompressionFormat)EditorGUILayout.EnumPopup("Installer patch compression: ", c_InstallerComp);

            GUILayout.Label("Ignored paths (one path per line): ");
            c_IgnoredPaths = EditorGUILayout.TextArea(c_IgnoredPaths);

            GUILayout.Space(10f);

            if (GUILayout.Button("Create Patch", GUILayout.Height(35f)))
            {
                c_RootPath       = c_RootPath.Trim();
                c_PrevRoot       = c_PrevRoot.Trim();
                c_PrevOutputPath = c_PrevOutputPath.Trim();
                c_OutputPath     = c_OutputPath.Trim();
                c_IgnoredPaths   = c_IgnoredPaths.Trim();
                c_Name           = c_Name.Trim();
                c_Version        = c_Version.Trim();

                if (c_RootPath.Length == 0 || c_OutputPath.Length == 0 || c_Name.Length == 0 || c_Version.Length == 0)
                {
                    return;
                }

                patchCreator = new PatchCreator(c_RootPath, c_OutputPath, c_Name, c_Version);
                patchCreator.CreateIncrementalPatch(c_PrevRoot.Length > 0, c_PrevRoot).CreateRepairPatch(c_CreateRepair).CreateInstallerPatch(c_CreateInstaller).
                SetCompressionFormat(c_RepairComp, c_InstallerComp, c_IncrementalComp).SetPreviousPatchFilesRoot(c_PrevOutputPath, c_SkipUnchangedPatchFiles);

                if (c_IgnoredPaths.Length > 0)
                {
                    patchCreator.AddIgnoredPaths(c_IgnoredPaths.Replace("\r", "").Split('\n'));
                }

                if (!EditorUtility.DisplayDialog("Self Patcher Executable", "If this is a self patching app (i.e. this app will update itself), you'll first need to generate a self patcher executable. See README for more info.", "Got it!", "Oh, I forgot it!"))
                {
                    return;
                }

                if (patchCreator.Run())
                {
                    Debug.Log("<b>Patch creator started</b>");

                    EditorApplication.update -= OnUpdate;
                    EditorApplication.update += OnUpdate;
                }
                else
                {
                    Debug.LogWarning("<b>Couldn't start patch creator. Maybe it is already running?</b>");
                }
            }

            if (GUILayout.Button("Generate Console Command", GUILayout.Height(25f)))
            {
                string command = string.Format("Patcher create -root=\"{0}\" -out=\"{1}\" -name=\"{2}\" -version=\"{3}\" -compressionRepair=\"{4}\" -compressionIncremental=\"{5}\" -compressionInstaller=\"{6}\"", c_RootPath, c_OutputPath, c_Name, c_Version, c_RepairComp, c_IncrementalComp, c_InstallerComp);
                if (c_PrevRoot.Length > 0)
                {
                    command += string.Concat(" -prevRoot=\"", c_PrevRoot, "\"");
                }
                if (c_PrevOutputPath.Length > 0)
                {
                    command += string.Concat(" -prevPatchRoot=\"", c_PrevOutputPath, "\"");
                }
                if (c_IgnoredPaths.Length > 0)
                {
                    command += string.Concat(" -ignoredPaths=\"", CONSOLE_COMMAND_IGNORED_PATHS_HOLDER, "\"");
                }
                if (!c_CreateRepair)
                {
                    command += " -dontCreateRepairPatch";
                }
                if (!c_CreateInstaller)
                {
                    command += " -dontCreateInstallerPatch";
                }
                if (c_SkipUnchangedPatchFiles)
                {
                    command += " -skipUnchangedPatchFiles";
                }

                Debug.Log(command);

                if (c_IgnoredPaths.Length > 0)
                {
                    Debug.Log(string.Concat("You have to insert the following ignored path(s) to \"", CONSOLE_COMMAND_IGNORED_PATHS_HOLDER, "\":\n", c_IgnoredPaths));
                }
            }

            if (GUILayout.Button("Help", GUILayout.Height(25f)))
            {
                Application.OpenURL("https://github.com/yasirkula/SimplePatchTool/wiki/Legacy:-Generating-Patch#via-unity-plugin");
            }
        }
        private void DrawCreateTab()
        {
            c_RootPath     = PathField("Root path: ", c_RootPath, true);
            c_PrevRoot     = PathField("Previous version path: ", c_PrevRoot, true);
            c_OutputPath   = PathField("Output path: ", c_OutputPath, true);
            c_IgnoredFiles = PathField("Ignored files holder: ", c_IgnoredFiles, false);

            c_Name    = EditorGUILayout.TextField("Project name: ", c_Name);
            c_Version = EditorGUILayout.TextField("Project version: ", c_Version);

            c_CreateRepair    = EditorGUILayout.Toggle("Create repair patch: ", c_CreateRepair);
            c_IgnoreOutputLog = EditorGUILayout.Toggle("Ignore output_log.txt: ", c_IgnoreOutputLog);

            GUILayout.Space(10f);

            if (GUILayout.Button("Create Patch", GUILayout.Height(35f)))
            {
                c_RootPath     = c_RootPath.Trim();
                c_PrevRoot     = c_PrevRoot.Trim();
                c_OutputPath   = c_OutputPath.Trim();
                c_IgnoredFiles = c_IgnoredFiles.Trim();
                c_Name         = c_Name.Trim();
                c_Version      = c_Version.Trim();

                if (string.IsNullOrEmpty(c_RootPath) || string.IsNullOrEmpty(c_OutputPath) || string.IsNullOrEmpty(c_Name) || string.IsNullOrEmpty(c_Version))
                {
                    return;
                }

                patchCreator = new PatchCreator(c_RootPath, c_OutputPath, c_Name, c_Version);
                patchCreator.CreateIncrementalPatch(c_PrevRoot.Length > 0, c_PrevRoot).CreateRepairPatch(c_CreateRepair);
                if (c_IgnoredFiles.Length > 0)
                {
                    patchCreator.LoadIgnoredPathsFromFile(c_IgnoredFiles);
                }
                if (c_IgnoreOutputLog)
                {
                    patchCreator.AddIgnoredPath("*output_log.txt");
                }

                if (patchCreator.Run())
                {
                    Debug.Log("<b>Patch creator started</b>");

                    EditorApplication.update -= OnUpdate;
                    EditorApplication.update += OnUpdate;
                }
                else
                {
                    Debug.LogWarning("<b>Couldn't start patch creator. Maybe it is already running?</b>");
                }
            }

            if (GUILayout.Button("Generate Console Command", GUILayout.Height(25f)))
            {
                string command = string.Format("Patcher create -root=\"{0}\" -out=\"{1}\" -name=\"{2}\" -version=\"{3}\"", c_RootPath, c_OutputPath, c_Name, c_Version);
                if (c_PrevRoot.Length > 0)
                {
                    command += string.Concat(" -prevRoot=\"", c_PrevRoot, "\"");
                }
                if (c_IgnoredFiles.Length > 0)
                {
                    command += string.Concat(" -ignoredPaths=\"", c_IgnoredFiles, "\"");
                }
                if (!c_CreateRepair)
                {
                    command += " -dontCreateRepairPatch";
                }

                Debug.Log(command);

                if (c_IgnoreOutputLog)
                {
                    if (c_IgnoredFiles.Length > 0)
                    {
                        Debug.Log(string.Concat("You have to add *output_log.txt to ", c_IgnoredFiles, " manually"));
                    }
                    else
                    {
                        Debug.Log("To ignore output_log.txt, you have to provide an Ignored files holder and add *output_log.txt to it manually");
                    }
                }
            }
        }
Exemple #3
0
        private void DrawCreateTab()
        {
            c_RootPath   = PathField("Root path: ", c_RootPath, true);
            c_PrevRoot   = PathField("Previous version path: ", c_PrevRoot, true);
            c_OutputPath = PathField("Output path: ", c_OutputPath, true);

            c_Name    = EditorGUILayout.TextField("Project name: ", c_Name);
            c_Version = EditorGUILayout.TextField("Project version: ", c_Version);

            c_CreateRepair = EditorGUILayout.Toggle("Create repair patch: ", c_CreateRepair);

            GUILayout.Label("Ignored paths (one path per line): ");
            c_IgnoredPaths = EditorGUILayout.TextArea(c_IgnoredPaths);

            GUILayout.Space(10f);

            if (GUILayout.Button("Create Patch", GUILayout.Height(35f)))
            {
                c_RootPath     = c_RootPath.Trim();
                c_PrevRoot     = c_PrevRoot.Trim();
                c_OutputPath   = c_OutputPath.Trim();
                c_IgnoredPaths = c_IgnoredPaths.Trim();
                c_Name         = c_Name.Trim();
                c_Version      = c_Version.Trim();

                if (c_RootPath.Length == 0 || c_OutputPath.Length == 0 || c_Name.Length == 0 || c_Version.Length == 0)
                {
                    return;
                }

                patchCreator = new PatchCreator(c_RootPath, c_OutputPath, c_Name, c_Version);
                patchCreator.CreateIncrementalPatch(c_PrevRoot.Length > 0, c_PrevRoot).CreateRepairPatch(c_CreateRepair);

                if (c_IgnoredPaths.Length > 0)
                {
                    patchCreator.AddIgnoredPaths(c_IgnoredPaths.Replace("\r", "").Split('\n'));
                }

                if (patchCreator.Run())
                {
                    Debug.Log("<b>Patch creator started</b>");

                    EditorApplication.update -= OnUpdate;
                    EditorApplication.update += OnUpdate;
                }
                else
                {
                    Debug.LogWarning("<b>Couldn't start patch creator. Maybe it is already running?</b>");
                }
            }

            if (GUILayout.Button("Generate Console Command", GUILayout.Height(25f)))
            {
                string command = string.Format("Patcher create -root=\"{0}\" -out=\"{1}\" -name=\"{2}\" -version=\"{3}\"", c_RootPath, c_OutputPath, c_Name, c_Version);
                if (c_PrevRoot.Length > 0)
                {
                    command += string.Concat(" -prevRoot=\"", c_PrevRoot, "\"");
                }
                if (c_IgnoredPaths.Length > 0)
                {
                    command += string.Concat(" -ignoredPaths=\"", CONSOLE_COMMAND_IGNORED_PATHS_HOLDER, "\"");
                }
                if (!c_CreateRepair)
                {
                    command += " -dontCreateRepairPatch";
                }

                Debug.Log(command);

                if (c_IgnoredPaths.Length > 0)
                {
                    Debug.Log(string.Concat("You have to insert the following ignored path(s) to \"", CONSOLE_COMMAND_IGNORED_PATHS_HOLDER, "\":\n", c_IgnoredPaths));
                }
            }
        }