├── CrystalMpq.snk
├── CrystalMpq
├── ICSharpCode.SharpZipLib
│ ├── uninstallGAC.bat
│ ├── SharpZipLib.chm
│ ├── ICSharpCode.SharpZipLib.dll
│ └── installGAC.bat
├── Keys
│ ├── Blizzard Weak.xml
│ ├── ReadMe.txt
│ ├── StarCraft Map.xml
│ ├── Blizzard Strong.xml
│ ├── Warcraft 3 Map.xml
│ ├── World of Warcraft Survey.xml
│ └── World of Warcraft Macintosh Patch.xml
├── ErrorMessages.cs
├── MpqVersionNotSupportedException.cs
├── IMpqFileSystem.cs
├── HuffmanOld.txt
├── 7zip
│ ├── Compress
│ │ ├── LZ
│ │ │ ├── IMatchFinder.cs
│ │ │ └── LzOutWindow.cs
│ │ ├── LZMA
│ │ │ └── LzmaBase.cs
│ │ └── RangeCoder
│ │ │ └── RangeCoderBit.cs
│ ├── Common
│ │ └── CRC.cs
│ └── ReadMe.txt
├── Properties
│ └── AssemblyInfo.cs
├── SeedNotFoundException.cs
├── ExtensionAttribute.cs
├── MpqHashEntry.cs
├── MpqBlockTable.cs
├── MpqFormat.cs
├── MpqFileFlags.cs
├── MpqCompressionNotSupportedException.cs
├── ErrorMessages.restext
├── ErrorMessages.fr.restext
├── ResolveStreamEventArgs.cs
├── SparseCompression.cs
├── StreamEx.cs
├── MpqBlockEntry.cs
└── MpqArchive.UserData.cs
├── WoWMapExplorer
├── App.ico
├── Properties
│ ├── Settings.settings
│ ├── AssemblyInfo.cs
│ └── Settings.Designer.cs
├── app.config
└── Program.cs
├── CrystalMpq.Explorer
├── up.ico
├── App.ico
├── copy.ico
├── copy.png
├── cut.ico
├── down.ico
├── find.ico
├── find.png
├── help.ico
├── left.ico
├── left2.ico
├── minus.ico
├── new.ico
├── open.ico
├── open.png
├── paste.ico
├── plus.ico
├── redo.ico
├── right.ico
├── save.ico
├── save.png
├── undo.ico
├── export.ico
├── export.png
├── import.ico
├── preview.ico
├── right2.ico
├── right3.ico
├── saveas.ico
├── properties.ico
├── properties.png
├── exclamation.ico
├── exclamation.png
├── file icons
│ ├── font.ico
│ ├── file-gif.ico
│ ├── file-jpeg.ico
│ ├── file-text.ico
│ ├── file-tiff.ico
│ ├── file-bitmap.ico
│ ├── file-config.ico
│ ├── file-music.ico
│ ├── file-system.ico
│ ├── file-video.ico
│ ├── folder-open.ico
│ ├── font-raster.ico
│ ├── file-bitmap-16.ico
│ ├── file-config-16.ico
│ ├── file-music-16.ico
│ ├── file-mutimedia.ico
│ ├── file-richtext.ico
│ ├── file-system-16.ico
│ ├── file-text-16.ico
│ ├── file-tiff-16.ico
│ ├── file-unknown.ico
│ ├── file-video-16.ico
│ ├── folder-closed.ico
│ ├── folder-open-16.ico
│ ├── font-truetype.ico
│ ├── file-unknown-16.ico
│ ├── folder-closed-16.ico
│ ├── font-truetype-16.ico
│ └── file-mutimedia-16.ico
├── ViewerAssociationCollection.cs
├── AssociationEditionForm.cs
├── Properties
│ └── AssemblyInfo.cs
├── LocalizedCategoryAttribute.cs
├── ViewerAssociation.cs
├── LocalizedDescriptionAttribute.cs
├── LocalizedDisplayNameAttribute.cs
├── EnhancedListViews.cs
├── Viewers
│ ├── FindTextForm.cs
│ ├── HexadecimalViewer.cs
│ ├── BitmapViewer.cs
│ ├── HexadecimalViewer.Designer.cs
│ ├── TextViewerSettings.cs
│ └── SearchItemOld.txt
├── NativeMethods.cs
├── ExtractionSettingsDialog.cs
├── AssociationEditionForm.Designer.cs
├── ExtractionProgressionDialog.cs
├── Program.cs
├── PluginManager.cs
├── GeneralSettings.cs
├── EnhancedTreeView.cs
├── ExtractionProgressionForm.Designer.cs
├── OptionsForm.Designer.cs
└── ExtractionSettingsForm.cs
├── DbcViewer
├── Resources
│ └── open.png
├── Properties
│ ├── Settings.settings
│ ├── AssemblyInfo.cs
│ └── Settings.Designer.cs
├── app.config
├── Program.cs
└── MainForm.cs
├── CrystalMpq.Explorer.AudioVideo
├── play.ico
├── play.png
├── stop.ico
├── stop.png
├── pause.ico
├── pause.png
├── DirectShowLib-2005.dll
├── Properties
│ └── AssemblyInfo.cs
└── ManagedMemAllocator.cs
├── WoWSpellViewer
├── Information
│ ├── SpellAuraNames.dbc
│ └── SpellEffectNames.dbc
├── Properties
│ ├── Settings.settings
│ ├── AssemblyInfo.cs
│ └── Settings.Designer.cs
├── Genre.cs
├── app.config
├── CharacterInformation.cs
├── SpellValue.cs
└── Program.cs
├── CrystalMpq.WoWDatabases
├── Doc
│ ├── FactionGroup.dbc.txt
│ ├── AreaTable.dbc.txt
│ ├── WorldMapContinent.dbc.txt
│ ├── WorldMapArea.dbc.txt
│ ├── WorldMapContinent.dbc - 20100112.txt
│ ├── Map.dbc.txt
│ ├── Map.dbc - 20100112.txt
│ └── WorldMapOverlay.dbc.txt
├── SpellIconRecord.cs
├── PhaseRecord.cs
├── DungeonMapRecord.cs
├── Properties
│ └── AssemblyInfo.cs
├── WorldMapContinentRecord.cs
├── WorldMapAreaRecord.cs
├── WorldMapOverlayRecord.cs
├── MapRecord.cs
├── AreaTableRecord.cs
├── SpellAuraNameDictionary.cs
└── SpellEffectNameDictionary.cs
├── CrystalMpq.Explorer.BaseViewers
├── Resources
│ └── export.png
└── Properties
│ └── AssemblyInfo.cs
├── CrystalMpq.FileExtractor
├── app.config
└── Properties
│ └── AssemblyInfo.cs
├── .gitignore
├── CrystalMpq.WoW
├── WoWArchiveKind.cs
├── WoWInstallationKind.cs
├── WoWArchiveInformationComparer.cs
├── ArchiveDetection
│ ├── CataclysmicVersionHandler.cs
│ ├── PandarianVersionHandler.cs
│ ├── VersionHandler.cs
│ └── ClassicVersionHandler.cs
├── Properties
│ ├── AssemblyInfo.cs
│ └── Resources.Designer.cs
├── WoWArchive.cs
├── WoWArchiveInformation.cs
└── CultureNotSupportedException.cs
├── CrystalMpq.DataFormats
├── Properties
│ └── AssemblyInfo.cs
├── SurfaceData.cs
├── LocalizedAttribute.cs
├── IdAttribute.cs
├── ZoneMap.cs
├── KeyedClientDatabase.cs
├── JpegSurface.cs
├── KeyAttribute.cs
├── DxtSurface.cs
├── ClientDatabaseIndex.cs
└── ArgbColor.cs
├── CrystalMpq.Explorer.Extensibility
├── Properties
│ └── AssemblyInfo.cs
├── IPluginSettings.cs
├── IHost.cs
└── FileViewer.cs
├── CrystalMpq.WoW.Windows.Forms
├── Properties
│ └── AssemblyInfo.cs
├── LanguagePackDialog.cs
└── LanguagePackPickerForm.cs
├── AssemblyInfo.Common.cs
├── README
└── License.txt
/CrystalMpq.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.snk
--------------------------------------------------------------------------------
/CrystalMpq/ICSharpCode.SharpZipLib/uninstallGAC.bat:
--------------------------------------------------------------------------------
1 | gacutil /u ICSharpCode.SharpZipLib
2 |
--------------------------------------------------------------------------------
/WoWMapExplorer/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/WoWMapExplorer/App.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/up.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/up.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/App.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/copy.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/copy.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/copy.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/cut.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/cut.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/down.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/down.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/find.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/find.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/find.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/find.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/help.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/help.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/left.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/left.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/left2.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/left2.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/minus.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/minus.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/new.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/new.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/open.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/open.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/open.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/paste.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/paste.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/plus.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/plus.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/redo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/redo.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/right.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/right.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/save.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/save.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/save.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/undo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/undo.ico
--------------------------------------------------------------------------------
/DbcViewer/Resources/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/DbcViewer/Resources/open.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/export.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/export.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/export.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/export.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/import.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/import.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/preview.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/preview.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/right2.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/right2.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/right3.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/right3.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/saveas.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/saveas.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/properties.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/properties.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/properties.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/properties.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/exclamation.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/exclamation.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/exclamation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/exclamation.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/play.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.AudioVideo/play.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.AudioVideo/play.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/stop.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.AudioVideo/stop.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.AudioVideo/stop.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/font.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/font.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/pause.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.AudioVideo/pause.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.AudioVideo/pause.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-gif.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-gif.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-jpeg.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-jpeg.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-text.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-text.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-tiff.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-tiff.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-bitmap.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-bitmap.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-config.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-config.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-music.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-music.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-system.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-system.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-video.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-video.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/folder-open.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/folder-open.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/font-raster.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/font-raster.ico
--------------------------------------------------------------------------------
/WoWSpellViewer/Information/SpellAuraNames.dbc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/WoWSpellViewer/Information/SpellAuraNames.dbc
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-bitmap-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-bitmap-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-config-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-config-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-music-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-music-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-mutimedia.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-mutimedia.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-richtext.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-richtext.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-system-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-system-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-text-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-text-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-tiff-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-tiff-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-unknown.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-unknown.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-video-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-video-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/folder-closed.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/folder-closed.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/folder-open-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/folder-open-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/font-truetype.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/font-truetype.ico
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/FactionGroup.dbc.txt:
--------------------------------------------------------------------------------
1 | FactionGroup.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 ?
6 | 2 Internal Group Name
7 | 3 Localized Name
--------------------------------------------------------------------------------
/WoWSpellViewer/Information/SpellEffectNames.dbc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/WoWSpellViewer/Information/SpellEffectNames.dbc
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-unknown-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-unknown-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/folder-closed-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/folder-closed-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/font-truetype-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/font-truetype-16.ico
--------------------------------------------------------------------------------
/CrystalMpq/ICSharpCode.SharpZipLib/SharpZipLib.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq/ICSharpCode.SharpZipLib/SharpZipLib.chm
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/DirectShowLib-2005.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.AudioVideo/DirectShowLib-2005.dll
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.BaseViewers/Resources/export.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer.BaseViewers/Resources/export.png
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/file icons/file-mutimedia-16.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq.Explorer/file icons/file-mutimedia-16.ico
--------------------------------------------------------------------------------
/CrystalMpq.FileExtractor/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/CrystalMpq/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgraf812/crystalmpq/HEAD/CrystalMpq/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/CrystalMpq/Keys/Blizzard Weak.xml:
--------------------------------------------------------------------------------
1 | kmJ3BL+4gswFI7kMsawEWSchdZaNAl7aR918STcb+PrrDgqSFnVXrVG3jMtoxUJikO6fsUvBGOQwNJ6k7WrYNw==AQAB
--------------------------------------------------------------------------------
/CrystalMpq/ICSharpCode.SharpZipLib/installGAC.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd bin
3 | echo installing ICSharpCode.SharpZipLib.dll into the GAC
4 | gacutil /i ICSharpCode.SharpZipLib.dll
5 | cd ..
6 |
7 |
--------------------------------------------------------------------------------
/DbcViewer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DbcViewer/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CrystalMpq/Keys/ReadMe.txt:
--------------------------------------------------------------------------------
1 | All the keys here are keys that have ben used by Blizzard to sign MPQ archives.
2 | In order to be loaded easily by the .NET Framework, the keys have to be in the XML format understood by the framework.
3 |
4 | These XML format keys were generated from the PEM keys contained in MPQKit.
5 |
6 | MPQKit: http://www.devklog.net/mpqkit/
7 |
8 |
--------------------------------------------------------------------------------
/CrystalMpq/ErrorMessages.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Resources;
3 |
4 | namespace CrystalMpq
5 | {
6 | internal static class ErrorMessages
7 | {
8 | private static readonly ResourceManager resourceManager = new ResourceManager(typeof(ErrorMessages));
9 |
10 | public static string GetString(string name) { return resourceManager.GetString(name); }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/AreaTable.dbc.txt:
--------------------------------------------------------------------------------
1 | AreaTable.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 Map.ID
6 | 2 AreaTable.ID
7 | 3 ?
8 | 4 ?
9 | 5 ?
10 | 6 ?
11 | 7 SoundAmbience.ID
12 | 8 ZoneMusic.ID
13 | 9 ZoneIntroMusic.ID
14 | 10 Area level
15 | 12-19 Localized Area Name
16 | 20 FactionGroup.ID
17 | 21
18 | 22
19 | 23
20 | 24
21 | 25 float being -500 or -5000
22 | 26 float between 0 and 1
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #ignore thumbnails created by windows
3 | Thumbs.db
4 | #Ignore files build by Visual Studio
5 | *.obj
6 | *.exe
7 | *.pdb
8 | *.user
9 | *.aps
10 | *.pch
11 | *.vspscc
12 | *_i.c
13 | *_p.c
14 | *.ncb
15 | *.suo
16 | *.tlb
17 | *.tlh
18 | *.bak
19 | *.cache
20 | *.ilk
21 | *.log
22 | [Bb]in
23 | [Dd]ebug*/
24 | *.lib
25 | *.sbr
26 | obj/
27 | [Rr]elease*/
28 | _ReSharper*/
29 | [Tt]est[Rr]esult*
30 |
--------------------------------------------------------------------------------
/CrystalMpq/Keys/StarCraft Map.xml:
--------------------------------------------------------------------------------
1 | mk4GT8zb+ICC25a17KZBq/ygKGJ2VSO6IT5PGHJlm1KfnHBA4B6SH3xMlJ4c6eG2k7QevZv+FOhjsAHubyWq2VKqWbrIFKv2ILc2RfMn8J9EDVRxvcxh6slRrVL69D0w1tfVGjMiKq2Fym5yGoRTE7CRgDqbAbXP9LBsCNWHiJLwfxMGzHbk8pIl9oia5pvM7ofZamSHchxlpy6xa4GJ7xKN01YCNvklTL1D7uol3wkwcHc7vrF8QwuJizuA5bSg4poEGtH62BZOYi+UL/z031YK+k9CbQyM0X0pJoJoYz1TK+Y5J7vBnXCZtfcTYQ/ZzN6UcxTa57dJaiOlCh9znQ==AQAB
--------------------------------------------------------------------------------
/CrystalMpq/Keys/Blizzard Strong.xml:
--------------------------------------------------------------------------------
1 | sQZ+ziT2h8h+J/iMQpgdtH1HaJzOBE3agjU4yMPcrixaPOZoA4t8bwfey7qczfWywocYo3pleytFF+IuD4HDFl9OXN1SFyupSgMx1EGZlgbFAomnbq9MQJyMqQtMhRAjFgg4TndS7YNb+JMSAEKpkXNqY28n/EVBHD5TsMuVCL579gIenbr61dI92DDEdy790IzIG0VKWLh/KOTcTJfmDs/7HQTkGouVW+WUsfekuqNQo7ND9DBnhLjLjptxeFE2AZqYcA1ao3S9LN3GL1tWlVXFIX9c7fWqaVTQlZ2oNsI/ARVApOK3grNgqvwH6YoVYVXjNJEo5sQJsPsdV/hkdw==AQAB
--------------------------------------------------------------------------------
/CrystalMpq/Keys/Warcraft 3 Map.xml:
--------------------------------------------------------------------------------
1 | 1BwklUUQ3UvjizOBRoF5yyOVc7KD+oGOQH5i6eUk1yfs0luCC70kNucNrfqhmviywVtahRse1JtXCPrx2bd3iN8Dx91fbkxjYIOGTsjYoHKTp0BbaFkJih776fcHgnFSb+7mJcDuJVvJOXxEH6w01vo6VtujCqj1arqbyoal+xtAaczF3us5cOEp45sR1zAWTn1+7omN7VWV4QqJPaDSgBSESc0l1grO0i1VUSumayk7yBKIkb+LBvcG6WnYZHCi7VdLmaxER5m8oZfER66bheHoiSQIZf9PAY6Guw2DT5BTc54j/AaLQAKf2qcRSgQLVo5kQaddF3rCpsXoB/746Q==AQAB
--------------------------------------------------------------------------------
/CrystalMpq/Keys/World of Warcraft Survey.xml:
--------------------------------------------------------------------------------
1 | nIt1DR6nRyyKsy2qahHeMKLtacatn/KxieHcwH87wLBxKy+jZ0gycTmJ7SaTdBAEMDs/V5IPIXEtoqYnid2c63TmfGDU92oc3Ph1PWUZ2PWxBhT06HYxRdbrgHw9/I29pNPi/607x+lzPORITOgUBR6MR8au8HsQP4bn4vkJNgnSgojh48/XQOB/cAln7As1neP61NmVimoLR4Bwi3ztzfgrZaUpyeNCUrOYJmH09YIjbBySTtXOUidoPHjFrMsCWpr6xs8xbETbs7MJFL6avcUfTT67qfIZ9RsuKfnXJTIrV0kwDSjjuNXiPTmWAehSsiHIsrUXX5RNcwsSjClrnQ==AQAB
--------------------------------------------------------------------------------
/CrystalMpq/Keys/World of Warcraft Macintosh Patch.xml:
--------------------------------------------------------------------------------
1 | wOsMV0LagAWPEtEQM6b96FHFkUyGbbyda2/Dfc9dyl21E9QvX+Yw7qKRMAKPzA2TlQQLZKvXpnKXF/YIK5xa5uwg9CEHCEAYolLG4xn0FUOE0E/0PuuytI0p0ICe6rk00PifZzTr8na2wI/l/GnQbvnIVF1ck6cslATpQJ5JJVMXzoFlUABS19WESw4MXuJAS3AbMhxNWdEhVv7eO51cyGjRLy9QjogZODZTY0fSEksgBqQxNCoYVJYI/sF5K2flDsGqrIp0OdJ6teJlzg1YUjYnb6bKjlidXoHEXI2TgA/mD6O3XFIt08I9s3crOCTgICq7cgX35qrZiIVWZdRvTw==AQAB
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/WorldMapContinent.dbc.txt:
--------------------------------------------------------------------------------
1 | WorldMapContinent.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 Map.ID
6 | 2 23 for Azeroth & Outland, 14 for Kalimdor
7 | 3 47 for Azeroth & Outland, 48 for Kalimdor
8 | 4 15 for Azeroth & Outland, 9 for Kalimdor
9 | 5 61 for Azeroth & Outland, 52 for Kalimdor
10 | 6 14.5 for Azeroth & Outland, -19 for Kalimdor
11 | 7 -7 for Azeroth & Outland, -0.322498 for Kalimdor
12 | 8 0.75 everywhere
13 | 9-12 Possible map coordinates (min & max...)
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/WorldMapArea.dbc.txt:
--------------------------------------------------------------------------------
1 | WorldMapArea.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 Map.ID
6 | 2 AreaTable.ID
7 | 3 Internal Area Name
8 | 4 y1
9 | 5 y2
10 | 6 x1
11 | 7 x2
12 | 8 Flag for in-game world map information
13 |
14 | The flag works as following:
15 | If it is -1, then the map ID in field 1 works for everything
16 | If it is >=0, then the map where the zone resides is the one pointed by field 1,
17 | but the map where the zone is "seen" is the map ID in field 8
18 |
19 |
--------------------------------------------------------------------------------
/WoWMapExplorer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | (Default)
7 |
8 |
9 |
--------------------------------------------------------------------------------
/WoWSpellViewer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | (Default)
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/WorldMapContinent.dbc - 20100112.txt:
--------------------------------------------------------------------------------
1 | WorldMapContinent.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 Map.ID
6 | 2 23 for Azeroth & Outland, 14 for Kalimdor
7 | 3 47 for Azeroth & Outland, 48 for Kalimdor
8 | 4 15 for Azeroth & Outland, 9 for Kalimdor
9 | 5 61 for Azeroth & Outland, 52 for Kalimdor
10 | 6 14.5 for Azeroth & Outland, -19 for Kalimdor
11 | 7 -7 for Azeroth & Outland, -0.322498 for Kalimdor
12 | 8 0.75 for Kalimdor, 0.7 otherwise. Some scaling of sorts ?
13 | 9-12 Possible map coordinates (min & max...)
14 | 13 Is on Azeroth map ?
--------------------------------------------------------------------------------
/WoWSpellViewer/Genre.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace WoWSpellViewer
16 | {
17 | enum Genre
18 | {
19 | Male = 1,
20 | Female = 2
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CrystalMpq/MpqVersionNotSupportedException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace CrystalMpq
6 | {
7 | /// Exception thrown when the MPQ version is not recognized by the library.
8 | public sealed class MpqVersionNotSupportedException : Exception
9 | {
10 | /// Initializes a new instance of the class.
11 | internal MpqVersionNotSupportedException(ushort version)
12 | : base(ErrorMessages.GetString(string.Format("MpqVersionNotSupported", version))) { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/WoWArchiveKind.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 |
13 | namespace CrystalMpq.WoW
14 | {
15 | [Flags]
16 | public enum WoWArchiveKind
17 | {
18 | Regular = 0,
19 | Base = 1,
20 | LanguagePack = 2,
21 | Global = 3,
22 | Patch = 4
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/WoWInstallationKind.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace CrystalMpq.WoW
6 | {
7 | /// Represents the kind of installation.
8 | public enum WoWInstallationKind
9 | {
10 | /// The installation is a classic World of Warcraft installation.
11 | Classic,
12 | /// The installation is a World of Warcraft installation from Cataclysm
13 | Cataclysmic,
14 | /// The installation is a World of Warcraft installation from Mists Of Pandaria or newer.
15 | Pandarian,
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/CrystalMpq/IMpqFileSystem.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 |
14 | namespace CrystalMpq
15 | {
16 | public interface IMpqFileSystem : IDisposable
17 | {
18 | MpqFile FindFile(string filename);
19 |
20 | IList Archives { get; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CrystalMpq/HuffmanOld.txt:
--------------------------------------------------------------------------------
1 | static HuffmanItem InsertIntoList(HuffmanItem tail, HuffmanItem item)
2 | {
3 | HuffmanItem current = tail;
4 |
5 | if (current == null)
6 | return item;
7 |
8 | while (current.Weight < item.Weight)
9 | {
10 | if (current.Previous == null)
11 | {
12 | item.Previous = null;
13 | item.Next = current;
14 | current.Previous = item;
15 |
16 | return tail;
17 | }
18 | else
19 | current = current.Previous;
20 | }
21 |
22 | item.Previous = current;
23 | item.Next = current.Next;
24 | current.Next.Previous = item;
25 | current.Next = item;
26 |
27 | return item;
28 | }
--------------------------------------------------------------------------------
/CrystalMpq.WoW/WoWArchiveInformationComparer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CrystalMpq.WoW
4 | {
5 | internal sealed class WoWArchiveInformationComparer : IComparer
6 | {
7 | public static readonly WoWArchiveInformationComparer Default = new WoWArchiveInformationComparer();
8 |
9 | public int Compare(WoWArchiveInformation x, WoWArchiveInformation y)
10 | {
11 | int delta = x.PatchNumber - y.PatchNumber;
12 |
13 | if (delta == 0) return (x.Kind & WoWArchiveKind.Global) - (y.Kind & WoWArchiveKind.Global);
14 | else return delta;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/Map.dbc.txt:
--------------------------------------------------------------------------------
1 | Map.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 WMO name
6 | 2 Zone type (Enum: 0 outside, 1 group instance, 2 raid instance, 3 pvp zone, 4 arena)
7 | 3 Is it a battleground ?
8 | 4-12 Name Localized
9 | 13 Minimum level
10 | 14 Maximum level
11 | 15 Maximum player count
12 | 16 True/False ?
13 | 17 X ?
14 | 18 Y ?
15 | 19 AreaTable.ID
16 | 20-28 Horde Description Localized
17 | 29-37 Alliance Description Localized
18 | 38 LoadingScreens.ID
19 | 39 Level slices for battleground & such
20 | 40 Unknown flag
21 | 41
22 |
23 | 69 Parent Instance (Azeroth for Azeroth instances, Kalimdor for Kalimdor instances, etc)
24 | 70-71 Some position in parent instance...
--------------------------------------------------------------------------------
/CrystalMpq/7zip/Compress/LZ/IMatchFinder.cs:
--------------------------------------------------------------------------------
1 | // IMatchFinder.cs
2 |
3 | using System;
4 |
5 | namespace SevenZip.Compression.LZ
6 | {
7 | interface IInWindowStream
8 | {
9 | void SetStream(System.IO.Stream inStream);
10 | void Init();
11 | void ReleaseStream();
12 | Byte GetIndexByte(Int32 index);
13 | UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit);
14 | UInt32 GetNumAvailableBytes();
15 | }
16 |
17 | interface IMatchFinder : IInWindowStream
18 | {
19 | void Create(UInt32 historySize, UInt32 keepAddBufferBefore,
20 | UInt32 matchMaxLen, UInt32 keepAddBufferAfter);
21 | UInt32 GetMatches(UInt32[] distances);
22 | void Skip(UInt32 num);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/Map.dbc - 20100112.txt:
--------------------------------------------------------------------------------
1 | Map.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 WMO name
6 | 2 Zone type (Enum: 0 outside, 1 group instance, 2 raid instance, 3 pvp zone, 4 arena)
7 | 3 Extra information ?
8 | 4 Is it a battleground ?
9 | 5-21 Name Localized
10 | 22 AreaTable.ID
11 | 23-39 Horde Description Localized
12 | 40-56 Alliance Description Localized
13 | 57 LoadingScreens.ID
14 | 58 Some scaling ?
15 | 59 Map.ID, Parent Instance (Azeroth for Azeroth instances, Kalimdor for Kalimdor instances, etc)
16 | 60-61 Some (X,Y) position in parent instance... (Exit ?)
17 | 62 Unknown flag
18 | 63 Expansion Number
19 | 64 Zul Gurub & Ahn Qiraj 20 Flag...
20 | 65 Maximum Player Count
21 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/SpellIconRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 |
15 | namespace CrystalMpq.WoWDatabases
16 | {
17 | [StructLayout(LayoutKind.Sequential)]
18 | public struct SpellIconRecord
19 | {
20 | [Id] public int Id;
21 | public string Path;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/ArchiveDetection/CataclysmicVersionHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.IO;
5 |
6 | namespace CrystalMpq.WoW.ArchiveDetection
7 | {
8 | class CataclysmicVersionHandler : CataclysmAndUpwardsVersionHandler
9 | {
10 | protected override int ExpansionNumber { get { return 4; } }
11 |
12 | protected override IEnumerable RelevantTopLevelElements
13 | {
14 | get
15 | {
16 | return new[]
17 | {
18 | "sound",
19 | "art",
20 | "world",
21 | };
22 | }
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/CrystalMpq/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.CompilerServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq")]
16 | [assembly: AssemblyDescription("MPQ reading Library for .NET")]
17 | [assembly: AssemblyProduct("CrystalMpq")]
18 | [assembly: CLSCompliant(true)]
19 |
20 | [assembly: AssemblyVersion("1.7.2.0")]
21 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/PhaseRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 |
15 | namespace CrystalMpq.WoWDatabases
16 | {
17 | [StructLayout(LayoutKind.Sequential)]
18 | public struct PhaseRecord
19 | {
20 | /* 000 */ [Id] public int Id;
21 | /* 001 */ public string Name;
22 | /* 002 */ public int Flags;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CrystalMpq.FileExtractor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.CompilerServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq MPQ File Extractor")]
16 | [assembly: AssemblyDescription("Command-line utility for extracting files contained inside MPQ archives.")]
17 | [assembly: AssemblyProduct("CrystalMpq")]
18 |
19 | [assembly: AssemblyVersion("0.1.0.0")]
--------------------------------------------------------------------------------
/DbcViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("DBC Viewer")]
16 | [assembly: AssemblyDescription("WoW DBC file viewer")]
17 | [assembly: AssemblyProduct("DbcViewer")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("5871ff76-8ef8-4a69-97a9-9a814f0e95af")]
21 |
22 | [assembly: AssemblyVersion("1.5.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/ViewerAssociationCollection.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Collections.ObjectModel;
14 | using System.Text;
15 |
16 | namespace CrystalMpq.Explorer
17 | {
18 | class ViewerAssociationCollection : KeyedCollection
19 | {
20 | protected override string GetKeyForItem(ViewerAssociation item)
21 | {
22 | return item.Extension;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/AssociationEditionForm.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.ComponentModel;
14 | using System.Data;
15 | using System.Drawing;
16 | using System.Text;
17 | using System.Windows.Forms;
18 |
19 | namespace CrystalMpq.Explorer
20 | {
21 | public partial class AssociationEditionForm : Form
22 | {
23 | public AssociationEditionForm()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/CrystalMpq/SeedNotFoundException.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 |
13 | namespace CrystalMpq
14 | {
15 | /// Thrown when the seed for a file is not known.
16 | /// The seed is needed for reading encrypted files.
17 | public sealed class SeedNotFoundException : Exception
18 | {
19 | internal SeedNotFoundException(long block)
20 | : base(string.Format(ErrorMessages.GetString("SeedNotFound"), block)) { }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Doc/WorldMapOverlay.dbc.txt:
--------------------------------------------------------------------------------
1 | WorldMapOverlay.dbc
2 |
3 | Field Contents
4 | 0 ID
5 | 1 WorldMapArea.ID
6 | 2 AreaTable.ID
7 | 3 AreaTable.ID
8 | 4 AreaTable.ID
9 | 5 AreaTable.ID
10 | 6 0
11 | 7 0
12 | 8 Area data name
13 | 9 Width of the overlay
14 | 10 Height of the overlay
15 | 11 X position of the overlay
16 | 12 Y position of the overlay
17 | 13 Bounding box - Y1
18 | 14 Bounding box - X1
19 | 15 Bounding box - Y2
20 | 16 Bounding box - X2
21 |
22 | Overlays may be composed of one or more texture.
23 | We have the overlay's dimensions in fields 9 & 10,
24 | and a texture can have a maximum size (x or y) of 256.
25 | Based on that it's easy to calculate the number of textures used.
26 | Textures will be named Overlay1.blp Overlay2.blp ... OverlayN.blp
27 | Usually there should not be more than 4 textures
--------------------------------------------------------------------------------
/WoWSpellViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("WoW Spell Viewer")]
16 | [assembly: AssemblyDescription("WoW Spell Viewer (Experimental)")]
17 | [assembly: AssemblyProduct("WoWSpellViewer")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("65600fde-56a3-412e-bfcd-5f388fb8181b")]
21 |
22 | [assembly: AssemblyVersion("0.8.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq Explorer")]
16 | [assembly: AssemblyDescription("MPQ archive explorer")]
17 | [assembly: AssemblyProduct("CrystalMpq.Explorer")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("4d3b0a42-881d-478a-bbf4-71db58010563")]
21 |
22 | [assembly: AssemblyVersion("1.7.0.0")]
23 |
--------------------------------------------------------------------------------
/WoWMapExplorer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("WoW Map Explorer")]
16 | [assembly: AssemblyDescription("World of Warcraft world map viewer")]
17 | [assembly: AssemblyProduct("WoWMapExplorer")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("f0763c13-c1dc-4f31-9779-d1f2bf14812a")]
21 |
22 | [assembly: AssemblyVersion("1.7.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq.DataFormats")]
16 | [assembly: AssemblyDescription("File format support classes.")]
17 | [assembly: AssemblyProduct("CrystalMpq")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("4f1d7a19-e441-40d4-9c1e-af2cce0b1aa3")]
21 |
22 | [assembly: AssemblyVersion("3.0.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq.WoW")]
16 | [assembly: AssemblyDescription("Support library for access of WoW MPQ archives with CrystalMpq.")]
17 | [assembly: AssemblyProduct("CrystalMpq")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("522190a5-37e5-4b39-810e-e51f015ce129")]
21 |
22 | [assembly: AssemblyVersion("2.2.0.0")]
23 |
--------------------------------------------------------------------------------
/DbcViewer/Program.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Windows.Forms;
14 |
15 | namespace DbcViewer
16 | {
17 | static class Program
18 | {
19 | ///
20 | /// Point d'entrée principal de l'application.
21 | ///
22 | [STAThread]
23 | static void Main()
24 | {
25 | Application.EnableVisualStyles();
26 | Application.SetCompatibleTextRenderingDefault(false);
27 | Application.Run(new MainForm());
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/DungeonMapRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 |
15 | namespace CrystalMpq.WoWDatabases
16 | {
17 | [StructLayout(LayoutKind.Sequential)]
18 | public struct DungeonMapRecord
19 | {
20 | [Id] public int Id;
21 | public int Map;
22 | public int Layer;
23 | public float Left;
24 | public float Top;
25 | public float Right;
26 | public float Bottom;
27 | public int AreaId;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq.WoWDatabases")]
16 | [assembly: AssemblyDescription("Definitions for standard World of Warcraft client databases")]
17 | [assembly: AssemblyProduct("CrystalMpq")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("88a7b18a-b0f4-4337-b352-b7fa1e570fc4")]
21 |
22 | [assembly: AssemblyVersion("4.0.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq.Explorer.AudioVideo")]
16 | [assembly: AssemblyDescription("Audio and video plugin for CrystalMpq")]
17 | [assembly: AssemblyProduct("CrystalMpq.Explorer")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("53c0a2d4-5e13-4a4b-abc3-5e2e87cd55dc")]
21 |
22 | [assembly: AssemblyVersion("2.5.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.BaseViewers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq.Explorer.BaseViewers")]
16 | [assembly: AssemblyDescription("Base Viewers for CrystalMpq Explorer")]
17 | [assembly: AssemblyProduct("CrystalMpq.Explorer")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("3cc16810-d76d-447d-a2e4-a8da8e53fc44")]
21 |
22 | [assembly: AssemblyVersion("1.5.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/SurfaceData.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 |
13 | namespace CrystalMpq.DataFormats
14 | {
15 | public struct SurfaceData
16 | {
17 | public readonly IntPtr DataPointer;
18 | public readonly int Stride;
19 | public readonly int Width;
20 | public readonly int Height;
21 |
22 | public SurfaceData(int width, int height, IntPtr dataPointer, int stride)
23 | {
24 | Width = width;
25 | Height = height;
26 | DataPointer = dataPointer;
27 | Stride = stride;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.Extensibility/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq.Explorer.Extensibility")]
16 | [assembly: AssemblyDescription("Extensibility interfaces for CrystalMpq Explorer")]
17 | [assembly: AssemblyProduct("CrystalMpq.Explorer")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("733ee739-1751-4567-9fae-20ee15329579")]
21 |
22 | [assembly: AssemblyVersion("1.2.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW.Windows.Forms/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.InteropServices;
14 |
15 | [assembly: AssemblyTitle("CrystalMpq.WoW.Windows.Forms")]
16 | [assembly: AssemblyDescription("UI Support library for access of WoW MPQ archives with CrystalMpq.")]
17 | [assembly: AssemblyProduct("CrystalMpq")]
18 |
19 | [assembly: ComVisible(false)]
20 | [assembly: Guid("ce0c46de-7c45-43d4-911d-173dd975129e")]
21 |
22 | [assembly: AssemblyVersion("1.1.0.0")]
23 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/LocalizedAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 |
14 | namespace CrystalMpq.DataFormats
15 | {
16 | ///
17 | /// Specifies that a given field is localized. This class cannot be inherited.
18 | ///
19 | [Obsolete("Localized fields are not stored in a specific format anymore. This attribute should only be used for working with older DBC versions.")]
20 | [AttributeUsage(AttributeTargets.Field)]
21 | public sealed class LocalizedAttribute : Attribute
22 | {
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/IdAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 |
14 | namespace CrystalMpq.DataFormats
15 | {
16 | ///
17 | /// Specifies the presence of an ID key on a field in a record structure. This class cannot be inherited.
18 | ///
19 | [AttributeUsage(AttributeTargets.Field)]
20 | public sealed class IdAttribute : KeyAttribute
21 | {
22 | ///
23 | /// Initializes a new instance of the class.
24 | ///
25 | public IdAttribute() : base("Id") { }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/ArchiveDetection/PandarianVersionHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CrystalMpq.WoW.ArchiveDetection
4 | {
5 | class PandarianVersionHandler : CataclysmAndUpwardsVersionHandler
6 | {
7 | protected override int ExpansionNumber { get { return 5; } }
8 |
9 | protected override IEnumerable RelevantTopLevelElements
10 | {
11 | get
12 | {
13 | // There is also base-Win.MPQ, which contains the platform specific binaries of WoW
14 | return new[]
15 | {
16 | "alternate",
17 | "interface",
18 | "itemtexture",
19 | "misc",
20 | "model",
21 | "sound",
22 | "texture",
23 | "world",
24 | };
25 | }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.Extensibility/IPluginSettings.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace CrystalMpq.Explorer.Extensibility
16 | {
17 | ///
18 | /// Interface used to implement plugin settings
19 | ///
20 | public interface IPluginSettings
21 | {
22 | ///
23 | /// Resets the properties to their original values
24 | ///
25 | void Reset();
26 |
27 | ///
28 | /// Saves the changes made to the properties
29 | ///
30 | void Save();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/WoWMapExplorer/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | (Default)
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/WoWSpellViewer/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | (Default)
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/LocalizedCategoryAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.ComponentModel;
13 |
14 | namespace CrystalMpq.Explorer
15 | {
16 | sealed class LocalizedCategoryAttribute : CategoryAttribute
17 | {
18 | protected override string GetLocalizedString(string value)
19 | {
20 | string localizedString = Properties.Resources.ResourceManager.GetString("PropertyCategory" + value, Properties.Resources.Culture);
21 |
22 | if (localizedString == null)
23 | return base.GetLocalizedString(value);
24 | else
25 | return localizedString;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/ViewerAssociation.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace CrystalMpq.Explorer
16 | {
17 | [Serializable]
18 | struct ViewerAssociation
19 | {
20 | string extension;
21 | string typeName;
22 |
23 | public ViewerAssociation(string extension, string typeName) { this.extension = extension; this.typeName = typeName; }
24 |
25 | public string Extension { get { return extension; } set { extension = value; } }
26 | public string TypeName { get { return typeName; } set { typeName = value; } }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/WoWArchive.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 |
13 | namespace CrystalMpq.WoW
14 | {
15 | /// Represents an archive in a World of Warcraft installation.
16 | public struct WoWArchive
17 | {
18 | /// Gets the associated with this entry.
19 | public readonly MpqArchive Archive;
20 | /// Gets the kind of archive represented by this entry.
21 | public readonly WoWArchiveKind Kind;
22 |
23 | internal WoWArchive(MpqArchive archive, WoWArchiveKind kind)
24 | {
25 | Archive = archive;
26 | Kind = kind;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AssemblyInfo.Common.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System.Reflection;
12 | using System.Runtime.CompilerServices;
13 | using System.Runtime.InteropServices;
14 | using System.Resources;
15 | using System;
16 |
17 | #if DEBUG
18 | [assembly: AssemblyConfiguration("Debug")]
19 | #else
20 | [assembly: AssemblyConfiguration("Release")]
21 | #endif
22 | [assembly: AssemblyCompany("GoldenCrystal")]
23 | [assembly: AssemblyCopyright("Copyright © GoldenCrystal 2007-2014, Bananenbrot 2011-2014")]
24 | [assembly: AssemblyTrademark("")]
25 | [assembly: AssemblyCulture("")]
26 | [assembly: NeutralResourcesLanguage("en")]
27 |
28 | [assembly: AssemblyFileVersion("1.7.3.0")]
29 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/WorldMapContinentRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 |
15 | namespace CrystalMpq.WoWDatabases
16 | {
17 | [StructLayout(LayoutKind.Sequential)]
18 | public struct WorldMapContinentRecord
19 | {
20 | [Id] public int Id;
21 | public int Map;
22 | public int Unknown1;
23 | public int Unknown2;
24 | public int Unknown3;
25 | public int Unknown4;
26 | public float CoordX;
27 | public float CoordY;
28 | public float Scaling;
29 | public float Left;
30 | public float Top;
31 | public float Right;
32 | public float Bottom;
33 | public bool IsOnAzeroth;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/WorldMapAreaRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 | using System.Diagnostics;
15 |
16 | namespace CrystalMpq.WoWDatabases
17 | {
18 | [StructLayout(LayoutKind.Sequential)]
19 | [DebuggerDisplay("WorldMapAreaRecord: Id={Id}, DataName={DataName}")]
20 | public struct WorldMapAreaRecord
21 | {
22 | [Id] public int Id;
23 | public int Map;
24 | public int Area;
25 | public string DataName;
26 | public float BoxRight;
27 | public float BoxLeft;
28 | public float BoxBottom;
29 | public float BoxTop;
30 | public int VirtualMap;
31 | public int DungeonMapId;
32 | public int ParentId;
33 | public int Flags;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/ZoneMap.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.IO;
15 |
16 | namespace CrystalMpq.DataFormats
17 | {
18 | public sealed class ZoneMap
19 | {
20 | int[,] map;
21 |
22 | public ZoneMap(Stream stream)
23 | {
24 | BinaryReader reader = new BinaryReader(stream);
25 |
26 | map = new int[128, 128];
27 |
28 | for (int i = 0; i < 128; i++)
29 | for (int j = 0; j < 128; j++)
30 | map[j, i] = reader.ReadInt32();
31 | }
32 |
33 | public int this[int x, int y]
34 | {
35 | get
36 | {
37 | return map[x, y];
38 | }
39 | }
40 |
41 | public int Height { get { return 128; } }
42 | public int Width { get { return 128; } }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/LocalizedDescriptionAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.ComponentModel;
13 |
14 | namespace CrystalMpq.Explorer
15 | {
16 | sealed class LocalizedDescriptionAttribute : DescriptionAttribute
17 | {
18 | public LocalizedDescriptionAttribute(string description)
19 | : base(description)
20 | {
21 | }
22 |
23 | private string GetLocalizedString(string value)
24 | {
25 | string localizedString = Properties.Resources.ResourceManager.GetString("PropertyDescription" + value, Properties.Resources.Culture);
26 |
27 | if (localizedString == null)
28 | return value;
29 | else
30 | return localizedString;
31 | }
32 |
33 | public override string Description
34 | {
35 | get
36 | {
37 | return GetLocalizedString(DescriptionValue);
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/LocalizedDisplayNameAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.ComponentModel;
13 |
14 | namespace CrystalMpq.Explorer
15 | {
16 | sealed class LocalizedDisplayNameAttribute : DisplayNameAttribute
17 | {
18 | public LocalizedDisplayNameAttribute(string displayName)
19 | : base(displayName)
20 | {
21 | }
22 |
23 | private string GetLocalizedString(string value)
24 | {
25 | string localizedString = Properties.Resources.ResourceManager.GetString("PropertyDisplayName" + value, Properties.Resources.Culture);
26 |
27 | if (localizedString == null)
28 | return value;
29 | else
30 | return localizedString;
31 | }
32 |
33 | public override string DisplayName
34 | {
35 | get
36 | {
37 | return GetLocalizedString(DisplayNameValue);
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/CrystalMpq/ExtensionAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalBoy.
3 | // Copyright © 2008-2011 Fabien Barbier
4 | //
5 | // CrystalBoy is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // CrystalBoy is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program. If not, see .
17 | #endregion
18 |
19 | #if NET_FX_2 // Declare the ExtensionAttribute for versions of the BCL ≤ 3.0
20 |
21 | using System;
22 |
23 | namespace System.Runtime.CompilerServices
24 | {
25 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
26 | internal sealed class ExtensionAttribute : Attribute { }
27 | }
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/WoWArchiveInformation.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 |
13 | namespace CrystalMpq.WoW
14 | {
15 | /// Represents an archive in a World of Warcraft installation.
16 | public struct WoWArchiveInformation
17 | {
18 | /// Gets the filename of the archive represented by this entry.
19 | public readonly string Filename;
20 | /// Gets the kind of archive represented by this entry.
21 | public readonly WoWArchiveKind Kind;
22 | /// Gets the patch number associated with this entry, or zero if there is none.
23 | public readonly int PatchNumber;
24 |
25 | internal WoWArchiveInformation(string filename, WoWArchiveKind kind, int patchNumber = 0)
26 | {
27 | Filename = filename;
28 | Kind = kind;
29 | PatchNumber = patchNumber;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/WoWSpellViewer/CharacterInformation.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace WoWSpellViewer
16 | {
17 | sealed class CharacterInformation
18 | {
19 | int level;
20 | Genre genre;
21 |
22 | public CharacterInformation()
23 | {
24 | level = 1;
25 | genre = Genre.Male;
26 | }
27 |
28 | public int Level
29 | {
30 | get
31 | {
32 | return level;
33 | }
34 | set
35 | {
36 | if (value < 1)
37 | throw new ArgumentOutOfRangeException();
38 | level = value;
39 | }
40 | }
41 |
42 | public Genre Genre
43 | {
44 | get
45 | {
46 | return genre;
47 | }
48 | set
49 | {
50 | if (!Enum.IsDefined(typeof(Genre), value))
51 | throw new ArgumentOutOfRangeException("value");
52 | genre = value;
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/DbcViewer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.18033
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DbcViewer.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/CrystalMpq/MpqHashEntry.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 |
14 | namespace CrystalMpq
15 | {
16 | [StructLayout(LayoutKind.Auto)]
17 | internal struct MpqHashEntry
18 | {
19 | public static readonly MpqHashEntry Invalid = new MpqHashEntry();
20 |
21 | private uint hashA;
22 | private uint hashB;
23 | private int locale;
24 | private int block;
25 |
26 | public MpqHashEntry(uint hashA, uint hashB, int locale, int block)
27 | {
28 | this.hashA = hashA;
29 | this.hashB = hashB;
30 | this.locale = locale;
31 | this.block = block;
32 | }
33 |
34 | public bool Test(uint hashA, uint hashB) { return hashA == this.hashA && hashB == this.hashB; }
35 |
36 | public int Locale { get { return locale; } }
37 |
38 | public int Block { get { return block; } }
39 |
40 | public bool IsValid { get { return block != -1 && hashA != 0xFFFFFFFF && hashA != 0xFFFFFFFF; } }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/WorldMapOverlayRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 | using System.Diagnostics;
15 |
16 | namespace CrystalMpq.WoWDatabases
17 | {
18 | [StructLayout(LayoutKind.Sequential)]
19 | [DebuggerDisplay("WorldMapOverlayRecord: Id={Id}, DataName={DataName}")]
20 | public struct WorldMapOverlayRecord
21 | {
22 | /* 000 */ [Id] public int Id;
23 | /* 001 */ public int WorldMapArea;
24 | /* 002 */ public int Area1;
25 | /* 003 */ public int Area2;
26 | /* 004 */ public int Area3;
27 | /* 005 */ public int Area4;
28 | /* 006 */ public string DataName;
29 | /* 007 */ public int Width;
30 | /* 008 */ public int Height;
31 | /* 009 */ public int Left;
32 | /* 010 */ public int Top;
33 | /* 011 */ public int BoxTop;
34 | /* 012 */ public int BoxLeft;
35 | /* 013 */ public int BoxBottom;
36 | /* 014 */ public int BoxRight;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/EnhancedListViews.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Windows.Forms;
13 | using System.ComponentModel;
14 |
15 | namespace CrystalMpq.Explorer
16 | {
17 | internal class EnhancedListView : ListView
18 | {
19 | private bool explorerStyle;
20 |
21 | public EnhancedListView() { this.DoubleBuffered = true; }
22 |
23 | [DefaultValue(false)]
24 | [Category("Appearance")]
25 | public bool ExplorerStyle
26 | {
27 | get { return explorerStyle; }
28 | set
29 | {
30 | if (value != explorerStyle)
31 | {
32 | explorerStyle = value;
33 | UpdateVisualStyle();
34 | }
35 | }
36 | }
37 |
38 | protected override void OnHandleCreated(EventArgs e)
39 | {
40 | UpdateVisualStyle();
41 |
42 | base.OnHandleCreated(e);
43 | }
44 |
45 | private void UpdateVisualStyle() { if (NativeMethods.IsVista) NativeMethods.SetWindowTheme(Handle, explorerStyle ? "explorer" : null, null); }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/CrystalMpq/7zip/Common/CRC.cs:
--------------------------------------------------------------------------------
1 | // Common/CRC.cs
2 |
3 | namespace SevenZip
4 | {
5 | class CRC
6 | {
7 | public static readonly uint[] Table;
8 |
9 | static CRC()
10 | {
11 | Table = new uint[256];
12 | const uint kPoly = 0xEDB88320;
13 | for (uint i = 0; i < 256; i++)
14 | {
15 | uint r = i;
16 | for (int j = 0; j < 8; j++)
17 | if ((r & 1) != 0)
18 | r = (r >> 1) ^ kPoly;
19 | else
20 | r >>= 1;
21 | Table[i] = r;
22 | }
23 | }
24 |
25 | uint _value = 0xFFFFFFFF;
26 |
27 | public void Init() { _value = 0xFFFFFFFF; }
28 |
29 | public void UpdateByte(byte b)
30 | {
31 | _value = Table[(((byte)(_value)) ^ b)] ^ (_value >> 8);
32 | }
33 |
34 | public void Update(byte[] data, uint offset, uint size)
35 | {
36 | for (uint i = 0; i < size; i++)
37 | _value = Table[(((byte)(_value)) ^ data[offset + i])] ^ (_value >> 8);
38 | }
39 |
40 | public uint GetDigest() { return _value ^ 0xFFFFFFFF; }
41 |
42 | static uint CalculateDigest(byte[] data, uint offset, uint size)
43 | {
44 | CRC crc = new CRC();
45 | // crc.Init();
46 | crc.Update(data, offset, size);
47 | return crc.GetDigest();
48 | }
49 |
50 | static bool VerifyDigest(uint digest, byte[] data, uint offset, uint size)
51 | {
52 | return (CalculateDigest(data, offset, size) == digest);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Viewers/FindTextForm.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.ComponentModel;
14 | using System.Data;
15 | using System.Drawing;
16 | using System.Text;
17 | using System.Windows.Forms;
18 |
19 | namespace CrystalMpq.Explorer.Viewers
20 | {
21 | partial class FindTextForm : Form
22 | {
23 | public FindTextForm()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | public string SearchText
29 | {
30 | get
31 | {
32 | return textBox.Text;
33 | }
34 | set
35 | {
36 | textBox.Text = value;
37 | }
38 | }
39 |
40 | public bool CaseSensitive
41 | {
42 | get
43 | {
44 | return caseSensitiveCheckBox.Checked;
45 | }
46 | set
47 | {
48 | caseSensitiveCheckBox.Checked = value;
49 | }
50 | }
51 |
52 | public bool EntireWord
53 | {
54 | get
55 | {
56 | return entireWordCheckBox.Checked;
57 | }
58 | set
59 | {
60 | entireWordCheckBox.Checked = value;
61 | }
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/CrystalMpq/MpqBlockTable.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace CrystalMpq
16 | {
17 | internal struct MpqBlockTable
18 | {
19 | internal static unsafe MpqBlockTable FromMemory(uint* table, ushort* highTable, long tableLength, out uint fileCount)
20 | {
21 | var entries = new MpqBlockEntry[tableLength];
22 |
23 | fileCount = 0;
24 |
25 | if (highTable == null)
26 | for (int i = 0; i < entries.Length; i++) // Fill MpqHashTable object
27 | entries[i] = new MpqBlockEntry(*table++, *table++, *table++, *table++, ref fileCount);
28 | else
29 | for (int i = 0; i < entries.Length; i++) // Fill MpqHashTable object
30 | entries[i] = new MpqBlockEntry(*table++ | ((long)*highTable++ << 32), *table++, *table++, *table++, ref fileCount);
31 |
32 | return new MpqBlockTable(entries);
33 | }
34 |
35 | internal readonly MpqBlockEntry[] Entries;
36 |
37 | private MpqBlockTable(MpqBlockEntry[] entries) { this.Entries = entries; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.Extensibility/IHost.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Text;
13 | using System.Drawing;
14 | using System.Windows.Forms;
15 | using System.Collections.Generic;
16 |
17 | namespace CrystalMpq.Explorer.Extensibility
18 | {
19 | ///
20 | /// Defines an host for a FileViewer plugin
21 | ///
22 | public interface IHost : IWin32Window
23 | {
24 | ///
25 | /// The filename of the selected file in the host interface
26 | ///
27 | String SelectedFileName { get; }
28 | ///
29 | /// The color to use as a back color for the control
30 | ///
31 | ///
32 | /// This color can be anything choosen by the used, so use it only where you feel it should be used.
33 | ///
34 | Color ViewerBackColor { get; }
35 | ///
36 | /// Displays a message in the status bar of the host application
37 | ///
38 | /// Text of the message
39 | void StatusMessage(string text);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW.Windows.Forms/LanguagePackDialog.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Windows.Forms;
13 |
14 | namespace CrystalMpq.WoW
15 | {
16 | public sealed class LanguagePackDialog : IDisposable
17 | {
18 | LanguagePackPickerForm languagePackPickerForm;
19 |
20 | public LanguagePackDialog() { languagePackPickerForm = new LanguagePackPickerForm(); }
21 |
22 | public WoWInstallation WoWInstallation
23 | {
24 | get { return languagePackPickerForm.WoWInstallation; }
25 | set { languagePackPickerForm.WoWInstallation = value; }
26 | }
27 |
28 | public WoWLanguagePack LanguagePack
29 | {
30 | get { return languagePackPickerForm.SelectedLanguagePack; }
31 | set { languagePackPickerForm.SelectedLanguagePack = value; }
32 | }
33 |
34 | public DialogResult ShowDialog() { return languagePackPickerForm.ShowDialog(); }
35 |
36 | public DialogResult ShowDialog(IWin32Window owner) { return languagePackPickerForm.ShowDialog(owner); }
37 |
38 | public void Dispose() { languagePackPickerForm.Dispose(); }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/KeyedClientDatabase.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Collections.Generic;
14 |
15 | namespace CrystalMpq.DataFormats
16 | {
17 | public sealed class KeyedClientDatabase : ClientDatabase
18 | where TValue : struct
19 | {
20 | ClientDatabaseIndex index;
21 |
22 | public KeyedClientDatabase(Stream stream) : base(stream) { Initialize(); }
23 | public KeyedClientDatabase(Stream stream, int localeFieldIndex) : base(stream, localeFieldIndex) { Initialize(); }
24 | public KeyedClientDatabase(Stream stream, int localeFieldIndex, int localeFieldCount) : base(stream, localeFieldIndex, localeFieldCount) { Initialize(); }
25 |
26 | private void Initialize() { index = Indexes["Id"] as ClientDatabaseIndex; }
27 |
28 | public TValue this[TKey key] { get { return index[key]; } }
29 | public bool ContainsKey(TKey key) { return index.ContainsKey(key); }
30 | public bool TryGetValue(TKey key, out TValue value) { return index.TryGetValue(key, out value); }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/WoWSpellViewer/SpellValue.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace WoWSpellViewer
16 | {
17 | struct SpellValue
18 | {
19 | public static SpellValue Empty = new SpellValue();
20 |
21 | float rangeMin, rangeMax;
22 |
23 | public SpellValue(float value)
24 | {
25 | rangeMin = value;
26 | rangeMax = value;
27 | }
28 |
29 | public SpellValue(float min, float max)
30 | {
31 | rangeMin = min;
32 | rangeMax = max;
33 | }
34 |
35 | public float RangeMin
36 | {
37 | get
38 | {
39 | return rangeMin;
40 | }
41 | set
42 | {
43 | rangeMin = value;
44 | }
45 | }
46 |
47 | public float RangeMax
48 | {
49 | get
50 | {
51 | return rangeMax;
52 | }
53 | set
54 | {
55 | rangeMax = value;
56 | }
57 | }
58 |
59 | public static implicit operator SpellValue(int value)
60 | {
61 | return new SpellValue(value);
62 | }
63 |
64 | public static implicit operator SpellValue(float value)
65 | {
66 | return new SpellValue(value);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/CrystalMpq/MpqFormat.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace CrystalMpq
16 | {
17 | ///
18 | /// This enumeraction gives information about the format of a given MPQ archive
19 | ///
20 | public enum MpqFormat
21 | {
22 | /// Original MPQ format.
23 | Original = 0,
24 | /// Extended MPQ format introduced with WoW - Brurning Crusade.
25 | /// These archives can exceed the file size of 2 Gb, and possesses additionnal attributes for the contained files.
26 | BurningCrusade = 1,
27 | /// Enhanced MPQ format introduced with WoW - Cataclysm.
28 | /// These archives can provide increased performance via the new hash table format.
29 | CataclysmFirst = 2,
30 | /// Enhanced MPQ format introduced with WoW - Cataclysm.
31 | /// These archives build upon the previous format, providing more reliability and a potentially reduced file size.
32 | CataclysmSecond = 3
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Viewers/HexadecimalViewer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.ComponentModel;
14 | using System.Drawing;
15 | using System.Data;
16 | using System.Text;
17 | using System.Windows.Forms;
18 | using CrystalMpq.Explorer.Extensibility;
19 |
20 | namespace CrystalMpq.Explorer.Viewers
21 | {
22 | internal sealed partial class HexadecimalViewer : UserControl
23 | {
24 | static Font defaultFont = new Font("Courier New", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 0);
25 |
26 | public HexadecimalViewer()
27 | {
28 | InitializeComponent();
29 | base.Font = defaultFont;
30 | }
31 |
32 | public override Font Font
33 | {
34 | get
35 | {
36 | return base.Font;
37 | }
38 | set
39 | {
40 | if (value == null || value == DefaultFont)
41 | base.Font = defaultFont;
42 | else
43 | base.Font = value;
44 | }
45 | }
46 |
47 | public bool ShouldSerializeFont()
48 | {
49 | return Font != defaultFont;
50 | }
51 |
52 | public override void ResetFont()
53 | {
54 | base.Font = defaultFont;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.AudioVideo/ManagedMemAllocator.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using DirectShowLib;
14 |
15 | namespace CrystalMpq.Explorer.AudioVideo
16 | {
17 | class ManagedMemAllocator : IMemAllocator
18 | {
19 | #region IMemAllocator Implementation
20 |
21 | int IMemAllocator.Commit()
22 | {
23 | throw new NotImplementedException();
24 | }
25 |
26 | int IMemAllocator.Decommit()
27 | {
28 | throw new NotImplementedException();
29 | }
30 |
31 | int IMemAllocator.GetBuffer(out IMediaSample ppBuffer, long pStartTime, long pEndTime, AMGBF dwFlags)
32 | {
33 | throw new NotImplementedException();
34 | }
35 |
36 | int IMemAllocator.GetProperties(AllocatorProperties pProps)
37 | {
38 | throw new NotImplementedException();
39 | }
40 |
41 | int IMemAllocator.ReleaseBuffer(IMediaSample pBuffer)
42 | {
43 | throw new NotImplementedException();
44 | }
45 |
46 | int IMemAllocator.SetProperties(AllocatorProperties pRequest, AllocatorProperties pActual)
47 | {
48 | throw new NotImplementedException();
49 | }
50 |
51 | #endregion
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using System.Security;
14 |
15 | namespace CrystalMpq.Explorer
16 | {
17 | internal static class NativeMethods
18 | {
19 | public static readonly bool IsVista = IsOSVista();
20 | private static bool IsOSVista() { return Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6; }
21 |
22 | public const int TV_FIRST = 0x1100;
23 | public const int TVM_SETEXTENDEDSTYLE = TV_FIRST + 44;
24 | public const int TVS_EX_DOUBLEBUFFER = 0x0004;
25 | public const int TVS_EX_NOINDENTSTATE = 0x0008;
26 | public const int TVS_EX_AUTOHSCROLL = 0x0020;
27 | public const int TVS_EX_FADEINOUTEXPANDOS = 0x0040;
28 |
29 | [DllImport("user32")]
30 | [SuppressUnmanagedCodeSecurity]
31 | public static extern int SendMessage(IntPtr hWnd, int message, IntPtr wParam, IntPtr lParam);
32 |
33 | [DllImport("uxtheme", CharSet = CharSet.Unicode)]
34 | [SuppressUnmanagedCodeSecurity]
35 | public extern static int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/ExtractionSettingsDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows.Forms;
5 |
6 | namespace CrystalMpq.Explorer
7 | {
8 | internal sealed class ExtractionSettingsDialog
9 | {
10 | private ExtractionSettingsForm form = new ExtractionSettingsForm();
11 |
12 | public string DestinationDirectory { get; set; }
13 | public bool OverwriteFiles { get; set; }
14 | public bool Recurse { get; set; }
15 | public bool AllowRecurse { get; set; }
16 |
17 | private void PrepareForm()
18 | {
19 | if (form.Visible) throw new InvalidOperationException();
20 |
21 | form.DestinationDirectory = DestinationDirectory;
22 | form.OverwriteFiles = OverwriteFiles;
23 | form.Recurse = Recurse;
24 | form.AllowRecurse = AllowRecurse;
25 | }
26 |
27 | private void RetrieveValues()
28 | {
29 | DestinationDirectory = form.DestinationDirectory;
30 | OverwriteFiles = form.OverwriteFiles;
31 | Recurse = form.Recurse;
32 | AllowRecurse = form.AllowRecurse;
33 | }
34 |
35 | public DialogResult ShowDialog()
36 | {
37 | PrepareForm();
38 |
39 | var dialogResult = form.ShowDialog();
40 |
41 | if (dialogResult == DialogResult.OK) RetrieveValues();
42 |
43 | return dialogResult;
44 | }
45 |
46 | public DialogResult ShowDialog(IWin32Window owner)
47 | {
48 | PrepareForm();
49 |
50 | var dialogResult = form.ShowDialog(owner);
51 |
52 | if (dialogResult == DialogResult.OK) RetrieveValues();
53 |
54 | return dialogResult;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/AssociationEditionForm.Designer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | namespace CrystalMpq.Explorer
12 | {
13 | partial class AssociationEditionForm
14 | {
15 | ///
16 | /// Variable nécessaire au concepteur.
17 | ///
18 | private System.ComponentModel.IContainer components = null;
19 |
20 | ///
21 | /// Nettoyage des ressources utilisées.
22 | ///
23 | /// true si les ressources managées doivent être supprimées ; sinon, false.
24 | protected override void Dispose(bool disposing)
25 | {
26 | if (disposing && (components != null))
27 | {
28 | components.Dispose();
29 | }
30 | base.Dispose(disposing);
31 | }
32 |
33 | #region Code généré par le Concepteur Windows Form
34 |
35 | ///
36 | /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
37 | /// le contenu de cette méthode avec l'éditeur de code.
38 | ///
39 | private void InitializeComponent()
40 | {
41 | this.components = new System.ComponentModel.Container();
42 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
43 | this.Text = "AssociationEditionForm";
44 | }
45 |
46 | #endregion
47 | }
48 | }
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/MapRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 | using System.Diagnostics;
15 |
16 | namespace CrystalMpq.WoWDatabases
17 | {
18 | [StructLayout(LayoutKind.Sequential)]
19 | [DebuggerDisplay("WorldMapAreaRecord: Id={Id}, DataName={DataName}, Name={Name}")]
20 | public struct MapRecord
21 | {
22 | /* 000 */ [Id] public int Id;
23 | /* 001 */ public string DataName;
24 | /* 002 */ public int AreaType;
25 | /* 003 */ public int ExtraInformation;
26 | /* 004 */ public int Unknown1;
27 | /* 005 */ public bool IsBattleground;
28 | /* 006 */ public string Name;
29 | /* 007 */ public int AreaId;
30 | /* 008 */ public string HordeDescription;
31 | /* 009 */ public string AllianceDescription;
32 | /* 010 */ public int LoadingScreen;
33 | /* 011 */ public float MapIconScaling;
34 | /* 012 */ public int ParentMapId;
35 | /* 013 */ public float EntryCoordX;
36 | /* 014 */ public float EntryCoordY;
37 | /* 015 */ public int TimeOfDayOverride;
38 | /* 016 */ public int ExpansionNumber;
39 | /* 017 */ public int Unknown2;
40 | /* 018 */ public int MaximumPlayerCount;
41 | /* 019 */ public int PhaseMapId;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Viewers/BitmapViewer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Drawing;
13 | using Stream = System.IO.Stream;
14 | using CrystalMpq.DataFormats;
15 | using CrystalMpq.Explorer.Extensibility;
16 |
17 | namespace CrystalMpq.Explorer.Viewers
18 | {
19 | internal sealed class BitmapViewer : FileViewer
20 | {
21 | private Bitmap bitmap;
22 |
23 | public BitmapViewer(IHost host)
24 | : base(host)
25 | {
26 | DoubleBuffered = true;
27 | BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
28 | ApplySettings();
29 | }
30 |
31 | public override void ApplySettings()
32 | {
33 | BackColor = Host.ViewerBackColor;
34 | }
35 |
36 | public Bitmap Bitmap
37 | {
38 | get
39 | {
40 | return bitmap;
41 | }
42 | set
43 | {
44 | if (value != bitmap)
45 | {
46 | bitmap = value;
47 | this.BackgroundImage = bitmap;
48 | }
49 | }
50 | }
51 |
52 | protected override void OnFileChanged()
53 | {
54 | if (File == null)
55 | {
56 | Bitmap = null;
57 | return;
58 | }
59 | else
60 | {
61 | Stream stream;
62 |
63 | stream = File.Open();
64 | try
65 | {
66 | Bitmap = new Bitmap(stream);
67 | }
68 | finally
69 | {
70 | stream.Close();
71 | }
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Viewers/HexadecimalViewer.Designer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | namespace CrystalMpq.Explorer.Viewers
12 | {
13 | partial class HexadecimalViewer
14 | {
15 | ///
16 | /// Variable nécessaire au concepteur.
17 | ///
18 | private System.ComponentModel.IContainer components = null;
19 |
20 | ///
21 | /// Nettoyage des ressources utilisées.
22 | ///
23 | /// true si les ressources managées doivent être supprimées ; sinon, false.
24 | protected override void Dispose(bool disposing)
25 | {
26 | if (disposing && (components != null))
27 | {
28 | components.Dispose();
29 | }
30 | base.Dispose(disposing);
31 | }
32 |
33 | #region Code généré par le Concepteur de composants
34 |
35 | ///
36 | /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
37 | /// le contenu de cette méthode avec l'éditeur de code.
38 | ///
39 | private void InitializeComponent()
40 | {
41 | this.SuspendLayout();
42 | //
43 | // HexadecimalViewer
44 | //
45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
47 | this.Name = "HexadecimalViewer";
48 | this.ResumeLayout(false);
49 |
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/CrystalMpq/7zip/ReadMe.txt:
--------------------------------------------------------------------------------
1 | The files in this directory (the "7zip" directory) are a *slightly modified* subset of the LZMA SDK 9.20:
2 | Only the part of the LZMA SDK required for CrystalMpq to work, and all the classes are marked as internal.
3 | Some XML comments have also been fixed in order not to generate any warning.
4 |
5 | Since I am not the developper of the LZMA SDK, I claim no copyright on those files derived from the LZMA SDK.
6 | The original license (public domain, see below) still applies to these files.
7 |
8 | I do not think there is any value in those files (other than being used by CrystalMpq) over the original SDK.
9 | Consider visiting the official website at http://www.7-zip.org/sdk.html for downloading the full package of the latest LZMA SDK if you need it.
10 |
11 |
12 | Excerpt from lzma.txt in LZMA SDK 9.20:
13 |
14 | LZMA SDK 9.20
15 | -------------
16 |
17 | LZMA SDK provides the documentation, samples, header files, libraries,
18 | and tools you need to develop applications that use LZMA compression.
19 |
20 | LZMA is default and general compression method of 7z format
21 | in 7-Zip compression program (www.7-zip.org). LZMA provides high
22 | compression ratio and very fast decompression.
23 |
24 | LZMA is an improved version of famous LZ77 compression algorithm.
25 | It was improved in way of maximum increasing of compression ratio,
26 | keeping high decompression speed and low memory requirements for
27 | decompressing.
28 |
29 |
30 |
31 | LICENSE
32 | -------
33 |
34 | LZMA SDK is written and placed in the public domain by Igor Pavlov.
35 |
36 | Some code in LZMA SDK is based on public domain code from another developers:
37 | 1) PPMd var.H (2001): Dmitry Shkarin
38 | 2) SHA-256: Wei Dai (Crypto++ library)
39 |
--------------------------------------------------------------------------------
/CrystalMpq/MpqFileFlags.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 |
13 | namespace CrystalMpq
14 | {
15 | /// Flags which can be applied to files in a MPQ archive.
16 | [Flags]
17 | public enum MpqFileFlags
18 | {
19 | /// The file is compressed using DCL compression only.
20 | DclCompressed = 0x100,
21 | /// The file is compressed using Blizzard's multiple compression system.
22 | MultiCompressed = 0x200,
23 | /// The file is compressed using either method.
24 | Compressed = 0x300,
25 | /// The file is encrypted with a seed.
26 | Encrypted = 0x10000,
27 | /// The encryption seed is altered with the file offset.
28 | PositionEncrypted = 0x20000,
29 | /// The file is a patch.
30 | /// This should only be found whithin patch archives.
31 | Patch = 0x100000,
32 | /// The file is stored as a single unit and not in multiple blocks.
33 | /// This was added with Burning Crusade.
34 | SingleBlock = 0x1000000,
35 | /// The file was deleted in a patch.
36 | Deleted = 0x2000000,
37 | /// The file has a CRC for each sector.
38 | SectorCrc = 0x4000000,
39 | /// The file exists. This flag should always be set for valid files.
40 | Exists = -0x7FFFFFFF
41 | }
42 | }
--------------------------------------------------------------------------------
/CrystalMpq/MpqCompressionNotSupportedException.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 |
13 | namespace CrystalMpq
14 | {
15 | /// Thrown when a compression is not handled by the library.
16 | /// Known but unsupported compressions will be reported by their name.
17 | public sealed class MpqCompressionNotSupportedException : Exception
18 | {
19 | internal MpqCompressionNotSupportedException(byte methodId)
20 | : base(string.Format(ErrorMessages.GetString("CompressionNotSupported_Byte"), methodId)) { }
21 |
22 | internal MpqCompressionNotSupportedException(byte methodId, string methodName)
23 | : base(string.Format(ErrorMessages.GetString("CompressionNotSupported_Name"), methodName)) { }
24 |
25 | private MpqCompressionNotSupportedException(string errorMessageName, byte methodId, string methodName)
26 | : base(string.Format(ErrorMessages.GetString(errorMessageName), methodId))
27 | {
28 | CompressionMethodId = methodId;
29 | CompressionMethodName = methodName;
30 | }
31 |
32 | /// Gets the id of the unsupported compression method.
33 | /// The compression method id.
34 | public byte CompressionMethodId { get; private set; }
35 | /// Gets the name of the unsupported compression method.
36 | /// The name of the compression method.
37 | public string CompressionMethodName { get; private set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/WoWMapExplorer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.18033
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WoWMapExplorer.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("(Default)")]
29 | public global::System.Globalization.CultureInfo LanguagePackCulture {
30 | get {
31 | return ((global::System.Globalization.CultureInfo)(this["LanguagePackCulture"]));
32 | }
33 | set {
34 | this["LanguagePackCulture"] = value;
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/WoWSpellViewer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.18033
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WoWSpellViewer.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("(Default)")]
29 | public global::System.Globalization.CultureInfo LanguagePackCulture {
30 | get {
31 | return ((global::System.Globalization.CultureInfo)(this["LanguagePackCulture"]));
32 | }
33 | set {
34 | this["LanguagePackCulture"] = value;
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CrystalMpq/ErrorMessages.restext:
--------------------------------------------------------------------------------
1 | NotEnoughData=The stream does not contain enough data to form a valid MPQ archive.
2 | SeekableStreamRequired=MPQ archives can only be read from a seekable stream.
3 | SeekingBeforeBegin=Cannot seek before the beginning of the stream.
4 | InvalidArchive=The data in the stream is not a valid MPQ archive.
5 | InvalidArchiveHeader=The MPQ archive has an invalid header.
6 | MpqVersionNotSupported=MPQ version {0} is not supported.
7 | SeedNotFound=The seed for file 0x{0:X4} was not found.
8 | CompressionNotSupported_Name=The compression method “{0}” is not supported yet.
9 | CompressionNotSupported_Byte=The compression method 0x{0:X2} is unknown and not supported yet.
10 | MpqFileDeleted=The requested file has been deleted from the archive and can't be opened.
11 | PatchBaseFileNotFound=The base file for the patch “{0}” could not be resolved.
12 | PatchInfoHeaderInvalidData=Patch file entry contains invalid information.
13 | PatchInfoHeaderEndOfStream=End of stream was encountered before reading the whole patch header.
14 | PatchHeaderInvalidSignature=Invalid signature found in patch header.
15 | PatchHeaderInvalidFileSize=Incorrect file size reported in patch header.
16 | PatchHeaderInvalidBaseFileSize=The size of the base data for the patch does not match the size reported in the patch header.
17 | PatchBaseFileMD5Failed=The MD5 check on the base file's data failed.
18 | PatchXfrmChunkError=The XFRM chunk is not the last one in the patch file.
19 | PatchFinalFileMD5Failed=The MD5 check on the patched file's data failed.
20 | PatchUnknownChunk=Unknown chunk encountered in patch file: '{0}'.
21 | CopyPatchInvalidSize=Incoherent file sizes reported in the patch file.
22 | Bsd0PatchHeaderInvalidSignature=Invalid signature found in BSD0 patch header.
23 | Bsd0PatchInvalidData=Found invalid data while applying BSD0 patch.
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/JpegSurface.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 |
14 | namespace CrystalMpq.DataFormats
15 | {
16 | public sealed class JpegSurface : Surface
17 | {
18 | private byte[] data;
19 |
20 | public JpegSurface(byte[] rawData, int width, int height, bool shareBuffer = false)
21 | : base(width, height, 0, false)
22 | {
23 | if (rawData == null) throw new ArgumentNullException("rawData");
24 |
25 | data = shareBuffer ? rawData : rawData.Clone() as byte[];
26 | }
27 |
28 | public override bool CanLock { get { return false; } }
29 |
30 | protected override IntPtr LockInternal(out int stride) { throw new NotSupportedException(); }
31 |
32 | protected override void UnlockInternal() { throw new NotSupportedException(); }
33 |
34 | protected override void CopyToArgbInternal(SurfaceData surfaceData) { throw new NotSupportedException(); }
35 |
36 | public override byte[] ToArray() { return data.Clone() as byte[]; }
37 |
38 | /// Creates a stream for accessing the surface data.
39 | /// The returned stream can be used for reading the surface data.
40 | /// A stream which can be used to access the surface data.
41 | public override Stream CreateStream() { return new MemoryStream(data, false); }
42 |
43 | public override object Clone()
44 | {
45 | var clone = base.Clone() as JpegSurface;
46 |
47 | clone.data = data.Clone() as byte[];
48 |
49 | return clone;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/KeyAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace CrystalMpq.DataFormats
16 | {
17 | ///
18 | /// Specifies the presence of a key on a field in a record structure.
19 | ///
20 | [AttributeUsage(AttributeTargets.Field)]
21 | public class KeyAttribute : Attribute
22 | {
23 | string name;
24 |
25 | ///
26 | /// Initializes a new instance of the class.
27 | ///
28 | public KeyAttribute() { name = null; }
29 |
30 | ///
31 | /// Initializes a new instance of the class.
32 | ///
33 | /// The key name.
34 | /// If you do not wish to specify a name, use the parameterless constructor.
35 | /// The key name is null.
36 | /// The key name is empty.
37 | public KeyAttribute(string name)
38 | {
39 | if (name == null)
40 | throw new ArgumentNullException("name");
41 | if (name.Length < 1)
42 | throw new ArgumentOutOfRangeException("name");
43 | this.name = name;
44 | }
45 |
46 | ///
47 | /// Gets the key name.
48 | ///
49 | /// The key name.
50 | /// This value may be null.
51 | public string Name { get { return name; } }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/AreaTableRecord.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 | using CrystalMpq.DataFormats;
14 | using System.Diagnostics;
15 |
16 | namespace CrystalMpq.WoWDatabases
17 | {
18 | [StructLayout(LayoutKind.Sequential)]
19 | [DebuggerDisplay("AreaTableRecord: Id={Id}, Name={Name}")]
20 | public struct AreaTableRecord
21 | {
22 | /* 000 */ [Id] public int Id;
23 | /* 001 */ public int Map;
24 | /* 002 */ public int Parent;
25 | /* 003 */ public int UnknownId1;
26 | /* 004 */ public int Flags;
27 | /* 005 */ public int SoundPreferences;
28 | /* 006 */ public int SoundPreferencesUnderwater;
29 | /* 007 */ public int SoundAmbience;
30 | /* 008 */ public int ZoneMusic;
31 | /* 009 */ public int ZoneIntroMusic;
32 | /* 010 */ public int AreaLevel;
33 | /* 011 */ public string Name;
34 | /* 012 */ public int FactionGroup;
35 | /* 013 */ public int LiquidType1;
36 | /* 014 */ public int LiquidType2; // Never set until now, but the 3 other fields around are confirmed…
37 | /* 015 */ public int LiquidType3;
38 | /* 016 */ public int LiquidType4;
39 | /* 017 */ public float MinimumElevation;
40 | /* 018 */ public float AmbientMultiplier;
41 | /* 019 */ public int Unknown1; // 0
42 | /* 020 */ public int LightId; // Unverified
43 | /* 021 */ public int Unknown2; // 0
44 | /* 022 */ public int Unknown3;
45 | /* 023 */ public int Unknown4; // Either 0 or 675…
46 | /* 023 */ public int Unknown5;
47 | /* 023 */ public int UnknownId2;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/ExtractionProgressionDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows.Forms;
5 |
6 | namespace CrystalMpq.Explorer
7 | {
8 | internal delegate void ExtractionProcedure(ExtractionProgressionDialog progresionDialog, object state);
9 |
10 | internal sealed class ExtractionProgressionDialog
11 | {
12 | private ExtractionProgressionForm form;
13 |
14 | public ExtractionProgressionDialog() { form = new ExtractionProgressionForm(this); }
15 |
16 | public ulong TotalSize
17 | {
18 | get { return form.TotalSize; }
19 | set { form.TotalSize = value; }
20 | }
21 |
22 | public ulong ProcessedSize
23 | {
24 | get { return form.ProcessedSize; }
25 | set { form.ProcessedSize = value; }
26 | }
27 |
28 | public int TotalFileCount
29 | {
30 | get { return form.TotalFileCount; }
31 | set { form.TotalFileCount = value; }
32 | }
33 |
34 | public int ProcessedFileCount
35 | {
36 | get { return form.ProcessedFileCount; }
37 | set { form.ProcessedFileCount = value; }
38 | }
39 |
40 | public string CurrentFileName
41 | {
42 | get { return form.CurrentFileName; }
43 | set { form.CurrentFileName = value; }
44 | }
45 |
46 | public bool Cancelled { get { return form.Cancelled; } }
47 |
48 | public void UpdateFileInformation(int index, string filename) { form.UpdateFileInformation(index, filename); }
49 |
50 | public void ErrorDialog(string message)
51 | {
52 | form.ErrorDialog(message);
53 | }
54 |
55 | public DialogResult AskForOverwrite(string file, string directory, ulong newSize)
56 | {
57 | return form.AskForOverwrite(file, directory, newSize);
58 | }
59 |
60 | public DialogResult ShowDialog(IWin32Window owner, ExtractionProcedure extractionProcedure, object state = null)
61 | {
62 | return form.ShowDialog(owner, extractionProcedure, state);
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Program.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using CrystalMpq;
13 | using System.IO;
14 | using System.Windows.Forms;
15 | using System.Globalization;
16 |
17 | namespace CrystalMpq.Explorer
18 | {
19 | internal static class Program
20 | {
21 | internal static string FormatFileSize(long size) { return FormatFileSize(checked((ulong)size)); }
22 |
23 | internal static string FormatFileSize(ulong size)
24 | {
25 | CultureInfo currentCulture = Properties.Resources.Culture;
26 | double currentValue = size;
27 | string[] formatStrings = new string[]
28 | {
29 | Properties.Resources.UnitBytesFormat,
30 | Properties.Resources.UnitKiloByteFormat,
31 | Properties.Resources.UnitMegaByteFormat,
32 | Properties.Resources.UnitGigaByteFormat,
33 | Properties.Resources.UnitTeraByteFormat,
34 | Properties.Resources.UnitPetaByteFormat,
35 | Properties.Resources.UnitExaByteFormat
36 | };
37 | int formatIndex = 0;
38 |
39 | // Special case
40 | if (size == 1)
41 | return Properties.Resources.UnitByteFormat;
42 |
43 | while (currentValue >= 1024 && formatIndex < formatStrings.Length)
44 | {
45 | formatIndex++;
46 | currentValue /= 1024;
47 | }
48 |
49 | return string.Format(currentCulture, formatStrings[formatIndex], currentValue);
50 | }
51 |
52 | [STAThread]
53 | private static void Main(string[] args)
54 | {
55 | PluginManager.LoadPluginAssemblies();
56 |
57 | Application.EnableVisualStyles();
58 | Application.SetCompatibleTextRenderingDefault(false);
59 | Application.Run(new MainForm());
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/CultureNotSupportedException.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Globalization;
15 |
16 | namespace CrystalMpq.WoW
17 | {
18 | /// This exception is thrown when a culture is not supported.
19 | /// Refer to the field for information on the unsupported culture.
20 | public sealed class CultureNotSupportedException : NotSupportedException
21 | {
22 | CultureInfo cultureInfo;
23 |
24 | /// Initializes a new instance of the class.
25 | /// The unsupported culture.
26 | public CultureNotSupportedException(CultureInfo culture)
27 | : base(string.Format(Properties.Resources.Culture, Properties.Resources.UnsupportedCultureMessage, culture.DisplayName, culture.Name))
28 | { this.cultureInfo = culture; }
29 |
30 | /// Initializes a new instance of the class.
31 | /// The unsupported culture.
32 | /// The inner exception.
33 | public CultureNotSupportedException(CultureInfo culture, Exception innerException)
34 | : base(string.Format(Properties.Resources.Culture, Properties.Resources.UnsupportedCultureMessage, culture.DisplayName, culture.Name), innerException)
35 | { this.cultureInfo = culture; }
36 |
37 | /// Gets the unsupported culture.
38 | /// The unsupported culture.
39 | public CultureInfo Culture { get { return cultureInfo; } }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/CrystalMpq/ErrorMessages.fr.restext:
--------------------------------------------------------------------------------
1 | NotEnoughData=Le flux ne contient pas suffisamment de données pour former une archive MPQ valide.
2 | SeekableStreamRequired=Les archives MPQ peuvent uniquement être lues à partir de flux qui permettent la recherche.
3 | SeekingBeforeBegin=Impossible de se placer avant le début du flux.
4 | InvalidArchive=Les données dans le flux ne correspondent pas à une archive MPQ valide.
5 | InvalidArchiveHeader=L'archive MPQ possède une en-tête invalide.
6 | MpqVersionNotSupported=Le format MPQ version {0} n'est pas supporté.
7 | SeedNotFound=La clé de décryptage pour le fichier 0x{0:X4} n'a pas été trouvée.
8 | CompressionNotSupported_Name=La méthode de compression « {0} » n'est pas supportée à l'heure actuelle.
9 | CompressionNotSupported_Byte=La méthode de compression « {0:X2} » est inconnue.
10 | MpqFileDeleted=Le fichier demandé a été effacé de l'archive et ne peut être ouvert.
11 | PatchBaseFileNotFound=Le fichier de base pour le patch « {0} » n'a pas été trouvé.
12 | PatchInfoHeaderInvalidData=L'entrée de patch contient des données invalides.
13 | PatchInfoHeaderEndOfStream=La fin du fichier a été rencontrée avant d'avoir entièrement lu l'en-tête du patch.
14 | PatchHeaderInvalidSignature=Signature invalide dans l'en-tête de patch.
15 | PatchHeaderInvalidFileSize=Taille incorrecte dans l'entrée du patch.
16 | PatchHeaderInvalidBaseFileSize=La taille des données de base ne correspond pas à la taille indiquée dans l'en-tête du patch.
17 | PatchBaseFileMD5Failed=La évrification MD5 sur les données de base a échouée.
18 | PatchXfrmChunkError=Le bloc XFRM n'est aps le dernier dans le fichier patch.
19 | PatchFinalFileMD5Failed=La vérification MD5 sur les données patchées a échoué.
20 | PatchUnknownChunk=Bloc inconnu rencontré dans les données du patch: '{0}'.
21 | CopyPatchInvalidSize=Tailles de fichier incohérentes dans le patch.
22 | Bsd0PatchHeaderInvalidSignature=Signature incorrecte dans l'en-tête du patch BSD0.
23 | Bsd0PatchInvalidData=Des données incorrectes ont été rencontrées lors de l'application du patch BSD0.
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Viewers/TextViewerSettings.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Text;
13 | using System.Drawing;
14 | using System.ComponentModel;
15 | using System.Collections.Generic;
16 | using CrystalMpq.Explorer;
17 | using CrystalMpq.Explorer.Properties;
18 | using CrystalMpq.Explorer.Extensibility;
19 |
20 | namespace CrystalMpq.Explorer.Viewers
21 | {
22 | [LocalizedDisplayName("TextViewerSettings")]
23 | [LocalizedDescription("TextViewerSettings")]
24 | internal sealed class TextViewerSettings : IPluginSettings
25 | {
26 | private Encoding defaultEncoding;
27 |
28 | public TextViewerSettings() { Reset(); }
29 |
30 | [Category("Behavior")]
31 | [LocalizedDisplayName("DefaultEncoding")]
32 | [LocalizedDescription("DefaultEncoding")]
33 | [TypeConverter(typeof(EncodingConverter))]
34 | public Encoding DefaultEncoding
35 | {
36 | get { return defaultEncoding; }
37 | set
38 | {
39 | if (value == null)
40 | defaultEncoding = Encoding.UTF8;
41 | else if (value != defaultEncoding)
42 | defaultEncoding = value;
43 | }
44 | }
45 |
46 | public bool ShouldSerializeDefaultEncoding() { return defaultEncoding.WebName != "utf-8"; }
47 |
48 | public void ResetDefaultEncoding() { defaultEncoding = Encoding.UTF8; }
49 |
50 | public void Reset()
51 | {
52 | try { defaultEncoding = Encoding.GetEncoding(Settings.Default.TextViewerDefaultEncoding); }
53 | catch { defaultEncoding = Encoding.UTF8; }
54 | }
55 |
56 | public void Save()
57 | {
58 | Settings.Default.TextViewerDefaultEncoding = defaultEncoding.WebName;
59 | Settings.Default.Save();
60 | }
61 |
62 | public override string ToString() { return null; }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/ArchiveDetection/VersionHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace CrystalMpq.WoW.ArchiveDetection
7 | {
8 | abstract class VersionHandler
9 | {
10 | public bool Recognizes(string dataPath)
11 | {
12 | foreach (var file in this.RelevantTopLevelElements)
13 | {
14 | string archiveName = FormatHyphenatedArchiveName(file);
15 | if (!File.Exists(Path.Combine(dataPath, archiveName))) return false;
16 | }
17 | return true;
18 | }
19 |
20 | protected static string FormatHyphenatedArchiveName(params object[] parts)
21 | {
22 | StringBuilder sb = new StringBuilder();
23 | int i = 0;
24 | sb.Append(parts[i++]);
25 | while (i < parts.Length)
26 | {
27 | sb.Append("-")
28 | .Append(parts[i++]);
29 | }
30 | return sb.Append(".MPQ").ToString();
31 | }
32 |
33 | protected static int DetectArchiveNumber(string name)
34 | {
35 | int extensionIndex = name.LastIndexOf(".mpq", StringComparison.OrdinalIgnoreCase);
36 | int index = extensionIndex;
37 |
38 | while (--index >= 0)
39 | {
40 | char c = name[index];
41 |
42 | if (c < '0' || c > '9') { index++; break; } // The incrementation has to be done here
43 | }
44 |
45 | return Int32.Parse(name.Substring(index, extensionIndex - index));
46 | }
47 |
48 | protected abstract IEnumerable RelevantTopLevelElements { get; }
49 |
50 | protected abstract IEnumerable RelevantLanguagePackElements { get; }
51 |
52 | public abstract IList CollectArchives(string dataPath);
53 |
54 | public abstract IList CollectLanguagePackArchives(string localePath, string wowCultureId);
55 | }
56 | }
--------------------------------------------------------------------------------
/CrystalMpq.WoW.Windows.Forms/LanguagePackPickerForm.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Collections.ObjectModel;
14 | using System.ComponentModel;
15 | using System.Drawing;
16 | using System.Text;
17 | using System.Windows.Forms;
18 | using System.Globalization;
19 |
20 | namespace CrystalMpq.WoW
21 | {
22 | partial class LanguagePackPickerForm : Form
23 | {
24 | WoWInstallation wowInstallation;
25 |
26 | public LanguagePackPickerForm()
27 | {
28 | InitializeComponent();
29 | }
30 |
31 | public WoWInstallation WoWInstallation
32 | {
33 | get
34 | {
35 | return wowInstallation;
36 | }
37 | set
38 | {
39 | if (wowInstallation != value)
40 | {
41 | wowInstallation = value;
42 | languageComboBox.Items.Clear();
43 | if (wowInstallation != null)
44 | {
45 | WoWLanguagePack selectedLanguagePack = null;
46 |
47 | foreach (WoWLanguagePack languagePack in wowInstallation.LanguagePacks)
48 | {
49 | if (languagePack.Culture.TwoLetterISOLanguageName == CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
50 | selectedLanguagePack = languagePack;
51 | languageComboBox.Items.Add(languagePack);
52 | }
53 | if (selectedLanguagePack == null && wowInstallation.LanguagePacks.Count > 0)
54 | selectedLanguagePack = wowInstallation.LanguagePacks[0];
55 | languageComboBox.SelectedItem = selectedLanguagePack;
56 | }
57 | }
58 | }
59 | }
60 |
61 | public WoWLanguagePack SelectedLanguagePack
62 | {
63 | get
64 | {
65 | return languageComboBox.SelectedItem as WoWLanguagePack;
66 | }
67 | set
68 | {
69 | if (value != null && value.WoWInstallation != wowInstallation)
70 | throw new ArgumentException();
71 | languageComboBox.SelectedItem = value;
72 | }
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/SpellAuraNameDictionary.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Xml;
15 |
16 | namespace CrystalMpq.WoWDatabases
17 | {
18 | public static class SpellAuraNameDictionary
19 | {
20 | static Dictionary spellAuraNameDictionary = BuildDictionary();
21 |
22 | static Dictionary BuildDictionary()
23 | {
24 | Dictionary spellAuraNameDictionary = new Dictionary();
25 | XmlReader xmlReader = XmlReader.Create(
26 | typeof(SpellAuraNameDictionary).Assembly.GetManifestResourceStream(typeof(SpellAuraNameDictionary), "SpellAuraNames.xml"),
27 | new XmlReaderSettings()
28 | {
29 | IgnoreWhitespace = true,
30 | IgnoreComments = true,
31 | CloseInput = true,
32 | ConformanceLevel = ConformanceLevel.Document,
33 | });
34 |
35 | xmlReader.Read();
36 | xmlReader.ReadStartElement("SpellAuras");
37 |
38 | while (xmlReader.NodeType == XmlNodeType.Element)
39 | {
40 | int id;
41 | string name;
42 |
43 | if (xmlReader.Name != "SpellAura")
44 | if (!xmlReader.ReadToNextSibling("SpellAura"))
45 | continue;
46 |
47 | xmlReader.MoveToAttribute("Id");
48 | xmlReader.ReadAttributeValue();
49 | id = int.Parse(xmlReader.Value);
50 | xmlReader.MoveToAttribute("Name");
51 | xmlReader.ReadAttributeValue();
52 | name = xmlReader.Value;
53 | xmlReader.Skip();
54 |
55 | spellAuraNameDictionary.Add(id, name);
56 | }
57 |
58 | xmlReader.ReadEndElement();
59 |
60 | return spellAuraNameDictionary;
61 | }
62 |
63 | public static string GetAuraName(int id)
64 | {
65 | string name;
66 |
67 | if (spellAuraNameDictionary.TryGetValue(id, out name))
68 | return name;
69 | else
70 | return id.ToString();
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/CrystalMpq.WoWDatabases/SpellEffectNameDictionary.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Xml;
15 |
16 | namespace CrystalMpq.WoWDatabases
17 | {
18 | public static class SpellEffectNameDictionary
19 | {
20 | static Dictionary spellEffectNameDictionary = BuildDictionary();
21 |
22 | static Dictionary BuildDictionary()
23 | {
24 | Dictionary spellEffectNameDictionary = new Dictionary();
25 | XmlReader xmlReader = XmlReader.Create(
26 | typeof(SpellEffectNameDictionary).Assembly.GetManifestResourceStream(typeof(SpellEffectNameDictionary), "SpellEffectNames.xml"),
27 | new XmlReaderSettings()
28 | {
29 | IgnoreWhitespace = true,
30 | IgnoreComments = true,
31 | CloseInput = true,
32 | ConformanceLevel = ConformanceLevel.Document,
33 | });
34 |
35 | xmlReader.Read();
36 | xmlReader.ReadStartElement("SpellEffects");
37 |
38 | while (xmlReader.NodeType == XmlNodeType.Element)
39 | {
40 | int id;
41 | string name;
42 |
43 | if (xmlReader.Name != "SpellEffect")
44 | if (!xmlReader.ReadToNextSibling("SpellEffect"))
45 | continue;
46 |
47 | xmlReader.MoveToAttribute("Id");
48 | xmlReader.ReadAttributeValue();
49 | id = int.Parse(xmlReader.Value);
50 | xmlReader.MoveToAttribute("Name");
51 | xmlReader.ReadAttributeValue();
52 | name = xmlReader.Value;
53 | xmlReader.Skip();
54 |
55 | spellEffectNameDictionary.Add(id, name);
56 | }
57 |
58 | xmlReader.ReadEndElement();
59 |
60 | return spellEffectNameDictionary;
61 | }
62 |
63 | public static string GetEffectName(int id)
64 | {
65 | string name;
66 |
67 | if (spellEffectNameDictionary.TryGetValue(id, out name))
68 | return name;
69 | else
70 | return id.ToString();
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/CrystalMpq/ResolveStreamEventArgs.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Collections.Generic;
14 | using System.Text;
15 |
16 | namespace CrystalMpq
17 | {
18 | /// is used for applying a patch.
19 | /// It is the responsibility to provide a valid stream.
20 | public sealed class ResolveStreamEventArgs : EventArgs, IDisposable
21 | {
22 | private Stream stream;
23 |
24 | internal ResolveStreamEventArgs() { } // Even though this class is quite simple and could have other uses, we don't want anyone to use it for unintended pruposes…
25 |
26 | /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
27 | public void Dispose()
28 | {
29 | stream.Dispose();
30 | stream = null;
31 | }
32 |
33 | /// Gets or sets the stream containing the data for the base file.
34 | /// The instance of will take ownership of the stream.
35 | /// The stream.
36 | public Stream Stream
37 | {
38 | get { return stream; }
39 | set
40 | {
41 | if (value != stream)
42 | {
43 | if (stream != null) stream.Dispose();
44 | stream = value;
45 | }
46 | }
47 | }
48 |
49 | /// Transfers the stream ownership to the caller.
50 | ///
51 | /// This method will return the value of and set the property to null afterwards.
52 | /// After a call to this method, the caller becomes responsible for managing the stream.
53 | ///
54 | /// The previously contained in this instance.
55 | internal Stream TransferStreamOwnership()
56 | {
57 | var stream = this.stream;
58 | this.stream = null;
59 | return stream;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/CrystalMpq/SparseCompression.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace CrystalMpq
16 | {
17 | internal static class SparseCompression
18 | {
19 | public static int CompressBlock(byte[] inBuffer, byte[] outBuffer)
20 | {
21 | throw new NotImplementedException();
22 | }
23 |
24 | public static unsafe int DecompressBlock(byte[] inBuffer, int offset, int count, byte[] outBuffer)
25 | {
26 | if (inBuffer == null) throw new ArgumentNullException("inBuffer");
27 | if (outBuffer == null) throw new ArgumentNullException("outBuffer");
28 |
29 | if (offset < 0 || offset > inBuffer.Length) throw new ArgumentOutOfRangeException("offset");
30 | if (count < 0 || checked(offset + count) > inBuffer.Length) throw new ArgumentOutOfRangeException("count");
31 |
32 | fixed (byte* inBufferPointer = inBuffer, outBufferPointer = outBuffer)
33 | return DecompressBlock(inBufferPointer + offset, count, outBufferPointer, outBuffer.Length);
34 | }
35 |
36 | public static unsafe int DecompressBlock(byte* inBuffer, int inLength, byte* outBuffer, int outLength)
37 | {
38 | if (inLength < 5)
39 | {
40 | int chunkLength = Math.Min(inLength, outLength);
41 |
42 | for (int i = chunkLength; i != 0; i--) *outBuffer++ = *inBuffer++;
43 |
44 | return chunkLength;
45 | }
46 |
47 | outLength = Math.Min((((((*inBuffer++ << 8) | *inBuffer++) << 8) | *inBuffer++) << 8) | *inBuffer++, outLength);
48 |
49 | if (outLength == 0) return 0;
50 |
51 | int length = outLength;
52 |
53 | do
54 | {
55 | byte chunkInfo = *inBuffer++;
56 | bool chunkIsData = (chunkInfo & 0x80) != 0;
57 | int chunkLength = Math.Min((chunkInfo & 0x7F) + (chunkIsData ? 1 : 3), length);
58 |
59 | length -= chunkLength;
60 |
61 | if (!chunkIsData) while (chunkLength-- != 0) *outBuffer++ = 0;
62 | else while (chunkLength != 0) *outBuffer++ = *inBuffer++;
63 | }
64 | while (length != 0);
65 |
66 | return outLength;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/PluginManager.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Reflection;
14 | using System.Collections.Generic;
15 | using System.Windows.Forms;
16 | using System.Text;
17 | using CrystalMpq.Explorer.Properties;
18 |
19 | namespace CrystalMpq.Explorer
20 | {
21 | // TODO: Make a better plugin loading exception mechanism
22 | // TODO: Migrate to MEF ?
23 | internal sealed class PluginManager
24 | {
25 | private static List assemblyList;
26 |
27 | static PluginManager() { assemblyList = new List(); }
28 |
29 | public static void LoadPluginAssemblies()
30 | {
31 | string assemblyDirectory, pluginsDirectory;
32 |
33 | assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
34 | pluginsDirectory = Path.Combine(assemblyDirectory, Settings.Default.PluginsDirectory);
35 |
36 | LoadDirectoryAssemblies(pluginsDirectory);
37 | }
38 |
39 | public static T[] LoadPlugins(Type[] parameterTypes, object[] parameters)
40 | {
41 | var loadedPlugins = new List();
42 |
43 | for (int i = 0; i < assemblyList.Count; i++)
44 | {
45 | var assemblyTypes = assemblyList[i].GetExportedTypes();
46 |
47 | for (int j = 0; j < assemblyTypes.Length; j++)
48 | {
49 | var type = assemblyTypes[j];
50 |
51 | try
52 | {
53 | if (typeof(T).IsAssignableFrom(type))
54 | {
55 | var constructor = type.GetConstructor(parameterTypes);
56 |
57 | if (constructor != null)
58 | try { loadedPlugins.Add((T)constructor.Invoke(parameters)); }
59 | catch { }
60 | }
61 | }
62 | catch (TypeLoadException) { }
63 | }
64 | }
65 |
66 | return loadedPlugins.ToArray();
67 | }
68 |
69 | private static void LoadDirectoryAssemblies(string directory)
70 | {
71 | foreach (var assemblyFile in Directory.GetFiles(directory, "*.dll", SearchOption.TopDirectoryOnly))
72 | assemblyList.Add(LoadPluginAssembly(assemblyFile));
73 | }
74 |
75 | private static Assembly LoadPluginAssembly(string filename) { return Assembly.LoadFrom(filename); }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/GeneralSettings.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Drawing;
14 | using System.Drawing.Design;
15 | using System.ComponentModel;
16 | using System.Collections.Generic;
17 | using System.Windows.Forms.Design;
18 | using CrystalMpq.Explorer.Properties;
19 | using CrystalMpq.Explorer.Extensibility;
20 |
21 | namespace CrystalMpq.Explorer
22 | {
23 | [LocalizedDisplayName("GeneralSettings")]
24 | [LocalizedDescription("GeneralSettings")]
25 | sealed class GeneralSettings : IPluginSettings
26 | {
27 | Color viewerBackColor;
28 | string pluginsDirectory;
29 | List associations;
30 |
31 | public GeneralSettings()
32 | {
33 | associations = new List();
34 | Reset();
35 | }
36 |
37 | [Category("Appearance")]
38 | [LocalizedDisplayName("ViewerBackColor")]
39 | [LocalizedDescription("ViewerBackColor")]
40 | [DefaultValue(typeof(Color), "SlateGray")]
41 | public Color ViewerBackColor
42 | {
43 | get
44 | {
45 | return viewerBackColor;
46 | }
47 | set
48 | {
49 | viewerBackColor = value;
50 | }
51 | }
52 |
53 | [LocalizedDisplayName("PluginsDirectory")]
54 | [LocalizedDescription("PluginsDirectory")]
55 | [Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
56 | [DefaultValue("Plugins")]
57 | public string PluginsDirectory
58 | {
59 | get
60 | {
61 | return pluginsDirectory;
62 | }
63 | set
64 | {
65 | if (Directory.Exists(Path.Combine(Path.GetDirectoryName(typeof(GeneralSettings).Assembly.Location), value)))
66 | pluginsDirectory = value;
67 | else
68 | throw new DirectoryNotFoundException();
69 | }
70 | }
71 |
72 | public void Reset()
73 | {
74 | viewerBackColor = Settings.Default.ViewerBackColor;
75 | pluginsDirectory = Settings.Default.PluginsDirectory;
76 | }
77 |
78 | public void Save()
79 | {
80 | Settings.Default.ViewerBackColor = viewerBackColor;
81 | Settings.Default.PluginsDirectory = pluginsDirectory;
82 | Settings.Default.Save();
83 | }
84 |
85 | public override string ToString()
86 | {
87 | return null;
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/CrystalMpq/StreamEx.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 |
14 | namespace CrystalMpq
15 | {
16 | internal static class StreamEx
17 | {
18 | [ThreadStatic]
19 | private static byte[] buffer;
20 |
21 | private static byte[] Buffer { get { return buffer ?? (buffer = new byte[16]); } }
22 |
23 | public static short ReadInt16(this Stream @this)
24 | {
25 | var buffer = Buffer;
26 |
27 | if (@this.Read(buffer, 0, sizeof(short)) != sizeof(short)) throw new EndOfStreamException();
28 |
29 | return (short)(buffer[0] | buffer[1] << 8);
30 | }
31 |
32 | public static ushort ReadUInt16(this Stream @this)
33 | {
34 | var buffer = Buffer;
35 |
36 | if (@this.Read(buffer, 0, sizeof(ushort)) != sizeof(ushort)) throw new EndOfStreamException();
37 |
38 | return (ushort)(buffer[0] | buffer[1] << 8);
39 | }
40 |
41 | public static int ReadInt32(this Stream @this)
42 | {
43 | var buffer = Buffer;
44 |
45 | if (@this.Read(buffer, 0, sizeof(int)) != sizeof(int)) throw new EndOfStreamException();
46 |
47 | return buffer[0] | buffer[1] << 8 | buffer[2] << 16 | buffer[3] << 24;
48 | }
49 |
50 | public static uint ReadUInt32(this Stream @this)
51 | {
52 | var buffer = Buffer;
53 |
54 | if (@this.Read(buffer, 0, sizeof(uint)) != sizeof(uint)) throw new EndOfStreamException();
55 |
56 | return (uint)(buffer[0] | buffer[1] << 8 | buffer[2] << 16 | buffer[3] << 24);
57 | }
58 |
59 | public static long ReadInt64(this Stream @this)
60 | {
61 | var buffer = Buffer;
62 |
63 | if (@this.Read(buffer, 0, sizeof(long)) != sizeof(long)) throw new EndOfStreamException();
64 |
65 | return (long)(uint)(buffer[0] | buffer[1] << 8 | buffer[2] << 16 | buffer[3] << 24) | (long)buffer[4] << 32 | (long)buffer[5] << 40 | (long)buffer[6] << 48 | (long)buffer[7] << 56;
66 | }
67 |
68 | public static ulong ReadUInt64(this Stream @this)
69 | {
70 | var buffer = Buffer;
71 |
72 | if (@this.Read(buffer, 0, sizeof(ulong)) != sizeof(ulong)) throw new EndOfStreamException();
73 |
74 | return (ulong)(uint)(buffer[0] | buffer[1] << 8 | buffer[2] << 16 | buffer[3] << 24) | (ulong)buffer[4] << 32 | (ulong)buffer[5] << 40 | (ulong)buffer[6] << 48 | (ulong)buffer[7] << 56;
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/EnhancedTreeView.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Windows.Forms;
13 | using System.ComponentModel;
14 |
15 | namespace CrystalMpq.Explorer
16 | {
17 | internal class EnhancedTreeView : TreeView
18 | {
19 | private bool explorerStyle;
20 | private bool fadePlusMinus;
21 | private bool autoHorizontalScroll;
22 |
23 | public EnhancedTreeView() { }
24 |
25 | [DefaultValue(false)]
26 | [Category("Appearance")]
27 | public bool ExplorerStyle
28 | {
29 | get { return explorerStyle; }
30 | set
31 | {
32 | if (value != explorerStyle)
33 | {
34 | explorerStyle = value;
35 | UpdateVisualStyle();
36 | }
37 | }
38 | }
39 |
40 | [DefaultValue(false)]
41 | [Category("Appearance")]
42 | public bool FadePlusMinus
43 | {
44 | get { return fadePlusMinus; }
45 | set
46 | {
47 | if (value != fadePlusMinus)
48 | {
49 | fadePlusMinus = value;
50 | UpdateExtendedStyles();
51 | }
52 | }
53 | }
54 |
55 | [DefaultValue(false)]
56 | [Category("Appearance")]
57 | public bool AutoHorizontalScroll
58 | {
59 | get { return autoHorizontalScroll; }
60 | set
61 | {
62 | if (value != autoHorizontalScroll)
63 | {
64 | autoHorizontalScroll = value;
65 | UpdateExtendedStyles();
66 | }
67 | }
68 | }
69 |
70 | protected override void OnHandleCreated(EventArgs e)
71 | {
72 | UpdateExtendedStyles();
73 | UpdateVisualStyle();
74 |
75 | base.OnHandleCreated(e);
76 | }
77 |
78 | private void UpdateExtendedStyles()
79 | {
80 | if (NativeMethods.IsVista)
81 | {
82 | int styles = 0;
83 |
84 | styles |= NativeMethods.TVS_EX_DOUBLEBUFFER;
85 | if (autoHorizontalScroll) styles |= NativeMethods.TVS_EX_AUTOHSCROLL;
86 | if (fadePlusMinus) styles |= NativeMethods.TVS_EX_FADEINOUTEXPANDOS;
87 | styles |= NativeMethods.TVS_EX_NOINDENTSTATE;
88 |
89 | NativeMethods.SendMessage(Handle, NativeMethods.TVM_SETEXTENDEDSTYLE, (IntPtr)(NativeMethods.TVS_EX_DOUBLEBUFFER | NativeMethods.TVS_EX_AUTOHSCROLL | NativeMethods.TVS_EX_FADEINOUTEXPANDOS | NativeMethods.TVS_EX_NOINDENTSTATE), (IntPtr)styles);
90 | }
91 | }
92 |
93 | private void UpdateVisualStyle() { if (NativeMethods.IsVista) NativeMethods.SetWindowTheme(Handle, explorerStyle ? "explorer" : null, null); }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/CrystalMpq/MpqBlockEntry.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 |
14 | namespace CrystalMpq
15 | {
16 | //[StructLayout(LayoutKind.Auto)]
17 | internal struct MpqBlockEntry
18 | {
19 | public string Name;
20 | public long Offset;
21 | public uint CompressedSize;
22 | public uint UncompressedSize;
23 | public MpqFileFlags Flags;
24 | public uint FileIndex;
25 | public uint Seed;
26 | public bool Listed;
27 |
28 | internal MpqBlockEntry(long offset, uint compressedSize, uint uncompressedSize, uint flags, ref uint fileIndex)
29 | {
30 | this.Offset = offset;
31 | this.CompressedSize = compressedSize;
32 | this.UncompressedSize = uncompressedSize;
33 | this.Flags = unchecked((MpqFileFlags)flags);
34 | this.Name = "";
35 | this.FileIndex = (this.Flags & MpqFileFlags.Exists) != 0 ? fileIndex++ : 0;
36 | this.Seed = 0;
37 | this.Listed = false;
38 | }
39 |
40 | /// Called internally when the name has been detected.
41 | /// Detected filename.
42 | /// If set to true, remember the filename.
43 | /// If set to true, the name was detected from the listfile.
44 | /// Right now, the method will only update the seed when needed.
45 | internal void OnNameDetected(string name, bool cache = false, bool listed = false)
46 | {
47 | if (!string.IsNullOrEmpty(this.Name)) return;
48 |
49 | // TODO: Improve the name caching mechanism (Global hash table for MPQ archives ?)
50 | if (cache || (this.Flags & MpqFileFlags.Encrypted) != 0)
51 | this.Seed = ComputeSeed(name);
52 | if (cache || (this.Flags & MpqFileFlags.Patch) != 0)
53 | this.Name = name; // Always cache the filename if the file is a patch… This is needed for base file lookup.
54 | if (cache) this.Listed = listed;
55 | }
56 |
57 | private static uint ComputeSeed(string filename)
58 | {
59 | // Calculate the seed based on the file name and not the full path.
60 | // I really don't know why but it worked with the full path for a lot of files…
61 | // But now it's fixed at least
62 | int index = filename.LastIndexOf('\\');
63 | return CommonMethods.Hash(index >= 0 ? filename.Substring(index + 1) : filename, 0x300);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/CrystalMpq/7zip/Compress/LZ/LzOutWindow.cs:
--------------------------------------------------------------------------------
1 | // LzOutWindow.cs
2 |
3 | namespace SevenZip.Compression.LZ
4 | {
5 | internal class OutWindow
6 | {
7 | byte[] _buffer = null;
8 | uint _pos;
9 | uint _windowSize = 0;
10 | uint _streamPos;
11 | System.IO.Stream _stream;
12 |
13 | public uint TrainSize = 0;
14 |
15 | public void Create(uint windowSize)
16 | {
17 | if (_windowSize != windowSize)
18 | {
19 | // System.GC.Collect();
20 | _buffer = new byte[windowSize];
21 | }
22 | _windowSize = windowSize;
23 | _pos = 0;
24 | _streamPos = 0;
25 | }
26 |
27 | public void Init(System.IO.Stream stream, bool solid)
28 | {
29 | ReleaseStream();
30 | _stream = stream;
31 | if (!solid)
32 | {
33 | _streamPos = 0;
34 | _pos = 0;
35 | TrainSize = 0;
36 | }
37 | }
38 |
39 | public bool Train(System.IO.Stream stream)
40 | {
41 | long len = stream.Length;
42 | uint size = (len < _windowSize) ? (uint)len : _windowSize;
43 | TrainSize = size;
44 | stream.Position = len - size;
45 | _streamPos = _pos = 0;
46 | while (size > 0)
47 | {
48 | uint curSize = _windowSize - _pos;
49 | if (size < curSize)
50 | curSize = size;
51 | int numReadBytes = stream.Read(_buffer, (int)_pos, (int)curSize);
52 | if (numReadBytes == 0)
53 | return false;
54 | size -= (uint)numReadBytes;
55 | _pos += (uint)numReadBytes;
56 | _streamPos += (uint)numReadBytes;
57 | if (_pos == _windowSize)
58 | _streamPos = _pos = 0;
59 | }
60 | return true;
61 | }
62 |
63 | public void ReleaseStream()
64 | {
65 | Flush();
66 | _stream = null;
67 | }
68 |
69 | public void Flush()
70 | {
71 | uint size = _pos - _streamPos;
72 | if (size == 0)
73 | return;
74 | _stream.Write(_buffer, (int)_streamPos, (int)size);
75 | if (_pos >= _windowSize)
76 | _pos = 0;
77 | _streamPos = _pos;
78 | }
79 |
80 | public void CopyBlock(uint distance, uint len)
81 | {
82 | uint pos = _pos - distance - 1;
83 | if (pos >= _windowSize)
84 | pos += _windowSize;
85 | for (; len > 0; len--)
86 | {
87 | if (pos >= _windowSize)
88 | pos = 0;
89 | _buffer[_pos++] = _buffer[pos++];
90 | if (_pos >= _windowSize)
91 | Flush();
92 | }
93 | }
94 |
95 | public void PutByte(byte b)
96 | {
97 | _buffer[_pos++] = b;
98 | if (_pos >= _windowSize)
99 | Flush();
100 | }
101 |
102 | public byte GetByte(uint distance)
103 | {
104 | uint pos = _pos - distance - 1;
105 | if (pos >= _windowSize)
106 | pos += _windowSize;
107 | return _buffer[pos];
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | This is a modified version by me to make it work with WoW 5.0 while
2 | providing a solid base for further addons. The original code is hosted
3 | at https://code.google.com/p/crystalmpq/.
4 |
5 | CrystalMpq
6 | ==========
7 |
8 | CrystalMpq is a MPQ reading library written in C#.
9 | The source code is released under the Ms-RL licence.
10 |
11 | If you're not a developper you'll probably be interrested in CrystalMpq Explorer which lets you access to the files in mpq archives or in a whole WoW installation, or in WoWMapExplorer which lets you browse the 2D maps usually shown in-game.
12 |
13 | This project consists of the library and tools written around it:
14 |
15 | * CrystalMpq is the core library. This is definitely the one you need if you want to read data from MPQ. Data is accessed using standard .NET streams, meaning the library should be useable with all CLS compliant languages. (Partial support for MPQ up to version 4, patch archives are supported)
16 | * CrystalMpq.Utility is a library with extensions allowing for Mpq file systems, and support for WoW installation detection. (Support for WoW 4.0+)
17 | * CrystalMpq.Utility.Windows.Forms is a library extending the previous one (separated from it in order to allow UI toolkit independence), managing an user interface for language pack selection. (WoW file system only)
18 | * CrystalMpq.DataFormats is a library giving support for some WoW file formats. Currently supported are DBC, BLP1 (War III) and BLP2 (WoW).
19 | * CrystalMpq.WoWDatabases is the most recent library, containing only definitions for some specific DBC files, as well as some spell information found here and there. (Aura names, Effect names)
20 | * CrystalMpqExplorer is an extensible Windows Forms interface that will let you explore MPQ files.
21 | * WoWMapExplorer will let you view WoW's world map in an Windows Forms user interface, streaming the map data directly from the wow installation.
22 | * DbcViewer is a standalone DBC reader provided for viewing DBC files outside of the MPQ explorer UI.
23 | * WoWSpellViewer is a test project for viewing Spell Data contained in MPQ files. It is not likely to work for now, as the database format has to be kept in sync with WoW quite frequently. (As of now, it will just not work at all, since the spell database ahs been split up in many smaller ones.)
24 | I started this project around 2005, and upgraded it regularly until I got something working decently. There, from refactoring to refactoring, and by adding features bit by bit, I finally got something quite pleasant for my own use. I never released the source code before 2011, but it has now been done. I am still upgrading the project from time to time, so you can expect progressive upgrades as long as I'm not dead…
25 |
26 | If you like this project, please spread the word !
27 |
28 | Thanks
--------------------------------------------------------------------------------
/DbcViewer/MainForm.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Collections.Generic;
14 | using System.ComponentModel;
15 | using System.Data;
16 | using System.Drawing;
17 | using System.Text;
18 | using System.Windows.Forms;
19 | using CrystalMpq.DataFormats;
20 | using CrystalMpq.Explorer.BaseViewers;
21 | using CrystalMpq.Explorer.Extensibility;
22 |
23 | namespace DbcViewer
24 | {
25 | public partial class MainForm : Form
26 | {
27 | #region PluginHost Class
28 | private sealed class PluginHost : IHost
29 | {
30 | MainForm mainForm;
31 |
32 | public PluginHost(MainForm mainForm) { this.mainForm = mainForm; }
33 |
34 | public string SelectedFileName { get { return ""; } }
35 |
36 | public Color ViewerBackColor { get { return Color.SlateGray; } }
37 |
38 | public void StatusMessage(string text)
39 | {
40 | }
41 |
42 | public IntPtr Handle { get { return mainForm.Handle; } }
43 | }
44 | #endregion
45 |
46 | PluginHost host;
47 |
48 | public MainForm()
49 | {
50 | host = new PluginHost(this);
51 |
52 | InitializeComponent();
53 |
54 | if (databaseViewer.Menu != null)
55 | ToolStripManager.Merge(databaseViewer.Menu, menuStrip);
56 | if (databaseViewer.MainToolStrip != null)
57 | ToolStripManager.Merge(databaseViewer.MainToolStrip, mainToolStrip);
58 | if (databaseViewer.StatusStrip != null)
59 | ToolStripManager.Merge(databaseViewer.StatusStrip, statusStrip);
60 | }
61 |
62 | private void openToolStripMenuItem_Click(object sender, EventArgs e)
63 | {
64 | if (openFileDialog.ShowDialog(this) == DialogResult.OK)
65 | {
66 | Stream fileStream = null;
67 | RawClientDatabase database;
68 |
69 | try
70 | {
71 | fileStream = File.Open(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
72 | database = new RawClientDatabase(fileStream);
73 | databaseViewer.Database = database;
74 | fileNameToolStripStatusLabel.Text = openFileDialog.FileName;
75 | }
76 | catch (Exception ex)
77 | {
78 | MessageBox.Show(ex.Message, Properties.Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
79 | fileNameToolStripStatusLabel.Text = "";
80 | }
81 | finally
82 | {
83 | if (fileStream != null)
84 | fileStream.Close();
85 | }
86 | }
87 | }
88 |
89 | private void exitToolStripMenuItem_Click(object sender, EventArgs e)
90 | {
91 | Close();
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/WoWSpellViewer/Program.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Globalization;
14 | using System.Collections.Generic;
15 | using System.Windows.Forms;
16 | using CrystalMpq.WoW;
17 |
18 | namespace WoWSpellViewer
19 | {
20 | static class Program
21 | {
22 | ///
23 | /// Point d'entrée principal de l'application.
24 | ///
25 | [STAThread]
26 | static void Main()
27 | {
28 | WoWInstallation wowInstallation;
29 | WoWLanguagePack languagePack;
30 |
31 | Application.EnableVisualStyles();
32 | Application.SetCompatibleTextRenderingDefault(false);
33 |
34 | wowInstallation = FindWoWInstallation();
35 |
36 | if (wowInstallation == null)
37 | return;
38 |
39 | languagePack = ChooseLanguagePack(wowInstallation);
40 |
41 | if (languagePack == null)
42 | return;
43 |
44 | Properties.Settings.Default.LanguagePackCulture = languagePack.Culture;
45 |
46 | Application.Run(new MainForm(wowInstallation, languagePack));
47 | }
48 |
49 | static WoWInstallation FindWoWInstallation()
50 | {
51 | WoWInstallation wowInstallation = null;
52 |
53 | // Try to find a valid wow installation
54 | try { wowInstallation = WoWInstallation.Find(); }
55 | catch (DirectoryNotFoundException)
56 | {
57 | // If we can't find wow, terminate here
58 | MessageBox.Show(Properties.Resources.CannotFindWow, Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
59 | }
60 | catch (Exception ex)
61 | {
62 | MessageBox.Show(ex.Message, Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
63 | }
64 |
65 | return wowInstallation;
66 | }
67 |
68 | static WoWLanguagePack ChooseLanguagePack(WoWInstallation wowInstallation)
69 | {
70 | CultureInfo desiredCulture = Properties.Settings.Default.LanguagePackCulture;
71 |
72 | if (wowInstallation.LanguagePacks.Count == 1)
73 | return wowInstallation.LanguagePacks[0];
74 |
75 | foreach (WoWLanguagePack languagePack in wowInstallation.LanguagePacks)
76 | if (languagePack.Culture == desiredCulture)
77 | return languagePack;
78 |
79 | using (LanguagePackDialog languagePackDialog = new LanguagePackDialog())
80 | {
81 | languagePackDialog.WoWInstallation = wowInstallation;
82 |
83 | switch (languagePackDialog.ShowDialog())
84 | {
85 | case DialogResult.OK:
86 | return languagePackDialog.LanguagePack;
87 | default:
88 | return null;
89 | }
90 | }
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/WoWMapExplorer/Program.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Globalization;
14 | using System.Collections.Generic;
15 | using System.Windows.Forms;
16 | using CrystalMpq.WoW;
17 |
18 | namespace WoWMapExplorer
19 | {
20 | static class Program
21 | {
22 | ///
23 | /// Point d'entrée principal de l'application.
24 | ///
25 | [STAThread]
26 | static void Main()
27 | {
28 | WoWInstallation wowInstallation;
29 | WoWLanguagePack languagePack;
30 |
31 | Application.EnableVisualStyles();
32 | Application.SetCompatibleTextRenderingDefault(false);
33 |
34 | wowInstallation = FindWoWInstallation();
35 |
36 | if (wowInstallation == null)
37 | return;
38 |
39 | languagePack = ChooseLanguagePack(wowInstallation);
40 |
41 | if (languagePack == null)
42 | return;
43 |
44 | Properties.Settings.Default.LanguagePackCulture = languagePack.Culture;
45 |
46 | Application.Run(new MainForm(wowInstallation, languagePack));
47 | }
48 |
49 | static WoWInstallation FindWoWInstallation()
50 | {
51 | WoWInstallation wowInstallation = null;
52 |
53 | // Try to find a valid wow installation
54 | try { wowInstallation = WoWInstallation.Find(); }
55 | catch (DirectoryNotFoundException)
56 | {
57 | // If we can't find wow, terminate here
58 | MessageBox.Show(Properties.Resources.CannotFindWow, Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
59 | }
60 | catch (Exception ex)
61 | {
62 | MessageBox.Show(ex.Message, Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
63 | }
64 |
65 | return wowInstallation;
66 | }
67 |
68 | static WoWLanguagePack ChooseLanguagePack(WoWInstallation wowInstallation)
69 | {
70 | CultureInfo desiredCulture = Properties.Settings.Default.LanguagePackCulture;
71 |
72 | if (wowInstallation.LanguagePacks.Count == 1)
73 | return wowInstallation.LanguagePacks[0];
74 |
75 | foreach (WoWLanguagePack languagePack in wowInstallation.LanguagePacks)
76 | if (languagePack.Culture == desiredCulture)
77 | return languagePack;
78 |
79 | using (LanguagePackDialog languagePackDialog = new LanguagePackDialog())
80 | {
81 | languagePackDialog.WoWInstallation = wowInstallation;
82 |
83 | switch (languagePackDialog.ShowDialog())
84 | {
85 | case DialogResult.OK:
86 | return languagePackDialog.LanguagePack;
87 | default:
88 | return null;
89 | }
90 | }
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/CrystalMpq.WoW/ArchiveDetection/ClassicVersionHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using System.IO;
4 |
5 | namespace CrystalMpq.WoW.ArchiveDetection
6 | {
7 | class ClassicVersionHandler : VersionHandler
8 | {
9 | protected override IEnumerable RelevantTopLevelElements
10 | {
11 | get
12 | {
13 | return new[]
14 | {
15 | "common",
16 | "expansion",
17 | "lichking",
18 | "patch"
19 | };
20 | }
21 | }
22 |
23 | protected override IEnumerable RelevantLanguagePackElements
24 | {
25 | get
26 | {
27 | return new[]
28 | {
29 | "backup",
30 | "base",
31 | "locale",
32 | "speech",
33 | "expansion-locale",
34 | "expansion-speech",
35 | "lichking-locale",
36 | "lichking-speech",
37 | "patch"
38 | };
39 | }
40 | }
41 |
42 | public override IList CollectArchives(string dataPath)
43 | {
44 | var archiveList = new List();
45 |
46 | foreach (string file in this.RelevantTopLevelElements)
47 | {
48 | archiveList.Add(new WoWArchiveInformation(FormatHyphenatedArchiveName(file), WoWArchiveKind.Base));
49 |
50 | for (int i = 2; ; i++)
51 | {
52 | string archiveName = FormatHyphenatedArchiveName(file, i);
53 | if (!File.Exists(Path.Combine(dataPath, archiveName))) break;
54 |
55 | archiveList.Add(new WoWArchiveInformation(archiveName, WoWArchiveKind.Base));
56 | }
57 | }
58 |
59 | return archiveList;
60 | }
61 |
62 | public override IList CollectLanguagePackArchives(string localePath, string wowCultureId)
63 | {
64 | var archiveList = new List();
65 |
66 | foreach (string file in this.RelevantLanguagePackElements)
67 | {
68 | archiveList.Add(new WoWArchiveInformation(FormatHyphenatedArchiveName(file), WoWArchiveKind.LanguagePack));
69 |
70 | for (int i = 2; ; i++)
71 | {
72 | string archiveName = FormatHyphenatedArchiveName(file, i);
73 | if (!File.Exists(Path.Combine(localePath, archiveName))) break;
74 |
75 | archiveList.Add(new WoWArchiveInformation(archiveName, WoWArchiveKind.LanguagePack));
76 | }
77 | }
78 |
79 | archiveList.Reverse();
80 | return archiveList;
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/License.txt:
--------------------------------------------------------------------------------
1 | Microsoft Reciprocal License (Ms-RL)
2 |
3 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
4 |
5 | 1. Definitions
6 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
7 | A "contribution" is the original software, or any additions or changes to the software.
8 | A "contributor" is any person that distributes its contribution under this license.
9 | "Licensed patents" are a contributor's patent claims that read directly on its contribution.
10 | 2. Grant of Rights
11 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
12 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
13 | 3. Conditions and Limitations
14 | (A) Reciprocal Grants- For any file you distribute that contains code from the software (in source code or binary format), you must provide recipients the source code to that file along with a copy of this license, which license will govern that file. You may license other files that are entirely your own work and do not contain code from the software under any terms you choose.
15 | (B) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
16 | (C) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
17 | (D) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
18 | (E) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
19 | (F) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
--------------------------------------------------------------------------------
/CrystalMpq/7zip/Compress/LZMA/LzmaBase.cs:
--------------------------------------------------------------------------------
1 | // LzmaBase.cs
2 |
3 | namespace SevenZip.Compression.LZMA
4 | {
5 | internal abstract class Base
6 | {
7 | public const uint kNumRepDistances = 4;
8 | public const uint kNumStates = 12;
9 |
10 | // static byte []kLiteralNextStates = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
11 | // static byte []kMatchNextStates = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
12 | // static byte []kRepNextStates = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
13 | // static byte []kShortRepNextStates = {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
14 |
15 | public struct State
16 | {
17 | public uint Index;
18 | public void Init() { Index = 0; }
19 | public void UpdateChar()
20 | {
21 | if (Index < 4) Index = 0;
22 | else if (Index < 10) Index -= 3;
23 | else Index -= 6;
24 | }
25 | public void UpdateMatch() { Index = (uint)(Index < 7 ? 7 : 10); }
26 | public void UpdateRep() { Index = (uint)(Index < 7 ? 8 : 11); }
27 | public void UpdateShortRep() { Index = (uint)(Index < 7 ? 9 : 11); }
28 | public bool IsCharState() { return Index < 7; }
29 | }
30 |
31 | public const int kNumPosSlotBits = 6;
32 | public const int kDicLogSizeMin = 0;
33 | // public const int kDicLogSizeMax = 30;
34 | // public const uint kDistTableSizeMax = kDicLogSizeMax * 2;
35 |
36 | public const int kNumLenToPosStatesBits = 2; // it's for speed optimization
37 | public const uint kNumLenToPosStates = 1 << kNumLenToPosStatesBits;
38 |
39 | public const uint kMatchMinLen = 2;
40 |
41 | public static uint GetLenToPosState(uint len)
42 | {
43 | len -= kMatchMinLen;
44 | if (len < kNumLenToPosStates)
45 | return len;
46 | return (uint)(kNumLenToPosStates - 1);
47 | }
48 |
49 | public const int kNumAlignBits = 4;
50 | public const uint kAlignTableSize = 1 << kNumAlignBits;
51 | public const uint kAlignMask = (kAlignTableSize - 1);
52 |
53 | public const uint kStartPosModelIndex = 4;
54 | public const uint kEndPosModelIndex = 14;
55 | public const uint kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
56 |
57 | public const uint kNumFullDistances = 1 << ((int)kEndPosModelIndex / 2);
58 |
59 | public const uint kNumLitPosStatesBitsEncodingMax = 4;
60 | public const uint kNumLitContextBitsMax = 8;
61 |
62 | public const int kNumPosStatesBitsMax = 4;
63 | public const uint kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
64 | public const int kNumPosStatesBitsEncodingMax = 4;
65 | public const uint kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
66 |
67 | public const int kNumLowLenBits = 3;
68 | public const int kNumMidLenBits = 3;
69 | public const int kNumHighLenBits = 8;
70 | public const uint kNumLowLenSymbols = 1 << kNumLowLenBits;
71 | public const uint kNumMidLenSymbols = 1 << kNumMidLenBits;
72 | public const uint kNumLenSymbols = kNumLowLenSymbols + kNumMidLenSymbols +
73 | (1 << kNumHighLenBits);
74 | public const uint kMatchMaxLen = kMatchMinLen + kNumLenSymbols - 1;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/DxtSurface.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.IO;
13 | using System.Runtime.InteropServices;
14 |
15 | namespace CrystalMpq.DataFormats
16 | {
17 | public abstract class DxtSurface : Surface
18 | {
19 | private GCHandle dataHandle;
20 | protected byte[] data;
21 |
22 | internal DxtSurface(int width, int height, byte alphaBitCount, bool alphaPremultiplied = false)
23 | : base(width, height, alphaBitCount, alphaPremultiplied) { }
24 |
25 | internal unsafe DxtSurface(byte[] rawData, int width, int height, byte alphaBitCount, bool alphaPremultiplied = false, bool shareBuffer = false)
26 | : base(width, height, alphaBitCount, alphaPremultiplied)
27 | {
28 | if (rawData == null) throw new ArgumentNullException("rawData");
29 |
30 | int wr = width & 3;
31 | int hr = height & 3;
32 | int length = (((wr != 0 ? width + 4 - wr : width) * (hr != 0 ? height + 4 - hr : height)) & ~0xF) >> (alphaBitCount > 1 ? 0 : 1);
33 |
34 | if (rawData.Length != length) throw new ArgumentException();
35 |
36 | data = shareBuffer ? rawData : rawData.Clone() as byte[];
37 | }
38 |
39 | internal unsafe DxtSurface(byte* rawData, int width, int height, byte alphaBitCount, bool alphaPremultiplied = false)
40 | : base(width, height, alphaBitCount, alphaPremultiplied)
41 | {
42 | if (rawData == null) throw new ArgumentNullException("rawData");
43 |
44 | int wr = width & 3;
45 | int hr = height & 3;
46 | int length = (((wr != 0 ? width + 4 - wr : width) * (hr != 0 ? height + 4 - hr : height)) & ~0xF) >> (alphaBitCount > 1 ? 0 : 1);
47 |
48 | data = new byte[length];
49 |
50 | for (int i = 0; i < data.Length; i++) data[i] = *rawData++;
51 | }
52 |
53 | public override bool CanLock { get { return true; } }
54 |
55 | protected override IntPtr LockInternal(out int stride)
56 | {
57 | dataHandle = GCHandle.Alloc(data, GCHandleType.Pinned);
58 |
59 | stride = Width * sizeof(uint);
60 |
61 | return dataHandle.AddrOfPinnedObject();
62 | }
63 |
64 | protected override void UnlockInternal() { dataHandle.Free(); }
65 |
66 | public override byte[] ToArray() { return data.Clone() as byte[]; }
67 |
68 | /// Creates a stream for accessing the surface data.
69 | /// The returned stream can be used for reading or modifying the surface data.
70 | /// A stream which can be used to access the surface data.
71 | public override Stream CreateStream() { return new MemoryStream(data, true); }
72 |
73 | public override object Clone()
74 | {
75 | var clone = base.Clone() as DxtSurface;
76 |
77 | clone.data = data.Clone() as byte[];
78 |
79 | return clone;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/CrystalMpq/MpqArchive.UserData.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.IO;
14 |
15 | namespace CrystalMpq
16 | {
17 | partial class MpqArchive
18 | {
19 | private sealed class MpqUserDataStream : Stream
20 | {
21 | private MpqArchive archive;
22 | private long position;
23 |
24 | internal MpqUserDataStream(MpqArchive archive) { this.archive = archive; }
25 |
26 | public override bool CanSeek { get { return true; } }
27 | public override bool CanRead { get { return true; } }
28 | public override bool CanWrite { get { return false; } }
29 |
30 | public override long Length { get { return archive.userDataLength; } }
31 |
32 | public override long Position
33 | {
34 | get { return 0; }
35 | set
36 | {
37 | if (value < 0) throw new IOException(ErrorMessages.GetString("SeekingBeforeBegin"));
38 |
39 | this.position = value;
40 | }
41 | }
42 |
43 | public override int Read(byte[] buffer, int offset, int count)
44 | {
45 | if (position >= archive.userDataLength) return 0;
46 |
47 | int remaining = checked((int)(archive.userDataLength - position));
48 |
49 | if (count > remaining) count = remaining;
50 |
51 | position += (count = archive.ReadArchiveData(buffer, 0, 0, count));
52 |
53 | return count;
54 | }
55 |
56 | public override long Seek(long offset, SeekOrigin origin)
57 | {
58 | long position;
59 |
60 | switch (origin)
61 | {
62 | case SeekOrigin.Begin: position = offset; break;
63 | case SeekOrigin.Current: position = checked(this.position + offset); break;
64 | case SeekOrigin.End: position = checked(archive.userDataLength + offset); break;
65 | default: throw new ArgumentOutOfRangeException("origin");
66 | }
67 |
68 | return Position = position;
69 | }
70 |
71 | public override void Flush() { }
72 | public override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException(); }
73 | public override void SetLength(long value) { throw new NotSupportedException(); }
74 | }
75 |
76 | /// Gets a value indicating whether the current archive contains user data.
77 | /// if the current archive contains user data; otherwise, .
78 | public bool HasUserData { get { return userDataLength > 0 || FindFile("(user data)") != null; } }
79 |
80 | /// Gets the user data stream.
81 | /// A to be used for accessing user data.
82 | public Stream GetUserDataStream()
83 | {
84 | if (userDataLength > 0) return new MpqUserDataStream(this);
85 | else
86 | {
87 | var file = FindFile(UserDataFileName);
88 |
89 | if (file != null) return file.Open();
90 | }
91 |
92 | throw new InvalidOperationException();
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/ExtractionProgressionForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CrystalMpq.Explorer
2 | {
3 | partial class ExtractionProgressionForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExtractionProgressionForm));
32 | this.progressBar = new System.Windows.Forms.ProgressBar();
33 | this.statusLabel = new System.Windows.Forms.Label();
34 | this.abortButton = new System.Windows.Forms.Button();
35 | this.fileInformationLabel = new System.Windows.Forms.Label();
36 | this.SuspendLayout();
37 | //
38 | // progressBar
39 | //
40 | resources.ApplyResources(this.progressBar, "progressBar");
41 | this.progressBar.Name = "progressBar";
42 | //
43 | // statusLabel
44 | //
45 | resources.ApplyResources(this.statusLabel, "statusLabel");
46 | this.statusLabel.Name = "statusLabel";
47 | //
48 | // abortButton
49 | //
50 | resources.ApplyResources(this.abortButton, "abortButton");
51 | this.abortButton.DialogResult = System.Windows.Forms.DialogResult.Abort;
52 | this.abortButton.Name = "abortButton";
53 | this.abortButton.UseVisualStyleBackColor = true;
54 | this.abortButton.Click += new System.EventHandler(this.abortButton_Click);
55 | //
56 | // fileInformationLabel
57 | //
58 | resources.ApplyResources(this.fileInformationLabel, "fileInformationLabel");
59 | this.fileInformationLabel.Name = "fileInformationLabel";
60 | //
61 | // ExtractionProgressionForm
62 | //
63 | resources.ApplyResources(this, "$this");
64 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
65 | this.CancelButton = this.abortButton;
66 | this.ControlBox = false;
67 | this.Controls.Add(this.fileInformationLabel);
68 | this.Controls.Add(this.abortButton);
69 | this.Controls.Add(this.statusLabel);
70 | this.Controls.Add(this.progressBar);
71 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
72 | this.MaximizeBox = false;
73 | this.MinimizeBox = false;
74 | this.Name = "ExtractionProgressionForm";
75 | this.ShowInTaskbar = false;
76 | this.ResumeLayout(false);
77 | this.PerformLayout();
78 |
79 | }
80 |
81 | #endregion
82 |
83 | private System.Windows.Forms.ProgressBar progressBar;
84 | private System.Windows.Forms.Label statusLabel;
85 | private System.Windows.Forms.Button abortButton;
86 | private System.Windows.Forms.Label fileInformationLabel;
87 | }
88 | }
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/OptionsForm.Designer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | namespace CrystalMpq.Explorer
12 | {
13 | partial class OptionsForm
14 | {
15 | ///
16 | /// Variable nécessaire au concepteur.
17 | ///
18 | private System.ComponentModel.IContainer components = null;
19 |
20 | ///
21 | /// Nettoyage des ressources utilisées.
22 | ///
23 | /// true si les ressources managées doivent être supprimées ; sinon, false.
24 | protected override void Dispose(bool disposing)
25 | {
26 | if (disposing && (components != null))
27 | {
28 | components.Dispose();
29 | }
30 | base.Dispose(disposing);
31 | }
32 |
33 | #region Code généré par le Concepteur Windows Form
34 |
35 | ///
36 | /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
37 | /// le contenu de cette méthode avec l'éditeur de code.
38 | ///
39 | private void InitializeComponent()
40 | {
41 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm));
42 | this.okButton = new System.Windows.Forms.Button();
43 | this.cancelButton = new System.Windows.Forms.Button();
44 | this.propertyGrid = new System.Windows.Forms.PropertyGrid();
45 | this.SuspendLayout();
46 | //
47 | // okButton
48 | //
49 | resources.ApplyResources(this.okButton, "okButton");
50 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
51 | this.okButton.Name = "okButton";
52 | this.okButton.UseVisualStyleBackColor = true;
53 | //
54 | // cancelButton
55 | //
56 | resources.ApplyResources(this.cancelButton, "cancelButton");
57 | this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
58 | this.cancelButton.Name = "cancelButton";
59 | this.cancelButton.UseVisualStyleBackColor = true;
60 | //
61 | // propertyGrid
62 | //
63 | resources.ApplyResources(this.propertyGrid, "propertyGrid");
64 | this.propertyGrid.Name = "propertyGrid";
65 | this.propertyGrid.ToolbarVisible = false;
66 | //
67 | // OptionsForm
68 | //
69 | this.AcceptButton = this.okButton;
70 | resources.ApplyResources(this, "$this");
71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
72 | this.CancelButton = this.cancelButton;
73 | this.Controls.Add(this.propertyGrid);
74 | this.Controls.Add(this.cancelButton);
75 | this.Controls.Add(this.okButton);
76 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
77 | this.MaximizeBox = false;
78 | this.MinimizeBox = false;
79 | this.Name = "OptionsForm";
80 | this.ResumeLayout(false);
81 |
82 | }
83 |
84 | #endregion
85 |
86 | private System.Windows.Forms.Button okButton;
87 | private System.Windows.Forms.Button cancelButton;
88 | private System.Windows.Forms.PropertyGrid propertyGrid;
89 | }
90 | }
--------------------------------------------------------------------------------
/CrystalMpq.Explorer.Extensibility/FileViewer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Windows.Forms;
15 | using CrystalMpq;
16 |
17 | namespace CrystalMpq.Explorer.Extensibility
18 | {
19 | /// Base class for implementig a FileViewer plugin.
20 | public /*abstract */class FileViewer : UserControl // Using abstract breaks the designer :(
21 | {
22 | private MpqFile file;
23 | private IHost host;
24 | private IPluginSettings pluginSettings;
25 |
26 | /// Initializes a new instance of the class.
27 | /// This will only be used by the Windows Forms designer.
28 | private FileViewer() { }
29 |
30 | /// Initializes a new instance of the class.
31 | /// The host which will be bound to this instance.
32 | public FileViewer(IHost host) { this.host = host; }
33 |
34 | /// Gets the associated with this FileViewer, or null if there is none.
35 | public virtual MenuStrip Menu { get { return null; } }
36 |
37 | /// Gets the associated with this FileViewer, or null if there is none.
38 | public virtual ToolStrip MainToolStrip { get { return null; } }
39 |
40 | /// Gets the associated with this FileViewer, or null if there is none.
41 | public virtual StatusStrip StatusStrip { get { return null; } }
42 |
43 | /// Gets the object that can be used to change the settings of this plugin, or null if there is none.
44 | public IPluginSettings Settings
45 | {
46 | get
47 | {
48 | if (pluginSettings != null)
49 | return pluginSettings;
50 | else
51 | return pluginSettings = CreatePluginSettings();
52 | }
53 | }
54 |
55 | /// Called when creation of the PluginSettings object is requested.
56 | /// The PluginSettings object to use, or null if there is none.
57 | protected virtual IPluginSettings CreatePluginSettings() { return null; }
58 |
59 | /// Gets or sets the MPQFile object to be viewed in this FileViewer.
60 | public MpqFile File
61 | {
62 | get { return file; }
63 | set
64 | {
65 | if (value != file)
66 | {
67 | file = value;
68 | OnFileChanged();
69 | }
70 | }
71 | }
72 |
73 | /// Gets the associated host.
74 | protected IHost Host { get { return host; } }
75 |
76 | /// Called when the viewed file has changed.
77 | protected virtual void OnFileChanged() { }
78 |
79 | /// Called when the settings need to be updated.
80 | public virtual void ApplySettings() { }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/ClientDatabaseIndex.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Collections.Generic;
13 |
14 | namespace CrystalMpq.DataFormats
15 | {
16 | public abstract class ClientDatabaseIndex
17 | where T : struct
18 | {
19 | readonly string name;
20 | readonly ClientDatabase database;
21 |
22 | internal ClientDatabaseIndex(string name, ClientDatabase database)
23 | {
24 | if (name == null || name.Length == 0)
25 | throw new ArgumentNullException("name");
26 | if (database == null)
27 | throw new ArgumentNullException("database");
28 | this.name = name;
29 | this.database = database;
30 | }
31 |
32 | public string Name { get { return name; } }
33 |
34 | public ClientDatabase Database { get { return database; } }
35 |
36 | public abstract Type KeyType { get; }
37 |
38 | public abstract T this[object key] { get; }
39 | }
40 |
41 | public sealed class ClientDatabaseIndex
42 | : ClientDatabaseIndex
43 | where TValue : struct
44 | {
45 | ///
46 | /// Returns the key of a given record.
47 | ///
48 | /// Record whose key is requested.
49 | /// Returns the record key.
50 | ///
51 | /// This is used for building the hash table, therefore this delegate must return a different value for each different record.
52 | /// If your records cannot be matched by key, then you have no need for this.
53 | ///
54 | public delegate TKey RecordKeyGetter(TValue record);
55 |
56 | Dictionary mappingDictionary;
57 |
58 | internal ClientDatabaseIndex(string name, ClientDatabase database, RecordKeyGetter recordKeyGetter)
59 | : base(name, database)
60 | {
61 | if (recordKeyGetter == null)
62 | throw new ArgumentNullException("recordKeyGetter");
63 |
64 | mappingDictionary = new Dictionary(database.Records.Count);
65 | for (int i = 0; i < database.Records.Count; i++)
66 | mappingDictionary.Add(recordKeyGetter(database.Records[i]), i);
67 | }
68 |
69 | public override TValue this[object key]
70 | {
71 | get
72 | {
73 | if (key is TKey)
74 | return Database.Records[mappingDictionary[(TKey)key]];
75 | else
76 | throw new KeyNotFoundException();
77 | }
78 | }
79 | public new TValue this[TKey key] { get { return Database.Records[mappingDictionary[key]]; } }
80 | public bool ContainsKey(TKey key) { return mappingDictionary.ContainsKey(key); }
81 | public bool TryGetValue(TKey key, out TValue value)
82 | {
83 | int index;
84 |
85 | if (mappingDictionary.TryGetValue(key, out index))
86 | {
87 | value = Database.Records[index];
88 | return true;
89 | }
90 | else
91 | {
92 | value = default(TValue);
93 | return false;
94 | }
95 | }
96 |
97 | public override Type KeyType { get { return typeof(TKey); } }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/ExtractionSettingsForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | namespace CrystalMpq.Explorer
11 | {
12 | internal sealed partial class ExtractionSettingsForm : Form
13 | {
14 | public ExtractionSettingsForm() { InitializeComponent(); }
15 |
16 | public string DestinationDirectory
17 | {
18 | get { return destinationTextBox.Text; }
19 | set { destinationTextBox.Text = value; }
20 | }
21 |
22 | public bool OverwriteFiles
23 | {
24 | get { return overwriteCheckBox.Checked; }
25 | set { overwriteCheckBox.Checked = value; }
26 | }
27 |
28 | public bool Recurse
29 | {
30 | get { return recurseCheckBox.Checked; }
31 | set { recurseCheckBox.Checked = value; }
32 | }
33 |
34 | public bool AllowRecurse
35 | {
36 | get { return recurseCheckBox.Enabled; }
37 | set { recurseCheckBox.Enabled = value; }
38 | }
39 |
40 | private void browseButton_Click(object sender, EventArgs e)
41 | {
42 | folderBrowserDialog.SelectedPath = destinationTextBox.Text;
43 | if (folderBrowserDialog.ShowDialog(this) == DialogResult.OK)
44 | destinationTextBox.Text = folderBrowserDialog.SelectedPath;
45 | }
46 |
47 | private void okButton_Click(object sender, EventArgs e)
48 | {
49 | string path = destinationTextBox.Text;
50 |
51 | // Check for null or empty by ourselves, as this is cheap to do.
52 | if (string.IsNullOrEmpty(path))
53 | {
54 | DialogResult = DialogResult.None;
55 | MessageBox.Show(this, Properties.Resources.InvalidDirectoryNullErrorDialogMessage, Properties.Resources.InvalidDirectoryErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
56 | return;
57 | }
58 |
59 | // Otherwise, let the BCL and the system do their verifications
60 | try
61 | {
62 | var directory = new DirectoryInfo(path);
63 |
64 | // If directory seems valid (no exception thrown), check for existence, and propose to create it if necessary
65 | if (!directory.Exists)
66 | if (MessageBox.Show(this, string.Format(Properties.Resources.Culture, Properties.Resources.DirectoryCreationDialogMessage, path), Properties.Resources.DirectoryCreationDialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
67 | try { directory.Create(); }
68 | catch (IOException)
69 | {
70 | DialogResult = DialogResult.None;
71 | MessageBox.Show(this, string.Format(Properties.Resources.Culture, Properties.Resources.DirectoryCreationErrorDialogMessage, path), Properties.Resources.DirectoryCreationErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
72 | }
73 | else DialogResult = DialogResult.None;
74 | }
75 | catch (ArgumentException)
76 | {
77 | DialogResult = DialogResult.None;
78 | MessageBox.Show(this, Properties.Resources.InvalidDirectoryNameErrorDialogMessage, Properties.Resources.InvalidDirectoryErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
79 | }
80 | catch (PathTooLongException)
81 | {
82 | DialogResult = DialogResult.None;
83 | MessageBox.Show(this, Properties.Resources.InvalidDirectoryPathTooLongErrorDialogMessage, Properties.Resources.InvalidDirectoryErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
84 | }
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/CrystalMpq.WoW/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.18033
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CrystalMpq.WoW.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CrystalMpq.WoW.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Sucht eine lokalisierte Zeichenfolge, die The culture {0}({1}) is currently not supported. ähnelt.
65 | ///
66 | internal static string UnsupportedCultureMessage {
67 | get {
68 | return ResourceManager.GetString("UnsupportedCultureMessage", resourceCulture);
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/CrystalMpq.DataFormats/ArgbColor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright Notice
2 | // This file is part of CrystalMPQ.
3 | //
4 | // Copyright (C) 2007-2011 Fabien BARBIER
5 | //
6 | // CrystalMPQ is licenced under the Microsoft Reciprocal License.
7 | // You should find the licence included with the source of the program,
8 | // or at this URL: http://www.microsoft.com/opensource/licenses.mspx#Ms-RL
9 | #endregion
10 |
11 | using System;
12 | using System.Runtime.InteropServices;
13 |
14 | namespace CrystalMpq.DataFormats
15 | {
16 | [StructLayout(LayoutKind.Sequential)]
17 | public struct ArgbColor
18 | {
19 | public byte B;
20 | public byte G;
21 | public byte R;
22 | public byte A;
23 |
24 | public ArgbColor(ushort color)
25 | {
26 | // Optimization used here:
27 | // x / 31 = x * 8457 >> 18 (for 0 ≤ x ≤ 31 * 255)
28 | // x / 63 = x * 16645 >> 20 (for 0 ≤ x ≤ 63 * 255)
29 | // Since a multiplication is needed anyway, it is probably useless to try optimizing the * 255…
30 | B = (byte)((color & 0x001F) * (255 * 8457) >> 18);
31 | G = (byte)(((color & 0x07E0) >> 5) * (255 * 16645) >> 20);
32 | R = (byte)((color >> 11) * (255 * 8457) >> 18);
33 | A = 255;
34 | }
35 |
36 | public ArgbColor(byte r, byte g, byte b)
37 | : this(r, g, b, 255) { }
38 |
39 | public ArgbColor(byte r, byte g, byte b, byte a)
40 | {
41 | B = b;
42 | G = g;
43 | R = r;
44 | A = a;
45 | }
46 |
47 | /// Merges two colors for DXT decompression.
48 | /// The storage to be used for the result.
49 | /// A color.
50 | /// A color.
51 | internal static unsafe void DxtMergeHalves(ArgbColor* result, ArgbColor* color1, ArgbColor* color2)
52 | {
53 | result->B = (byte)((color1->B + color2->B) >> 1);
54 | result->G = (byte)((color1->G + color2->G) >> 1);
55 | result->R = (byte)((color1->R + color2->R) >> 1);
56 | result->A = 255;
57 | }
58 |
59 | /// Merges two colors for DXT decompression.
60 | /// The storage to be used for the result.
61 | /// The color whose weight will be 1/3.
62 | /// The color whose weight will be 2/3.
63 | internal static unsafe void DxtMergeThirds(ArgbColor* result, ArgbColor* minColor, ArgbColor* maxColor)
64 | {
65 | // Formula used here:
66 | // x / 3 = x * 683 >> 11 (for 0 ≤ x ≤ 3 * 255)
67 | // Need to verify that this is indeed faster, but it'll do the work for now.
68 | result->B = (byte)((minColor->B + maxColor->B + maxColor->B) * 683 >> 11);
69 | result->G = (byte)((minColor->G + maxColor->G + maxColor->G) * 683 >> 11);
70 | result->R = (byte)((minColor->R + maxColor->R + maxColor->R) * 683 >> 11);
71 | result->A = 255;
72 | }
73 |
74 | /// Copies an into another, with forced opaque alpha.
75 | /// The destination color.
76 | /// The source color.
77 | internal static unsafe void CopyOpaque(ArgbColor* destination, ArgbColor* source)
78 | {
79 | destination->B = source->B;
80 | destination->G = source->G;
81 | destination->R = source->R;
82 | destination->A = 255;
83 | }
84 |
85 | /// Copies an into another, with forced opaque alpha.
86 | /// The destination color.
87 | /// The source color.
88 | internal static unsafe void CopyWithAlpha(ArgbColor* destination, ArgbColor* source, byte alpha)
89 | {
90 | destination->B = source->B;
91 | destination->G = source->G;
92 | destination->R = source->R;
93 | destination->A = alpha;
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/CrystalMpq/7zip/Compress/RangeCoder/RangeCoderBit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SevenZip.Compression.RangeCoder
4 | {
5 | struct BitEncoder
6 | {
7 | public const int kNumBitModelTotalBits = 11;
8 | public const uint kBitModelTotal = (1 << kNumBitModelTotalBits);
9 | const int kNumMoveBits = 5;
10 | const int kNumMoveReducingBits = 2;
11 | public const int kNumBitPriceShiftBits = 6;
12 |
13 | uint Prob;
14 |
15 | public void Init() { Prob = kBitModelTotal >> 1; }
16 |
17 | public void UpdateModel(uint symbol)
18 | {
19 | if (symbol == 0)
20 | Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
21 | else
22 | Prob -= (Prob) >> kNumMoveBits;
23 | }
24 |
25 | public void Encode(Encoder encoder, uint symbol)
26 | {
27 | // encoder.EncodeBit(Prob, kNumBitModelTotalBits, symbol);
28 | // UpdateModel(symbol);
29 | uint newBound = (encoder.Range >> kNumBitModelTotalBits) * Prob;
30 | if (symbol == 0)
31 | {
32 | encoder.Range = newBound;
33 | Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
34 | }
35 | else
36 | {
37 | encoder.Low += newBound;
38 | encoder.Range -= newBound;
39 | Prob -= (Prob) >> kNumMoveBits;
40 | }
41 | if (encoder.Range < Encoder.kTopValue)
42 | {
43 | encoder.Range <<= 8;
44 | encoder.ShiftLow();
45 | }
46 | }
47 |
48 | private static UInt32[] ProbPrices = new UInt32[kBitModelTotal >> kNumMoveReducingBits];
49 |
50 | static BitEncoder()
51 | {
52 | const int kNumBits = (kNumBitModelTotalBits - kNumMoveReducingBits);
53 | for (int i = kNumBits - 1; i >= 0; i--)
54 | {
55 | UInt32 start = (UInt32)1 << (kNumBits - i - 1);
56 | UInt32 end = (UInt32)1 << (kNumBits - i);
57 | for (UInt32 j = start; j < end; j++)
58 | ProbPrices[j] = ((UInt32)i << kNumBitPriceShiftBits) +
59 | (((end - j) << kNumBitPriceShiftBits) >> (kNumBits - i - 1));
60 | }
61 | }
62 |
63 | public uint GetPrice(uint symbol)
64 | {
65 | return ProbPrices[(((Prob - symbol) ^ ((-(int)symbol))) & (kBitModelTotal - 1)) >> kNumMoveReducingBits];
66 | }
67 | public uint GetPrice0() { return ProbPrices[Prob >> kNumMoveReducingBits]; }
68 | public uint GetPrice1() { return ProbPrices[(kBitModelTotal - Prob) >> kNumMoveReducingBits]; }
69 | }
70 |
71 | struct BitDecoder
72 | {
73 | public const int kNumBitModelTotalBits = 11;
74 | public const uint kBitModelTotal = (1 << kNumBitModelTotalBits);
75 | const int kNumMoveBits = 5;
76 |
77 | uint Prob;
78 |
79 | public void UpdateModel(int numMoveBits, uint symbol)
80 | {
81 | if (symbol == 0)
82 | Prob += (kBitModelTotal - Prob) >> numMoveBits;
83 | else
84 | Prob -= (Prob) >> numMoveBits;
85 | }
86 |
87 | public void Init() { Prob = kBitModelTotal >> 1; }
88 |
89 | public uint Decode(RangeCoder.Decoder rangeDecoder)
90 | {
91 | uint newBound = (uint)(rangeDecoder.Range >> kNumBitModelTotalBits) * (uint)Prob;
92 | if (rangeDecoder.Code < newBound)
93 | {
94 | rangeDecoder.Range = newBound;
95 | Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
96 | if (rangeDecoder.Range < Decoder.kTopValue)
97 | {
98 | rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
99 | rangeDecoder.Range <<= 8;
100 | }
101 | return 0;
102 | }
103 | else
104 | {
105 | rangeDecoder.Range -= newBound;
106 | rangeDecoder.Code -= newBound;
107 | Prob -= (Prob) >> kNumMoveBits;
108 | if (rangeDecoder.Range < Decoder.kTopValue)
109 | {
110 | rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
111 | rangeDecoder.Range <<= 8;
112 | }
113 | return 1;
114 | }
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/CrystalMpq.Explorer/Viewers/SearchItemOld.txt:
--------------------------------------------------------------------------------
1 | Since it seems e.StartIndex is already "the next item", i back up the old algorithm…
2 |
3 | private void listView_SearchForVirtualItem(object sender, SearchForVirtualItemEventArgs e)
4 | {
5 | // Note 1: The IsPrefix property of SearchForVirtualItemEventArgs seems to be false for keyboard prefix search events…
6 | // Since this is the only use we'll have of this method, we can assume this is always a prefix search.
7 | // Note 2: We'll assume that we are always searching forward. (This is important for "proximity" search)
8 | // Note 3: Now that I think about it, maybe I can merge the two "separate" phases of the search into one loop.
9 | // But this would lead to an algorithm somewhat different from a regular binary search. (If it isn't already… ;))
10 |
11 | if (rootNode == null) return;
12 |
13 | // Since we are processing filenames, the invariant culture will be used here.
14 | var comparer = CultureInfo.InvariantCulture.CompareInfo;
15 | var nodes = rootNode.Nodes;
16 | // Assuming the nodes re sorted alphabetically (they should be !), the binary search is the most efficient choice.
17 | int prefixLength = e.Text.Length;
18 | int low, high; // These will represent the dynamic search range.
19 | int difference;
20 | bool found = false; // Indicates whether a match has been found
21 |
22 | // Match the prefix against the start item.
23 | difference = comparer.Compare(nodes[e.StartIndex].Text, 0, prefixLength, e.Text, 0, prefixLength, CompareOptions.OrdinalIgnoreCase);
24 | // Depending on the prefix comparison, we can either adjust search parameters or even terminate the search. ;)
25 | if (difference == 0)
26 | {
27 | // If this was a match, we check the next item for a match
28 | if (e.StartIndex + 1 < nodes.Count && comparer.IsPrefix(nodes[e.StartIndex + 1].Text, e.Text, CompareOptions.OrdinalIgnoreCase))
29 | {
30 | // If the test is successful, then the next item was the item we were looking for ! :)
31 | e.Index = e.StartIndex + 1;
32 | return;
33 | }
34 | // If the next item was not an option, then we check the previous item the same way
35 | else if (e.StartIndex > 0 && comparer.IsPrefix(nodes[e.StartIndex - 1].Text, e.Text, CompareOptions.OrdinalIgnoreCase))
36 | {
37 | // If the test was successful, we only know the previous item is a potential candidate.
38 | low = 0;
39 | high = e.Index = e.StartIndex - 1;
40 | found = true;
41 | }
42 | else
43 | {
44 | // If both comparison failed, then there certainly can be no match other than the current item.
45 | // (Still assuming items are sorted alphabetically, remember ?)
46 | e.Index = e.StartIndex;
47 | return;
48 | }
49 | }
50 | else if (difference > 0)
51 | {
52 | // If prefix may only be found before the start item, search before
53 | low = 0;
54 | if (e.StartIndex > 0) high = e.StartIndex - 1;
55 | else return; // If start item was the first item, then the search failed.
56 | }
57 | else
58 | {
59 | // If prefix may only be found after the start item, search after
60 | if (e.StartIndex + 1 < nodes.Count) low = e.StartIndex + 1;
61 | else return; // If start item was the last item, then the search failed.
62 | high = nodes.Count - 1;
63 | }
64 |
65 | // In this algorithm, we may have low == high, but this is a normal (final) case.
66 | do
67 | {
68 | int pivot = (low + high) / 2;
69 | string text = nodes[pivot].Text;
70 |
71 | difference = comparer.Compare(text, 0, Math.Min(prefixLength, text.Length), e.Text, 0, prefixLength, CompareOptions.OrdinalIgnoreCase);
72 |
73 | if (difference == 0)
74 | {
75 | // Once a match is found, adjust the search parameters accordingly
76 | high = (e.Index = pivot) - 1;
77 | found = true;
78 | }
79 | else if (difference > 0)
80 | high = pivot - 1;
81 | else
82 | low = pivot + 1;
83 | } while (low <= high);
84 | }
--------------------------------------------------------------------------------