Ejemplo n.º 1
0
        /// <summary>
        /// command-line install.
        /// </summary>
        internal void ProcessInstallMod(List <string> installPaths, bool skipConflictChecks, bool skipCleanup)
        {
            List <string> InstallFileList = new List <string>();

            foreach (string installModPath in installPaths)
            {
                if (File.Exists(installModPath) && installModPath.Contains(".mgsv"))
                {
                    InstallFileList.Add(installModPath);
                }
                else
                {
                    if (Directory.Exists(installModPath))
                    {
                        var folderFiles = Directory.GetFiles(installModPath, "*.mgsv");
                        foreach (string mgsv in folderFiles)
                        {
                            InstallFileList.Add(mgsv);
                        }
                        if (InstallFileList.Count == 0)
                        {
                            Debug.LogLine($"[Install] Could not find any .mgsv files in {installModPath}.", Debug.LogLevel.Basic);
                        }
                        InstallFileList.Sort();
                    }
                    else
                    {
                        Debug.LogLine($"[Install] Could not find file or directory {installModPath}.", Debug.LogLevel.Basic);
                    }
                }
            }
            if (InstallFileList.Count == 0)
            {
                Debug.LogLine($"[Install] Could not find any .mgsv files in installPaths.", Debug.LogLevel.Basic);
                return;
            }
            if (!skipConflictChecks)
            {
                foreach (string modPath in InstallFileList)
                {
                    if (!PreinstallManager.CheckConflicts(modPath))
                    {
                        return;
                    }
                }
            }
            string displayPath = InstallFileList[0];

            if (InstallFileList.Count > 1)
            {
                displayPath = $"{displayPath} and {InstallFileList.Count} mods";
            }
            ProgressWindow.Show("Installing Mod", $"Installing {displayPath}...",
                                new Action((MethodInvoker) delegate { InstallManager.InstallMods(InstallFileList, skipCleanup); }
                                           ), log);
            this.Invoke((MethodInvoker) delegate { RefreshInstalledMods(); });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// command-line install.
        /// </summary>
        internal void ProcessInstallMod(string installModPath, bool skipConflictChecks, bool skipCleanup)
        {
            List <string> InstallFileList = null;

            if (File.Exists(installModPath) && installModPath.Contains(".mgsv"))
            {
                InstallFileList = new List <string> {
                    installModPath
                };
            }
            else
            {
                if (Directory.Exists(installModPath))
                {
                    InstallFileList = Directory.GetFiles(installModPath, "*.mgsv").ToList();
                    if (InstallFileList.Count == 0)
                    {
                        Debug.LogLine($"[Install] Could not find any .mgsv files in {installModPath}.", Debug.LogLevel.Basic);
                        return;
                    }
                }
                else
                {
                    Debug.LogLine($"[Install] Could not find file or directory {installModPath}.", Debug.LogLevel.Basic);
                    return;
                }
            }
            if (InstallFileList == null)
            {
                return;
            }
            if (!skipConflictChecks)
            {
                foreach (string modPath in InstallFileList)
                {
                    if (!PreinstallManager.CheckConflicts(modPath))
                    {
                        return;
                    }
                }
            }
            ProgressWindow.Show("Installing Mod", $"Installing {installModPath}...",
                                new Action((MethodInvoker) delegate { InstallManager.InstallMods(InstallFileList, skipCleanup); }
                                           ), log);
            this.Invoke((MethodInvoker) delegate { RefreshInstalledMods(); });
        }
Ejemplo n.º 3
0
        internal void ProcessInstallMod(string installFile, bool skipCleanup)// command-line install.
        {
            var metaData = Tools.ReadMetaData(installFile);

            if (metaData == null)
            {
                return;
            }
            List <string> InstallFileList = new List <string>();

            InstallFileList.Add(installFile);

            if (!PreinstallManager.CheckConflicts(installFile))
            {
                return;
            }

            ProgressWindow.Show("Installing Mod", String.Format("Installing {0}...", metaData.Name), new Action((MethodInvoker) delegate { ModManager.InstallMod(InstallFileList, skipCleanup); }));

            this.Invoke((MethodInvoker) delegate { RefreshInstalledMods(); });
        }