public SpringScanner(SpringPaths springPaths)
        {
            this.springPaths = springPaths;
            MetaData         = new MetaDataCache(springPaths, this);

            foreach (var folder in springPaths.DataDirectories)
            {
                var modsPath = Utils.MakePath(folder, "games");
                if (Directory.Exists(modsPath))
                {
                    modsWatchers.Add(new FileSystemWatcher(modsPath));
                }
                var mapsPath = Utils.MakePath(folder, "maps");
                if (Directory.Exists(mapsPath))
                {
                    mapsWatchers.Add(new FileSystemWatcher(mapsPath));
                }
                var packagesPath = Utils.MakePath(folder, "packages");
                if (Directory.Exists(packagesPath))
                {
                    packagesWatchers.Add(new FileSystemWatcher(packagesPath));
                }
            }

            SetupWatcherEvents(mapsWatchers);
            SetupWatcherEvents(modsWatchers);
            SetupWatcherEvents(packagesWatchers);

            service.RegisterResourceCompleted += HandleServiceRegisterResourceCompleted;
            Directory.CreateDirectory(springPaths.Cache);
            cachePath = Utils.MakePath(springPaths.Cache, "ScannerCache.dat");
            Directory.CreateDirectory(Utils.MakePath(springPaths.Cache, "Resources"));
        }
Exemple #2
0
        public Pool(SpringPaths paths)
        {
            foreach (var p in paths.DataDirectories)
            {
                var readPath = Utils.MakePath(p, "pool");
                Utils.CheckPath(readPath);
                readPaths.Add(readPath);
            }

            writePath = Utils.MakePath(paths.WritableDirectory, "pool");
            Utils.CheckPath(writePath);

            tempPath = Utils.MakePath(paths.WritableDirectory, "temp");
            Utils.CheckPath(tempPath);
        }
Exemple #3
0
 public MetaDataCache(SpringPaths springPaths, SpringScanner scanner)
 {
     this.scanner   = scanner;
     resourceFolder = Utils.MakePath(springPaths.Cache, "Resources");
     Utils.CheckPath(resourceFolder);
 }