├── .gitattributes
├── .gitignore
├── AdvancedDataGridView
├── AdvancedDataGridView.cs
├── AdvancedDataGridView.csproj
├── ChangeTracking.cs
├── ColumnHeader.cs
├── ColumnMenu.cs
├── ColumnMenu.designer.cs
├── DataCache.cs
├── FilterForm.Designer.cs
├── FilterForm.cs
├── FilterForm.resx
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
└── Resources
│ └── Images
│ ├── ColumnHeader_Filtered.png
│ ├── ColumnHeader_FilteredAndOrderedASC.png
│ ├── ColumnHeader_FilteredAndOrderedDESC.png
│ ├── ColumnHeader_OrderedASC.png
│ ├── ColumnHeader_OrderedDESC.png
│ ├── ColumnHeader_UnFiltered.png
│ ├── MenuStrip_OrderASCtxt.png
│ ├── MenuStrip_OrderDESCtxt.png
│ └── MenuStrip_ResizeGrip.png
├── CHANGES.md
├── Help
├── CommandLine.htm
├── DataGrid.htm
├── FindReplace.htm
├── Help.chm
├── Help.hhp
├── Images
│ ├── DataGrid.png
│ ├── Definition Editor.png
│ ├── Definition Selector.png
│ ├── FindReplace.png
│ └── SQL Import.png
├── Import_Export.htm
├── Introduction.htm
├── Main Screen
│ ├── btn_next_n.gif
│ └── btn_prev_n.gif
├── Menu_Items.htm
├── Notes.htm
├── Tools.htm
├── help.hhc
└── help.hhk
├── README.md
├── Run on Linux.md
├── UpdateDBC.bat
├── WDBXEditor.sln
├── WDBXEditor
├── About.Designer.cs
├── About.cs
├── About.resx
├── App.config
├── Archives
│ ├── CASC
│ │ ├── Constants
│ │ │ └── Locales.cs
│ │ ├── Handlers
│ │ │ ├── BuildConfig.cs
│ │ │ ├── BuildInfo.cs
│ │ │ ├── CASCHandler.cs
│ │ │ ├── CDNConfig.cs
│ │ │ ├── DataFile.cs
│ │ │ ├── EncodingFile.cs
│ │ │ ├── IndexFile.cs
│ │ │ └── RootFile.cs
│ │ ├── Misc
│ │ │ ├── ByteArrayComparer.cs
│ │ │ ├── Extensions.cs
│ │ │ └── Lookup3.cs
│ │ └── Structures
│ │ │ ├── BLTEChunk.cs
│ │ │ ├── BLTEEntry.cs
│ │ │ ├── EncodingEntry.cs
│ │ │ ├── IndexEntry.cs
│ │ │ └── RootEntry.cs
│ └── MPQ
│ │ ├── MpqArchive.cs
│ │ ├── MpqArchiveCompactingEventArgs.cs
│ │ ├── MpqFileStream.cs
│ │ └── Native
│ │ ├── Callbacks.cs
│ │ ├── MpqArchiveSafeHandle.cs
│ │ ├── MpqFileSafeHandle.cs
│ │ ├── NativeMethods.cs
│ │ ├── SFileInfoClass.cs
│ │ ├── SFileOpenArchiveFlags.cs
│ │ └── Win32Methods.cs
├── Common
│ ├── AutoProgressBar.cs
│ ├── BufferedListBox.cs
│ ├── ColourWheel.cs
│ ├── Constants.cs
│ ├── DropdownCheckList.Designer.cs
│ ├── DropdownCheckList.cs
│ ├── DropdownCheckList.resx
│ ├── Extensions.cs
│ ├── FloatUtil.cs
│ ├── FormHandler.cs
│ ├── GithubReleaseModel.cs
│ └── ORowComparer.cs
├── ConsoleHandler
│ ├── ConsoleCommands.cs
│ └── ConsoleManager.cs
├── Definitions
│ ├── Alpha 0.5.3 (3368).xml
│ ├── BfA 8.0.1 (26231).xml
│ ├── BfA 8.0.1 (26367).xml
│ ├── BfA 8.0.1 (26806).xml
│ ├── BfA 8.0.1 (27075).xml
│ ├── BfA 8.2.5 (32978).xml
│ ├── Cata 4.3.4 (15595).xml
│ ├── Classic 1.12.1 (5875).xml
│ ├── Legion 7.0.3 (22248).xml
│ ├── Legion 7.1.0 (22578).xml
│ ├── Legion 7.2.0 (23835).xml
│ ├── Legion 7.3.0 (24492).xml
│ ├── Legion 7.3.0 (24793).xml
│ ├── Legion 7.3.5 (25632).xml
│ ├── Legion 7.3.5 (26654).xml
│ ├── Legion 7.3.5 (26972).xml
│ ├── MoP 5.4.8 (18414).xml
│ ├── Offsets.json
│ ├── TBC 2.4.3 (8606).xml
│ ├── WDB.xml
│ ├── WoD 6.2.4 (21742).xml
│ └── WotLK 3.3.5 (12340).xml
├── EditDefinition.Designer.cs
├── EditDefinition.cs
├── EditDefinition.resx
├── Forms
│ ├── ColourConverter.Designer.cs
│ ├── ColourConverter.cs
│ ├── ColourConverter.resx
│ ├── ErrorReport.Designer.cs
│ ├── ErrorReport.cs
│ ├── ErrorReport.resx
│ ├── FindReplace.Designer.cs
│ ├── FindReplace.cs
│ ├── FindReplace.resx
│ ├── InputBox.cs
│ ├── LegionParser.Designer.cs
│ ├── LegionParser.cs
│ ├── LegionParser.resx
│ ├── LoadCSV.Designer.cs
│ ├── LoadCSV.cs
│ ├── LoadCSV.resx
│ ├── LoadDefinition.Designer.cs
│ ├── LoadDefinition.cs
│ ├── LoadDefinition.resx
│ ├── LoadHotfix.Designer.cs
│ ├── LoadHotfix.cs
│ ├── LoadHotfix.resx
│ ├── LoadMPQ.Designer.cs
│ ├── LoadMPQ.cs
│ ├── LoadMPQ.resx
│ ├── LoadSQL.Designer.cs
│ ├── LoadSQL.cs
│ ├── LoadSQL.resx
│ ├── PlayerLocation.Designer.cs
│ ├── PlayerLocation.cs
│ ├── PlayerLocation.resx
│ ├── TextEditor.Designer.cs
│ ├── TextEditor.cs
│ ├── TextEditor.resx
│ ├── WotLKItemFix.Designer.cs
│ ├── WotLKItemFix.cs
│ └── WotLKItemFix.resx
├── Help.chm
├── InstanceManager.cs
├── Main.Designer.cs
├── Main.cs
├── Main.resx
├── NamedPipeManager.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Reader
│ ├── BitStream.cs
│ ├── ColumnStructureEntry.cs
│ ├── DBHeader.cs
│ ├── DBReader.cs
│ ├── DBReaderExtensions.cs
│ ├── FieldStructureEntry.cs
│ ├── FileTypes
│ │ ├── HTFX.cs
│ │ ├── WCH5.cs
│ │ ├── WCH7.cs
│ │ ├── WCH8.cs
│ │ ├── WDB.cs
│ │ ├── WDB2.cs
│ │ ├── WDB5.cs
│ │ ├── WDB6.cs
│ │ ├── WDBC.cs
│ │ ├── WDC1.cs
│ │ ├── WDC2.cs
│ │ └── WDC3.cs
│ ├── MemoryReader.cs
│ ├── RelationShipData.cs
│ └── StringTable.cs
├── Resources
│ ├── LoadDef.png
│ ├── close.png
│ ├── csv.png
│ ├── hide.png
│ ├── icon.ico
│ ├── open-new.png
│ ├── open.png
│ ├── paintbrush.png
│ ├── reload.png
│ ├── save_file.png
│ ├── search.png
│ ├── sql.png
│ ├── sqlfile.png
│ ├── table.png
│ ├── target.png
│ ├── tick.png
│ └── toggle.png
├── Storage
│ ├── DBEntry.cs
│ ├── Database.cs
│ └── Definition.cs
├── UpdateManager.cs
├── WDBXEditor.csproj
├── packages.config
├── x64
│ └── StormLib.dll
└── x86
│ └── StormLib.dll
└── appveyor.yml
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 | Changes.txt
10 |
11 | # User-specific files (MonoDevelop/Xamarin Studio)
12 | *.userprefs
13 |
14 | # Build results
15 | [Dd]ebug/
16 | [Dd]ebugPublic/
17 | [Rr]elease/
18 | [Rr]eleases/
19 | bld/
20 | [Bb]in/
21 | [Oo]bj/
22 | [Ll]og/
23 |
24 | # Visual Studio 2015 cache/options directory
25 | .vs/
26 | # Uncomment if you have tasks that create the project's static files in wwwroot
27 | #wwwroot/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | # DNX
43 | project.lock.json
44 | artifacts/
45 |
46 | *_i.c
47 | *_p.c
48 | *_i.h
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.tmp_proj
63 | *.log
64 | *.vspscc
65 | *.vssscc
66 | .builds
67 | *.pidb
68 | *.svclog
69 | *.scc
70 |
71 | # Chutzpah Test files
72 | _Chutzpah*
73 |
74 | # Visual C++ cache files
75 | ipch/
76 | *.aps
77 | *.ncb
78 | *.opendb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 | *.VC.db
83 | *.VC.VC.opendb
84 |
85 | # Visual Studio profiler
86 | *.psess
87 | *.vsp
88 | *.vspx
89 | *.sap
90 |
91 | # TFS 2012 Local Workspace
92 | $tf/
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 | *.DotSettings.user
101 |
102 | # JustCode is a .NET coding add-in
103 | .JustCode
104 |
105 | # TeamCity is a build add-in
106 | _TeamCity*
107 |
108 | # DotCover is a Code Coverage Tool
109 | *.dotCover
110 |
111 | # NCrunch
112 | _NCrunch_*
113 | .*crunch*.local.xml
114 | nCrunchTemp_*
115 |
116 | # MightyMoose
117 | *.mm.*
118 | AutoTest.Net/
119 |
120 | # Web workbench (sass)
121 | .sass-cache/
122 |
123 | # Installshield output folder
124 | [Ee]xpress/
125 |
126 | # DocProject is a documentation generator add-in
127 | DocProject/buildhelp/
128 | DocProject/Help/*.HxT
129 | DocProject/Help/*.HxC
130 | DocProject/Help/*.hhc
131 | DocProject/Help/*.hhk
132 | DocProject/Help/*.hhp
133 | DocProject/Help/Html2
134 | DocProject/Help/html
135 |
136 | # Click-Once directory
137 | publish/
138 |
139 | # Publish Web Output
140 | *.[Pp]ublish.xml
141 | *.azurePubxml
142 | # TODO: Comment the next line if you want to checkin your web deploy settings
143 | # but database connection strings (with potential passwords) will be unencrypted
144 | *.pubxml
145 | *.publishproj
146 |
147 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
148 | # checkin your Azure Web App publish settings, but sensitive information contained
149 | # in these scripts will be unencrypted
150 | PublishScripts/
151 |
152 | # NuGet Packages
153 | *.nupkg
154 | # The packages folder can be ignored because of Package Restore
155 | **/packages/*
156 | # except build/, which is used as an MSBuild target.
157 | !**/packages/build/
158 | # Uncomment if necessary however generally it will be regenerated when needed
159 | #!**/packages/repositories.config
160 | # NuGet v3's project.json files produces more ignoreable files
161 | *.nuget.props
162 | *.nuget.targets
163 |
164 | # Microsoft Azure Build Output
165 | csx/
166 | *.build.csdef
167 |
168 | # Microsoft Azure Emulator
169 | ecf/
170 | rcf/
171 |
172 | # Windows Store app package directories and files
173 | AppPackages/
174 | BundleArtifacts/
175 | Package.StoreAssociation.xml
176 | _pkginfo.txt
177 |
178 | # Visual Studio cache files
179 | # files ending in .cache can be ignored
180 | *.[Cc]ache
181 | # but keep track of directories ending in .cache
182 | !*.[Cc]ache/
183 |
184 | # Others
185 | ClientBin/
186 | ~$*
187 | *~
188 | *.dbmdl
189 | *.dbproj.schemaview
190 | *.pfx
191 | *.publishsettings
192 | node_modules/
193 | orleans.codegen.cs
194 |
195 | # Since there are multiple workflows, uncomment next line to ignore bower_components
196 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
197 | #bower_components/
198 |
199 | # RIA/Silverlight projects
200 | Generated_Code/
201 |
202 | # Backup & report files from converting an old project file
203 | # to a newer Visual Studio version. Backup files are not needed,
204 | # because we have git ;-)
205 | _UpgradeReport_Files/
206 | Backup*/
207 | UpgradeLog*.XML
208 | UpgradeLog*.htm
209 |
210 | # SQL Server files
211 | *.mdf
212 | *.ldf
213 |
214 | # Business Intelligence projects
215 | *.rdl.data
216 | *.bim.layout
217 | *.bim_*.settings
218 |
219 | # Microsoft Fakes
220 | FakesAssemblies/
221 |
222 | # GhostDoc plugin setting file
223 | *.GhostDoc.xml
224 |
225 | # Node.js Tools for Visual Studio
226 | .ntvs_analysis.dat
227 |
228 | # Visual Studio 6 build log
229 | *.plg
230 |
231 | # Visual Studio 6 workspace options file
232 | *.opt
233 |
234 | # Visual Studio LightSwitch build output
235 | **/*.HTMLClient/GeneratedArtifacts
236 | **/*.DesktopClient/GeneratedArtifacts
237 | **/*.DesktopClient/ModelManifest.xml
238 | **/*.Server/GeneratedArtifacts
239 | **/*.Server/ModelManifest.xml
240 | _Pvt_Extensions
241 |
242 | # Paket dependency manager
243 | .paket/paket.exe
244 | paket-files/
245 |
246 | # FAKE - F# Make
247 | .fake/
248 |
249 | # JetBrains Rider
250 | .idea/
251 | *.sln.iml
252 | .vscode/settings.json
253 |
--------------------------------------------------------------------------------
/AdvancedDataGridView/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Properties/AssemblyInfo.cs
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/ColumnHeader_Filtered.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/ColumnHeader_Filtered.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/ColumnHeader_FilteredAndOrderedASC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/ColumnHeader_FilteredAndOrderedASC.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/ColumnHeader_FilteredAndOrderedDESC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/ColumnHeader_FilteredAndOrderedDESC.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/ColumnHeader_OrderedASC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/ColumnHeader_OrderedASC.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/ColumnHeader_OrderedDESC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/ColumnHeader_OrderedDESC.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/ColumnHeader_UnFiltered.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/ColumnHeader_UnFiltered.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/MenuStrip_OrderASCtxt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/MenuStrip_OrderASCtxt.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/MenuStrip_OrderDESCtxt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/MenuStrip_OrderDESCtxt.png
--------------------------------------------------------------------------------
/AdvancedDataGridView/Resources/Images/MenuStrip_ResizeGrip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/AdvancedDataGridView/Resources/Images/MenuStrip_ResizeGrip.png
--------------------------------------------------------------------------------
/Help/CommandLine.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Command Line
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | WDBX
52 | Editor Help
53 | Command Line
54 |
55 |
56 |
57 |
58 | Command Line Arguments
59 |
60 | Console Mode
61 |
62 | Opens the editor in a console window. Type help to see a list of commands.
63 |
64 | Arguments:
65 |
66 |
67 | -console
68 |
69 |
70 |
71 | Example: -console
72 |
73 |
74 |
75 | Extract
76 |
77 | Extracts files matching the file filter from either an MPQ archive or a CASC directory.
78 |
79 | Arguments:
80 |
81 |
82 | -f : File filter, * is used as a wildcard
83 |
84 | -s : Source, this is the location of the MPQ file or the CASC directory
85 |
86 | -o Output directory, this is the folder to export the files to
87 |
88 |
89 |
90 | Example: -extract -f "*.dbc" -s "E:\WoW\Data\Patch-3.mpq" -o "C:\WotLK\"
91 |
92 |
93 | Export
94 |
95 | Exports a specific file to either CSV, JSON or a SQL file.
96 |
97 | Arguments:
98 |
99 |
100 | -f : File, if combined with a source this simply needs to be the filename otherwise the full file path
101 |
102 | -s : Source, this is the optional location of the MPQ file or the CASC directory
103 |
104 | -b : Build number to load the correct definition from
105 |
106 | -o Output directory, this is the output file name and location
107 |
108 |
109 |
110 | Example: -export -f "Achievement.dbc" -s "E:\WoW\Data\Patch-3.mpq" -b 11802 -o "Achievement.csv"
111 |
112 |
113 | SQL Dump
114 |
115 | Dumps a specific file's data into a MySQL database.
116 |
117 | Arguments:
118 |
119 |
120 | -f : File, if combined with a source this simply needs to be the filename otherwise the full file path
121 |
122 | -s : Source, this is the optional location of the MPQ file or the CASC directory
123 |
124 | -b : Build number to load the correct definition from
125 |
126 | -c Connection string, the MySQL connection string including database name
127 |
128 |
129 |
130 | Example: -sqldump -f "Achievement.dbc" -s "E:\WoW\Data\Patch-3.mpq" -b 11802 -c "Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/Help/DataGrid.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Tools
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | WDBX
52 | Editor Help
53 | Data Grid
54 |
55 |
56 |
57 |
58 | Custom Header
59 | The data grid has been custom built to support basic actions that should be included in any grid based program. These include:
60 |
61 | Sorting - Two way sorts for both numbers and strings
62 | Filter - A relatively complex filtering system is available whereby chaining AND or OR statements together can be achieved (similar to boolean search). There are several operators that are distinct to the data type
63 | Hex View - Integers also have the option to be displayed as hex which is in the format of 0x{0:X?} with ? being the largest field length. With this turned on you will only be able to edit in hex (prefixing with '0x' isn't required)
64 |
65 |
66 |
67 |
68 | Column Filter
69 | The column filter allows the hiding of any specified columns and the option to restore all, this is particularly useful for localised strings in older DBC files when you are only working with one locale. This state is reset everytime the current file being edited is changed
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/Help/FindReplace.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Tools
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | WDBX
52 | Editor Help
53 | Find and Replace
54 |
55 |
56 |
57 |
58 | Find and Replace
59 | The Find and Replace window is designed to stay active when used and changes opacity in a similar fashion to Notepad++. There are several search options that are available:
60 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Help/Help.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Help.chm
--------------------------------------------------------------------------------
/Help/Help.hhp:
--------------------------------------------------------------------------------
1 | [OPTIONS]
2 | Compatibility=1.1 or later
3 | Compiled file=Help.chm
4 | Contents file=help.hhc
5 | Default topic=Introduction.htm
6 | Display compile progress=No
7 | Index file=help.hhk
8 | Language=0x809 English (United Kingdom)
9 |
10 |
11 | [FILES]
12 | Import_Export.htm
13 | Introduction.htm
14 | Menu_Items.htm
15 | Tools.htm
16 | DataGrid.htm
17 | FindReplace.htm
18 |
19 | [INFOTYPES]
20 |
21 |
--------------------------------------------------------------------------------
/Help/Images/DataGrid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Images/DataGrid.png
--------------------------------------------------------------------------------
/Help/Images/Definition Editor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Images/Definition Editor.png
--------------------------------------------------------------------------------
/Help/Images/Definition Selector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Images/Definition Selector.png
--------------------------------------------------------------------------------
/Help/Images/FindReplace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Images/FindReplace.png
--------------------------------------------------------------------------------
/Help/Images/SQL Import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Images/SQL Import.png
--------------------------------------------------------------------------------
/Help/Import_Export.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Import Export
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | WDBX
52 | Editor Help
53 | Import Export
54 |
55 |
56 |
57 |
58 | Export
59 | To SQL - When exporting directly to a database, the system will create a
60 | table named `db_<FileName>` which is then populated using the MySQL Bulk
61 | Copy which is faster than importing a SQL file.
62 | To SQL File - This will generate a MySQL formatted file
63 | To CSV - This will produce a comma seperated file, with escaped strings
64 | To MPQ - This will export the selected file to an MPQ archive, if an existing
65 | archive is selected then the file will be appended to it otherwise a new archive
66 | will be created
67 | Import
68 | From SQL - This will import data directly from a MySQL database
69 | From CSV
70 | Import Notes:
71 |
72 | Columns currently need to be identical to the definition file i.e. same column names, types and count
73 | Importing data has the choice of:
74 |
75 | Importing new rows only
76 | Updating different rows and importing new rows
77 | Overwriting all existing data
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/Help/Introduction.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Introduction
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | WDBX
52 | Editor Help
53 | Introduction
54 |
55 |
56 |
57 |
58 | WDBX Editor is an editor designed to open all release
59 | client database files implemented in World of Warcraft clients.
60 | The currently supported file formats are:
61 |
62 |
63 | DBC
64 |
65 | DB2
66 |
67 | ADB
68 |
69 | WDB
70 | The editor works with all versions of World of Warcraft
71 | ranging from the Alpha (0.5.3) up to the latest build of Legion.
72 | The base editor features includes:
73 |
74 | Full support of release versions of DBC, DB2, WDB and ADB (WCH3 and WCH4 are not supported as I deem them depreciated)
75 | Opening and having open multiple files regardless of type and build
76 | Open DBC/DB2 files from both MPQ and CASC directories
77 | Save single (to file) and save all (to folder)
78 | Standard CRUD operations as well as go to, copy row, paste row, undo and redo
79 | Hide, show and sort columns
80 | A relatively powerful column filter system
81 | Displaying and editing columns in hex (supported on numeric columns only)
82 | Exporting to SQL Database, SQL file, CSV and MPQ
83 | Importing from SQL Database and CSV
84 | An Excel style Find and Replace
85 | Shortcuts for common tasks using commonly used key combinations
86 |
87 | I've included some functionality around
88 | Importing, Exporting and also some tools to help do common tasks. The data grid itself has also been custom built to implement common grid features.
89 |
90 | The application works as a single instance so all files will open within the original instance of the program. There is however an option to open new files in a new instance. The program also has command line arguments which can be utalised with batch scripts and provides integration into other systems.
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Help/Main Screen/btn_next_n.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Main Screen/btn_next_n.gif
--------------------------------------------------------------------------------
/Help/Main Screen/btn_prev_n.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robinsch/WDBXEditor/c4b7f1bea74a5ac98d0066885981ca2c5a58e95d/Help/Main Screen/btn_prev_n.gif
--------------------------------------------------------------------------------
/Help/Notes.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Tools
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | WDBX
52 | Editor Help
53 | Tips and Notes
54 |
55 |
56 |
57 |
58 | Tips and Notes
59 | Some things to remember and note:
60 |
61 | Importing gives you the option to import; new rows, changed and new rows and to override all data
62 | Legion ADB files MUST have the DB2 counterpart open BEFORE as required information is stored in the DB2 file. The program will prioritise DB2 if DB2 and ADB are opened at the same time
63 | Find and Replace can be set to case sensitive and match entire cell value
64 | Database connection details are saved on successful connection
65 | The WDB5 Parser works surprisingly well thanks to the new field structure data however it does trip up on the inline strings so definitions will need to be validated manually
66 | Undo, redo and copy data history are lost when changing the current file
67 | Everything is stored in memory so if your PC is ancient the program will crash attempting to read hundreds of files at once!
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/Help/Tools.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Tools
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | WDBX
52 | Editor Help
53 | Tools
54 |
55 |
56 |
57 |
58 | Defintion Editor
59 | The definition editor allows the ability to create, edit
60 | and delete defintions.
61 | These can also be created and
62 | edited manually. Any *.xml files in the Definition will be imported
63 | provided they meet the basic rules of being named correctly and having a single
64 | int32 ID column.
65 | Available Types:
66 |
90 | There are also a number of additional settings that are
91 | rarely used.
92 |
93 |
94 | AutoGenerated - This is used to add a column that
95 | does not read data from the file i.e. CharBaseInfo where there is no
96 | ID field
97 |
98 | ArraySize - Allows the grouping of simlar fields. The
99 | column name will be incremented when displayed i.e. Field, Field_1, Field_2 etc
100 |
101 | Padding - This is used where files are nonuniformly
102 | padded such as having a padding in the middle of the file
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/Help/help.hhc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/Help/help.hhk:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WDBX Editor
2 |
3 | ### About
4 | This editor has full support for reading and saving all release versions of DBC, DB2, WDB, ADB and DBCache. This does include support for Legion DB2 and DBCache files and works with all variants (header flags) of these.
5 | Like the other editors I've used a definition based system whereby definitions tell the editor how to interpret each file's columns - this is a lot more reliable than guessing column types but does mean the definitions must be maintained. So far, I've mapped almost all expansions with MoP being ~50% complete and everything else being 99%+ (excluding column names).
6 |
7 | You will need [Microsoft .NET Framework 4.6.1](https://www.microsoft.com/en-us/download/details.aspx?id=49982) to run this application
8 |
9 | ### Features:
10 | * Full support of release versions of DBC, DB2, WDB, ADB and DBCache (WCH3 and WCH4 are not supported as I deem them depreciated)
11 | * Supports being the default file assocation
12 | * Opening and having open multiple files regardless of type and build
13 | * Open DBC/DB2 files from both MPQ archives and CASC directories
14 | * Save single (to file) and save all (to folder)
15 | * Standard CRUD operations as well as go to, copy row, paste row, undo and redo
16 | * Hide, show, hide empty and sort columns
17 | * A relatively powerful column filter system (similar to boolean search)
18 | * Displaying and editing columns in hex (numeric columns only)
19 | * Exporting to a SQL database, SQL file, CSV file and MPQ archives
20 | * Importing from a SQL database and a CSV file
21 | * An Excel style Find and Replace
22 | * Shortcuts for common tasks using common shortcut key combinations
23 | * A help file to try and cover off some of the pitfalls and caveats of the program (needs some work)
24 | * A simple memory reader to get player's co-ordinates from the client
25 | * A colour picker for LightData and LightIntBand
26 |
27 | ### Tools:
28 | * Definition editor for maintaining the definitions
29 | * WotLK Item Import to remove the dreaded red question mark from custom items
30 | * Legion Parser which is an attempt to automatically parse the structure of WDB5 and WDB6 files
31 |
32 | ### Project Goal:
33 | The goal of this project is to create a communal program that is compatible with all file variants, is feature rich and negates the need to use multiple different programs.
34 | This means any and all contribution in the form of commits, change requests, issues etc are more than welcome!
35 |
36 | ### Credits:
37 | Credits go to Ladislav Zezula for the awesome StormLib and thanks to all those that contribute to the WoWDev wiki.
38 | I've also patched the definitions together for various sources across the internet, there are too many to name, but thanks to all.
39 |
--------------------------------------------------------------------------------
/Run on Linux.md:
--------------------------------------------------------------------------------
1 | ## Run WDBX on Ubuntu with wine
2 |
3 | Install last version of wine from this guide: https://tecadmin.net/install-wine-on-ubuntu/
4 |
5 | Install also winetricks using:
6 | ```
7 | $ sudo apt install winetricks
8 | ```
9 |
10 | Delete all previous dotnet versions that you have installed and run:
11 |
12 | ```
13 | $ winetricks
14 | ```
15 |
16 | Running winetricks, Wine Mono Installer will appear, just wait and install.
17 | This will solve the following error:
18 | ```
19 | 0009:err:mscoree:CLRRuntimeInfo_GetRuntimeHost Wine Mono is not installed
20 | ```
21 |
22 |
23 | Run:
24 | ```
25 | winetricks dotnet461
26 | ```
27 |
28 | Here you go, now you can run WDBX.exe
29 |
30 |
31 | ## Troubleshooting:
32 |
33 | If **Wine Mono Installer** does not appear or you get some errors, try to clean everything about wine and winetricks using:
34 | ```
35 | $ winetricks
36 | ```
37 | - `Select the default wineprefix`
38 | - `Install a Windows DLL or component`
39 | - last option `Delete ALL DATA AND APPLICATIONS INSIDE THIS WINEPREFIX` <-- be careful, this will delete everything inside your ~/.wine directory.
40 | - follow again the steps
41 |
42 |
43 | ### Credits
44 |
45 | - [Helias](https://github.com/Helias)
46 |
47 | Tested with wine 4.0.2, Ubuntu 18.04.3 LTS and with [WDBX 1.1.9a](https://github.com/WowDevTools/WDBXEditor/releases/tag/1.1.9.a)
48 |
--------------------------------------------------------------------------------
/UpdateDBC.bat:
--------------------------------------------------------------------------------
1 | SET WDBX="C:\WDBXEditor\WDBX Editor.exe"
2 |
3 | FOR %%A IN (%*) DO %WDBX% -sqlload -f %%A -b 12340 -m 2 -c "Server=127.0.0.1;Database=database;Uid=trinity;Pwd=trinity;"
--------------------------------------------------------------------------------
/WDBXEditor.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WDBXEditor", "WDBXEditor\WDBXEditor.csproj", "{E1F42B5C-7A40-4539-AD92-E24CAD7041F5}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedDataGridView", "AdvancedDataGridView\AdvancedDataGridView.csproj", "{6EBA0A55-B390-4479-A564-58D46094998D}"
9 | EndProject
10 | Global
11 | GlobalSection(Performance) = preSolution
12 | HasPerformanceSessions = true
13 | EndGlobalSection
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|Any CPU = Debug|Any CPU
16 | Debug|x64 = Debug|x64
17 | Release|Any CPU = Release|Any CPU
18 | Release|x64 = Release|x64
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Debug|x64.ActiveCfg = Debug|x64
24 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Debug|x64.Build.0 = Debug|x64
25 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Release|x64.ActiveCfg = Release|x64
28 | {E1F42B5C-7A40-4539-AD92-E24CAD7041F5}.Release|x64.Build.0 = Release|x64
29 | {6EBA0A55-B390-4479-A564-58D46094998D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {6EBA0A55-B390-4479-A564-58D46094998D}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {6EBA0A55-B390-4479-A564-58D46094998D}.Debug|x64.ActiveCfg = Debug|x64
32 | {6EBA0A55-B390-4479-A564-58D46094998D}.Debug|x64.Build.0 = Debug|x64
33 | {6EBA0A55-B390-4479-A564-58D46094998D}.Release|Any CPU.ActiveCfg = Release|Any CPU
34 | {6EBA0A55-B390-4479-A564-58D46094998D}.Release|Any CPU.Build.0 = Release|Any CPU
35 | {6EBA0A55-B390-4479-A564-58D46094998D}.Release|x64.ActiveCfg = Release|x64
36 | {6EBA0A55-B390-4479-A564-58D46094998D}.Release|x64.Build.0 = Release|x64
37 | EndGlobalSection
38 | GlobalSection(SolutionProperties) = preSolution
39 | HideSolutionNode = FALSE
40 | EndGlobalSection
41 | GlobalSection(ExtensibilityGlobals) = postSolution
42 | SolutionGuid = {645EB3D9-4619-4DF0-BDC5-9A0B95065969}
43 | EndGlobalSection
44 | EndGlobal
45 |
--------------------------------------------------------------------------------
/WDBXEditor/About.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WDBXEditor
2 | {
3 | partial class About
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(About));
32 | this.imgLogo = new System.Windows.Forms.PictureBox();
33 | this.txtAbout = new System.Windows.Forms.RichTextBox();
34 | ((System.ComponentModel.ISupportInitialize)(this.imgLogo)).BeginInit();
35 | this.SuspendLayout();
36 | //
37 | // imgLogo
38 | //
39 | this.imgLogo.BackColor = System.Drawing.SystemColors.Control;
40 | this.imgLogo.Image = ((System.Drawing.Image)(resources.GetObject("imgLogo.Image")));
41 | this.imgLogo.Location = new System.Drawing.Point(12, 12);
42 | this.imgLogo.Name = "imgLogo";
43 | this.imgLogo.Size = new System.Drawing.Size(40, 40);
44 | this.imgLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
45 | this.imgLogo.TabIndex = 0;
46 | this.imgLogo.TabStop = false;
47 | //
48 | // txtAbout
49 | //
50 | this.txtAbout.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
51 | | System.Windows.Forms.AnchorStyles.Left)
52 | | System.Windows.Forms.AnchorStyles.Right)));
53 | this.txtAbout.BorderStyle = System.Windows.Forms.BorderStyle.None;
54 | this.txtAbout.Enabled = false;
55 | this.txtAbout.Location = new System.Drawing.Point(58, 12);
56 | this.txtAbout.Name = "txtAbout";
57 | this.txtAbout.ReadOnly = true;
58 | this.txtAbout.Size = new System.Drawing.Size(289, 99);
59 | this.txtAbout.TabIndex = 1;
60 | this.txtAbout.Text = "WDBX Editor\n\nCreated by Barncastle © 2016\n\nCredits to Ladislav Zezula for the awe" +
61 | "some StormLib\n\nThanks to everyone that contributes to the WoWDev wiki";
62 | //
63 | // About
64 | //
65 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
66 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
67 | this.ClientSize = new System.Drawing.Size(348, 113);
68 | this.Controls.Add(this.txtAbout);
69 | this.Controls.Add(this.imgLogo);
70 | this.MaximizeBox = false;
71 | this.MinimizeBox = false;
72 | this.Name = "About";
73 | this.ShowIcon = false;
74 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
75 | this.Text = "About";
76 | ((System.ComponentModel.ISupportInitialize)(this.imgLogo)).EndInit();
77 | this.ResumeLayout(false);
78 |
79 | }
80 |
81 | #endregion
82 |
83 | private System.Windows.Forms.PictureBox imgLogo;
84 | private System.Windows.Forms.RichTextBox txtAbout;
85 | }
86 | }
--------------------------------------------------------------------------------
/WDBXEditor/About.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace WDBXEditor
12 | {
13 | public partial class About : Form
14 | {
15 | public About()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/WDBXEditor/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 3306
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | https://github.com/WowDevTools/WDBXEditor/releases
34 |
35 |
36 | http://api.github.com/repos/WowDevTools/WDBXEditor/releases/latest
37 |
38 |
39 | Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; WDBXEditor
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Constants/Locales.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WDBXEditor.Archives.CASC.Constants
4 | {
5 | [Flags]
6 | public enum Locales : uint
7 | {
8 | All = 0xFFFFFFFF,
9 | None = 0,
10 | EnUS = 0x2,
11 | KoKR = 0x4,
12 | FrFR = 0x10,
13 | DeDE = 0x20,
14 | ZhCN = 0x40,
15 | EsES = 0x80,
16 | ZhTW = 0x100,
17 | EnGB = 0x200,
18 | EnCN = 0x400,
19 | EnTW = 0x800,
20 | EsMX = 0x1000,
21 | RuRU = 0x2000,
22 | PtBR = 0x4000,
23 | ItIT = 0x8000,
24 | PtPT = 0x10000,
25 | All_WoW = EnUS | KoKR | FrFR | DeDE | ZhCN | EsES | ZhTW | EnGB | EsMX | RuRU | PtBR | ItIT | PtPT
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Handlers/BuildConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using WDBXEditor.Archives.Misc;
5 |
6 | namespace WDBXEditor.Archives.FileSystem.Structures
7 | {
8 | public class BuildConfig
9 | {
10 | public string[] this[string name]
11 | {
12 | get
13 | {
14 | string[] entry;
15 |
16 | if (entries.TryGetValue(name, out entry))
17 | return entry;
18 |
19 | return null;
20 | }
21 | }
22 |
23 | Dictionary entries = new Dictionary();
24 |
25 | public BuildConfig(string wowPath, string buildKey)
26 | {
27 | using (var sr = new StreamReader($"{wowPath}/Data/config/{buildKey.GetHexAt(0)}/{buildKey.GetHexAt(2)}/{buildKey}"))
28 | {
29 | while (!sr.EndOfStream)
30 | {
31 | var data = sr.ReadLine().Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
32 |
33 | if (data.Length < 2)
34 | continue;
35 |
36 | var key = data[0].Trim();
37 | var value = data[1].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
38 |
39 | entries.Add(key, value);
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Handlers/BuildInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace WDBXEditor.Archives.CASC.Handlers
6 | {
7 | public class BuildInfo
8 | {
9 | public string this[string name]
10 | {
11 | get
12 | {
13 | string entry;
14 | if (entries.TryGetValue(name, out entry))
15 | return entry;
16 |
17 | return null;
18 | }
19 | }
20 |
21 | Dictionary entries = new Dictionary();
22 |
23 | public BuildInfo(string file)
24 | {
25 | using (var sr = new StreamReader(file))
26 | {
27 | var header = sr.ReadLine().Split(new[] { '|', '!' });
28 | var dataLine = "";
29 |
30 | while ((dataLine = sr.ReadLine()) != null)
31 | {
32 | var data = dataLine.Split(new[] { '|' });
33 |
34 | if (data.Length != header.Length / 2)
35 | throw new InvalidOperationException("Invalid header length");
36 |
37 | // Be sure to get the active build info.
38 | if (data[1] == "0")
39 | continue;
40 |
41 | for (var i = 0; i < data.Length; i++)
42 | entries.Add(header[i << 1], data[i]);
43 | }
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Handlers/CDNConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using WDBXEditor.Archives.CASC.Structures;
5 | using WDBXEditor.Archives.Misc;
6 |
7 | namespace WDBXEditor.Archives.CASC.Handlers
8 | {
9 | class CDNConfig
10 | {
11 | public string[] this[string name]
12 | {
13 | get
14 | {
15 | string[] entry;
16 |
17 | if (entries.TryGetValue(name, out entry))
18 | return entry;
19 |
20 | return null;
21 | }
22 | }
23 |
24 | public string Host { get; set; }
25 | public string Path { get; set; }
26 | public string DownloadUrl => Host + Path;
27 |
28 | Dictionary entries = new Dictionary();
29 |
30 | public CDNConfig(string wowPath, string buildKey)
31 | {
32 | using (var sr = new StreamReader($"{wowPath}/Data/config/{buildKey.GetHexAt(0)}/{buildKey.GetHexAt(2)}/{buildKey}"))
33 | {
34 | while (!sr.EndOfStream)
35 | {
36 | var data = sr.ReadLine().Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
37 | if (data.Length < 2)
38 | continue;
39 |
40 | var key = data[0].Trim();
41 | var value = data[1].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
42 |
43 | entries.Add(key, value);
44 | }
45 | }
46 | }
47 |
48 | public BinaryReader DownloadFile(string archive, IndexEntry indexEntry)
49 | {
50 | throw new NotImplementedException("Client data folder is incomplete.");
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Handlers/DataFile.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO;
3 | using System.IO.Compression;
4 | using WDBXEditor.Archives.CASC.Structures;
5 | using WDBXEditor.Archives.Misc;
6 |
7 | namespace WDBXEditor.Archives.CASC.Handlers
8 | {
9 | public class DataFile
10 | {
11 | public readonly BinaryReader readStream;
12 |
13 | static object readLock = new object();
14 |
15 | public DataFile(Stream data)
16 | {
17 | readStream = new BinaryReader(data);
18 | }
19 |
20 | public static MemoryStream LoadBLTEEntry(IndexEntry idxEntry, BinaryReader readStream = null)
21 | {
22 | lock (readLock)
23 | {
24 | if (readStream == null)
25 | return null;
26 |
27 | readStream.BaseStream.Position = idxEntry.Offset + 30;
28 |
29 | if (readStream.ReadUInt32() != 0x45544C42)
30 | {
31 | Trace.TraceError($"data.{idxEntry.Index:000}: Invalid BLTE signature at 0x{readStream.BaseStream.Position:X8}.");
32 |
33 | return null;
34 | }
35 |
36 | var blte = new BLTEEntry();
37 | var frameHeaderLength = readStream.ReadBEUInt32();
38 | var chunks = 0u;
39 | var size = 0L;
40 |
41 | if (frameHeaderLength == 0)
42 | {
43 | chunks = 1;
44 | size = idxEntry.Size - 38;
45 | }
46 | else
47 | {
48 | readStream.BaseStream.Position += 1;
49 |
50 | chunks = readStream.ReadUInt24();
51 | }
52 |
53 | blte.Chunks = new BLTEChunk[chunks];
54 |
55 | for (var i = 0; i < chunks; i++)
56 | {
57 | if (frameHeaderLength == 0)
58 | {
59 | blte.Chunks[i].CompressedSize = size;
60 | blte.Chunks[i].UncompressedSize = size - 1;
61 | }
62 | else
63 | {
64 | blte.Chunks[i].CompressedSize = readStream.ReadBEUInt32();
65 | blte.Chunks[i].UncompressedSize = readStream.ReadBEUInt32();
66 |
67 | // Skip MD5 hash
68 | readStream.BaseStream.Position += 16;
69 | }
70 | }
71 |
72 | var data = new MemoryStream();
73 |
74 | for (var i = 0; i < chunks; i++)
75 | {
76 | var formatCode = readStream.ReadByte();
77 | var dataBytes = readStream.ReadBytes((int)blte.Chunks[i].CompressedSize - 1);
78 |
79 | // Not compressed
80 | if (formatCode == 0x4E)
81 | data.Write(dataBytes, 0, (int)blte.Chunks[i].UncompressedSize);
82 | // Compressed
83 | else if (formatCode == 0x5A)
84 | {
85 | using (var decompressed = new MemoryStream())
86 | {
87 | using (var inflate = new DeflateStream(new MemoryStream(dataBytes, 2, dataBytes.Length - 2), CompressionMode.Decompress))
88 | inflate.CopyTo(decompressed);
89 |
90 | var inflateData = decompressed.ToArray();
91 | data.Write(inflateData, 0, inflateData.Length);
92 | }
93 | }
94 | }
95 |
96 | data.Position = 0;
97 |
98 |
99 | return data;
100 | }
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Handlers/EncodingFile.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using WDBXEditor.Archives.CASC.Structures;
4 | using WDBXEditor.Archives.Misc;
5 |
6 | namespace WDBXEditor.Archives.CASC.Handlers
7 | {
8 | public class EncodingFile
9 | {
10 | public EncodingEntry this[byte[] md5]
11 | {
12 | get
13 | {
14 | EncodingEntry entry;
15 |
16 | if (entries.TryGetValue(md5, out entry))
17 | return entry;
18 |
19 | return default(EncodingEntry);
20 | }
21 | }
22 |
23 | public byte[] Key { get; }
24 |
25 | Dictionary entries = new Dictionary(new ByteArrayComparer());
26 |
27 | public EncodingFile(byte[] encodingKey)
28 | {
29 | Key = encodingKey.Slice(0, 9);
30 | }
31 |
32 | public void LoadEntries(DataFile file, IndexEntry indexEntry)
33 | {
34 | var blteEntry = new BinaryReader(DataFile.LoadBLTEEntry(indexEntry, file.readStream));
35 |
36 | blteEntry.BaseStream.Position = 9;
37 |
38 | var entries = blteEntry.ReadBEUInt32();
39 |
40 | blteEntry.BaseStream.Position += 5;
41 |
42 | var offsetEntries = blteEntry.ReadBEUInt32();
43 |
44 | blteEntry.BaseStream.Position += offsetEntries + (entries << 5);
45 |
46 | for (var i = 0; i < entries; i++)
47 | {
48 | var keys = blteEntry.ReadUInt16();
49 |
50 | while (keys != 0)
51 | {
52 | var encodingEntry = new EncodingEntry
53 | {
54 | Keys = new byte[keys][],
55 | Size = blteEntry.ReadBEUInt32()
56 | };
57 |
58 | var md5 = blteEntry.ReadBytes(16);
59 |
60 | for (var j = 0; j < keys; j++)
61 | encodingEntry.Keys[j] = blteEntry.ReadBytes(16);
62 |
63 | this.entries.Add(md5, encodingEntry);
64 |
65 | keys = blteEntry.ReadUInt16();
66 | }
67 |
68 | while (blteEntry.ReadByte() == 0);
69 |
70 | blteEntry.BaseStream.Position -= 1;
71 | }
72 |
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Handlers/IndexFile.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using WDBXEditor.Archives.CASC.Structures;
4 | using WDBXEditor.Archives.Misc;
5 |
6 | namespace WDBXEditor.Archives.CASC.Handlers
7 | {
8 | public class IndexFile
9 | {
10 | public IndexEntry this[byte[] hash]
11 | {
12 | get
13 | {
14 | IndexEntry entry;
15 |
16 | if (entries.TryGetValue(hash, out entry))
17 | return entry;
18 |
19 | return default(IndexEntry);
20 | }
21 | }
22 |
23 | public Dictionary entries = new Dictionary(new ByteArrayComparer());
24 |
25 | public IndexFile(string idx, bool cdnIndex = false, ushort fileIndex = 0)
26 | {
27 | if (cdnIndex)
28 | {
29 | var nullHash = new byte[16];
30 |
31 | using (var br = new BinaryReader(File.OpenRead(idx)))
32 | {
33 | br.BaseStream.Position = br.BaseStream.Length - 12;
34 |
35 | var entries = br.ReadUInt32();
36 |
37 | br.BaseStream.Position = 0;
38 |
39 | for (var i = 0; i < entries; i++)
40 | {
41 | var hash = br.ReadBytes(16);
42 |
43 | if (hash.Compare(nullHash))
44 | hash = br.ReadBytes(16);
45 |
46 | var entry = new IndexEntry
47 | {
48 | Index = fileIndex,
49 | Size = br.ReadBEUInt32(),
50 | Offset = br.ReadBEUInt32()
51 | };
52 |
53 | if (this.entries.ContainsKey(hash))
54 | continue;
55 |
56 | this.entries.Add(hash, entry);
57 | }
58 | }
59 | }
60 | else
61 | {
62 | using (var br = new BinaryReader(File.OpenRead(idx)))
63 | {
64 | br.BaseStream.Position = 0x20;
65 |
66 | var dataLength = br.ReadUInt32();
67 |
68 | br.BaseStream.Position += 4;
69 |
70 | // 18 bytes per entry.
71 | for (var i = 0; i < dataLength / 18; i++)
72 | {
73 | var hash = br.ReadBytes(9);
74 | var index = br.ReadByte();
75 | var offset = br.ReadBEUInt32();
76 |
77 | var entry = new IndexEntry();
78 |
79 | entry.Size = br.ReadUInt32();
80 | entry.Index = (ushort)((ushort)(index << 2) | (offset >> 30));
81 | entry.Offset = (uint)(offset & 0x3FFFFFFF);
82 |
83 | if (entries.ContainsKey(hash))
84 | continue;
85 |
86 | entries.Add(hash, entry);
87 | }
88 | }
89 | }
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Handlers/RootFile.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using WDBXEditor.Archives.CASC.Constants;
5 | using WDBXEditor.Archives.CASC.Structures;
6 |
7 | namespace WDBXEditor.Archives.CASC.Handlers
8 | {
9 | public class RootFile
10 | {
11 | public ILookup Entries { get; private set; }
12 |
13 | public RootEntry[] this[ulong hash] => Entries.Contains(hash) ? Entries[hash].ToArray() : new RootEntry[0];
14 |
15 | public void LoadEntries(DataFile file, IndexEntry indexEntry)
16 | {
17 | var list = new List();
18 | var blteEntry = new BinaryReader(DataFile.LoadBLTEEntry(indexEntry, file.readStream));
19 |
20 | while (blteEntry.BaseStream.Position < blteEntry.BaseStream.Length)
21 | {
22 | var entries = new RootEntry[blteEntry.ReadInt32()];
23 |
24 | blteEntry.BaseStream.Position += 4;
25 |
26 | var locales = (Locales)blteEntry.ReadUInt32();
27 |
28 | blteEntry.BaseStream.Position += (entries.Length << 2);
29 |
30 | for (var i = 0; i < entries.Length; i++)
31 | {
32 | list.Add(new RootEntry
33 | {
34 | MD5 = blteEntry.ReadBytes(16),
35 | Hash = blteEntry.ReadUInt64(),
36 | Locales = locales
37 | });
38 | }
39 | }
40 |
41 | Entries = list.ToLookup(re => re.Hash);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Misc/ByteArrayComparer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 |
4 | namespace WDBXEditor.Archives.Misc
5 | {
6 | public class ByteArrayComparer : IEqualityComparer, IEqualityComparer
7 | {
8 | public new bool Equals(object x, object y)
9 | {
10 | var eq = x as IStructuralEquatable;
11 | return eq == null ? object.Equals(x, y) : eq.Equals(y, this);
12 | }
13 |
14 | public int GetHashCode(object obj)
15 | {
16 | var eq = obj as IStructuralEquatable;
17 | return eq == null ? EqualityComparer.Default.GetHashCode(obj) : eq.GetHashCode(this);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Misc/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace WDBXEditor.Archives.Misc
5 | {
6 | public static class Extensions
7 | {
8 | public static byte[] ToByteArray(this string s)
9 | {
10 | var data = new byte[s.Length / 2];
11 |
12 | for (int i = 0; i < s.Length; i += 2)
13 | data[i / 2] = Convert.ToByte(s.Substring(i, 2), 16);
14 |
15 | return data;
16 | }
17 |
18 | public static string GetHexAt(this string value, int index)
19 | {
20 | var hex = Convert.ToByte(value.Substring(index, 2), 16);
21 |
22 | return $"{hex:x2}";
23 | }
24 |
25 | public static bool Compare(this byte[] b, byte[] b2)
26 | {
27 | for (int i = 0; i < b2.Length; i++)
28 | if (b[i] != b2[i])
29 | return false;
30 |
31 | return true;
32 | }
33 |
34 | public static T[] Slice(this T[] arr, int start, int end)
35 | {
36 | var newLength = end - start;
37 | var ret = new T[newLength];
38 |
39 | for (var i = 0; i < newLength; i++)
40 | ret[i] = arr[start + i];
41 |
42 | return ret;
43 | }
44 |
45 | public static ushort ReadBEUInt16(this BinaryReader br)
46 | {
47 | return (ushort)System.Net.IPAddress.HostToNetworkOrder(br.ReadInt16());
48 | }
49 |
50 | public static uint ReadBEUInt32(this BinaryReader br)
51 | {
52 | return (uint)System.Net.IPAddress.HostToNetworkOrder(br.ReadInt32());
53 | }
54 |
55 | public static uint ReadUInt24(this BinaryReader br)
56 | {
57 | var bytes = br.ReadBytes(3);
58 |
59 | return (uint)((bytes[0] << 16) | (bytes[1] << 8) | bytes[2]);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Misc/Lookup3.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using System.Text;
4 |
5 | namespace WDBXEditor.Archives.Misc
6 | {
7 | public class Lookup3
8 | {
9 | public ulong Hash(string data)
10 | {
11 | data = data.Replace('/', '\\').ToUpperInvariant(); // fix string
12 | return Hash(Encoding.ASCII.GetBytes(data));
13 | }
14 |
15 | public ulong Hash(byte[] data)
16 | {
17 | var length = data.Length;
18 | uint a, b, c;
19 |
20 | a = b = c = 0xdeadbeef + (uint)length;
21 |
22 | if ((data.Length % 12) != 0)
23 | Array.Resize(ref data, data.Length + (12 - (data.Length % 12)));
24 |
25 | var k = 0;
26 |
27 | while (length > 12)
28 | {
29 | var i = (k >> 2) << 2;
30 |
31 | a += BitConverter.ToUInt32(data, i);
32 | b += BitConverter.ToUInt32(data, i + 4);
33 | c += BitConverter.ToUInt32(data, i + 8);
34 |
35 | Mix(ref a, ref b, ref c);
36 |
37 | length -= 12;
38 | k += 12;
39 | }
40 |
41 | var l = data.Length - 12;
42 |
43 | a += BitConverter.ToUInt32(data, l);
44 | b += BitConverter.ToUInt32(data, l + 4);
45 | c += BitConverter.ToUInt32(data, l + 8);
46 |
47 | Final(ref a, ref b, ref c);
48 |
49 | return ((ulong)c << 32) | b;
50 | }
51 |
52 | void Mix(ref uint a, ref uint b, ref uint c)
53 | {
54 | a -= c; a ^= Rot(c, 4); c += b;
55 | b -= a; b ^= Rot(a, 6); a += c;
56 | c -= b; c ^= Rot(b, 8); b += a;
57 | a -= c; a ^= Rot(c, 16); c += b;
58 | b -= a; b ^= Rot(a, 19); a += c;
59 | c -= b; c ^= Rot(b, 4); b += a;
60 | }
61 |
62 | void Final(ref uint a, ref uint b, ref uint c)
63 | {
64 | c ^= b; c -= Rot(b, 14);
65 | a ^= c; a -= Rot(c, 11);
66 | b ^= a; b -= Rot(a, 25);
67 | c ^= b; c -= Rot(b, 16);
68 | a ^= c; a -= Rot(c, 4);
69 | b ^= a; b -= Rot(a, 14);
70 | c ^= b; c -= Rot(b, 24);
71 | }
72 |
73 | uint Rot(uint x, int k)
74 | {
75 | return (x << k) | (x >> (32 - k));
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Structures/BLTEChunk.cs:
--------------------------------------------------------------------------------
1 | namespace WDBXEditor.Archives.CASC.Structures
2 | {
3 | public struct BLTEChunk
4 | {
5 | public long CompressedSize { get; set; }
6 | public long UncompressedSize { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Structures/BLTEEntry.cs:
--------------------------------------------------------------------------------
1 | namespace WDBXEditor.Archives.CASC.Structures
2 | {
3 | public class BLTEEntry
4 | {
5 | public BLTEChunk[] Chunks { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Structures/EncodingEntry.cs:
--------------------------------------------------------------------------------
1 | namespace WDBXEditor.Archives.CASC.Structures
2 | {
3 | public struct EncodingEntry
4 | {
5 | public byte[][] Keys { get; set; }
6 | public uint Size { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Structures/IndexEntry.cs:
--------------------------------------------------------------------------------
1 | namespace WDBXEditor.Archives.CASC.Structures
2 | {
3 | public struct IndexEntry
4 | {
5 | public ushort Index { get; set; }
6 | public uint Offset { get; set; }
7 | public uint Size { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/CASC/Structures/RootEntry.cs:
--------------------------------------------------------------------------------
1 | using WDBXEditor.Archives.CASC.Constants;
2 |
3 | namespace WDBXEditor.Archives.CASC.Structures
4 | {
5 | public struct RootEntry
6 | {
7 | public byte[] MD5 { get; set; }
8 | public ulong Hash { get; set; }
9 | public Locales Locales { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/MpqArchiveCompactingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace WDBXEditor.Archives.MPQ
7 | {
8 | public delegate void MpqArchiveCompactingEventHandler(MpqArchive sender, MpqArchiveCompactingEventArgs e);
9 |
10 | public class MpqArchiveCompactingEventArgs : EventArgs
11 | {
12 | internal MpqArchiveCompactingEventArgs(uint dwWorkType, ulong processed, ulong total)
13 | {
14 | unchecked
15 | {
16 | WorkType = (MpqCompactingWorkType)dwWorkType;
17 | BytesProcessed = (long)processed;
18 | TotalBytes = (long)total;
19 | }
20 | }
21 |
22 | public MpqCompactingWorkType WorkType
23 | {
24 | get;
25 | private set;
26 | }
27 |
28 | public long BytesProcessed
29 | {
30 | get;
31 | private set;
32 | }
33 |
34 | public long TotalBytes
35 | {
36 | get;
37 | private set;
38 | }
39 | }
40 |
41 | public enum MpqCompactingWorkType
42 | {
43 | CheckingFiles = 1,
44 | CheckingHashTable = 2,
45 | CopyingNonMpqData = 3,
46 | CompactingFiles = 4,
47 | ClosingArchive = 5,
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/MpqFileStream.cs:
--------------------------------------------------------------------------------
1 | using WDBXEditor.Archives.MPQ.Native;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading;
9 |
10 | namespace WDBXEditor.Archives.MPQ
11 | {
12 | public class MpqFileStream : Stream
13 | {
14 | private MpqFileSafeHandle _handle;
15 | private FileAccess _accessType;
16 | private MpqArchive _owner;
17 |
18 | internal MpqFileStream(MpqFileSafeHandle handle, FileAccess accessType, MpqArchive owner)
19 | {
20 | _handle = handle;
21 | _accessType = accessType;
22 | _owner = owner;
23 | }
24 |
25 | private void VerifyHandle()
26 | {
27 | if (_handle == null || _handle.IsInvalid || _handle.IsClosed)
28 | throw new ObjectDisposedException("MpqFileStream");
29 | }
30 |
31 | public override bool CanRead
32 | {
33 | get { VerifyHandle(); return true; }
34 | }
35 |
36 | public override bool CanSeek
37 | {
38 | get { VerifyHandle(); return true; }
39 | }
40 |
41 | public override bool CanWrite
42 | {
43 | get { VerifyHandle(); return _accessType != FileAccess.Read; }
44 | }
45 |
46 | public override void Flush()
47 | {
48 | VerifyHandle();
49 |
50 | _owner.Flush();
51 | }
52 |
53 | public override long Length
54 | {
55 | get
56 | {
57 | VerifyHandle();
58 |
59 | uint high = 0;
60 | uint low = NativeMethods.SFileGetFileSize(_handle, ref high);
61 |
62 | ulong val = (high << 32) | low;
63 | return unchecked((long)val);
64 | }
65 | }
66 |
67 | public override long Position
68 | {
69 | get
70 | {
71 | VerifyHandle();
72 |
73 | return NativeMethods.SFileGetFilePointer(_handle);
74 | }
75 | set
76 | {
77 | Seek(value, SeekOrigin.Begin);
78 | }
79 | }
80 |
81 | public override unsafe int Read(byte[] buffer, int offset, int count)
82 | {
83 | if (buffer == null)
84 | throw new ArgumentNullException("buffer");
85 | if (offset > buffer.Length || (offset + count) > buffer.Length)
86 | throw new ArgumentException();
87 | if (count < 0)
88 | throw new ArgumentOutOfRangeException("count");
89 |
90 | VerifyHandle();
91 |
92 | bool success;
93 | uint read;
94 | fixed (byte* pb = &buffer[offset])
95 | {
96 | NativeOverlapped overlapped = default(NativeOverlapped);
97 | success = NativeMethods.SFileReadFile(_handle, new IntPtr(pb), unchecked((uint)count), out read, ref overlapped);
98 | }
99 |
100 | if (!success)
101 | throw new Exception("Unable to read file");
102 |
103 | return unchecked((int)read);
104 | }
105 |
106 | public override long Seek(long offset, SeekOrigin origin)
107 | {
108 | VerifyHandle();
109 |
110 | uint low, high;
111 | low = unchecked((uint)(offset & 0xffffffffu));
112 | high = unchecked((uint)(offset >> 32));
113 | return NativeMethods.SFileSetFilePointer(_handle, low, ref high, (uint)origin);
114 | }
115 |
116 | public override void SetLength(long value)
117 | {
118 | throw new NotSupportedException();
119 | }
120 |
121 | public override unsafe void Write(byte[] buffer, int offset, int count)
122 | {
123 | VerifyHandle();
124 |
125 | if (buffer == null)
126 | throw new ArgumentNullException("buffer");
127 | if (offset > buffer.Length || (offset + count) > buffer.Length)
128 | throw new ArgumentException();
129 | if (count < 0)
130 | throw new ArgumentOutOfRangeException("count");
131 |
132 | VerifyHandle();
133 |
134 | bool success;
135 | fixed (byte* pb = &buffer[offset])
136 | {
137 | success = NativeMethods.SFileWriteFile(_handle, new IntPtr(pb), unchecked((uint)count), 0u);
138 | }
139 |
140 | if (!success)
141 | throw new Win32Exception();
142 | }
143 |
144 | protected override void Dispose(bool disposing)
145 | {
146 | base.Dispose(disposing);
147 |
148 | if (disposing)
149 | {
150 | if (_handle != null && !_handle.IsInvalid)
151 | {
152 | _handle.Close();
153 | _handle = null;
154 | }
155 |
156 | if (_owner != null)
157 | {
158 | _owner.RemoveOwnedFile(this);
159 | _owner = null;
160 | }
161 | }
162 | }
163 |
164 | public int ChecksumCrc32
165 | {
166 | get
167 | {
168 | throw new NotImplementedException();
169 | }
170 | }
171 |
172 | public byte[] GetMd5Hash()
173 | {
174 | throw new NotImplementedException();
175 | }
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/Native/Callbacks.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace WDBXEditor.Archives.MPQ.Native
8 | {
9 | [UnmanagedFunctionPointer(CallingConvention.Winapi)]
10 | internal delegate void SFILE_DOWNLOAD_CALLBACK(IntPtr pvUserData, ulong byteOffset, uint dwTotalBytes);
11 |
12 | [UnmanagedFunctionPointer(CallingConvention.Winapi)]
13 | internal delegate void SFILE_COMPACT_CALLBACK(IntPtr pvUserData, uint dwWorkType, ulong bytesProcessed, ulong totalBytes);
14 |
15 | [UnmanagedFunctionPointer(CallingConvention.Winapi)]
16 | internal delegate void SFILE_ADDFILE_CALLBACK(IntPtr pvUserData, uint dwBytesWritte, uint dwTotalBytes, bool bFinalCall);
17 | }
18 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/Native/MpqArchiveSafeHandle.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32.SafeHandles;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 |
8 | namespace WDBXEditor.Archives.MPQ.Native
9 | {
10 | internal sealed class MpqArchiveSafeHandle : SafeHandleZeroOrMinusOneIsInvalid
11 | {
12 | public MpqArchiveSafeHandle(IntPtr handle)
13 | : base(true)
14 | {
15 | this.SetHandle(handle);
16 | }
17 |
18 | public MpqArchiveSafeHandle()
19 | : base(true) { }
20 |
21 | protected override bool ReleaseHandle()
22 | {
23 | return NativeMethods.SFileCloseArchive(this.handle);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/Native/MpqFileSafeHandle.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32.SafeHandles;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace WDBXEditor.Archives.MPQ.Native
8 | {
9 | internal sealed class MpqFileSafeHandle : SafeHandleZeroOrMinusOneIsInvalid
10 | {
11 | public MpqFileSafeHandle(IntPtr handle)
12 | : base(true)
13 | {
14 | this.SetHandle(handle);
15 | }
16 |
17 | public MpqFileSafeHandle()
18 | : base(true)
19 | {
20 | }
21 |
22 | protected override bool ReleaseHandle()
23 | {
24 | return NativeMethods.SFileCloseFile(this.handle);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/Native/SFileInfoClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace WDBXEditor.Archives.MPQ.Native
7 | {
8 | internal enum SFileInfoClass
9 | {
10 | // Info classes for archives
11 | SFileMpqFileName, // Name of the archive file (TCHAR [])
12 | SFileMpqStreamBitmap, // Array of bits, each bit means availability of one block (BYTE [])
13 | SFileMpqUserDataOffset, // Offset of the user data header (ULONGLONG)
14 | SFileMpqUserDataHeader, // Raw (unfixed) user data header (TMPQUserData)
15 | SFileMpqUserData, // MPQ USer data, without the header (BYTE [])
16 | SFileMpqHeaderOffset, // Offset of the MPQ header (ULONGLONG)
17 | SFileMpqHeaderSize, // Fixed size of the MPQ header
18 | SFileMpqHeader, // Raw (unfixed) archive header (TMPQHeader)
19 | SFileMpqHetTableOffset, // Offset of the HET table, relative to MPQ header (ULONGLONG)
20 | SFileMpqHetTableSize, // Compressed size of the HET table (ULONGLONG)
21 | SFileMpqHetHeader, // HET table header (TMPQHetHeader)
22 | SFileMpqHetTable, // HET table as pointer. Must be freed using SFileFreeFileInfo
23 | SFileMpqBetTableOffset, // Offset of the BET table, relative to MPQ header (ULONGLONG)
24 | SFileMpqBetTableSize, // Compressed size of the BET table (ULONGLONG)
25 | SFileMpqBetHeader, // BET table header, followed by the flags (TMPQBetHeader + DWORD[])
26 | SFileMpqBetTable, // BET table as pointer. Must be freed using SFileFreeFileInfo
27 | SFileMpqHashTableOffset, // Hash table offset, relative to MPQ header (ULONGLONG)
28 | SFileMpqHashTableSize64, // Compressed size of the hash table (ULONGLONG)
29 | SFileMpqHashTableSize, // Size of the hash table, in entries (DWORD)
30 | SFileMpqHashTable, // Raw (unfixed) hash table (TMPQBlock [])
31 | SFileMpqBlockTableOffset, // Block table offset, relative to MPQ header (ULONGLONG)
32 | SFileMpqBlockTableSize64, // Compressed size of the block table (ULONGLONG)
33 | SFileMpqBlockTableSize, // Size of the block table, in entries (DWORD)
34 | SFileMpqBlockTable, // Raw (unfixed) block table (TMPQBlock [])
35 | SFileMpqHiBlockTableOffset, // Hi-block table offset, relative to MPQ header (ULONGLONG)
36 | SFileMpqHiBlockTableSize64, // Compressed size of the hi-block table (ULONGLONG)
37 | SFileMpqHiBlockTable, // The hi-block table (USHORT [])
38 | SFileMpqSignatures, // Signatures present in the MPQ (DWORD)
39 | SFileMpqStrongSignatureOffset, // Byte offset of the strong signature, relative to begin of the file (ULONGLONG)
40 | SFileMpqStrongSignatureSize, // Size of the strong signature (DWORD)
41 | SFileMpqStrongSignature, // The strong signature (BYTE [])
42 | SFileMpqArchiveSize64, // Archive size from the header (ULONGLONG)
43 | SFileMpqArchiveSize, // Archive size from the header (DWORD)
44 | SFileMpqMaxFileCount, // Max number of files in the archive (DWORD)
45 | SFileMpqFileTableSize, // Number of entries in the file table (DWORD)
46 | SFileMpqSectorSize, // Sector size (DWORD)
47 | SFileMpqNumberOfFiles, // Number of files (DWORD)
48 | SFileMpqRawChunkSize, // Size of the raw data chunk for MD5
49 | SFileMpqStreamFlags, // Stream flags (DWORD)
50 | SFileMpqIsReadOnly, // Nonzero if the MPQ is read only (DWORD)
51 |
52 | // Info classes for files
53 | SFileInfoPatchChain, // Chain of patches where the file is (TCHAR [])
54 | SFileInfoFileEntry, // The file entry for the file (TFileEntry)
55 | SFileInfoHashEntry, // Hash table entry for the file (TMPQHash)
56 | SFileInfoHashIndex, // Index of the hash table entry (DWORD)
57 | SFileInfoNameHash1, // The first name hash in the hash table (DWORD)
58 | SFileInfoNameHash2, // The second name hash in the hash table (DWORD)
59 | SFileInfoNameHash3, // 64-bit file name hash for the HET/BET tables (ULONGLONG)
60 | SFileInfoLocale, // File locale (DWORD)
61 | SFileInfoFileIndex, // Block index (DWORD)
62 | SFileInfoByteOffset, // File position in the archive (ULONGLONG)
63 | SFileInfoFileTime, // File time (ULONGLONG)
64 | SFileInfoFileSize, // Size of the file (DWORD)
65 | SFileInfoCompressedSize, // Compressed file size (DWORD)
66 | SFileInfoFlags, // File flags from (DWORD)
67 | SFileInfoEncryptionKey, // File encryption key
68 | SFileInfoEncryptionKeyRaw, // Unfixed value of the file key
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/Native/SFileOpenArchiveFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace WDBXEditor.Archives.MPQ.Native
7 | {
8 | [Flags]
9 | internal enum SFileOpenArchiveFlags : uint
10 | {
11 | None = 0,
12 | TypeIsFile = None,
13 | TypeIsMemoryMapped = 1,
14 | TypeIsHttp = 2,
15 |
16 | AccessReadOnly = 0x100,
17 | AccessReadWriteShare = 0x200,
18 | AccessUseBitmap = 0x400,
19 |
20 | DontOpenListfile = 0x10000,
21 | DontOpenAttributes = 0x20000,
22 | DontSearchHeader = 0x40000,
23 | ForceVersion1 = 0x80000,
24 | CheckSectorCRC = 0x100000,
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/WDBXEditor/Archives/MPQ/Native/Win32Methods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Diagnostics;
5 | using System.IO.MemoryMappedFiles;
6 | using System.Linq;
7 | using System.Runtime.InteropServices;
8 | using System.Text;
9 |
10 | namespace WDBXEditor.Archives.MPQ.Native
11 | {
12 | internal static class Win32Methods
13 | {
14 | [DllImport("kernel32", ExactSpelling = false, SetLastError = true)]
15 | public static extern uint GetMappedFileName(
16 | IntPtr hProcess,
17 | IntPtr fileHandle,
18 | IntPtr lpFilename,
19 | uint nSize
20 | );
21 |
22 | [DllImport("kernel32", ExactSpelling = false, SetLastError = true)]
23 | public static extern uint GetFinalPathNameByHandle(
24 | IntPtr hFile,
25 | IntPtr lpszFilePath,
26 | uint cchFilePath,
27 | uint dwFlags
28 | );
29 |
30 | public static string GetFileNameOfMemoryMappedFile(MemoryMappedFile file)
31 | {
32 | const uint size = 522;
33 | IntPtr path = Marshal.AllocCoTaskMem(unchecked((int)size)); // MAX_PATH + 1 char
34 |
35 | string result = null;
36 | try
37 | {
38 | // constant 0x2 = VOLUME_NAME_NT
39 | uint test = GetFinalPathNameByHandle(file.SafeMemoryMappedFileHandle.DangerousGetHandle(), path, size, 0x2);
40 | if (test != 0)
41 | throw new Win32Exception();
42 |
43 | result = Marshal.PtrToStringAuto(path);
44 | }
45 | catch
46 | {
47 | uint test = GetMappedFileName(Process.GetCurrentProcess().Handle, file.SafeMemoryMappedFileHandle.DangerousGetHandle(), path, size);
48 | if (test != 0)
49 | throw new Win32Exception();
50 |
51 | result = Marshal.PtrToStringAuto(path);
52 | }
53 |
54 | return result;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/WDBXEditor/Common/AutoProgressBar.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 |
10 | namespace WDBXEditor.Common
11 | {
12 | class AutoProgressBar : ProgressBar
13 | {
14 | private BackgroundWorker bgw = new BackgroundWorker();
15 |
16 | public void Start(int increment = 3)
17 | {
18 | if (bgw.IsBusy) return;
19 |
20 | this.Style = ProgressBarStyle.Continuous;
21 | this.Value = 0;
22 | bgw.DoWork += new DoWorkEventHandler(bgw_DoWork);
23 | bgw.ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged);
24 | bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);
25 | bgw.WorkerReportsProgress = true;
26 | bgw.WorkerSupportsCancellation = true;
27 | bgw.RunWorkerAsync(increment);
28 | }
29 |
30 | void bgw_DoWork(object sender, DoWorkEventArgs e)
31 | {
32 | int inc = (int)e.Argument;
33 | int i = 0;
34 |
35 | while (!bgw.CancellationPending)
36 | {
37 | System.Threading.Thread.Sleep(250);
38 | int percent = i;
39 |
40 | if (percent > 100)
41 | {
42 | percent = 100;
43 | i = 0;
44 | }
45 | else
46 | i += inc;
47 |
48 | bgw.ReportProgress(percent);
49 | }
50 | }
51 |
52 | void bgw_ProgressChanged(object sender, ProgressChangedEventArgs e)
53 | {
54 | if (!bgw.CancellationPending)
55 | this.Invoke((MethodInvoker)delegate { Value = e.ProgressPercentage; });
56 | }
57 |
58 | void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
59 | {
60 | Task.Run(() => ClearValue());
61 | }
62 |
63 | public void Stop(bool clear = true)
64 | {
65 | if (bgw.IsBusy)
66 | bgw.CancelAsync();
67 |
68 | if (clear)
69 | Task.Run(() => ClearValue());
70 | }
71 |
72 | private async Task ClearValue()
73 | {
74 | await Task.Factory.StartNew(() =>
75 | {
76 | while (bgw.CancellationPending || this.Value != 0)
77 | {
78 | this.Invoke((MethodInvoker)delegate { this.Value = 0; });
79 | Task.Delay(50).Wait();
80 | }
81 | });
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/WDBXEditor/Common/BufferedListBox.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace WDBXEditor.Common
4 | {
5 | class BufferedListBox : ListBox
6 | {
7 | public BufferedListBox()
8 | {
9 | this.DoubleBuffered = true;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/WDBXEditor/Common/DropdownCheckList.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WDBXEditor.Common
2 | {
3 | partial class DropdownCheckList
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 Component 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 | this.components = new System.ComponentModel.Container();
32 | this.lbItems = new System.Windows.Forms.CheckedListBox();
33 | this.cbBox = new System.Windows.Forms.ComboBox();
34 | this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
35 | this.btnEmpty = new System.Windows.Forms.Button();
36 | this.btnReset = new System.Windows.Forms.Button();
37 | this.SuspendLayout();
38 | //
39 | // lbItems
40 | //
41 | this.lbItems.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
42 | | System.Windows.Forms.AnchorStyles.Right)));
43 | this.lbItems.CheckOnClick = true;
44 | this.lbItems.FormattingEnabled = true;
45 | this.lbItems.Location = new System.Drawing.Point(0, 21);
46 | this.lbItems.Name = "lbItems";
47 | this.lbItems.Size = new System.Drawing.Size(272, 94);
48 | this.lbItems.TabIndex = 1;
49 | this.lbItems.Visible = false;
50 | this.lbItems.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lbItems_ItemCheck);
51 | //
52 | // cbBox
53 | //
54 | this.cbBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
55 | | System.Windows.Forms.AnchorStyles.Right)));
56 | this.cbBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
57 | this.cbBox.DropDownHeight = 1;
58 | this.cbBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
59 | this.cbBox.DropDownWidth = 1;
60 | this.cbBox.FormattingEnabled = true;
61 | this.cbBox.IntegralHeight = false;
62 | this.cbBox.Items.AddRange(new object[] {
63 | "[All]"});
64 | this.cbBox.Location = new System.Drawing.Point(0, 0);
65 | this.cbBox.Name = "cbBox";
66 | this.cbBox.Size = new System.Drawing.Size(214, 21);
67 | this.cbBox.TabIndex = 0;
68 | this.cbBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cbBox_DrawItem);
69 | this.cbBox.DropDown += new System.EventHandler(this.cbBox_DropDown);
70 | this.cbBox.DropDownClosed += new System.EventHandler(this.cbBox_DropDownClosed);
71 | //
72 | // btnEmpty
73 | //
74 | this.btnEmpty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
75 | this.btnEmpty.Image = global::WDBXEditor.Properties.Resources.hide;
76 | this.btnEmpty.Location = new System.Drawing.Point(217, -1);
77 | this.btnEmpty.Margin = new System.Windows.Forms.Padding(0);
78 | this.btnEmpty.Name = "btnEmpty";
79 | this.btnEmpty.Size = new System.Drawing.Size(26, 23);
80 | this.btnEmpty.TabIndex = 3;
81 | this.toolTip1.SetToolTip(this.btnEmpty, "Hide Empty");
82 | this.btnEmpty.UseVisualStyleBackColor = true;
83 | //
84 | // btnReset
85 | //
86 | this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
87 | this.btnReset.Image = global::WDBXEditor.Properties.Resources.close;
88 | this.btnReset.Location = new System.Drawing.Point(246, -1);
89 | this.btnReset.Margin = new System.Windows.Forms.Padding(0);
90 | this.btnReset.Name = "btnReset";
91 | this.btnReset.Size = new System.Drawing.Size(26, 23);
92 | this.btnReset.TabIndex = 2;
93 | this.toolTip1.SetToolTip(this.btnReset, "Reset");
94 | this.btnReset.UseVisualStyleBackColor = true;
95 | this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
96 | //
97 | // DropdownCheckList
98 | //
99 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
100 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
101 | this.Controls.Add(this.btnEmpty);
102 | this.Controls.Add(this.btnReset);
103 | this.Controls.Add(this.lbItems);
104 | this.Controls.Add(this.cbBox);
105 | this.Name = "DropdownCheckList";
106 | this.Size = new System.Drawing.Size(272, 115);
107 | this.EnabledChanged += new System.EventHandler(this.DropdownCheckList_EnabledChanged);
108 | this.Leave += new System.EventHandler(this.DropdownCheckList_Leave);
109 | this.ResumeLayout(false);
110 |
111 | }
112 |
113 | #endregion
114 | private System.Windows.Forms.CheckedListBox lbItems;
115 | private System.Windows.Forms.ComboBox cbBox;
116 | private System.Windows.Forms.Button btnReset;
117 | private System.Windows.Forms.ToolTip toolTip1;
118 | private System.Windows.Forms.Button btnEmpty;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/WDBXEditor/Common/FloatUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WDBXEditor.Common
8 | {
9 | ///
10 | /// android-apktool
11 | ///
12 | public class FloatUtil
13 | {
14 | private readonly static int canonicalFloatNaN = FloatToRawIntBits(float.NaN);
15 | private readonly static int maxFloat = FloatToRawIntBits(float.MaxValue);
16 | private readonly static int minFloat = FloatToRawIntBits(float.MinValue);
17 | private readonly static int piFloat = FloatToRawIntBits((float)Math.PI);
18 | private readonly static int eFloat = FloatToRawIntBits((float)Math.E);
19 | private readonly static int piNegFloat = FloatToRawIntBits(-(float)Math.PI);
20 | private readonly static int eNegFloat = FloatToRawIntBits(-(float)Math.E);
21 | private readonly static int pInfinity = FloatToRawIntBits(float.PositiveInfinity);
22 | private readonly static int nInfinity = FloatToRawIntBits(float.NegativeInfinity);
23 |
24 | private static unsafe int FloatToRawIntBits(float f) => *((int*)&f);
25 | private static unsafe float IntBitsToFloat(int i) => *((float*)&i);
26 |
27 | public static bool IsLikelyFloat(int value, int minexp = -7, int maxexp = 6)
28 | {
29 | // unwanted common named float values
30 | if (value == canonicalFloatNaN || value == maxFloat || value == minFloat || value == pInfinity || value == nInfinity)
31 | {
32 | return false;
33 | }
34 |
35 | // wanted common named float values
36 | if (value == eFloat || value == piFloat || value == eNegFloat || value == piNegFloat)
37 | {
38 | return true;
39 | }
40 |
41 | // check for some named integer values
42 | if (value == int.MaxValue || value == int.MinValue)
43 | {
44 | return false;
45 | }
46 |
47 | // check for likely resource id
48 | int packageId = value >> 24;
49 | int resourceType = value >> 16 & 0xff;
50 | int resourceId = value & 0xffff;
51 | if ((packageId == 0x7f || packageId == 1) && resourceType < 0x1f && resourceId < 0xfff)
52 | {
53 | return false;
54 | }
55 |
56 | // a non-canonical NaN is more likely to be an integer
57 | float floatValue = IntBitsToFloat(value);
58 | if (float.IsNaN(floatValue))
59 | {
60 | return false;
61 | }
62 |
63 | // exponent range check, range is taken from the Alpha client
64 | double exp = Math.Floor(Math.Log10(Math.Abs(floatValue)));
65 | if (exp <= minexp || exp >= maxexp)
66 | return false;
67 |
68 | // try to strip off any small imprecision near the end of the mantissa, remove 0 exponent
69 | string asInt = StripImprecision(string.Format("{0:0.00000000000000000000E0}", value));
70 | string asFloat = StripImprecision(string.Format("{0:0.00000000000000000000E0}", floatValue));
71 |
72 | return asFloat.TrimEnd('0').Length < asInt.Length;
73 | }
74 |
75 | private static string StripImprecision(string value)
76 | {
77 | int dp = value.IndexOf('.');
78 | int exp = value.IndexOf("E");
79 | int zeros = value.IndexOf("000");
80 | int nines = value.IndexOf("999");
81 |
82 | if (zeros > dp && zeros < exp)
83 | {
84 | value = value.Substring(0, zeros) + value.Substring(exp);
85 | }
86 | else if (nines > dp && nines < exp)
87 | {
88 | value = value.Substring(0, nines) + value.Substring(exp);
89 | }
90 |
91 | return value;
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/WDBXEditor/Common/FormHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 | using WDBXEditor.Storage;
8 |
9 | namespace WDBXEditor.Common
10 | {
11 | static class FormHandler
12 | {
13 | private static Main _Parent;
14 | private static Dictionary _Forms = new Dictionary();
15 |
16 | static FormHandler()
17 | {
18 | _Parent = GetForm();
19 | }
20 |
21 | public static T Show(params object[] args) where T : Form, new()
22 | {
23 | var type = typeof(T);
24 | bool findreplace = typeof(T) == typeof(FindReplace);
25 | Form f = null;
26 |
27 | if (findreplace) //FindReplace argument check
28 | {
29 | if (args.Length == 0)
30 | throw new ArgumentException("FindReplace requires Screen Type argument.");
31 | if (args[0].GetType() != typeof(bool))
32 | throw new ArgumentException("FindReplace argument should be a boolean.");
33 | }
34 |
35 | if (_Forms.TryGetValue(type, out f))
36 | {
37 | f.BringToFront();
38 | f.Activate();
39 | }
40 | else
41 | {
42 | f = new T();
43 | f.FormClosing += (s, e) => _Forms.Remove(s.GetType());
44 | f.TopMost = true;
45 | f.Show(_Parent);
46 |
47 | _Forms.Add(type, f);
48 | }
49 |
50 | if (findreplace)
51 | ((FindReplace)f).SetScreenType((bool)args[0]); //Set FindReplace screen type
52 |
53 | return (T)f;
54 | }
55 |
56 | public static T GetForm() where T : Form
57 | {
58 | return Application.OpenForms.Cast