public static CASCHandler OpenStorage(CASCConfig config, BackgroundWorkerEx worker = null) => Open(worker, config);
private CDNIndexHandler(CASCConfig cascConfig, BackgroundWorkerEx worker) { config = cascConfig; this.worker = worker; }
public static void Init(CASCConfig config) { _instance = new CDNCache(config); }
public static CASCHandlerLite OpenOnlineStorage(string product, LocaleFlags locale, string region = "us", BackgroundWorkerEx worker = null) { CASCConfig config = CASCConfig.LoadOnlineStorageConfig(product, region); return(Open(locale, worker, config)); }
public static CASCConfig LoadOnlineStorageConfig(string product, string region, bool useCurrentBuild = false, ILoggerOptions loggerOptions = null) { if (product == null) { throw new ArgumentNullException(nameof(product)); } if (region == null) { throw new ArgumentNullException(nameof(region)); } Logger.Init(loggerOptions); var config = new CASCConfig { OnlineMode = true, Region = region, Product = product }; using (var ribbit = new RibbitClient("us")) using (var cdnsStream = ribbit.GetAsStream($"v1/products/{product}/cdns")) //using (var cdnsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/cdns", product))) { config._CdnsData = VerBarConfig.ReadVerBarConfig(cdnsStream); } using (var ribbit = new RibbitClient("us")) using (var versionsStream = ribbit.GetAsStream($"v1/products/{product}/versions")) //using (var versionsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/versions", product))) { config._VersionsData = VerBarConfig.ReadVerBarConfig(versionsStream); } CDNCache.Init(config); config.GameType = CASCGame.DetectGameByUid(product); if (File.Exists("fakecdnconfig")) { using (Stream stream = new FileStream("fakecdnconfig", FileMode.Open)) { config._CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } else { string cdnKey = config.GetVersionsVariable("CDNConfig").ToLower(); //string cdnKey = "da4896ce91922122bc0a2371ee114423"; using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, cdnKey)) { config._CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } config.ActiveBuild = 0; config._Builds = new List <KeyValueConfig>(); if (config._CDNConfig["builds"] != null) { for (int i = 0; i < config._CDNConfig["builds"].Count; i++) { try { using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, config._CDNConfig["builds"][i])) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } } catch { } } if (useCurrentBuild) { string curBuildKey = config.GetVersionsVariable("BuildConfig"); int buildIndex = config._CDNConfig["builds"].IndexOf(curBuildKey); if (buildIndex != -1) { config.ActiveBuild = buildIndex; } } } if (File.Exists("fakebuildconfig")) { using (Stream stream = new FileStream("fakebuildconfig", FileMode.Open)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } } else { string buildKey = config.GetVersionsVariable("BuildConfig").ToLower(); //string buildKey = "3b0517b51edbe0b96f6ac5ea7eaaed38"; using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, buildKey)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } } return(config); }
public static CASCConfig LoadLocalStorageConfig(string basePath, string product = null) { var config = new CASCConfig { OnlineMode = false, BasePath = basePath, Product = product }; config.GameType = CASCGame.DetectLocalGame(basePath); if (config.GameType == CASCGameType.Agent || config.GameType == CASCGameType.Hearthstone) { throw new Exception("Local mode not supported for this game!"); } string buildInfoPath = Path.Combine(basePath, ".build.info"); using (Stream buildInfoStream = new FileStream(buildInfoPath, FileMode.Open)) { config.BuildInfo = VerBarConfig.ReadVerBarConfig(buildInfoStream); } Dictionary <string, string> bi = config.GetActiveBuild(product); if (bi == null) { throw new Exception("Can't find active BuildInfoEntry"); } string dataFolder = CASCGame.GetDataFolder(config.GameType); config.ActiveBuild = 0; config.Builds = new List <KeyValueConfig>(); if (File.Exists("fakebuildconfig")) { using (Stream stream = new FileStream("fakebuildconfig", FileMode.Open)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config.Builds.Add(cfg); } } else { string buildKey = bi["BuildKey"]; //string buildKey = "5a05c58e28d0b2c3245954b6f4e2ae66"; string buildCfgPath = Path.Combine(basePath, dataFolder, "config", buildKey.Substring(0, 2), buildKey.Substring(2, 2), buildKey); using (Stream stream = new FileStream(buildCfgPath, FileMode.Open)) { config.Builds.Add(KeyValueConfig.ReadKeyValueConfig(stream)); } } if (File.Exists("fakecdnconfig")) { using (Stream stream = new FileStream("fakecdnconfig", FileMode.Open)) { config.CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } else { string cdnKey = bi["CDNKey"]; //string cdnKey = "23d301e8633baaa063189ca9442b3088"; string cdnCfgPath = Path.Combine(basePath, dataFolder, "config", cdnKey.Substring(0, 2), cdnKey.Substring(2, 2), cdnKey); using (Stream stream = new FileStream(cdnCfgPath, FileMode.Open)) { config.CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } return(config); }
public static CASCHandlerLite OpenStorage(LocaleFlags locale, CASCConfig config, BackgroundWorkerEx worker = null) { return(Open(locale, worker, config)); }
private static CASCHandlerLite Open(LocaleFlags locale, CASCConfig config) { return(new CASCHandlerLite(config, locale)); }
public static CASCHandler OpenStorage(CASCConfig config) { return(new CASCHandler(config)); }
public static CASCHandlerLite OpenLocalStorage(string basePath, LocaleFlags locale, string product = null) { CASCConfig config = CASCConfig.LoadLocalStorageConfig(basePath); return(Open(locale, config)); }
public static CASCHandlerLite OpenOnlineStorage(string product, LocaleFlags locale, string region = "us") { CASCConfig config = CASCConfig.LoadOnlineStorageConfig(product, region); return(Open(locale, config)); }
public static CASCHandlerLite OpenStorage(LocaleFlags locale, CASCConfig config) { return(Open(locale, config)); }
public static CASCConfig LoadOnlineStorageConfig(string product, string region, bool useCurrentBuild = false) { var config = new CASCConfig { OnlineMode = true }; config.Region = region; config.Product = product; using (var cdnsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/cdns", product))) { config._CDNData = VerBarConfig.ReadVerBarConfig(cdnsStream); } using (var versionsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/versions", product))) { config._VersionsData = VerBarConfig.ReadVerBarConfig(versionsStream); } for (int i = 0; i < config._VersionsData.Count; ++i) { if (config._VersionsData[i]["Region"] == region) { config._versionsIndex = i; break; } } config.GameType = CASCGame.DetectOnlineGame(product); string cdnKey = config._VersionsData[config._versionsIndex]["CDNConfig"].ToLower(); //string cdnKey = "1964f5dfcb945c1b31acabedeaf13d09"; using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, cdnKey)) { config._CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } config.ActiveBuild = 0; config._Builds = new List <KeyValueConfig>(); if (config._CDNConfig["builds"] != null) { for (int i = 0; i < config._CDNConfig["builds"].Count; i++) { try { using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, config._CDNConfig["builds"][i])) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } } catch { } } if (useCurrentBuild) { string curBuildKey = config._VersionsData[config._versionsIndex]["BuildConfig"]; int buildIndex = config._CDNConfig["builds"].IndexOf(curBuildKey); if (buildIndex != -1) { config.ActiveBuild = buildIndex; } } } string buildKey = config._VersionsData[config._versionsIndex]["BuildConfig"].ToLower(); //string buildKey = "e8f3d86ab313c4bdf5cf4f5daea32477"; using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, buildKey)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } return(config); }
public static CASCConfig LoadLocalStorageConfig(string basePath, string product, ILoggerOptions loggerOptions = null) { if (basePath == null) { throw new ArgumentNullException(nameof(basePath)); } if (product == null) { throw new ArgumentNullException(nameof(product)); } string buildInfoPath = Path.Combine(basePath, ".build.info"); if (!File.Exists(buildInfoPath)) { throw new Exception("Local mode not supported for this game!"); } Logger.Init(loggerOptions); var config = new CASCConfig { OnlineMode = false, BasePath = basePath, Product = product }; using (Stream buildInfoStream = new FileStream(buildInfoPath, FileMode.Open)) { config._BuildInfo = VerBarConfig.ReadVerBarConfig(buildInfoStream); } CASCGameType gameType; if (!HasConfigVariable(config._BuildInfo, "Product")) { var detectedGameType = CASCGame.DetectLocalGame(basePath, product, config.GetBuildInfoVariable("BuildKey")); if (detectedGameType.HasValue) { gameType = detectedGameType.Value; } else { throw new Exception($"No product {product} found at {basePath}"); } } else { string productUid = config.GetBuildInfoVariable("Product"); if (productUid == null) { throw new Exception($"No product {product} found at {basePath}"); } gameType = CASCGame.DetectGameByUid(product); } config.GameType = gameType; string dataFolder = CASCGame.GetDataFolder(config.GameType); config.ActiveBuild = 0; config._Builds = new List <KeyValueConfig>(); if (File.Exists("fakebuildconfig")) { using (Stream stream = new FileStream("fakebuildconfig", FileMode.Open)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } } else { string buildKey = config.GetBuildInfoVariable("BuildKey"); //string buildKey = "5a05c58e28d0b2c3245954b6f4e2ae66"; string buildCfgPath = Path.Combine(basePath, dataFolder, "config", buildKey.Substring(0, 2), buildKey.Substring(2, 2), buildKey); using (Stream stream = new FileStream(buildCfgPath, FileMode.Open)) { config._Builds.Add(KeyValueConfig.ReadKeyValueConfig(stream)); } } if (File.Exists("fakecdnconfig")) { using (Stream stream = new FileStream("fakecdnconfig", FileMode.Open)) { config._CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } else { string cdnKey = config.GetBuildInfoVariable("CDNKey"); //string cdnKey = "23d301e8633baaa063189ca9442b3088"; string cdnCfgPath = Path.Combine(basePath, dataFolder, "config", cdnKey.Substring(0, 2), cdnKey.Substring(2, 2), cdnKey); using (Stream stream = new FileStream(cdnCfgPath, FileMode.Open)) { config._CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } CDNCache.Init(config); return(config); }
private CASCHandler(CASCConfig config, BackgroundWorkerEx worker) : base(config, worker) { Logger.WriteLine("CASCHandler: loading encoding data..."); using (var _ = new PerfCounter("new EncodingHandler()")) { using (var fs = OpenEncodingFile(this)) EncodingHandler = new EncodingHandler(fs, worker); } Logger.WriteLine("CASCHandler: loaded {0} encoding data", EncodingHandler.Count); if ((CASCConfig.LoadFlags & LoadFlags.Download) != 0) { Logger.WriteLine("CASCHandler: loading download data..."); using (var _ = new PerfCounter("new DownloadHandler()")) { using (var fs = OpenDownloadFile(EncodingHandler, this)) DownloadHandler = new DownloadHandler(fs, worker); } Logger.WriteLine("CASCHandler: loaded {0} download data", EncodingHandler.Count); } Logger.WriteLine("CASCHandler: loading root data..."); using (var _ = new PerfCounter("new RootHandler()")) { using (var fs = OpenRootFile(EncodingHandler, this)) { if (config.GameType == CASCGameType.S2 || config.GameType == CASCGameType.HotS) { RootHandler = new MNDXRootHandler(fs, worker); } else if (config.GameType == CASCGameType.D3) { RootHandler = new D3RootHandler(fs, worker, this); } else if (config.GameType == CASCGameType.WoW) { RootHandler = new WowRootHandler(fs, worker); } else if (config.GameType == CASCGameType.Agent || config.GameType == CASCGameType.Bna || config.GameType == CASCGameType.Client) { RootHandler = new AgentRootHandler(fs, worker); } else if (config.GameType == CASCGameType.S1) { RootHandler = new S1RootHandler(fs, worker); } else if (config.GameType == CASCGameType.WC3) { RootHandler = new WC3RootHandler(fs, worker); } else if (config.GameType == CASCGameType.Hearthstone) { RootHandler = new HSRootHandler(fs, worker); } else if (config.GameType == CASCGameType.Overwatch) { RootHandler = new OwRootHandler(fs, worker, this); } else if (config.GameType == CASCGameType.Destiny2) { RootHandler = new Destiny2RootHandler(fs, worker); } else { using (var ufs = new FileStream("unk_root", FileMode.Create)) fs.BaseStream.CopyTo(ufs); throw new Exception("Unsupported game " + config.BuildUID); } } } Logger.WriteLine("CASCHandler: loaded {0} root data", RootHandler.Count); if ((CASCConfig.LoadFlags & LoadFlags.Install) != 0) { Logger.WriteLine("CASCHandler: loading install data..."); using (var _ = new PerfCounter("new InstallHandler()")) { using (var fs = OpenInstallFile(EncodingHandler, this)) InstallHandler = new InstallHandler(fs, worker); InstallHandler.Print(); } Logger.WriteLine("CASCHandler: loaded {0} install data", InstallHandler.Count); } }
public static CASCHandler OpenLocalStorage(string basePath, string product = null, BackgroundWorkerEx worker = null) { CASCConfig config = CASCConfig.LoadLocalStorageConfig(basePath, product); return(Open(worker, config)); }
public static CASCConfig LoadOnlineStorageConfig(string product, string region, bool useCurrentBuild = false) { var config = new CASCConfig { OnlineMode = true, Region = region, Product = product }; using (var ribbit = new RibbitClient("us")) using (var cdnsStream = ribbit.GetAsStream($"v1/products/{product}/cdns")) //using (var cdnsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/cdns", product))) { config.CDNData = VerBarConfig.ReadVerBarConfig(cdnsStream); } using (var ribbit = new RibbitClient("us")) using (var versionsStream = ribbit.GetAsStream($"v1/products/{product}/versions")) //using (var versionsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/versions", product))) { config.VersionsData = VerBarConfig.ReadVerBarConfig(versionsStream); } for (int i = 0; i < config.VersionsData.Count; ++i) { if (config.VersionsData[i]["Region"] == region) { config.versionsIdx = i; break; } } config.GameType = CASCGame.DetectGameByUid(product); if (File.Exists("fakecdnconfig")) { using (Stream stream = new FileStream("fakecdnconfig", FileMode.Open)) { config.CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } else { string cdnKey = config.VersionsData[config.versionsIdx]["CDNConfig"].ToLower(); using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, cdnKey)) { config.CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } } config.ActiveBuild = 0; config.Builds = new List <KeyValueConfig>(); if (config.CDNConfig["builds"] != null) { for (int i = 0; i < config.CDNConfig["builds"].Count; i++) { try { using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, config.CDNConfig["builds"][i])) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config.Builds.Add(cfg); } } catch { } } if (useCurrentBuild) { string curBuildKey = config.VersionsData[config.versionsIdx]["BuildConfig"]; int buildIndex = config.CDNConfig["builds"].IndexOf(curBuildKey); if (buildIndex != -1) { config.ActiveBuild = buildIndex; } } } if (File.Exists("fakebuildconfig")) { using (Stream stream = new FileStream("fakebuildconfig", FileMode.Open)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config.Builds.Add(cfg); } } else { string buildKey = config.VersionsData[config.versionsIdx]["BuildConfig"].ToLower(); //string buildKey = "3b0517b51edbe0b96f6ac5ea7eaaed38"; using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, buildKey)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config.Builds.Add(cfg); } } return(config); }
private CASCHandler(CASCConfig config, BackgroundWorkerEx worker) : base(config, worker) { Logger.WriteLine("CASCHandler: loading encoding data..."); using (var _ = new PerfCounter("new EncodingHandler()")) { using (var fs = OpenEncodingFile(this)) EncodingHandler = new EncodingHandler(fs, worker); } Logger.WriteLine("CASCHandler: loaded {0} encoding data", EncodingHandler.Count); if ((CASCConfig.LoadFlags & LoadFlags.Download) != 0) { Logger.WriteLine("CASCHandler: loading download data..."); using (var _ = new PerfCounter("new DownloadHandler()")) { using (var fs = OpenDownloadFile(EncodingHandler, this)) DownloadHandler = new DownloadHandler(fs, worker); } Logger.WriteLine("CASCHandler: loaded {0} download data", EncodingHandler.Count); } KeyService.LoadKeys(); Logger.WriteLine("CASCHandler: loading root data..."); using (var _ = new PerfCounter("new RootHandler()")) { if (config.IsVfsRoot) { RootHandler = new TVFSRootHandler(worker, this); } else { using (var fs = OpenRootFile(EncodingHandler, this)) { RootHandlerBase UnknownRootHandler() { using (var ufs = new FileStream("unk_root", FileMode.Create)) fs.BaseStream.CopyTo(ufs); throw new Exception("Unsupported game " + config.BuildProduct); } RootHandler = config.GameType switch { CASCGameType.S2 => new MNDXRootHandler(fs, worker), CASCGameType.HotS => new MNDXRootHandler(fs, worker), CASCGameType.D3 => new D3RootHandler(fs, worker, this), CASCGameType.WoW => new WowRootHandler(fs, worker), CASCGameType.S1 => new S1RootHandler(fs, worker), CASCGameType.Agent => new DummyRootHandler(fs, worker), CASCGameType.Bna => new DummyRootHandler(fs, worker), CASCGameType.Client => new DummyRootHandler(fs, worker), CASCGameType.Hearthstone => new DummyRootHandler(fs, worker), CASCGameType.Destiny2 => new DummyRootHandler(fs, worker), CASCGameType.Wlby => new DummyRootHandler(fs, worker), CASCGameType.Rtro => new DummyRootHandler(fs, worker), _ => UnknownRootHandler() }; } } } Logger.WriteLine("CASCHandler: loaded {0} root data", RootHandler.Count); if ((CASCConfig.LoadFlags & LoadFlags.Install) != 0) { Logger.WriteLine("CASCHandler: loading install data..."); using (var _ = new PerfCounter("new InstallHandler()")) { using (var fs = OpenInstallFile(EncodingHandler, this)) InstallHandler = new InstallHandler(fs, worker); //InstallHandler.Print(); } Logger.WriteLine("CASCHandler: loaded {0} install data", InstallHandler.Count); } }
private CASCHandlerLite(CASCConfig config, LocaleFlags locale, BackgroundWorkerEx worker) : base(config, worker) { if (config.GameType != CASCGameType.WoW) { throw new Exception("Unsupported game " + config.BuildUID); } Logger.WriteLine("CASCHandlerLite: loading encoding data..."); EncodingHandler EncodingHandler; using (var _ = new PerfCounter("new EncodingHandler()")) { using (var fs = OpenEncodingFile(this)) EncodingHandler = new EncodingHandler(fs, worker); } Logger.WriteLine("CASCHandlerLite: loaded {0} encoding data", EncodingHandler.Count); Logger.WriteLine("CASCHandlerLite: loading root data..."); WowRootHandler RootHandler; using (var _ = new PerfCounter("new RootHandler()")) { using (var fs = OpenRootFile(EncodingHandler, this)) RootHandler = new WowRootHandler(fs, worker); } Logger.WriteLine("CASCHandlerLite: loaded {0} root data", RootHandler.Count); RootHandler.SetFlags(locale, ContentFlags.None, false); CDNIndexData = new Dictionary <MD5Hash, IndexEntry>(comparer); if (LocalIndex != null) { LocalIndexData = new Dictionary <MD5Hash, IndexEntry>(comparer); } RootEntry rootEntry; foreach (var entry in RootHandler.GetAllEntries()) { rootEntry = entry.Value; if ((rootEntry.LocaleFlags == locale || (rootEntry.LocaleFlags & locale) != LocaleFlags.None) && (rootEntry.ContentFlags & ContentFlags.LowViolence) == ContentFlags.None) { if (EncodingHandler.GetEntry(rootEntry.MD5, out EncodingEntry enc)) { if (!HashToKey.ContainsKey(entry.Key)) { HashToKey.Add(entry.Key, enc.Key); FileDataIdToHash.Add(RootHandler.GetFileDataIdByHash(entry.Key), entry.Key); if (LocalIndex != null) { IndexEntry iLocal = LocalIndex.GetIndexInfo(enc.Key); if (iLocal != null && !LocalIndexData.ContainsKey(enc.Key)) { LocalIndexData.Add(enc.Key, iLocal); } } IndexEntry iCDN = CDNIndex.GetIndexInfo(enc.Key); if (iCDN != null && !CDNIndexData.ContainsKey(enc.Key)) { CDNIndexData.Add(enc.Key, iCDN); } } } } } CDNIndex.Clear(); //CDNIndex = null; LocalIndex?.Clear(); LocalIndex = null; RootHandler.Clear(); RootHandler = null; EncodingHandler.Clear(); EncodingHandler = null; GC.Collect(); Logger.WriteLine("CASCHandlerLite: loaded {0} files", HashToKey.Count); }
private CDNIndexHandler(CASCConfig cascConfig) { config = cascConfig; }
public static CASCHandlerLite OpenLocalStorage(string basePath, LocaleFlags locale, BackgroundWorkerEx worker = null) { CASCConfig config = CASCConfig.LoadLocalStorageConfig(basePath); return(Open(locale, worker, config)); }
private CDNIndexHandler(CASCConfig cascConfig, BackgroundWorkerEx worker) { config = cascConfig; this.worker = worker; downloader = new SyncDownloader(worker); }
private static CASCHandlerLite Open(LocaleFlags locale, BackgroundWorkerEx worker, CASCConfig config) { using (var _ = new PerfCounter("new CASCHandlerLite()")) { return(new CASCHandlerLite(config, locale, worker)); } }
public static CASCConfig LoadOnlineStorageConfig(string product, string region, bool useCurrentBuild = false) { var config = new CASCConfig { OnlineMode = true }; config.Region = region; config.Product = product; using (var cdnsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/cdns", product))) { config._CDNData = VerBarConfig.ReadVerBarConfig(cdnsStream); } using (var versionsStream = CDNIndexHandler.OpenFileDirect(string.Format("http://us.patch.battle.net:1119/{0}/versions", product))) { config._VersionsData = VerBarConfig.ReadVerBarConfig(versionsStream); } for (int i = 0; i < config._VersionsData.Count; ++i) { if (config._VersionsData[i]["Region"] == region) { config._versionsIndex = i; break; } } config.GameType = CASCGame.DetectOnlineGame(product); string cdnKey = config._VersionsData[config._versionsIndex]["CDNConfig"].ToLower(); //string cdnKey = "d583ee15a02b81cc494aeeef8d195059"; //string cdnKey = "8c4ac7ab2f96ab75dab58448ffd07842"; using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, cdnKey)) { config._CDNConfig = KeyValueConfig.ReadKeyValueConfig(stream); } config.ActiveBuild = 0; config._Builds = new List <KeyValueConfig>(); if (config._CDNConfig["builds"] != null) { for (int i = 0; i < config._CDNConfig["builds"].Count; i++) { try { using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, config._CDNConfig["builds"][i])) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } } catch { } } if (useCurrentBuild) { string curBuildKey = config._VersionsData[config._versionsIndex]["BuildConfig"]; int buildIndex = config._CDNConfig["builds"].IndexOf(curBuildKey); if (buildIndex != -1) { config.ActiveBuild = buildIndex; } } } string buildKey = config._VersionsData[config._versionsIndex]["BuildConfig"].ToLower(); //string buildKey = "2e1db4da3a538cd52521b73040bdb162"; //string buildKey = "f639eab0a11d5b7a9099bc188badaa2e"; using (Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, buildKey)) { var cfg = KeyValueConfig.ReadKeyValueConfig(stream); config._Builds.Add(cfg); } return(config); }