Beispiel #1
0
        public DeconstructBSAs(ACompiler compiler) : base(compiler)
        {
            _mo2Compiler     = (MO2Compiler)compiler;
            _includeDirectly = _mo2Compiler.ModInis.Where(kv =>
            {
                var general = kv.Value.General;
                if (general.notes != null && (general.notes.Contains(Consts.WABBAJACK_INCLUDE) || general.notes.Contains(Consts.WABBAJACK_NOMATCH_INCLUDE)))
                {
                    return(true);
                }
                if (general.comments != null && (general.comments.Contains(Consts.WABBAJACK_INCLUDE) || general.comments.Contains(Consts.WABBAJACK_NOMATCH_INCLUDE)))
                {
                    return(true);
                }
                return(false);
            })
                               .Select(kv => kv.Key.RelativeTo(_mo2Compiler.SourcePath))
                               .ToList();

            _microstack = bsa => new List <ICompilationStep>
            {
                new DirectMatch(_mo2Compiler),
                new IncludePatches(_mo2Compiler, bsa),
                new DropAll(_mo2Compiler)
            };

            _microstackWithInclude = bsa => new List <ICompilationStep>
            {
                new DirectMatch(_mo2Compiler),
                new IncludePatches(_mo2Compiler, bsa),
                new IncludeAll(_mo2Compiler)
            };
        }
Beispiel #2
0
 public IncludePatches(ACompiler compiler) : base(compiler)
 {
     _indexed = _compiler.IndexedFiles.Values
                .SelectMany(f => f)
                .GroupBy(f => Path.GetFileName(f.Name).ToLower())
                .ToDictionary(f => f.Key);
 }
Beispiel #3
0
 public MatchSimilarTextures(ACompiler compiler) : base(compiler)
 {
     _byName = _compiler.IndexedFiles.SelectMany(kv => kv.Value)
               .Where(f => f.Name.FileName.Extension == DDS)
               .Where(f => f.ImageState != null)
               .ToLookup(f => f.Name.FileName.FileNameWithoutExtension);
 }
        public IgnoreTaggedFiles(ACompiler compiler, string tag) : base(compiler)
        {
            _aCompiler = (ACompiler)compiler;
            _sourcePath = _aCompiler.SourcePath;
            _tag = tag;
            string rootDirectory = (string)_sourcePath;

            _reason = $"Ignored because folder/file was tagged with {_tag}";

            _tagFiles = Directory.EnumerateFiles(rootDirectory, _tag, SearchOption.AllDirectories)
                .Select(str => (AbsolutePath)str)
                .ToList();

            foreach (var tagFile in _tagFiles)
            {
                _ignoreList.Add(tagFile);
                string[] taggedFiles = File.ReadAllLines((String)tagFile);
                foreach (var taggedFile in taggedFiles)
                {
                    _ignoreList.Add((AbsolutePath)(tagFile.ToString()
                        .Replace(_tag,taggedFile)));
                }
            }

        }
 public IgnoreWabbajackInstallCruft(ACompiler compiler) : base(compiler)
 {
     _cruftFiles = new HashSet <string>
     {
         "7z.dll", "7z.exe", "vfs_staged_files\\", "nexus.key_cache", "patch_cache\\"
     };
 }
Beispiel #6
0
        public IncludeSteamWorkshopItems(ACompiler compiler) : base(compiler)
        {
            var mo2Compiler = (MO2Compiler)compiler;

            _isGenericGame = mo2Compiler.CompilingGame.IsGenericMO2Plugin;
            _game          = (SteamGame)StoreHandler.Instance.SteamHandler.Games.FirstOrDefault(x =>
                                                                                                mo2Compiler.CompilingGame.SteamIDs !.Contains(x.ID));
        }
        public IgnoreOtherProfiles(ACompiler compiler) : base(compiler)
        {
            _mo2Compiler = (MO2Compiler)compiler;

            _profiles = _mo2Compiler.SelectedProfiles
                        .Select(p => Path.Combine("profiles", p) + "\\")
                        .ToList();
        }
        public IgnoreOtherProfiles(ACompiler compiler) : base(compiler)
        {
            _mo2Compiler       = (MO2Compiler)compiler;
            _modProfilesFolder = _mo2Compiler.MO2Folder.Combine("profiles");

            _profiles = _mo2Compiler.SelectedProfiles
                        .Select(p => _modProfilesFolder.Combine(p))
                        .ToList();
        }
Beispiel #9
0
        public IncludeTaggedFolders(ACompiler compiler, string tag) : base(compiler)
        {
            _aCompiler  = (ACompiler)compiler;
            _sourcePath = _aCompiler.SourcePath;
            _tag        = tag;
            string rootDirectory = (string)_sourcePath;

            _includeDirectly = Directory.EnumerateFiles(rootDirectory, _tag, SearchOption.AllDirectories).Select(str => (AbsolutePath)str.Replace(_tag, ""));
        }
