Represents a language pack in a WoWInstallation.
Esempio n. 1
0
        /// <summary>Creates a MpqFileSystem using the specified language pack.</summary>
        /// <param name="languagePack">The language pack.</param>
        /// <param name="enforceCultureCheck">if set to <c>true</c> the culture checks will be enforced.</param>
        /// <param name="shouldParseListFiles">if set to <c>true</c> the list files will be parsed.</param>
        /// <returns>The newly created MpqFileSystem.</returns>
        public WoWMpqFileSystem CreateFileSystem(WoWLanguagePack languagePack, bool enforceCultureCheck, bool shouldParseListFiles)
        {
            if (languagePack == null)
            {
                throw new ArgumentNullException("languagePack");
            }
            if (languagePack.WoWInstallation != this)
            {
                throw new ArgumentException();
            }
#pragma warning disable 618
            if (enforceCultureCheck && installationKind == WoW.WoWInstallationKind.Classic && languagePack.DatabaseFieldIndex < 0)
#pragma warning restore 618
            {
                throw new CultureNotSupportedException(languagePack.Culture);
            }

            // Process the archive list
            var archiveInformationList = new List <WoWArchiveInformation>();
            archiveInformationList.AddRange(archiveArray);
            archiveInformationList.AddRange(languagePack.Archives);
            archiveInformationList.Sort(WoWArchiveInformationComparer.Default);
            archiveInformationList.Reverse();

            // Load the various archives and create the file system
            var wowArchiveArray = new WoWArchive[archiveInformationList.Count];

            for (int i = 0; i < wowArchiveArray.Length; i++)
            {
                var archiveInformation = archiveInformationList[i];

                var path = (archiveInformation.Kind & WoWArchiveKind.Global) == WoWArchiveKind.LanguagePack
                    ? languagePack.Path : DataPath;
                wowArchiveArray[i] = new WoWArchive(new MpqArchive(IOPath.Combine(path, archiveInformation.Filename), shouldParseListFiles), archiveInformation.Kind);
            }

            return(new WoWMpqFileSystem(wowArchiveArray, IOPath.GetFileName(languagePack.Path)));
        }
Esempio n. 2
0
 /// <summary>Creates a MpqFileSystem using the specified language pack.</summary>
 /// <param name="languagePack">The language pack.</param>
 /// <param name="shouldParseListFiles">if set to <c>true</c> the list files will be parsed.</param>
 /// <returns>The newly created MpqFileSystem.</returns>
 public WoWMpqFileSystem CreateFileSystem(WoWLanguagePack languagePack, bool shouldParseListFiles)
 {
     return(CreateFileSystem(languagePack, true, shouldParseListFiles));
 }