예제 #1
0
 /// <summary>
 /// Creates a new set of configs
 /// </summary>
 /// <param name="build">Optionally loads build specific config values</param>
 public void Create(uint build = 0)
 {
     CDNsFile     = new VariableConfig(ConfigType.CDNs);
     VersionsFile = new VariableConfig(ConfigType.Versions);
     BuildConfig  = new KeyValueConfig(ConfigType.BuildConfig);
     CDNConfig    = new KeyValueConfig(ConfigType.CDNConfig);
 }
예제 #2
0
        /// <summary>
        /// Opens the CDNs, Versions and config files from disk
        /// </summary>
        /// <param name="directory">Directory containing the config files</param>
        public void OpenLocal(string directory)
        {
            CDNsFile     = new VariableConfig(Path.Combine(directory, Product), ConfigType.CDNs);
            VersionsFile = new VariableConfig(Path.Combine(directory, Product), ConfigType.Versions);

            LoadConfigs(directory);
        }
예제 #3
0
        /// <summary>
        /// Opens the CDNs, Versions and config files from disk
        /// </summary>
        /// <param name="directory">Directory containing the config files</param>
        public void OpenLocal(string directory)
        {
            CDNsFile     = new VariableConfig(directory, ConfigType.CDNs);
            VersionsFile = new VariableConfig(directory, ConfigType.Versions);

            LoadConfigs(directory);
        }
예제 #4
0
        /// <summary>
        /// Opens the CDNs, Versions from Ribbit and the config files from Blizzard's CDN
        /// </summary>
        public void OpenRemote()
        {
            var ribbit = new RibbitClient(Locale);

            using var cdnstream = ribbit.GetStream(RibbitCommand.CDNs, Product).Result;
            using var verstream = ribbit.GetStream(RibbitCommand.Versions, Product).Result;
            CDNsFile            = new VariableConfig(cdnstream, ConfigType.CDNs);
            VersionsFile        = new VariableConfig(verstream, ConfigType.Versions);
        }
예제 #5
0
        /// <summary>
        /// Opens the CDNs and Versions files from Ribbit and the config files from disk
        /// </summary>
        public void OpenRemote(string directory)
        {
            var ribbit = new RibbitClient(Locale);

            using (var cdnstream = ribbit.GetStream(RibbitCommand.CDNs, Product).Result)
                using (var verstream = ribbit.GetStream(RibbitCommand.Versions, Product).Result)
                {
                    CDNsFile     = new VariableConfig(cdnstream, ConfigType.CDNs);
                    VersionsFile = new VariableConfig(verstream, ConfigType.Versions);
                }

            LoadConfigs(directory);
        }
예제 #6
0
        /// <summary>
        /// Opens the CDNs, Versions from Ribbit and the config files from Blizzard's CDN
        /// </summary>
        public void OpenRemote()
        {
            var ribbit = new RibbitClient(Locale);

            using (var cdnstream = ribbit.GetStream(RibbitCommand.CDNs, Product).Result)
                using (var verstream = ribbit.GetStream(RibbitCommand.Versions, Product).Result)
                {
                    CDNsFile     = new VariableConfig(cdnstream, ConfigType.CDNs);
                    VersionsFile = new VariableConfig(verstream, ConfigType.Versions);

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

                    var cdnClient = new CDNClient(this);

                    if (BuildConfigMD5.Value != null)
                    {
                        string configUrl = Helpers.GetCDNUrl(BuildConfigMD5.ToString(), "config");
                        BuildConfig = new KeyValueConfig(cdnClient.OpenStream(configUrl).Result, ConfigType.BuildConfig);
                    }

                    if (CDNConfigMD5.Value != null)
                    {
                        string configUrl = Helpers.GetCDNUrl(CDNConfigMD5.ToString(), "config");
                        CDNConfig = new KeyValueConfig(cdnClient.OpenStream(configUrl).Result, ConfigType.CDNConfig);
                    }

                    if (PatchConfigMD5.Value != null)
                    {
                        string configUrl = Helpers.GetCDNUrl(PatchConfigMD5.ToString(), "config");
                        PatchConfig = new KeyValueConfig(cdnClient.OpenStream(configUrl).Result, ConfigType.PatchConfig);
                    }
                }
        }
예제 #7
0
 /// <summary>
 /// Creates a new set of configs
 /// </summary>
 /// <param name="build">Optionally loads build specific config values</param>
 public void Create()
 {
     CDNsFile     = new VariableConfig(ConfigType.CDNs);
     VersionsFile = new VariableConfig(ConfigType.Versions);
 }
예제 #8
0
 private MD5Hash TryGetKey(VariableConfig config, string identifier)
 {
     MD5Hash.TryParse(config.GetValue(identifier, Locale), out MD5Hash hash);
     return(hash);
 }