Example #1
0
        /// <summary>
        /// Download and open an remote TACT container
        /// <para>Note: This will download the entire CDN so will take a while</para>
        /// </summary>
        /// <param name="url"></param>
        /// <param name="tprDirectory"></param>
        /// <param name="product"></param>
        /// <param name="locale"></param>
        public void DownloadRemote(string tprDirectory, string product, Locale locale, bool systemFileOnly = false)
        {
            ManifestContainer = new Configs.ManifestContainer(product, locale);
            ManifestContainer.DownloadRemote(BaseDirectory);

            ConfigContainer = new Configs.ConfigContainer();
            ConfigContainer.DownloadRemote(tprDirectory, ManifestContainer);

            var cdnClient      = new CDNClient(ManifestContainer);
            var queuedDownload = new QueuedDownloader(tprDirectory, cdnClient);

            if (ConfigContainer.EncodingEKey.Value != null)
            {
                // Download encoding file
                var encodingEKey = DownloadSystemFile(ConfigContainer.EncodingEKey, cdnClient, tprDirectory);
                if (encodingEKey.Value != null)
                {
                    EncodingFile = new Encoding.EncodingFile(tprDirectory, encodingEKey, true);
                }

                // Download PatchFile
                DownloadSystemFile(ConfigContainer.PatchEKey, cdnClient, tprDirectory, "patch");

                // Download RootFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.RootCKey, out var ekeyEntry))
                {
                    ekeyEntry.EKeys.ForEach(x => queuedDownload.Enqueue(x.Value.ToString()));
                }

                // Download InstallFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.InstallCKey, out ekeyEntry))
                {
                    ekeyEntry.EKeys.ForEach(x => queuedDownload.Enqueue(x.Value.ToString()));
                }

                // Download DownloadFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadCKey, out ekeyEntry))
                {
                    ekeyEntry.EKeys.ForEach(x => queuedDownload.Enqueue(x.Value.ToString()));
                }

                // Download DownloadSizeFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadSizeCKey, out ekeyEntry))
                {
                    ekeyEntry.EKeys.ForEach(x => queuedDownload.Enqueue(x.Value.ToString()));
                }

                queuedDownload.Download("data");
            }

            // Download Indices and archives
            if (!systemFileOnly)
            {
                IndexContainer = new Indices.IndexContainer();
                IndexContainer.DownloadRemote(tprDirectory, ConfigContainer, ManifestContainer);
            }

            Open(tprDirectory);
        }
Example #2
0
        /// <summary>
        /// Download and open an remote TACT container
        /// <para>Note: This will download the entire CDN so will take a while</para>
        /// </summary>
        /// <param name="url"></param>
        /// <param name="directory"></param>
        /// <param name="product"></param>
        /// <param name="locale"></param>
        public void DownloadRemote(string directory, string product, Locale locale)
        {
            ConfigContainer = new Configs.ConfigContainer(product, locale);
            ConfigContainer.DownloadRemote(directory);

            var cdnClient      = new CDNClient(ConfigContainer);
            var queuedDownload = new QueuedDownloader(directory, cdnClient);

            if (ConfigContainer.EncodingEKey.Value != null)
            {
                // Download encoding file
                var encodingEKey = DownloadSystemFile(ConfigContainer.EncodingEKey, cdnClient, directory);
                if (encodingEKey.Value != null)
                {
                    EncodingFile = new Encoding.EncodingFile(BaseDirectory, encodingEKey, true);
                }

                // Download PatchFile
                DownloadSystemFile(ConfigContainer.PatchEKey, cdnClient, directory, "patch");

                // Download RootFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.RootCKey, out var ekeyEntry))
                {
                    queuedDownload.Enqueue(ekeyEntry.EKey.ToString());
                }

                // Download InstallFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.InstallCKey, out ekeyEntry))
                {
                    queuedDownload.Enqueue(ekeyEntry.EKey.ToString());
                }

                // Download DownloadFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadCKey, out ekeyEntry))
                {
                    queuedDownload.Enqueue(ekeyEntry.EKey.ToString());
                }

                // Download DownloadSizeFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadSizeCKey, out ekeyEntry))
                {
                    queuedDownload.Enqueue(ekeyEntry.EKey.ToString());
                }

                queuedDownload.Download("data");
            }

            // Download Indices and archives
            IndexContainer = new Indices.IndexContainer();
            IndexContainer.DownloadRemote(directory, ConfigContainer);

            Open(directory, product, locale);
        }