Example #1
0
 public GameHandlerMetadata ReadMetadataFromFile(string metadataPath)
 {
     using (Stream str = File.OpenRead(metadataPath)) {
         using (StreamReader reader = new StreamReader(str)) {
             string fullGameInfo          = reader.ReadToEnd();
             GameHandlerMetadata metadata = JsonConvert.DeserializeObject <GameHandlerMetadata>(fullGameInfo);
             metadata.RootDirectory = Path.GetDirectoryName(metadataPath);
             gameManager.MetadataManager.UpdateNaming(metadata);
             return(metadata);
         }
     }
 }
Example #2
0
        public static string GetInstallPath(GameHandlerMetadata metadata)
        {
            if (!string.IsNullOrEmpty(metadata.RootDirectory))
            {
                return(metadata.RootDirectory);
            }

            string installed     = GameManager.Instance.GetInstalledPackagePath();
            string installedName = GetPackageFileName(metadata);

            return(Path.Combine(installed, installedName));
        }
Example #3
0
        public static string GetInstallPath(GameHandlerMetadata metadata)
        {
            if (!string.IsNullOrEmpty(metadata.RootDirectory))
            {
                return(metadata.RootDirectory);
            }

            string installed     = GameManager.Instance.GetInstalledPackagePath();
            string installedName = metadata.GameID + "-H" + metadata.HandlerID + "-V" + metadata.V + "-N" + metadata.PlatV + "-" + metadata.Dev;

            return(Path.Combine(installed, installedName));
        }
Example #4
0
        public HandlerDataManager ReadHandlerDataFromInstalledPackage(GameHandlerMetadata handler)
        {
            string installPath = GetInstallPath(handler);
            string handlerPath = Path.Combine(installPath, HandlerFileName + JsFormat);

            if (!File.Exists(handlerPath))
            {
                return(null);
            }

            using (Stream str = File.OpenRead(handlerPath)) {
                return(new HandlerDataManager(handler, str));
            }
        }
Example #5
0
        public GameHandlerMetadata ReadInfoFromPackageFile(string pkgPath)
        {
            ZipFile  zip   = new ZipFile(pkgPath);
            ZipEntry entry = zip[InfoFileName + JsonFormat];

            using (Stream str = entry.OpenReader()) {
                using (StreamReader reader = new StreamReader(str)) {
                    string fullGameInfo          = reader.ReadToEnd();
                    GameHandlerMetadata metadata = JsonConvert.DeserializeObject <GameHandlerMetadata>(fullGameInfo);
                    metadata.RootDirectory = Path.GetDirectoryName(pkgPath);
                    gameManager.MetadataManager.UpdateNaming(metadata);
                    return(metadata);
                }
            }
        }
Example #6
0
        public static string GetAssetsFolder(GameHandlerMetadata metadata)
        {
            string installFolder = GetInstallPath(metadata);

            return(Path.Combine(installFolder, AssetsFolder));
        }
 public static int CompareHandlerTitle(GameHandlerMetadata x, GameHandlerMetadata y)
 {
     return(x.Title.CompareTo(y.Title));
 }
Example #8
0
 public static string GetPackageFileName(GameHandlerMetadata metadata)
 {
     return(metadata.GameID + "-H" + metadata.HandlerID + "-V" + metadata.V + "-N" + metadata.PlatV + "-" + metadata.Dev);
 }