Beispiel #1
0
        /// <summary>
        /// Opens an existing TACT container and loads the Root and Encoding files
        /// </summary>
        /// <param name="directory"></param>
        /// <param name="product"></param>
        /// <param name="locale"></param>
        public void Open(string directory, string product, Locale locale)
        {
            ConfigContainer = new Configs.ConfigContainer(product, locale);
            ConfigContainer.OpenLocal(directory);

            if (uint.TryParse(ConfigContainer?.VersionsFile?.GetValue("BuildId", locale), out uint build))
            {
                Build = build;
            }

            ApplyVersionSpecificSettings(build);

            IndexContainer = new Indices.IndexContainer();
            IndexContainer.Open(directory);

            if (!ConfigContainer.EncodingEKey.IsEmpty)
            {
                EncodingFile = new Encoding.EncodingFile(BaseDirectory, ConfigContainer.EncodingEKey);

                // Open RootFile
                if (ConfigContainer.RootCKey.Value != null && EncodingFile.TryGetCKeyEntry(ConfigContainer.RootCKey, out var rootEKey))
                {
                    RootFile = new Root.RootFile(BaseDirectory, rootEKey.EKey);
                }

                // Open InstallFile
                if (ConfigContainer.InstallCKey.Value != null && EncodingFile.TryGetCKeyEntry(ConfigContainer.InstallCKey, out var installEKey))
                {
                    InstallFile = new Install.InstallFile(BaseDirectory, installEKey.EKey);
                }

                // Open DownloadFile
                if (ConfigContainer.DownloadCKey.Value != null && EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadCKey, out var downloadEKey))
                {
                    DownloadFile = new Download.DownloadFile(BaseDirectory, downloadEKey.EKey);
                }

                // Open DownloadSizeFile
                if (ConfigContainer.DownloadSizeCKey.Value != null && EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadSizeCKey, out var downloadSizeEKey))
                {
                    DownloadSizeFile = new Download.DownloadSizeFile(BaseDirectory, downloadSizeEKey.EKey);
                }
            }

            // Open PatchFile
            if (ConfigContainer.PatchEKey.Value != null)
            {
                PatchFile = new Patch.PatchFile(BaseDirectory, ConfigContainer.PatchEKey);
            }

            ApplyVersionSpecificSettings(Build);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new TACT container populated with: defaulted configs, an index container
        /// and an empty root, encoding, install and download file
        /// </summary>
        /// <param name="product"></param>
        /// <param name="locale"></param>
        /// <param name="build"></param>
        public void Create(string product, Locale locale, uint build)
        {
            Build = build;

            ConfigContainer = new Configs.ConfigContainer(product, locale);
            ConfigContainer.Create();

            IndexContainer = new Indices.IndexContainer();
            RootFile       = new Root.RootFile();
            EncodingFile   = new Encoding.EncodingFile();
            InstallFile    = new Install.InstallFile();
            DownloadFile   = new Download.DownloadFile();

            ApplyVersionSpecificSettings(build);

            // set the default tag entries
            InstallFile.SetDefaultTags(build);
            DownloadFile.SetDefaultTags(build);
            DownloadSizeFile?.SetDefaultTags(build);
        }
Beispiel #3
0
        /// <summary>
        /// Opens an existing TACT container and loads the Root and Encoding files
        /// </summary>
        /// <param name="directory"></param>
        /// <param name="product"></param>
        /// <param name="locale"></param>
        public void Open(string directory, string product, Locale locale)
        {
            ConfigContainer = new Configs.ConfigContainer(product, locale);
            ConfigContainer.OpenLocal(directory);

            if (uint.TryParse(ConfigContainer?.VersionsFile?.GetValue("BuildId", locale), out uint build))
            {
                Build = build;
            }

            IndexContainer = new Indices.IndexContainer();
            IndexContainer.Open(directory);

            if (!ConfigContainer.EncodingEKey.IsEmpty)
            {
                EncodingFile = new Encoding.EncodingFile(BaseDirectory, ConfigContainer.EncodingEKey);

                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.RootMD5, out var rootCEntry))
                {
                    RootFile = new Root.RootFile(BaseDirectory, rootCEntry.EKey);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Streams an existing TACT container from an external CDN
        /// </summary>
        /// <param name="product"></param>
        /// <param name="locale"></param>
        public void OpenRemote(string product, Locale locale)
        {
            ManifestContainer = new Configs.ManifestContainer(product, locale);

            ConfigContainer = new Configs.ConfigContainer();
            ConfigContainer.OpenRemote(ManifestContainer);

            if (uint.TryParse(ManifestContainer?.VersionsFile?.GetValue("BuildId", locale), out uint build))
            {
                Build = build;
            }

            // stream Indicies
            IndexContainer = new Indices.IndexContainer();
            IndexContainer.OpenRemote(ConfigContainer, ManifestContainer, true);

            var cdnClient = new CDNClient(ManifestContainer);

            if (ConfigContainer.EncodingEKey.Value != null)
            {
                // Stream EncodingFile
                EncodingFile = new Encoding.EncodingFile(cdnClient, ConfigContainer.EncodingEKey);

                // Stream RootFile
                if (EncodingFile.TryGetCKeyEntry(ConfigContainer.RootCKey, out var entry))
                {
                    RootFile = new Root.RootFile(cdnClient, entry.EKeys[0]);
                }

                // Stream InstallFile
                if (ConfigContainer.InstallEKey.Value != null)
                {
                    InstallFile = new Install.InstallFile(cdnClient, ConfigContainer.InstallEKey);
                }
                else if (EncodingFile.TryGetCKeyEntry(ConfigContainer.InstallCKey, out entry))
                {
                    InstallFile = new Install.InstallFile(cdnClient, entry.EKeys[0]);
                }

                // Stream DownloadFile
                if (ConfigContainer.DownloadEKey.Value != null)
                {
                    DownloadFile = new Download.DownloadFile(cdnClient, ConfigContainer.DownloadEKey);
                }
                else if (EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadCKey, out entry))
                {
                    DownloadFile = new Download.DownloadFile(cdnClient, entry.EKeys[0]);
                }

                // Stream DownloadSizeFile
                if (ConfigContainer.DownloadSizeEKey.Value != null)
                {
                    DownloadSizeFile = new Download.DownloadSizeFile(cdnClient, ConfigContainer.DownloadSizeEKey);
                }
                else if (EncodingFile.TryGetCKeyEntry(ConfigContainer.DownloadSizeCKey, out entry))
                {
                    DownloadSizeFile = new Download.DownloadSizeFile(cdnClient, entry.EKeys[0]);
                }
            }

            // Stream PatchFile
            if (ConfigContainer.PatchEKey.Value != null)
            {
                PatchFile = new Patch.PatchFile(cdnClient, ConfigContainer.PatchEKey);
            }
        }