コード例 #1
0
        public VortexCompiler(Game game, AbsolutePath gamePath, AbsolutePath vortexFolder, AbsolutePath downloadsFolder, AbsolutePath stagingFolder, AbsolutePath outputFile)
        {
            Game = game;

            GamePath          = gamePath;
            GameName          = game.MetaData().NexusName;
            VortexFolder      = vortexFolder;
            DownloadsFolder   = downloadsFolder;
            StagingFolder     = stagingFolder;
            ModListOutputFile = outputFile;

            if (string.IsNullOrEmpty(ModListName))
            {
                ModListName       = $"Vortex ModList for {Game.ToString()}";
                ModListOutputFile = ((RelativePath)ModListName).RelativeToEntryPoint().WithExtension(Consts.ModListExtension);
            }

            GameName = Game.MetaData().NexusName;

            ActiveArchives = new List <string>();

            // there can be max one game after filtering

            /*
             * StoreHandler.Instance.StoreGames.Where(g => g.Game == game && g.Type == StoreType.STEAM).Do(g =>
             * {
             *  _isSteamGame = true;
             *  _steamGame = (SteamGame)g;
             *  _hasSteamWorkshopItems = _steamGame.WorkshopItems.Count > 0;
             * });
             */
        }
コード例 #2
0
        public VortexCompiler(Game game, string gamePath, string vortexFolder, string downloadsFolder, string stagingFolder, string outputFile)
        {
            Game = game;

            GamePath          = gamePath;
            GameName          = game.MetaData().NexusName;
            VortexFolder      = vortexFolder;
            DownloadsFolder   = downloadsFolder;
            StagingFolder     = stagingFolder;
            ModListOutputFile = outputFile;

            if (string.IsNullOrEmpty(ModListName))
            {
                ModListName       = $"Vortex ModList for {Game.ToString()}";
                ModListOutputFile = $"{ModListName}{Consts.ModListExtension}";
            }

            GameName = Game.MetaData().NexusName;

            ActiveArchives = new List <string>();

            // there can be max one game after filtering
            StoreHandler.Instance.StoreGames.Where(g => g.Game == game && g.Type == StoreType.STEAM).Do(g =>
            {
                _isSteamGame           = true;
                _steamGame             = (SteamGame)g;
                _hasSteamWorkshopItems = _steamGame.WorkshopItems.Count > 0;
            });
        }
コード例 #3
0
        public static string RetrieveStagingLocation(Game game, string vortexFolderPath = null)
        {
            vortexFolderPath = vortexFolderPath ?? TypicalVortexFolder();
            var gameName = game.MetaData().NexusName;

            return(Path.Combine(vortexFolderPath, gameName, Consts.MO2ModFolderName));
        }
コード例 #4
0
        public static async Task <BethesdaNetData?> Login(Game game)
        {
            var metadata = game.MetaData();

            if (metadata.MainExecutable == null)
            {
                throw new NotImplementedException();
            }
            var gamePath = metadata.GameLocation().Combine(metadata.MainExecutable);
            var info     = new ProcessStartInfo
            {
                FileName               = @"Downloaders\BethesdaNet\bethnetlogin.exe",
                Arguments              = $"\"{gamePath}\" {metadata.MainExecutable}",
                RedirectStandardError  = true,
                RedirectStandardInput  = true,
                RedirectStandardOutput = true,
                UseShellExecute        = false,
                CreateNoWindow         = true
            };
            var process = Process.Start(info);

            ChildProcessTracker.AddProcess(process);
            string last_line = "";

            while (true)
            {
                var line = await process.StandardOutput.ReadLineAsync();

                if (line == null)
                {
                    break;
                }
                last_line = line;
            }

            try
            {
                var result = last_line.FromJsonString <BethesdaNetData>();
                await result.ToEcryptedJson(DataName);

                return(result);
            }
            catch (Exception ex)
            {
                Utils.Error(ex, "Could not save Bethesda.NET login info");
                return(null);
            }
        }
コード例 #5
0
        private void ParseDeploymentFile()
        {
            Info("Searching for vortex.deployment.json...");

            var deploymentFile = "";

            Directory.EnumerateFiles(GamePath, "vortex.deployment.json", SearchOption.AllDirectories)
            .Where(File.Exists)
            .Do(f => deploymentFile = f);
            var currentGame = Game.MetaData();

            if (currentGame.AdditionalFolders != null && currentGame.AdditionalFolders.Count != 0)
            {
                currentGame.AdditionalFolders.Do(f => Directory.EnumerateFiles(f, "vortex.deployment.json", SearchOption.AllDirectories)
                                                 .Where(File.Exists)
                                                 .Do(d => deploymentFile = d));
            }

            if (string.IsNullOrEmpty(deploymentFile))
            {
                Error("vortex.deployment.json not found!");
                return;
            }
            Info($"vortex.deployment.json found at {deploymentFile}");

            Info("Parsing vortex.deployment.json...");
            try
            {
                VortexDeployment = deploymentFile.FromJSON <VortexDeployment>();
            }
            catch (JsonSerializationException e)
            {
                Utils.Error(e, "Failed to parse vortex.deployment.json!");
            }

            VortexDeployment.files.Do(f =>
            {
                var archive = f.source;
                if (ActiveArchives.Contains(archive))
                {
                    return;
                }

                Utils.Log($"Adding archive {archive} to ActiveArchives");
                ActiveArchives.Add(archive);
            });
        }
コード例 #6
0
        private void AddExternalFolder(ref List <string> roots)
        {
            var currentGame = Game.MetaData();

            if (currentGame.AdditionalFolders == null || currentGame.AdditionalFolders.Count == 0)
            {
                return;
            }
            foreach (var path in currentGame.AdditionalFolders.Select(f => f.Replace("%documents%", KnownFolders.Documents.Path)))
            {
                if (!Directory.Exists(path))
                {
                    return;
                }
                roots.Add(path);
            }
        }
コード例 #7
0
 public override string[] GetMetaIni()
 {
     return(new[] { "[General]", $"gameName={Game.MetaData().MO2ArchiveName}", $"modID={ModID}", $"fileID={FileID}" });
 }
コード例 #8
0
 public override string GetManifestURL(Archive a)
 {
     return($"http://nexusmods.com/{Game.MetaData().NexusName}/mods/{ModID}");
 }
コード例 #9
0
 public static bool IsActiveVortexGame(Game g)
 {
     return(g.MetaData().SupportedModManager == ModManager.Vortex && !GameRegistry.Games[g].Disabled);
 }
コード例 #10
0
 public static string RetrieveDownloadLocation(Game game, string vortexFolderPath = null)
 {
     vortexFolderPath = vortexFolderPath ?? TypicalVortexFolder();
     return(Path.Combine(vortexFolderPath, "downloads", game.MetaData().NexusName));
 }
コード例 #11
0
 public override string GetManifestURL(Archive a)
 {
     return($"https://www.nexusmods.com/{Game.MetaData().NexusName}/mods/{ModID}/?tab=files&file_id={FileID}");
 }