Exemplo n.º 1
0
        private DirectoryWalker(AppMetadata metadata, string path, int appId)
        {
            this.metadata = metadata;
            this.appId = appId;
            rootDir = path;

            if (!Directory.Exists(path))
                return;

            directoriesToWalk.Enqueue(path);

            Walk();
        }
Exemplo n.º 2
0
        internal App(AppMetadata metadata, AppManifestItem manifest, string steamDir)
        {
            this.manifest = manifest;

            string gameName = manifest["UserConfig"].Items.ContainsKey("name") ? manifest["UserConfig"]["name"] : manifest["appID"];

            string baseDir;
            try
            {
                baseDir = manifest["UserConfig"].Items.ContainsKey("appinstalldir") ? manifest["UserConfig"]["appinstalldir"] : Path.Combine(steamDir, "common", manifest["installdir"]);
            }
            catch (KeyNotFoundException)
            {
                throw new IgnoreAppException("Game " + gameName + ": No installdir present in manifest");
            }

            if (baseDir.Length == 2 && baseDir[1] == ':')
            {
                throw new IgnoreAppException("Game " + gameName + ": invalid appinstalldir " + baseDir);
            }

            SteamSize = long.Parse(manifest["SizeOnDisk"]);

            DirectoryWalker walker;
            try
            {
                walker = DirectoryWalker.Walk(metadata, baseDir, Id);
            }
            catch (IgnoreAppException e)
            {
                throw new IgnoreAppException("Game " + gameName + ": " + e.Message);
            }
            Known = metadata.Known.Contains(Id);

            TotalSize = walker.TotalSize;
            if (!Known)
                return;

            DeletableSize = walker.DeletableSize;
            NotSelectedSize = walker.NotSelectedSize;

            DeletableFiles = walker.DeletableFiles;
        }
Exemplo n.º 3
0
 internal static DirectoryWalker Walk(AppMetadata metadata, string path, int appId)
 {
     return new DirectoryWalker(metadata, path, appId);
 }