Beispiel #10
0
        public static int GetFilePriority(ACompiler compiler, VirtualFile file)
        {
            var archive = file.TopParent;
            var adata   = compiler.ArchivesByFullPath[archive.AbsoluteName];

            if (adata.State is GameFileSourceDownloader.State gs)
            {
                return(gs.Game == compiler.CompilingGame.Game ? 2 : 3);
            }
            return(1);
        }
Beispiel #11
0
 public IncludePatches(ACompiler compiler, VirtualFile constructingFromBSA = null) : base(compiler)
 {
     _bsa     = constructingFromBSA;
     _indexed = _compiler.IndexedFiles.Values
                .SelectMany(f => f)
                .GroupBy(f => Path.GetFileName(f.Name).ToLower())
                .ToDictionary(f => f.Key);
     _indexedByName = _indexed.Values
                      .SelectMany(s => s)
                      .Where(f => f.IsNative)
                      .ToDictionary(f => Path.GetFileName(f.FullPath));
 }
Beispiel #12
0
        public IgnoreDisabledMods(ACompiler compiler) : base(compiler)
        {
            _mo2Compiler = (MO2Compiler)compiler;
            var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IsAlwaysEnabled(f.Value)).Select(f => f.Key).Distinct();

            _allEnabledMods = _mo2Compiler.SelectedProfiles
                              .SelectMany(p => _mo2Compiler.MO2Folder.Combine("profiles", p, "modlist.txt").ReadAllLines())
                              .Where(line => line.StartsWith("+") || line.EndsWith("_separator"))
                              .Select(line => line.Substring(1).RelativeTo(_mo2Compiler.MO2ModsFolder))
                              .Concat(alwaysEnabled)
                              .ToList();
        }
Beispiel #13
0
        public IgnoreTaggedFolders(ACompiler compiler, string tag) : base(compiler)
        {
            _aCompiler  = (ACompiler)compiler;
            _sourcePath = _aCompiler.SourcePath;
            _tag        = tag;
            string rootDirectory = (string)_sourcePath;

            _reason = $"Ignored because folder was tagged with {_tag}";

            _ignoreDirecrtory = Directory.EnumerateFiles(rootDirectory, _tag, SearchOption.AllDirectories)
                                .Select(str => (AbsolutePath)str.Replace(_tag, ""))
                                .ToList();
        }
Beispiel #14
0
 public IncludeTaggedMods(ACompiler compiler, string tag) : base(compiler)
 {
     _mo2Compiler     = (MO2Compiler)compiler;
     _tag             = tag;
     _includeDirectly = _mo2Compiler.ModInis.Where(kv =>
     {
         var general = kv.Value.General;
         if (general.notes != null && general.notes.Contains(_tag))
         {
             return(true);
         }
         return(general.comments != null && general.comments.Contains(_tag));
     }).Select(kv => $"mods\\{kv.Key}\\");
 }
Beispiel #15
0
        public IgnoreDisabledMods(ACompiler compiler) : base(compiler)
        {
            _mo2Compiler = (MO2Compiler)compiler;
            var alwaysEnabled  = _mo2Compiler.ModInis.Where(f => HasFlagInNotes(f.Value, Consts.WABBAJACK_ALWAYS_ENABLE)).Select(f => f.Key).Distinct();
            var alwaysDisabled = _mo2Compiler.ModInis
                                 .Where(f => HasFlagInNotes(f.Value, Consts.WABBAJACK_ALWAYS_DISABLE)).Select(f => f.Key).Distinct();

            _allEnabledMods = _mo2Compiler.SelectedProfiles
                              .SelectMany(p => _mo2Compiler.SourcePath.Combine("profiles", p, "modlist.txt").ReadAllLines())
                              .Where(line => line.StartsWith("+") || line.EndsWith("_separator"))
                              .Select(line => line.Substring(1).RelativeTo(_mo2Compiler.MO2ModsFolder))
                              .Concat(alwaysEnabled)
                              .Except(alwaysDisabled)
                              .ToList();
        }
Beispiel #16
0
        public IncludePatches(ACompiler compiler, VirtualFile?constructingFromBSA = null) : base(compiler)
        {
            _bsa      = constructingFromBSA;
            _compiler = compiler;
            _indexed  = _compiler.IndexedFiles.Values
                        .SelectMany(f => f)
                        .GroupBy(f => f.Name.FileName)
                        .ToDictionary(f => f.Key);
            _indexedByName = _indexed.Values
                             .SelectMany(s => s)
                             .Where(f => f.IsNative)
                             .GroupBy(f => f.Name.FileName)
                             .ToDictionary(f => f.Key, f => (IEnumerable <VirtualFile>)f);

            _isGenericGame = _compiler.CompilingGame.IsGenericMO2Plugin;
        }
Beispiel #17
0
        protected async Task Install(ACompiler compiler)
        {
            Utils.Log("Loading Modlist");
            var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile);

            Utils.Log("Constructing Installer");
            var installer = new MO2Installer(
                archive: compiler.ModListOutputFile,
                modList: modlist,
                outputFolder: utils.InstallPath,
                downloadFolder: utils.DownloadsPath,
                parameters: CreateDummySystemParameters());

            installer.WarnOnOverwrite = false;
            installer.GameFolder      = utils.GameFolder;
            Utils.Log("Starting Install");
            await installer.Begin();
        }
