Exemplo n.º 1
0
        internal WoWLanguagePack(WoWInstallation wowInstallation, CultureInfo culture, IList <WoWArchiveInformation> archiveArray)
        {
            this.wowInstallation = wowInstallation;
            this.culture         = culture;
            this.wowCultureId    = string.Join(null, culture.Name.Split('-'));
            if (!localeFieldIndexDictionary.TryGetValue(this.wowCultureId, out this.localeFieldIndex))
            {
                this.localeFieldIndex = -1;
            }
            this.dataPath = IOPath.Combine(wowInstallation.DataPath, wowCultureId);

            archiveCollection = new ReadOnlyCollection <WoWArchiveInformation>(archiveArray);
        }
Exemplo n.º 2
0
 internal LanguagePackCollection(WoWInstallation wowInstallation)
 {
     this.wowInstallation = wowInstallation;
 }
Exemplo n.º 3
0
        private static WoWArchiveInformation[] FindArchives(string dataPath, string wowCultureId)
        {
            var archiveList = new List <WoWArchiveInformation>();

            foreach (string expectedArchiveName in expectedArchiveNamesCataclysm)
            {
                string archiveName = string.Format(CultureInfo.InvariantCulture, firstArchive, expectedArchiveName, wowCultureId);
                if (File.Exists(IOPath.Combine(dataPath, archiveName)))
                {
                    archiveList.Add(new WoWArchiveInformation(archiveName, WoWArchiveKind.LanguagePack));
                }
            }

            for (int i = 1; ; i++)
            {
                foreach (string expectedArchiveName in expectedExpansionArchiveNames)
                {
                    string archiveName = string.Format(CultureInfo.InvariantCulture, expansionArchive, i, expectedArchiveName, wowCultureId);
                    if (File.Exists(IOPath.Combine(dataPath, archiveName)))
                    {
                        archiveList.Add(new WoWArchiveInformation(archiveName, WoWArchiveKind.LanguagePack));
                    }
                    else if (i <= 3)
                    {
                        return(null);                                 // There are at least 3 expansion archives for cataclysm…
                    }
                    else
                    {
                        goto FindPatchArchives;
                    }
                }
            }

            FindPatchArchives :;
            var patchArchives = Directory.GetFiles(dataPath, string.Format(CultureInfo.InvariantCulture, patchArchivePattern, wowCultureId), SearchOption.TopDirectoryOnly);

            Array.Sort(patchArchives, StringComparer.InvariantCultureIgnoreCase);

            foreach (var archivePath in patchArchives)
            {
                string archiveName = IOPath.GetFileName(archivePath);
                archiveList.Add(new WoWArchiveInformation(archiveName, WoWArchiveKind.LanguagePack | WoWArchiveKind.Patch, WoWInstallation.DetectArchiveNumber(archiveName)));
            }

            return(archiveList.ToArray());
        }