Esempio n. 1
0
        public static CASCConfig LoadOnlineStorageConfig()
        {
            var config = new CASCConfig {
                OnlineMode = true
            };

            using (var cdnsStream = CDNHandler.OpenFileDirect("http://us.patch.battle.net/wow_beta/cdns"))
            {
                config._CDNData = KeyValueConfig.ReadVerBarConfig(cdnsStream);
            }

            using (var versionsStream = CDNHandler.OpenFileDirect("http://us.patch.battle.net/wow_beta/versions"))
            {
                config._VersionsData = KeyValueConfig.ReadVerBarConfig(versionsStream);
            }

            string buildKey = config._VersionsData["BuildConfig"][0];

            using (Stream stream = CDNHandler.OpenConfigFileDirect(config.CDNUrl, buildKey))
            {
                config._BuildConfig = KeyValueConfig.ReadKeyValueConfig(stream);
            }

            string cdnKey = config._VersionsData["CDNConfig"][0];

            using (Stream stream = CDNHandler.OpenConfigFileDirect(config.CDNUrl, cdnKey))
            {
                config._CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream);
            }
            return(config);
        }
Esempio n. 2
0
        public static void Load(bool online)
        {
            string wowPath = Properties.Settings.Default.WowPath;

            if (online)
            {
                using (var cdnsStream = CDNHandler.OpenFileDirect("http://us.patch.battle.net/wow_beta/cdns"))
                    _CDNData = new VerBarConfig(cdnsStream);

                using (var versionsStream = CDNHandler.OpenFileDirect("http://us.patch.battle.net/wow_beta/versions"))
                    _VersionsData = new VerBarConfig(versionsStream);

                string buildKey = _VersionsData["BuildConfig"][0];
                using (Stream buildConfigStream = CDNHandler.OpenConfigFileDirect(buildKey))
                    _BuildConfig = new KeyValueConfig(buildConfigStream);

                string cdnKey = _VersionsData["CDNConfig"][0];
                using (Stream CDNConfigStream = CDNHandler.OpenConfigFileDirect(cdnKey))
                    _CDNConfig = new KeyValueConfig(CDNConfigStream);
            }
            else
            {
                string buildInfoPath = Path.Combine(wowPath, ".build.info");

                using (Stream buildInfoStream = new FileStream(buildInfoPath, FileMode.Open))
                    _BuildInfo = new VerBarConfig(buildInfoStream);

                string buildKey     = _BuildInfo["Build Key"][0];
                string buildCfgPath = Path.Combine(wowPath, "Data\\config\\", buildKey.Substring(0, 2), buildKey.Substring(2, 2), buildKey);
                using (Stream buildConfigStream = new FileStream(buildCfgPath, FileMode.Open))
                    _BuildConfig = new KeyValueConfig(buildConfigStream);

                string cdnKey     = _BuildInfo["CDN Key"][0];
                string cdnCfgPath = Path.Combine(wowPath, "Data\\config\\", cdnKey.Substring(0, 2), cdnKey.Substring(2, 2), cdnKey);
                using (Stream CDNConfigStream = new FileStream(cdnCfgPath, FileMode.Open))
                    _CDNConfig = new KeyValueConfig(CDNConfigStream);
            }
        }