Beispiel #1
0
 private static Task <GenericModsEnabler> GetInstanceAsyncInner(string rootDirectory, string modsDirectory, bool useHardLinks)
 {
     FileUtils.EnsureDirectoryExists(modsDirectory);
     return(Task.Run(() => {
         _instanceParameters = GetParameters(rootDirectory, modsDirectory, useHardLinks);
         _instance = new GenericModsEnabler(rootDirectory,
                                            modsDirectory, useHardLinks);
         return _instance;
     }));
 }
Beispiel #2
0
 internal GenericMod(GenericModsEnabler enabler, string modDirectory)
 {
     _enabler     = enabler;
     DisplayName  = Path.GetFileName(modDirectory);
     ModDirectory = modDirectory;
     Description  = new Lazier <string>(() => Task.Run(() => {
         var d = Directory.GetFiles(ModDirectory, "*" + DescriptionExtension, SearchOption.TopDirectoryOnly);
         return(d.Length > 0 ? File.ReadAllText(d[0]) : null);
     }));
 }
Beispiel #3
0
        private IEnumerable <GenericModFile> LoadFilesList()
        {
            foreach (var filename in FileUtils.GetFilesRecursive(ModDirectory))
            {
                var relative = FileUtils.GetRelativePath(filename.ApartFromLast("-remove"), ModDirectory);
                if (relative.StartsWith("documentation\\") || relative.EndsWith(".jsgme"))
                {
                    continue;
                }

                var destination = Path.Combine(_enabler.RootDirectory, relative);
                var backup      = GenericModsEnabler.GetBackupFilename(_enabler.ModsDirectory, DisplayName, relative);

                if (filename.EndsWith("-remove"))
                {
                    yield return(new GenericModFile(null, destination, backup, relative, DisplayName));
                }
                else
                {
                    yield return(new GenericModFile(filename, destination, backup, relative, DisplayName));
                }
            }
        }