static void ImportSettings(KitSettings settings)
 {
     if (!settings.ForcedGalacticAdventuresSporeAppPath.IsNullOrEmptyOrWhiteSpace())
     {
         Settings.ForcedGameExeType = settings.ForcedGalacticAdventuresSporeAppPath;
     }
     if (!settings.ForcedCoreSporeDataPath.IsNullOrEmptyOrWhiteSpace())
     {
         Settings.ForcedCoreSporeDataPath = settings.ForcedCoreSporeDataPath;
     }
     if (!settings.ForcedSporebinEP1Path.IsNullOrEmptyOrWhiteSpace())
     {
         Settings.ForcedGalacticAdventuresSporebinEP1Path = settings.ForcedSporebinEP1Path;
     }
     if (!settings.ForcedGalacticAdventuresDataPath.IsNullOrEmptyOrWhiteSpace())
     {
         Settings.ForcedGalacticAdventuresDataPath = settings.ForcedGalacticAdventuresDataPath;
     }
     if (settings.ExecutableType != GameInfo.GameExecutableType.None)
     {
         Settings.ForcedGameExeType = settings.ExecutableType.ToString();
     }
 }
        public static ImportResult Import(string kitPath)
        {
            Exception settingsReason = null;

            //ImportResult result = null;

            try
            {
                string configPath = Path.Combine(kitPath, "LauncherSettings.config");
                if (File.Exists(configPath))
                {
                    var kitSettings = new KitSettings();
                    kitSettings.Load(configPath);
                    ImportSettings(kitSettings);
                }
            }
            catch (Exception ex)
            {
                settingsReason = ex;
            }

            string modsPath = Path.Combine(kitPath, "InstalledMods.config");

            List <KitMod> skippedMods = new List <KitMod>();
            List <ImportFailureEventArgs> failedMods = new List <ImportFailureEventArgs>();
            bool hasRecord = File.Exists(modsPath);

            ModSkipped += (sneder, args) =>
            {
                if (sneder is KitMod skipped)
                {
                    skippedMods.Add(skipped);
                }
            };
            KitInstalledMods.ModImportFailed += (sneder, args) =>
            {
                if (sneder is ImportFailureEventArgs failure)
                {
                    failedMods.Add(failure);
                }
            };

            if (hasRecord)
            {
                var kitMods = new KitInstalledMods(modsPath);
                foreach (ImportFailureEventArgs fail in ImportMods(kitPath, kitMods))
                {
                    failedMods.Add(fail);
                }
            }

            //purge Launcher Kit shortcuts
            try
            {
                string[] desktopShortcutPaths = Directory.EnumerateFiles(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)).ToArray();
                foreach (string s in desktopShortcutPaths)
                {
                    YeetShortcutIfLauncherKit(s);
                }

                string   startMenuShortcutFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "Spore ModAPI Launcher Kit");
                string[] startMenuShortcutPaths  = Directory.EnumerateFiles(startMenuShortcutFolder).ToArray();
                foreach (string s in startMenuShortcutPaths)
                {
                    YeetShortcutIfLauncherKit(s);
                }
                if ((Directory.EnumerateFiles(startMenuShortcutFolder).Count() == 0) && (Directory.EnumerateDirectories(startMenuShortcutFolder).Count() == 0))
                {
                    Directory.Delete(startMenuShortcutFolder);
                }
            }
            catch { }

            //purge Launcher Kit locator path
            try
            {
                string locatorFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Spore ModAPI Launcher");
                if (Directory.Exists(locatorFolderPath))
                {
                    Directory.Move(locatorFolderPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ModAPILauncherSMMBKP"));
                }
            }
            catch { }

            return(new ImportResult(skippedMods, failedMods, hasRecord, settingsReason));
        }