Пример #1
0
        public static void Main(string[] args)
        {
            //const string path = @"C:\ow\game\Overwatch\";
            //const string path = @"D:\Games\Call of Duty Black Ops 4";

            Logger.RegisterBasic();

            var ribbit  = new RibbitClient(ClientCreateArgs.US_RIBBIT);
            var summary = ribbit.GetSummary();
            var ver     = ribbit.GetVersions("pro");

            //System.Diagnostics.Debugger.Break();
            var clientHandler = new ClientHandler(args[0], new ClientCreateArgs());

            Logger.Info("LOAD", clientHandler.Product.ToString("G"));

            return;

            /*
             * ClientHandler onlineClientHandler = new ClientHandler(args[0], new ClientCreateArgs {
             *  Mode = ClientCreateArgs.InstallMode.Ribbit,
             *  OnlineProduct = TACTProduct.Overwatch
             * });
             * Logger.Info("LOAD", onlineClientHandler.Product.ToString("G"));
             */
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #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);

                    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);
                    }
                }
        }
Пример #5
0
        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"))
                {
                    config._CDNData = VerBarConfig.ReadVerBarConfig(cdnsStream);
                }

            using (var ribbit = new RibbitClient("us"))
                using (var versionsStream = ribbit.GetAsStream($"v1/products/{product}/versions"))
                {
                    config._VersionsData = VerBarConfig.ReadVerBarConfig(versionsStream);
                }

            for (int i = 0; i < config._VersionsData.Count; ++i)
            {
                if (config._VersionsData[i]["Region"] == region)
                {
                    config._versionsIndex = i;
                    break;
                }
            }

            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._VersionsData[config._versionsIndex]["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._VersionsData[config._versionsIndex]["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._versionsIndex]["BuildConfig"].ToLower();
                //string buildKey = "3b0517b51edbe0b96f6ac5ea7eaaed38";
                using Stream stream = CDNIndexHandler.OpenConfigFileDirect(config, buildKey);
                var cfg = KeyValueConfig.ReadKeyValueConfig(stream);
                config._Builds.Add(cfg);
            }

            return(config);
        }