Exemple #1
0
        /// <summary>Initializes a new instance of the <see cref="WoWInstallation"/> class.</summary>
        /// <param name="path">The installation path.</param>
        /// <exception cref="DirectoryNotFoundException"><paramref name="path"/> does not exist, or does not contain a directory named <c>Data</c>.</exception>
        /// <exception cref="FileNotFoundException">At least one of the required archives has not been found in the specified directory.</exception>
        private WoWInstallation(string path)
        {
            if (!Directory.Exists(this.wowPath = path))
            {
                throw new DirectoryNotFoundException();
            }

            if (!Directory.Exists(this.dataPath = System.IO.Path.Combine(path, "Data")))
            {
                throw new DirectoryNotFoundException();
            }

            if ((archiveArray = FindArchives(this.dataPath)) != null)
            {
                installationKind = WoWInstallationKind.Cataclysmic;
            }
            else if ((archiveArray = FindArchivesOld(this.dataPath)) != null)
            {
                installationKind = WoWInstallationKind.Classic;
            }
            else
            {
                throw new FileNotFoundException();
            }

            archiveCollection = new ReadOnlyCollection <WoWArchiveInformation>(archiveArray);

            FindLanguagePacks();
        }
        /// <summary>Initializes a new instance of the <see cref="WoWInstallation"/> class.</summary>
        /// <param name="path">The installation path.</param>
        /// <exception cref="DirectoryNotFoundException"><paramref name="path"/> does not exist, or does not contain a directory named <c>Data</c>.</exception>
        /// <exception cref="FileNotFoundException">At least one of the required archives has not been found in the specified directory.</exception>
        private WoWInstallation(string path)
        {
            if (!Directory.Exists(this.wowPath = path))
            {
                throw new DirectoryNotFoundException();
            }

            if (!Directory.Exists(this.dataPath = System.IO.Path.Combine(path, "Data")))
            {
                throw new DirectoryNotFoundException();
            }

            var detector = new WoWArchiveDetector(this.dataPath);

            archiveArray      = detector.CollectArchives();
            installationKind  = detector.DetermineInstallationKind().Value;
            archiveCollection = new ReadOnlyCollection <WoWArchiveInformation>(archiveArray);

            languagePackArray      = detector.CollectLanguagePacks(this);
            languagePackCollection = new LanguagePackCollection(this);
        }