Beispiel #1
0
        /// <summary>
        /// Loads the Build, CDN and Patch configs
        /// </summary>
        /// <param name="directory"></param>
        /// <param name="locale"></param>
        private void LoadConfigs(string directory)
        {
            if (VersionsFile == null || CDNsFile == null)
            {
                throw new Exception("Versions and CDNs files must be loaded first");
            }

            if (!VersionsFile.HasLocale(Locale))
            {
                throw new Exception($"Versions missing {Locale} locale");
            }

            if (BuildConfigMD5.Value != null)
            {
                BuildConfig = new KeyValueConfig(BuildConfigMD5.ToString(), directory, ConfigType.BuildConfig);
            }

            if (CDNConfigMD5.Value != null)
            {
                CDNConfig = new KeyValueConfig(CDNConfigMD5.ToString(), directory, ConfigType.CDNConfig);
            }

            // optionally load the patch config
            if (PatchConfigMD5.Value != null)
            {
                string path = Helpers.GetCDNPath(PatchConfigMD5.ToString(), "config", directory);
                if (File.Exists(path))
                {
                    PatchConfig = new KeyValueConfig(PatchConfigMD5.ToString(), directory, ConfigType.PatchConfig);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Loads the Build, CDN and Patch configs
        /// </summary>
        /// <param name="directory"></param>
        /// <param name="locale"></param>
        private void LoadConfigs(string directory)
        {
            if (VersionsFile == null || CDNsFile == null)
            {
                throw new Exception("Versions and CDNs files must be loaded first");
            }

            if (!VersionsFile.HasLocale(Locale))
            {
                throw new Exception($"Versions missing {Locale} locale");
            }

            if (!BuildConfigMD5.IsEmpty)
            {
                BuildConfig = new KeyValueConfig(BuildConfigMD5.ToString(), directory, ConfigType.BuildConfig);
            }

            if (!CDNConfigMD5.IsEmpty)
            {
                CDNConfig = new KeyValueConfig(CDNConfigMD5.ToString(), directory, ConfigType.CDNConfig);
            }

            if (!PatchConfigMD5.IsEmpty)
            {
                PatchConfig = new KeyValueConfig(PatchConfigMD5.ToString(), directory, ConfigType.PatchConfig);
            }
        }