Beispiel #18
0
        public IgnoreSaveFiles(ACompiler compiler) : base(compiler)
        {
            _tag        = Consts.WABBAJACK_INCLUDE_SAVES;
            _sourcePath = compiler.SourcePath;
            string rootDirectory = (string)_sourcePath;

            try
            {
                _includeSaves = File.Exists(((String)Directory.EnumerateFiles(rootDirectory, _tag).ToList().First())) ? true : false;
            }
            catch // Cant get a .First() if the list is empty, which it is when the files doesn't exist.
            {
                _includeSaves = false;
            }


            _profilePaths =
                MO2Compiler.SelectedProfiles.Select(p => MO2Compiler.SourcePath.Combine("profiles", p, "saves")).ToArray();
        }
        public static string RemapData(ACompiler compiler, string data)
        {
            var gamePath = compiler.GamePath.Normalize();

            data = data.Replace(gamePath, Consts.GAME_PATH_MAGIC_BACK, StringComparison.InvariantCultureIgnoreCase);
            data = data.Replace(gamePath.Replace("\\", "\\\\"), Consts.GAME_PATH_MAGIC_DOUBLE_BACK, StringComparison.InvariantCultureIgnoreCase);
            data = data.Replace(gamePath.Replace("\\", "/"), Consts.GAME_PATH_MAGIC_FORWARD, StringComparison.InvariantCultureIgnoreCase);

            var sourcePath = compiler.SourcePath.Normalize();

            data = data.Replace(sourcePath, Consts.MO2_PATH_MAGIC_BACK, StringComparison.InvariantCultureIgnoreCase);
            data = data.Replace(sourcePath.Replace("\\", "\\\\"), Consts.MO2_PATH_MAGIC_DOUBLE_BACK, StringComparison.InvariantCultureIgnoreCase);
            data = data.Replace(sourcePath.Replace("\\", "/"), Consts.MO2_PATH_MAGIC_FORWARD, StringComparison.InvariantCultureIgnoreCase);

            var downloadsPath = compiler.DownloadsPath.Normalize();

            data = data.Replace(downloadsPath, Consts.DOWNLOAD_PATH_MAGIC_BACK, StringComparison.InvariantCultureIgnoreCase);
            data = data.Replace(downloadsPath.Replace("\\", "\\\\"), Consts.DOWNLOAD_PATH_MAGIC_DOUBLE_BACK, StringComparison.InvariantCultureIgnoreCase);
            data = data.Replace(downloadsPath.Replace("\\", "/"), Consts.DOWNLOAD_PATH_MAGIC_FORWARD, StringComparison.InvariantCultureIgnoreCase);
            return(data);
        }
Beispiel #20
0
        public IncludeTaggedFiles(ACompiler compiler, string tag) : base(compiler)
        {
            _aCompiler  = (ACompiler)compiler;
            _sourcePath = _aCompiler.SourcePath;
            _tag        = tag;
            string rootDirectory = (string)_sourcePath;

            _tagFiles = Directory.EnumerateFiles(rootDirectory, _tag, SearchOption.AllDirectories)
                        .Select(str => (AbsolutePath)str)
                        .ToList();

            foreach (var tagFile in _tagFiles)
            {
                _includeDirectly.Add(tagFile);
                string[] taggedFiles = File.ReadAllLines((String)tagFile);
                foreach (var taggedFile in taggedFiles)
                {
                    _includeDirectly.Add((AbsolutePath)(tagFile.ToString()
                                                        .Replace(_tag, taggedFile)));
                }
            }
        }
Beispiel #21
0
 public ICompilationStep CreateStep(ACompiler compiler)
 {
     return(new IgnoreVortex(compiler));
 }
Beispiel #22
0
 public IncludeDummyESPs(ACompiler compiler) : base(compiler)
 {
 }
Beispiel #23
0
 public IgnoreVortex(ACompiler compiler) : base(compiler)
 {
     _vortex = (VortexCompiler)compiler;
 }
Beispiel #24
0
 public PatchStockESMs(ACompiler compiler) : base(compiler)
 {
     _mo2Compiler = (MO2Compiler)compiler;
 }
Beispiel #25
0
 public ICompilationStep CreateStep(ACompiler compiler)
 {
     return(new PatchStockESMs(compiler));
 }
 public ICompilationStep CreateStep(ACompiler compiler)
 {
     return(new IncludeThisProfile(compiler));
 }
 public IncludeThisProfile(ACompiler compiler) : base(compiler)
 {
     _mo2Compiler     = (MO2Compiler)compiler;
     _correctProfiles = _mo2Compiler.SelectedProfiles.Select(p => Path.Combine("profiles", p) + "\\").ToList();
 }
 public IncludeModIniData(ACompiler compiler) : base(compiler)
 {
 }
 public ICompilationStep CreateStep(ACompiler compiler)
 {
     return(new IncludeModIniData(compiler));
 }
 public ICompilationStep CreateStep(ACompiler compiler)
 {
     return(new IncludeLootFiles(compiler));
 }