示例#1
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(); });
        }