Exemple #1
0
        public void Install()
        {
            _modList = _installBase.ModpackMods;

            // Install Mod Organizer
            var installPath = Path.Combine(_installBase.InstallDirectory, _installBase.ModpackHeader.Name);

            if (_installBase.ModpackHeader.InstallModOrganizer)
            {
                DebugWrite("[INSTALL] Installing Mod Organizer...");
                var modOrganizerObject = _modList.First(x => x.IsModOrganizer);

                _archiveContents.ExtractToDirectory(modOrganizerObject.FilePath, installPath);
                _modList.Remove(modOrganizerObject);

                var gamePath = _registryHandle.GetGamePath(_installBase.ModpackHeader.TargetGame ?? "Skyrim").Replace(@"\", @"\\");

                File.Create(Path.Combine(installPath, "ModOrganizer.ini")).Close();
                File.WriteAllText(Path.Combine(installPath, "ModOrganizer.ini"),
                                  "[General] \n" +
                                  $"gameName={_installBase.ModpackHeader.TargetGame ?? "Skyrim"} \n" +
                                  $"gamePath={gamePath} \n" +
                                  $"first_start=false"
                                  );

                Directory.CreateDirectory(Path.Combine(installPath), "mods");

                // Clear the registry if applicable
                _registryHandle.ClearMOCurrentInstance();
            }

            foreach (var mod in _modList)
            {
                InstallMod(mod);
            }

            // Write the needed profile information
            var profilePath = System.IO.Path.Combine(installPath, "profiles", _installBase.ModpackHeader.Name);

            if (Directory.Exists(profilePath))
            {
                _commonFilesystemUtility.DeleteDirectory(profilePath);
            }

            Directory.CreateDirectory(profilePath);

            File.WriteAllText(Path.Combine(profilePath, "plugins.txt"), _installBase.PluginsTxt);
            File.WriteAllText(Path.Combine(profilePath, "loadorder.txt"), _installBase.LoadorderTxt);
            File.WriteAllText(Path.Combine(profilePath, "modlist.txt"), _installBase.ModlistTxt);
            File.WriteAllText(Path.Combine(profilePath, "archives.txt"), _installBase.ArchivesTxt);

            DebugWrite("_END");
        }
Exemple #2
0
        public void Install()
        {
            // Install Mod Organizer
            var installPath = Path.Combine(_installBase.InstallDirectory, _installBase.ModpackHeader.Name);

            if (_installBase.ModpackHeader.InstallModOrganizer)
            {
                DebugWrite("[INSTALL] Installing Mod Organizer...");
                var modOrganizerObject = _installBase.ModpackMods.First(x => x.IsModOrganizer);

                _archiveContents.ExtractToDirectory(modOrganizerObject.FilePath, installPath);
                _installBase.ModpackMods.Remove(modOrganizerObject);

                File.Create(Path.Combine(installPath, "ModOrganizer.ini"));
            }

            DebugWrite("_CLEAR");


            foreach (var mod in _installBase.ModpackMods)
            {
                InstallMod(mod);

                DebugWrite("_CLEAR");
            }

            // Write the needed profile information
            var profilePath = System.IO.Path.Combine(installPath, "profiles", _installBase.ModpackHeader.Name);

            if (Directory.Exists(profilePath))
            {
                _commonFilesystemUtility.DeleteDirectory(profilePath);
            }

            Directory.CreateDirectory(profilePath);

            File.WriteAllText(Path.Combine(profilePath, "plugins.txt"), _installBase.PluginsTxt);
            File.WriteAllText(Path.Combine(profilePath, "loadorder.txt"), _installBase.LoadorderTxt);
            File.WriteAllText(Path.Combine(profilePath, "modlist.txt"), _installBase.ModlistTxt);
            File.WriteAllText(Path.Combine(profilePath, "archives.txt"), _installBase.ArchivesTxt);

            DebugWrite("[DONE] Operation completed.");
            DebugWrite("_END");
        }