Ejemplo n.º 1
0
        /// <summary>
        /// Generates the patch mod descriptor.
        /// </summary>
        /// <param name="allMods">All mods.</param>
        /// <param name="game">The game.</param>
        /// <param name="patchName">Name of the patch.</param>
        /// <returns>IMod.</returns>
        protected virtual IMod GeneratePatchModDescriptor(IEnumerable <IMod> allMods, IGame game, string patchName)
        {
            var mod = DIResolver.Get <IMod>();

            mod.DescriptorFile = $"{Shared.Constants.ModDirectory}/{patchName}{Shared.Constants.ModExtension}";
            mod.FileName       = GetPatchModDirectory(game, patchName).Replace("\\", "/");
            mod.Name           = patchName;
            mod.Source         = ModSource.Local;
            var version = GameService.GetVersion(game);

            if (!string.IsNullOrWhiteSpace(version))
            {
                mod.Version = version;
            }
            else
            {
                mod.Version = allMods.OrderByDescending(p => p.VersionData).FirstOrDefault() != null?allMods.OrderByDescending(p => p.VersionData).FirstOrDefault().Version : string.Empty;
            }
            mod.Tags = new List <string>()
            {
                "Fixes"
            };
            mod.IsValid  = true;
            mod.FullPath = mod.FileName.StandardizeDirectorySeparator();
            return(mod);
        }