├── .gitattributes
├── .gitignore
├── Binary.sln
├── Binary
├── App.config
├── Binary.csproj
├── Endscript
│ ├── Core.cs
│ ├── EndLine.cs
│ ├── Generate.cs
│ ├── Launch.cs
│ ├── Process.cs
│ ├── ScriptDict.cs
│ ├── eChooseDirMethod.cs
│ ├── eCommands.cs
│ ├── eScriptArgs.cs
│ └── eSettingType.cs
├── Interact
│ ├── About.Designer.cs
│ ├── About.cs
│ ├── About.resx
│ ├── BoundsList.Designer.cs
│ ├── BoundsList.cs
│ ├── BoundsList.resx
│ ├── EndMenu.Designer.cs
│ ├── EndMenu.cs
│ ├── EndMenu.resx
│ ├── ErrorView.Designer.cs
│ ├── ErrorView.cs
│ ├── ErrorView.resx
│ ├── FEngEditor.Designer.cs
│ ├── FEngEditor.cs
│ ├── FEngEditor.resx
│ ├── Input.Designer.cs
│ ├── Input.cs
│ ├── Input.resx
│ ├── STREditor.Designer.cs
│ ├── STREditor.cs
│ ├── STREditor.resx
│ ├── TPKEditor.Designer.cs
│ ├── TPKEditor.cs
│ ├── TPKEditor.resx
│ ├── Welcome.Designer.cs
│ ├── Welcome.cs
│ └── Welcome.resx
├── Main
│ ├── Main.Designer.cs
│ ├── Main.cs
│ └── Main.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── About1.png
│ ├── Hasher1.png
│ ├── Picker1.png
│ ├── Raider.png
│ ├── Readme1.png
│ ├── Swatcher.png
│ ├── Unlock1.png
│ ├── background.png
│ ├── background1.png
│ └── binary.png
├── Support
│ ├── Shared.Designer.cs
│ ├── Shared.cs
│ ├── Shared.resx
│ └── eRootType.cs
├── Tools
│ ├── ColorPicker.Designer.cs
│ ├── ColorPicker.cs
│ ├── ColorPicker.resx
│ ├── Hasher.Designer.cs
│ ├── Hasher.cs
│ ├── Hasher.resx
│ ├── Raider.Designer.cs
│ ├── Raider.cs
│ ├── Raider.resx
│ ├── SwatchPicker.Designer.cs
│ ├── SwatchPicker.cs
│ └── SwatchPicker.resx
├── Utils
│ ├── CleanUp.cs
│ ├── Filenames.cs
│ └── Path.cs
├── binary.ico
└── packages.config
├── LICENSE
└── Readme.md
/.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 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
--------------------------------------------------------------------------------
/Binary.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29806.167
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Binary", "Binary\Binary.csproj", "{9623900B-DF9E-404C-B2CC-6FF14616C1D1}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {9623900B-DF9E-404C-B2CC-6FF14616C1D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {9623900B-DF9E-404C-B2CC-6FF14616C1D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {9623900B-DF9E-404C-B2CC-6FF14616C1D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {9623900B-DF9E-404C-B2CC-6FF14616C1D1}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {5E4A8D04-1211-42B5-8F7C-7ED54B12EE8F}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Binary/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | False
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | True
27 |
28 |
29 | False
30 |
31 |
32 | True
33 |
34 |
35 | False
36 |
37 |
38 | False
39 |
40 |
41 | False
42 |
43 |
44 | NULL
45 |
46 |
47 |
48 |
49 |
50 | False
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Binary/Endscript/EndLine.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Endscript
28 | {
29 | public class EndLine
30 | {
31 | public string Error { get; set; }
32 | public string Text { get; set; }
33 | public int Index { get; set; }
34 | public string Filename { get; set; }
35 |
36 | public override string ToString()
37 | {
38 | return $"{Index} | {Filename} | {Text}";
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/Binary/Endscript/Generate.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using FastColoredTextBoxNS;
29 |
30 |
31 |
32 | namespace Binary.Endscript
33 | {
34 | public static class Generate
35 | {
36 | private static bool NeedsNewLine(FastColoredTextBox box)
37 | {
38 | if (string.IsNullOrEmpty(box.Text) || box.Text.EndsWith(Environment.NewLine))
39 | return false;
40 | else
41 | return true;
42 | }
43 |
44 | public static void WriteCommand(eCommands command, FastColoredTextBox box, params string[] paths)
45 | {
46 | string str = command.ToString();
47 | bool needs_newline = NeedsNewLine(box);
48 |
49 | foreach (var path in paths)
50 | str += " " + path;
51 | box.Text += needs_newline ? Environment.NewLine : string.Empty;
52 | box.Text += str + Environment.NewLine;
53 | Core.WriteEndscriptLine(str);
54 | }
55 |
56 | public static void WriteCommand(string line, FastColoredTextBox box)
57 | {
58 | box.Text += NeedsNewLine(box) ? Environment.NewLine : string.Empty;
59 | box.Text += line + Environment.NewLine;
60 | Core.WriteEndscriptLine(line);
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/Binary/Endscript/Launch.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System.Collections.Generic;
28 |
29 |
30 |
31 | namespace Binary.Endscript
32 | {
33 | public class Launch
34 | {
35 | public string ProcessName { get; set; }
36 | public string Description { get; set; }
37 | public eChooseDirMethod ChooseDir { get; set; }
38 | public int NumCommandArgs { get; set; }
39 | public List StrCommandArgs { get; set; }
40 | public string ScriptFilename { get; set; }
41 | public string ThisEndDirectory { get; set; }
42 |
43 | public Launch(string thisenddir)
44 | {
45 | this.ThisEndDirectory = thisenddir;
46 | this.ChooseDir = eChooseDirMethod.None;
47 | this.NumCommandArgs = -1;
48 | this.StrCommandArgs = new List();
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Binary/Endscript/Process.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.IO;
29 | using System.Diagnostics;
30 | using System.Windows.Forms;
31 | using System.ComponentModel;
32 | using System.Collections.Generic;
33 | using GlobalLib.Utils;
34 |
35 |
36 |
37 | namespace Binary.Endscript
38 | {
39 | public static class Linear
40 | {
41 | public static string LaunchProcess(string filename, string origdir)
42 | {
43 | try
44 | {
45 | var lines = File.ReadAllLines(filename);
46 | if (lines == null) return null;
47 | var launches = new List();
48 |
49 | const string startregion = "#region launch";
50 | const string endregion = "#endregion";
51 | const string YAMLDatabase = "YAMLDatabase.exe";
52 | bool in_launch_format = false;
53 | int last_index = -1;
54 |
55 | foreach (var line in lines)
56 | {
57 | if (string.IsNullOrWhiteSpace(line) || line.StartsWith("//"))
58 | continue;
59 | else if (in_launch_format && line == endregion)
60 | {
61 | in_launch_format = false;
62 | continue;
63 | }
64 | else if (!in_launch_format && line == startregion)
65 | {
66 | last_index = launches.Count;
67 | in_launch_format = true;
68 | launches.Add(new Launch(origdir));
69 | continue;
70 | }
71 | else if (in_launch_format)
72 | {
73 | if (!line.Contains("="))
74 | throw new Exception($"Unable to process line {line} in script {filename}.");
75 | var tokens = Utils.CleanUp.SplitScriptString(line);
76 | if (!Enum.TryParse(tokens.Item1, out eScriptArgs arg))
77 | throw new Exception($"Unrecognized keyword {tokens.Item1} in script {filename}.");
78 | if (!ScriptDict.KeywordFunctions[arg].Invoke(tokens.Item2, launches[last_index]))
79 | throw new Exception($"Unable to process keyword {arg} in script {filename}.");
80 | }
81 | else
82 | {
83 | throw new Exception($"Unable to process line {line} in script {filename}.");
84 | }
85 | }
86 |
87 | if (in_launch_format)
88 | throw new Exception($"Keyword {endregion} was not found in script {filename}.");
89 |
90 |
91 | bool is_yaml_linked = File.Exists(Properties.Settings.Default.YAMLDirectory);
92 | string prev_launch = string.Empty;
93 | foreach (var launch in launches)
94 | {
95 | switch (launch.ChooseDir)
96 | {
97 | case eChooseDirMethod.None:
98 | throw new Exception($"Unable to find file named {launch.ProcessName}.");
99 |
100 | case eChooseDirMethod.OpenFileDialog:
101 | if (launch.ProcessName == YAMLDatabase && is_yaml_linked)
102 | {
103 | launch.ProcessName = Properties.Settings.Default.YAMLDirectory;
104 | goto default;
105 | }
106 | var ofd = new OpenFileDialog()
107 | {
108 | Filter = $"{Path.GetFileNameWithoutExtension(launch.ProcessName)} | " +
109 | $"*{Path.GetExtension(launch.ProcessName)}",
110 | CheckFileExists = true,
111 | CheckPathExists = true,
112 | Multiselect = false,
113 | Title = launch.Description,
114 | };
115 | ofd.FileOk += new CancelEventHandler((object sender, CancelEventArgs e) =>
116 | {
117 | if (Path.GetFileName(ofd.FileName) != launch.ProcessName)
118 | {
119 | MessageBox.Show($"File chosen is not {launch.ProcessName}.", "Error",
120 | MessageBoxButtons.OK, MessageBoxIcon.Error);
121 | e.Cancel = true;
122 | }
123 | });
124 |
125 | if (ofd.ShowDialog() == DialogResult.OK)
126 | {
127 | launch.ProcessName = ofd.FileName;
128 | goto default;
129 | }
130 | throw new Exception($"User interrupted execution of process {launch.ProcessName}.");
131 |
132 | case eChooseDirMethod.OpenFolderDialog:
133 | if (launch.ProcessName == YAMLDatabase && is_yaml_linked)
134 | {
135 | launch.ProcessName = Properties.Settings.Default.YAMLDirectory;
136 | goto default;
137 | }
138 | var fbd = new FolderBrowserDialog()
139 | {
140 | RootFolder = Environment.SpecialFolder.MyComputer,
141 | Description = launch.Description,
142 | ShowNewFolderButton = false,
143 | };
144 | if (fbd.ShowDialog() == DialogResult.OK)
145 | {
146 | string path = Path.Combine(fbd.SelectedPath, launch.ProcessName);
147 | if (!File.Exists(path))
148 | {
149 | MessageBox.Show($"File {launch.ProcessName} does not exist in the chosen directory",
150 | "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
151 | goto case eChooseDirMethod.OpenFolderDialog;
152 | }
153 | else
154 | {
155 | launch.ProcessName = path;
156 | goto default;
157 | }
158 | }
159 | throw new Exception($"User interrupted execution of process {launch.ProcessName}.");
160 |
161 | case eChooseDirMethod.UserEnterFilePath:
162 | if (launch.ProcessName == YAMLDatabase && is_yaml_linked)
163 | {
164 | launch.ProcessName = Properties.Settings.Default.YAMLDirectory;
165 | goto default;
166 | }
167 | var fileform = new Interact.Input(launch.Description);
168 | if (fileform.ShowDialog() == DialogResult.OK)
169 | {
170 | if (!File.Exists(fileform.CollectionName))
171 | {
172 | MessageBox.Show($"File named {fileform.CollectionName} does not exist.",
173 | "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
174 | goto case eChooseDirMethod.UserEnterFilePath;
175 | }
176 | else if (Path.GetFileName(fileform.CollectionName) != launch.ProcessName)
177 | {
178 | MessageBox.Show($"File chosen is not a file named {launch.ProcessName}.",
179 | "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
180 | goto case eChooseDirMethod.UserEnterFilePath;
181 | }
182 | else
183 | {
184 | launch.ProcessName = fileform.CollectionName;
185 | goto default;
186 | }
187 | }
188 | throw new Exception($"User interrupted execution of process {launch.ProcessName}.");
189 |
190 | case eChooseDirMethod.UserEnterFolderPath:
191 | if (launch.ProcessName == YAMLDatabase && is_yaml_linked)
192 | {
193 | launch.ProcessName = Properties.Settings.Default.YAMLDirectory;
194 | goto default;
195 | }
196 | var folderform = new Interact.Input(launch.Description);
197 | if (folderform.ShowDialog() == DialogResult.OK)
198 | {
199 | string path = Path.Combine(folderform.CollectionName, launch.ProcessName);
200 | if (!File.Exists(path))
201 | {
202 | MessageBox.Show($"File named {folderform.CollectionName} does not exist.",
203 | "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
204 | goto case eChooseDirMethod.UserEnterFilePath;
205 | }
206 | else
207 | {
208 | launch.ProcessName = path;
209 | goto default;
210 | }
211 | }
212 | throw new Exception($"User interrupted execution of process {launch.ProcessName}.");
213 |
214 | case eChooseDirMethod.FromPreviousLaunch:
215 | if (string.IsNullOrEmpty(prev_launch))
216 | throw new Exception($"Unable to use file path from previous launch in script {filename}.");
217 | launch.ProcessName = prev_launch;
218 | goto default;
219 |
220 | default:
221 | prev_launch = launch.ProcessName;
222 | var args = string.Empty;
223 | foreach (var arg in launch.StrCommandArgs)
224 | args += arg + " ";
225 | using (var process = new Process())
226 | {
227 | Log.EnableLog = true;
228 | process.StartInfo.FileName = launch.ProcessName;
229 | process.StartInfo.Arguments = args;
230 | process.StartInfo.UseShellExecute = false;
231 | process.StartInfo.WorkingDirectory = Path.GetDirectoryName(launch.ProcessName);
232 | process.StartInfo.RedirectStandardOutput = true;
233 | process.Start();
234 | Log.Write(process.StandardOutput.ReadToEnd());
235 | process.WaitForExit();
236 | Log.EnableLog = false;
237 | break;
238 | }
239 | }
240 | }
241 |
242 | Utils.CleanUp.GCCollect();
243 | return null;
244 | }
245 | catch (Exception e)
246 | {
247 | while (e.InnerException != null) e = e.InnerException;
248 | return e.Message;
249 | }
250 | }
251 | }
252 | }
253 |
--------------------------------------------------------------------------------
/Binary/Endscript/ScriptDict.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.IO;
29 | using System.Collections.Generic;
30 |
31 |
32 |
33 | namespace Binary.Endscript
34 | {
35 | public static class ScriptDict
36 | {
37 | public static Dictionary> KeywordFunctions { get; set; } =
38 | new Dictionary>()
39 | {
40 | {
41 | eScriptArgs.Process,
42 | (string str, Launch lan) =>
43 | {
44 | if (string.IsNullOrEmpty(lan.ProcessName))
45 | {
46 | lan.ProcessName = str;
47 | return true;
48 | }
49 | else return false;
50 | }
51 | },
52 |
53 | {
54 | eScriptArgs.ChooseMethod,
55 | (string str, Launch lan) =>
56 | {
57 | if (lan.ChooseDir != eChooseDirMethod.None) return false;
58 | if (Enum.TryParse(str, out eChooseDirMethod method))
59 | {
60 | lan.ChooseDir = method;
61 | return true;
62 | }
63 | else return false;
64 | }
65 | },
66 |
67 | {
68 | eScriptArgs.Description,
69 | (string str, Launch lan) =>
70 | {
71 | if (string.IsNullOrEmpty(lan.Description))
72 | lan.Description = str;
73 | else if (!lan.Description.EndsWith(" "))
74 | lan.Description += " " + str;
75 | else
76 | lan.Description += str;
77 | return true;
78 | }
79 | },
80 |
81 | {
82 | eScriptArgs.NumCommandArgs,
83 | (string str, Launch lan) =>
84 | {
85 | if (lan.NumCommandArgs > -1) return false;
86 | if (!int.TryParse(str, out var num) || num < 0)
87 | return false;
88 | lan.NumCommandArgs = num;
89 | return true;
90 | }
91 | },
92 |
93 | {
94 | eScriptArgs.StrCommandArgs,
95 | (string str, Launch lan) =>
96 | {
97 | if (lan.StrCommandArgs.Count >= lan.NumCommandArgs) return false;
98 | else if (str.Contains(eScriptArgs.ScriptFilename.ToString()))
99 | lan.StrCommandArgs.Add(str.Replace(eScriptArgs.ScriptFilename.ToString(),
100 | lan.ScriptFilename));
101 | else
102 | lan.StrCommandArgs.Add(str);
103 | return true;
104 | }
105 | },
106 |
107 | {
108 | eScriptArgs.ScriptFilename,
109 | (string str, Launch lan) =>
110 | {
111 | if (string.IsNullOrEmpty(lan.ScriptFilename))
112 | {
113 | lan.ScriptFilename = Path.Combine(lan.ThisEndDirectory, str);
114 | return true;
115 | }
116 | else return false;
117 | }
118 | }
119 | };
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/Binary/Endscript/eChooseDirMethod.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Endscript
28 | {
29 | public enum eChooseDirMethod : int
30 | {
31 | None = 0,
32 | UserEnterFilePath = 1,
33 | UserEnterFolderPath = 2,
34 | OpenFileDialog = 3,
35 | OpenFolderDialog = 4,
36 | FromPreviousLaunch = 5,
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Binary/Endscript/eCommands.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Endscript
28 | {
29 | public enum eCommands : int
30 | {
31 | none = 0,
32 | update = 1,
33 | add = 2,
34 | delete = 3,
35 | copy = 4,
36 | export = 5,
37 | import = 6,
38 | duplicate = 7,
39 | replace = 8,
40 | attach = 9,
41 | execute = 10,
42 | @static = 11,
43 | move = 12,
44 | erase = 13,
45 | create = 14,
46 | @switch = 15,
47 | }
48 | }
--------------------------------------------------------------------------------
/Binary/Endscript/eScriptArgs.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Endscript
28 | {
29 | public enum eScriptArgs : int
30 | {
31 | None = 0,
32 | Process = 1,
33 | ChooseMethod = 2,
34 | Description = 3,
35 | NumCommandArgs = 4,
36 | StrCommandArgs = 5,
37 | ScriptFilename = 6,
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Binary/Endscript/eSettingType.cs:
--------------------------------------------------------------------------------
1 | namespace Binary.Endscript
2 | {
3 | enum eSettingType : int
4 | {
5 | None = 0,
6 | Enable_Auto_Backup_Save = 1,
7 | Compress_Files_When_Saving = 2,
8 | Save_End_Commands = 3,
9 | Enable_Static_Commands = 4,
10 | Start_In_Maximized_Mode = 5,
11 | Enable_Modder_Watermarks = 6,
12 | Suppress_ADCI_Errors = 7,
13 | Set_Modder_Name = 8,
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Binary/Interact/About.Designer.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Interact
28 | {
29 | partial class About
30 | {
31 | ///
32 | /// Required designer variable.
33 | ///
34 | private System.ComponentModel.IContainer components = null;
35 |
36 | ///
37 | /// Clean up any resources being used.
38 | ///
39 | /// true if managed resources should be disposed; otherwise, false.
40 | protected override void Dispose(bool disposing)
41 | {
42 | if (disposing && (components != null))
43 | {
44 | components.Dispose();
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 |
51 | ///
52 | /// Required method for Designer support - do not modify
53 | /// the contents of this method with the code editor.
54 | ///
55 | private void InitializeComponent()
56 | {
57 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(About));
58 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
59 | this.label1 = new System.Windows.Forms.Label();
60 | this.label2 = new System.Windows.Forms.Label();
61 | this.textBox1 = new System.Windows.Forms.TextBox();
62 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
63 | this.SuspendLayout();
64 | //
65 | // pictureBox1
66 | //
67 | this.pictureBox1.Image = global::Binary.Properties.Resources.binary;
68 | this.pictureBox1.Location = new System.Drawing.Point(12, 12);
69 | this.pictureBox1.Name = "pictureBox1";
70 | this.pictureBox1.Size = new System.Drawing.Size(200, 200);
71 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
72 | this.pictureBox1.TabIndex = 0;
73 | this.pictureBox1.TabStop = false;
74 | //
75 | // label1
76 | //
77 | this.label1.AutoSize = true;
78 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
79 | this.label1.ForeColor = System.Drawing.SystemColors.Info;
80 | this.label1.Location = new System.Drawing.Point(12, 215);
81 | this.label1.Name = "label1";
82 | this.label1.Size = new System.Drawing.Size(185, 17);
83 | this.label1.TabIndex = 1;
84 | this.label1.Text = "Copyright © MaxHwoy, 2020";
85 | //
86 | // label2
87 | //
88 | this.label2.AutoSize = true;
89 | this.label2.Font = new System.Drawing.Font("Fugaz One", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
90 | this.label2.ForeColor = System.Drawing.SystemColors.Info;
91 | this.label2.Location = new System.Drawing.Point(300, 12);
92 | this.label2.Name = "label2";
93 | this.label2.Size = new System.Drawing.Size(170, 35);
94 | this.label2.TabIndex = 2;
95 | this.label2.Text = "Binary v1.0.5";
96 | //
97 | // textBox1
98 | //
99 | this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(36)))), ((int)(((byte)(53)))));
100 | this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
101 | this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
102 | this.textBox1.ForeColor = System.Drawing.SystemColors.Info;
103 | this.textBox1.Location = new System.Drawing.Point(229, 50);
104 | this.textBox1.Multiline = true;
105 | this.textBox1.Name = "textBox1";
106 | this.textBox1.ReadOnly = true;
107 | this.textBox1.Size = new System.Drawing.Size(313, 181);
108 | this.textBox1.TabIndex = 3;
109 | this.textBox1.Text = resources.GetString("textBox1.Text");
110 | //
111 | // About
112 | //
113 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
114 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
115 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(36)))), ((int)(((byte)(53)))));
116 | this.ClientSize = new System.Drawing.Size(554, 243);
117 | this.Controls.Add(this.textBox1);
118 | this.Controls.Add(this.label2);
119 | this.Controls.Add(this.label1);
120 | this.Controls.Add(this.pictureBox1);
121 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
122 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
123 | this.MaximizeBox = false;
124 | this.Name = "About";
125 | this.Text = "About";
126 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
127 | this.ResumeLayout(false);
128 | this.PerformLayout();
129 |
130 | }
131 |
132 | #endregion
133 |
134 | private System.Windows.Forms.PictureBox pictureBox1;
135 | private System.Windows.Forms.Label label1;
136 | private System.Windows.Forms.Label label2;
137 | private System.Windows.Forms.TextBox textBox1;
138 | }
139 | }
--------------------------------------------------------------------------------
/Binary/Interact/About.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System.Windows.Forms;
28 |
29 |
30 |
31 | namespace Binary.Interact
32 | {
33 | public partial class About : Form
34 | {
35 | public About()
36 | {
37 | this.InitializeComponent();
38 | this.textBox1.SelectionStart = this.textBox1.Text.Length;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Binary/Interact/BoundsList.Designer.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Interact
28 | {
29 | partial class BoundsList
30 | {
31 | ///
32 | /// Required designer variable.
33 | ///
34 | private System.ComponentModel.IContainer components = null;
35 |
36 | ///
37 | /// Clean up any resources being used.
38 | ///
39 | /// true if managed resources should be disposed; otherwise, false.
40 | protected override void Dispose(bool disposing)
41 | {
42 | if (disposing && (components != null))
43 | {
44 | components.Dispose();
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 |
51 | ///
52 | /// Required method for Designer support - do not modify
53 | /// the contents of this method with the code editor.
54 | ///
55 | private void InitializeComponent()
56 | {
57 | this.BoundListView = new System.Windows.Forms.ListView();
58 | this.BoundIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
59 | this.VltKeyColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
60 | this.CollisionNameColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
61 | this.label1 = new System.Windows.Forms.Label();
62 | this.label2 = new System.Windows.Forms.Label();
63 | this.ButtonOK = new System.Windows.Forms.Button();
64 | this.SuspendLayout();
65 | //
66 | // BoundListView
67 | //
68 | this.BoundListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
69 | | System.Windows.Forms.AnchorStyles.Left)
70 | | System.Windows.Forms.AnchorStyles.Right)));
71 | this.BoundListView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
72 | this.BoundListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
73 | this.BoundListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
74 | this.BoundIndex,
75 | this.VltKeyColumn,
76 | this.CollisionNameColumn});
77 | this.BoundListView.ForeColor = System.Drawing.SystemColors.Window;
78 | this.BoundListView.FullRowSelect = true;
79 | this.BoundListView.GridLines = true;
80 | this.BoundListView.HideSelection = false;
81 | this.BoundListView.Location = new System.Drawing.Point(12, 44);
82 | this.BoundListView.MultiSelect = false;
83 | this.BoundListView.Name = "BoundListView";
84 | this.BoundListView.OwnerDraw = true;
85 | this.BoundListView.ShowItemToolTips = true;
86 | this.BoundListView.Size = new System.Drawing.Size(472, 261);
87 | this.BoundListView.TabIndex = 0;
88 | this.BoundListView.UseCompatibleStateImageBehavior = false;
89 | this.BoundListView.View = System.Windows.Forms.View.Details;
90 | this.BoundListView.DrawColumnHeader += new System.Windows.Forms.DrawListViewColumnHeaderEventHandler(this.BoundListView_DrawColumnHeader);
91 | this.BoundListView.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.BoundListView_DrawItem);
92 | this.BoundListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.BoundListView_MouseDoubleClick);
93 | //
94 | // BoundIndex
95 | //
96 | this.BoundIndex.Text = "Index";
97 | this.BoundIndex.Width = 40;
98 | //
99 | // VltKeyColumn
100 | //
101 | this.VltKeyColumn.Text = "Vault Memory Hash";
102 | this.VltKeyColumn.Width = 150;
103 | //
104 | // CollisionNameColumn
105 | //
106 | this.CollisionNameColumn.Text = "Collision Name";
107 | this.CollisionNameColumn.Width = 260;
108 | //
109 | // label1
110 | //
111 | this.label1.AutoSize = true;
112 | this.label1.ForeColor = System.Drawing.SystemColors.Info;
113 | this.label1.Location = new System.Drawing.Point(12, 15);
114 | this.label1.Name = "label1";
115 | this.label1.Size = new System.Drawing.Size(409, 13);
116 | this.label1.TabIndex = 1;
117 | this.label1.Text = "Collision Bounds List that can be used in CollisionInternalName fields of CarType" +
118 | "Infos.";
119 | //
120 | // label2
121 | //
122 | this.label2.AutoSize = true;
123 | this.label2.ForeColor = System.Drawing.SystemColors.Info;
124 | this.label2.Location = new System.Drawing.Point(12, 28);
125 | this.label2.Name = "label2";
126 | this.label2.Size = new System.Drawing.Size(322, 13);
127 | this.label2.TabIndex = 2;
128 | this.label2.Text = "Double click on any line to copy its Collision Name to the clipboard.";
129 | //
130 | // ButtonOK
131 | //
132 | this.ButtonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
133 | this.ButtonOK.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
134 | this.ButtonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
135 | this.ButtonOK.FlatAppearance.BorderColor = System.Drawing.Color.Black;
136 | this.ButtonOK.FlatAppearance.BorderSize = 0;
137 | this.ButtonOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
138 | this.ButtonOK.ForeColor = System.Drawing.SystemColors.Info;
139 | this.ButtonOK.Location = new System.Drawing.Point(378, 315);
140 | this.ButtonOK.Name = "ButtonOK";
141 | this.ButtonOK.Size = new System.Drawing.Size(102, 21);
142 | this.ButtonOK.TabIndex = 3;
143 | this.ButtonOK.Text = "OK";
144 | this.ButtonOK.UseVisualStyleBackColor = false;
145 | this.ButtonOK.Click += new System.EventHandler(this.ButtonOK_Click);
146 | //
147 | // BoundsList
148 | //
149 | this.AcceptButton = this.ButtonOK;
150 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
151 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
152 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(36)))), ((int)(((byte)(53)))));
153 | this.ClientSize = new System.Drawing.Size(496, 345);
154 | this.Controls.Add(this.ButtonOK);
155 | this.Controls.Add(this.label2);
156 | this.Controls.Add(this.label1);
157 | this.Controls.Add(this.BoundListView);
158 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
159 | this.MaximizeBox = false;
160 | this.Name = "BoundsList";
161 | this.ShowIcon = false;
162 | this.Text = "BoundsList";
163 | this.Load += new System.EventHandler(this.BoundsList_Load);
164 | this.ResumeLayout(false);
165 | this.PerformLayout();
166 |
167 | }
168 |
169 | #endregion
170 |
171 | private System.Windows.Forms.ListView BoundListView;
172 | private System.Windows.Forms.ColumnHeader BoundIndex;
173 | private System.Windows.Forms.ColumnHeader VltKeyColumn;
174 | private System.Windows.Forms.ColumnHeader CollisionNameColumn;
175 | private System.Windows.Forms.Label label1;
176 | private System.Windows.Forms.Label label2;
177 | private System.Windows.Forms.Button ButtonOK;
178 | }
179 | }
--------------------------------------------------------------------------------
/Binary/Interact/BoundsList.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Drawing;
29 | using System.Windows.Forms;
30 | using GlobalLib.Core;
31 |
32 |
33 |
34 | namespace Binary.Interact
35 | {
36 | public partial class BoundsList : Form
37 | {
38 | public BoundsList()
39 | {
40 | this.InitializeComponent();
41 | }
42 |
43 | private void BoundsList_Load(object sender, EventArgs e)
44 | {
45 | int index = 0;
46 | foreach (var bound in Map.CollisionMap)
47 | {
48 | var Item = new ListViewItem();
49 | Item.Text = (index++).ToString();
50 | Item.SubItems.Add($"0x{bound.Key:X8}");
51 | Item.SubItems.Add(bound.Value);
52 | this.BoundListView.Items.Add(Item);
53 | }
54 | }
55 |
56 | private void BoundListView_MouseDoubleClick(object sender, MouseEventArgs e)
57 | {
58 | var HitTest = this.BoundListView.HitTest(e.X, e.Y);
59 | var Item = HitTest.Item;
60 | Clipboard.SetText(Item.SubItems[2].Text);
61 | }
62 |
63 | private void ButtonOK_Click(object sender, EventArgs e)
64 | {
65 | this.Close();
66 | }
67 |
68 | private void BoundListView_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
69 | {
70 | e.Graphics.FillRectangle(Brushes.DarkGray, e.Bounds);
71 | e.DrawText();
72 | }
73 |
74 | private void BoundListView_DrawItem(object sender, DrawListViewItemEventArgs e)
75 | {
76 | e.DrawDefault = true;
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Binary/Interact/BoundsList.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Binary/Interact/EndMenu.Designer.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Interact
28 | {
29 | partial class EndMenu
30 | {
31 | ///
32 | /// Required designer variable.
33 | ///
34 | private System.ComponentModel.IContainer components = null;
35 |
36 | ///
37 | /// Clean up any resources being used.
38 | ///
39 | /// true if managed resources should be disposed; otherwise, false.
40 | protected override void Dispose(bool disposing)
41 | {
42 | if (disposing && (components != null))
43 | {
44 | components.Dispose();
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 |
51 | ///
52 | /// Required method for Designer support - do not modify
53 | /// the contents of this method with the code editor.
54 | ///
55 | private void InitializeComponent()
56 | {
57 | this.TextPanel = new System.Windows.Forms.Panel();
58 | this.ImagePanel = new System.Windows.Forms.Panel();
59 | this.TextPanel.SuspendLayout();
60 | this.SuspendLayout();
61 | //
62 | // TextPanel
63 | //
64 | this.TextPanel.Controls.Add(this.DescriptionBox.RTX);
65 | this.TextPanel.Location = new System.Drawing.Point(12, 12);
66 | this.TextPanel.Name = "TextPanel";
67 | this.TextPanel.Size = new System.Drawing.Size(508, 426);
68 | this.TextPanel.TabIndex = 0;
69 | //
70 | // ImagePanel
71 | //
72 | this.ImagePanel.Location = new System.Drawing.Point(530, 12);
73 | this.ImagePanel.Name = "ImagePanel";
74 | this.ImagePanel.Size = new System.Drawing.Size(258, 387);
75 | this.ImagePanel.TabIndex = 1;
76 | //
77 | // DescriptionBox.RTX
78 | //
79 | this.DescriptionBox.RTX.Location = new System.Drawing.Point(3, 3);
80 | this.DescriptionBox.RTX.Name = "DescriptionBox";
81 | this.DescriptionBox.RTX.ReadOnly = true;
82 | this.DescriptionBox.RTX.Size = new System.Drawing.Size(502, 420);
83 | this.DescriptionBox.RTX.TabIndex = 0;
84 | this.DescriptionBox.RTX.Text = "";
85 | //
86 | // EndMenu
87 | //
88 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
89 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
90 | this.ClientSize = new System.Drawing.Size(800, 450);
91 | this.Controls.Add(this.ImagePanel);
92 | this.Controls.Add(this.TextPanel);
93 | this.Name = "EndMenu";
94 | this.Text = "EndMenu";
95 | this.ResumeLayout(false);
96 |
97 | }
98 |
99 | #endregion
100 | }
101 | }
--------------------------------------------------------------------------------
/Binary/Interact/EndMenu.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.IO;
29 | using System.Drawing;
30 | using System.Windows.Forms;
31 | using GlobalLib.Utils.EA;
32 | using GlobalLib.Utils.HTML;
33 |
34 |
35 |
36 | namespace Binary.Interact
37 | {
38 | public partial class EndMenu : Form
39 | {
40 | private HTMLTextBox DescriptionBox;
41 | private Panel TextPanel;
42 | private Panel ImagePanel;
43 | private Button InstallConfirm;
44 | private PictureBox Image1;
45 | private PictureBox Image2;
46 | private PictureBox Image3;
47 |
48 | public EndMenu(string[] lines, string filename)
49 | {
50 | this.DescriptionBox = new HTMLTextBox(lines);
51 | for (int a1 = 0; a1 < this.DescriptionBox.Menu.ImagePaths.Count; ++a1)
52 | this.DescriptionBox.Menu.ImagePaths[a1] = Path.Combine(filename, this.DescriptionBox.Menu.ImagePaths[a1]);
53 | this.CustomInitializer();
54 | }
55 |
56 | // Use custom initializer b/c of HTMLTextBox that is defined on user's settings.
57 | private void CustomInitializer()
58 | {
59 | int X = this.DescriptionBox.Menu.Width;
60 | int Y = this.DescriptionBox.Menu.Height;
61 | for (int a1 = this.DescriptionBox.Menu.ImagePaths.Count; a1 < 3; ++a1)
62 | this.DescriptionBox.Menu.ImagePaths.Add(null);
63 |
64 | this.TextPanel = new Panel();
65 | this.ImagePanel = new Panel();
66 | this.InstallConfirm = new Button();
67 | this.Image1 = new PictureBox();
68 | this.Image2 = new PictureBox();
69 | this.Image3 = new PictureBox();
70 | this.TextPanel.SuspendLayout();
71 | this.SuspendLayout();
72 | //
73 | // TextPanel
74 | //
75 | this.TextPanel.Controls.Add(this.DescriptionBox.RTX);
76 | this.TextPanel.Location = new Point((int)(X * 0.025), (int)(Y * 0.0375));
77 | this.TextPanel.Name = "TextPanel";
78 | this.TextPanel.Size = new Size((int)(X * 0.65), (int)(Y * 0.925));
79 | this.TextPanel.TabIndex = 0;
80 | //
81 | // ImagePanel
82 | //
83 | this.ImagePanel.Controls.Add(this.Image1);
84 | this.ImagePanel.Controls.Add(this.Image2);
85 | this.ImagePanel.Controls.Add(this.Image3);
86 | this.ImagePanel.Location = new Point((int)(X * 0.7), (int)(Y * 0.0375));
87 | this.ImagePanel.Name = "ImagePanel";
88 | this.ImagePanel.Size = new Size((int)(X * 0.275), (int)(Y * 0.8));
89 | this.ImagePanel.TabIndex = 1;
90 | //
91 | // DescriptionBox.RTX
92 | //
93 | this.DescriptionBox.RTX.BackColor = this.DescriptionBox.Menu.WFColor;
94 | this.DescriptionBox.RTX.Location = new Point(0, 0);
95 | this.DescriptionBox.RTX.Name = "DescriptionBox";
96 | this.DescriptionBox.RTX.ReadOnly = true;
97 | this.DescriptionBox.RTX.Size = new Size(this.TextPanel.Width, this.TextPanel.Height);
98 | this.DescriptionBox.RTX.TabIndex = 0;
99 | //
100 | // Image1
101 | //
102 | this.Image1.BackColor = this.DescriptionBox.Menu.WBColor;
103 | this.Image1.Location = new Point(0, 0);
104 | this.Image1.Name = "Image1";
105 | this.Image1.SizeMode = PictureBoxSizeMode.Zoom;
106 | this.Image1.Size = new Size(this.ImagePanel.Width, (int)(this.ImagePanel.Height / 3));
107 | if (Resolve.IsImageFormat(this.DescriptionBox.Menu.ImagePaths[0]))
108 | this.Image1.Image = Image.FromFile(this.DescriptionBox.Menu.ImagePaths[0]);
109 | //
110 | // Image2
111 | //
112 | this.Image2.BackColor = this.DescriptionBox.Menu.WBColor;
113 | this.Image2.Location = new Point(0, (int)(this.ImagePanel.Height / 3));
114 | this.Image2.Name = "Image2";
115 | this.Image2.SizeMode = PictureBoxSizeMode.Zoom;
116 | this.Image2.Size = new Size(this.ImagePanel.Width, (int)(this.ImagePanel.Height / 3));
117 | if (Resolve.IsImageFormat(this.DescriptionBox.Menu.ImagePaths[1]))
118 | this.Image2.Image = Image.FromFile(this.DescriptionBox.Menu.ImagePaths[1]);
119 | //
120 | // Image3
121 | //
122 | this.Image3.BackColor = this.DescriptionBox.Menu.WBColor;
123 | this.Image3.Location = new Point(0, (int)(this.ImagePanel.Height / 3) * 2);
124 | this.Image3.Name = "Image3";
125 | this.Image3.SizeMode = PictureBoxSizeMode.Zoom;
126 | this.Image3.Size = new Size(this.ImagePanel.Width, (int)(this.ImagePanel.Height / 3));
127 | if (Resolve.IsImageFormat(this.DescriptionBox.Menu.ImagePaths[2]))
128 | this.Image3.Image = Image.FromFile(this.DescriptionBox.Menu.ImagePaths[2]);
129 | //
130 | // ButtonOK
131 | //
132 | this.InstallConfirm.BackColor = Color.FromArgb(0x40, 0x40, 0x40);
133 | this.InstallConfirm.ForeColor = SystemColors.Info;
134 | this.InstallConfirm.Location = new Point((int)(X * 0.7), (int)(Y * 0.875));
135 | this.InstallConfirm.Name = "InstallConfirm";
136 | this.InstallConfirm.Size = new Size((int)(X * 0.275), (int)(Y * 0.0875));
137 | this.InstallConfirm.TabIndex = 2;
138 | this.InstallConfirm.Text = "Install";
139 | this.InstallConfirm.UseVisualStyleBackColor = false;
140 | this.InstallConfirm.FlatStyle = FlatStyle.Flat;
141 | this.InstallConfirm.Click += new EventHandler(this.InstallConfirm_Click);
142 | //
143 | // EndMenu
144 | //
145 | this.AutoScaleDimensions = new SizeF(6, 13F);
146 | this.AutoScaleMode = AutoScaleMode.Font;
147 | this.ClientSize = new Size(X, Y);
148 | this.BackColor = this.DescriptionBox.Menu.WBColor;
149 | this.Controls.Add(this.ImagePanel);
150 | this.Controls.Add(this.TextPanel);
151 | this.Controls.Add(this.InstallConfirm);
152 | this.FormBorderStyle = FormBorderStyle.FixedSingle;
153 | this.MaximizeBox = false;
154 | this.ShowIcon = false;
155 | this.Name = "EndMenu";
156 | this.Text = this.DescriptionBox.Menu.Title;
157 | this.ResumeLayout(false);
158 | this.PerformLayout();
159 | }
160 |
161 | private void InstallConfirm_Click(object sender, EventArgs e)
162 | {
163 | this.DialogResult = DialogResult.OK;
164 | this.Close();
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/Binary/Interact/EndMenu.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Binary/Interact/ErrorView.Designer.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Interact
28 | {
29 | partial class ErrorView
30 | {
31 | ///
32 | /// Required designer variable.
33 | ///
34 | private System.ComponentModel.IContainer components = null;
35 |
36 | ///
37 | /// Clean up any resources being used.
38 | ///
39 | /// true if managed resources should be disposed; otherwise, false.
40 | protected override void Dispose(bool disposing)
41 | {
42 | if (disposing && (components != null))
43 | {
44 | components.Dispose();
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 |
51 | ///
52 | /// Required method for Designer support - do not modify
53 | /// the contents of this method with the code editor.
54 | ///
55 | private void InitializeComponent()
56 | {
57 | this.ErrorListView = new System.Windows.Forms.ListView();
58 | this.LineNumber = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
59 | this.CommandString = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
60 | this.ErrorString = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
61 | this.label1 = new System.Windows.Forms.Label();
62 | this.Filename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
63 | this.SuspendLayout();
64 | //
65 | // ErrorListView
66 | //
67 | this.ErrorListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
68 | | System.Windows.Forms.AnchorStyles.Left)
69 | | System.Windows.Forms.AnchorStyles.Right)));
70 | this.ErrorListView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
71 | this.ErrorListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
72 | this.LineNumber,
73 | this.Filename,
74 | this.CommandString,
75 | this.ErrorString});
76 | this.ErrorListView.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
77 | this.ErrorListView.FullRowSelect = true;
78 | this.ErrorListView.GridLines = true;
79 | this.ErrorListView.HideSelection = false;
80 | this.ErrorListView.Location = new System.Drawing.Point(9, 31);
81 | this.ErrorListView.Name = "ErrorListView";
82 | this.ErrorListView.OwnerDraw = true;
83 | this.ErrorListView.ShowItemToolTips = true;
84 | this.ErrorListView.Size = new System.Drawing.Size(744, 310);
85 | this.ErrorListView.TabIndex = 0;
86 | this.ErrorListView.UseCompatibleStateImageBehavior = false;
87 | this.ErrorListView.View = System.Windows.Forms.View.Details;
88 | this.ErrorListView.DrawColumnHeader += new System.Windows.Forms.DrawListViewColumnHeaderEventHandler(this.ErrorListView_DrawColumnHeader);
89 | this.ErrorListView.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.ErrorListView_DrawItem);
90 | //
91 | // LineNumber
92 | //
93 | this.LineNumber.Text = "Line";
94 | //
95 | // CommandString
96 | //
97 | this.CommandString.Text = "Command";
98 | this.CommandString.Width = 270;
99 | //
100 | // ErrorString
101 | //
102 | this.ErrorString.Text = "Error Type";
103 | this.ErrorString.Width = 260;
104 | //
105 | // label1
106 | //
107 | this.label1.AutoSize = true;
108 | this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
109 | this.label1.ForeColor = System.Drawing.Color.Red;
110 | this.label1.Location = new System.Drawing.Point(17, 9);
111 | this.label1.Name = "label1";
112 | this.label1.Size = new System.Drawing.Size(247, 13);
113 | this.label1.TabIndex = 1;
114 | this.label1.Text = "During installation the following errors had occured:";
115 | //
116 | // Filename
117 | //
118 | this.Filename.Text = "Filename";
119 | this.Filename.Width = 150;
120 | //
121 | // ErrorView
122 | //
123 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
124 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
125 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(36)))), ((int)(((byte)(53)))));
126 | this.ClientSize = new System.Drawing.Size(765, 353);
127 | this.Controls.Add(this.label1);
128 | this.Controls.Add(this.ErrorListView);
129 | this.Name = "ErrorView";
130 | this.ShowIcon = false;
131 | this.Text = "Error View";
132 | this.ResumeLayout(false);
133 | this.PerformLayout();
134 |
135 | }
136 |
137 | #endregion
138 |
139 | private System.Windows.Forms.ListView ErrorListView;
140 | private System.Windows.Forms.ColumnHeader LineNumber;
141 | private System.Windows.Forms.ColumnHeader CommandString;
142 | private System.Windows.Forms.ColumnHeader ErrorString;
143 | private System.Windows.Forms.Label label1;
144 | private System.Windows.Forms.ColumnHeader Filename;
145 | }
146 | }
--------------------------------------------------------------------------------
/Binary/Interact/ErrorView.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System.IO;
28 | using System.Drawing;
29 | using System.Windows.Forms;
30 | using System.Collections.Generic;
31 | using Binary.Endscript;
32 |
33 |
34 |
35 | namespace Binary.Interact
36 | {
37 | public partial class ErrorView : Form
38 | {
39 | public ErrorView(List EndLines)
40 | {
41 | this.InitializeComponent();
42 | foreach (var endline in EndLines)
43 | {
44 | var Item = new ListViewItem();
45 | Item.Text = endline.Index.ToString();
46 | Item.SubItems.Add(Path.GetFileName(endline.Filename));
47 | Item.SubItems.Add(endline.Text);
48 | Item.SubItems.Add(endline.Error);
49 | this.ErrorListView.Items.Add(Item);
50 | }
51 | }
52 |
53 | private void ErrorListView_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
54 | {
55 | e.Graphics.FillRectangle(Brushes.DarkGray, e.Bounds);
56 | e.DrawText();
57 | }
58 |
59 | private void ErrorListView_DrawItem(object sender, DrawListViewItemEventArgs e)
60 | {
61 | e.DrawDefault = true;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Binary/Interact/ErrorView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Binary/Interact/FEngEditor.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Drawing;
29 | using System.Windows.Forms;
30 | using Binary.Endscript;
31 | using GlobalLib.Utils.EA;
32 | using GlobalLib.Support.Shared.Parts.FNGParts;
33 |
34 |
35 |
36 | namespace Binary.Interact
37 | {
38 | public partial class FEngEditor : Form
39 | {
40 | private int _index;
41 | private FEngColor _color;
42 | public string CommandProcessed { get; set; }
43 | public const string FNGroups = "FNGroups";
44 | public const string ReplaceAllNoAlpha = "ReplaceAllNoAlpha";
45 | public const string ReplaceAllWithAlpha = "ReplaceAllWithAlpha";
46 | public const string ReplaceSameNoAlpha = "ReplaceSameNoAlpha";
47 | public const string ReplaceSameWithAlpha = "ReplaceSameWithAlpha";
48 |
49 | public FEngEditor()
50 | {
51 | this.InitializeComponent();
52 | }
53 |
54 | public FEngEditor(FEngColor color, int index)
55 | {
56 | this._color = color;
57 | this._index = index;
58 | this.InitializeComponent();
59 | }
60 |
61 | private void TrackBar_Red_Scroll(object sender, EventArgs e)
62 | {
63 | this.NewRed.Value = this.TrackBar_Red.Value;
64 | this.NewColorBox.BackColor = Color.FromArgb(this.NewColorBox.BackColor.A,
65 | (int)NewRed.Value, this.NewColorBox.BackColor.G, this.NewColorBox.BackColor.B);
66 | }
67 |
68 | private void TrackBar_Green_Scroll(object sender, EventArgs e)
69 | {
70 | this.NewGreen.Value = this.TrackBar_Green.Value;
71 | this.NewColorBox.BackColor = Color.FromArgb(this.NewColorBox.BackColor.A,
72 | this.NewColorBox.BackColor.R, (int)NewGreen.Value, this.NewColorBox.BackColor.B);
73 | }
74 |
75 | private void TrackBar_Blue_Scroll(object sender, EventArgs e)
76 | {
77 | this.NewBlue.Value = this.TrackBar_Blue.Value;
78 | this.NewColorBox.BackColor = Color.FromArgb(this.NewColorBox.BackColor.A,
79 | this.NewColorBox.BackColor.R, this.NewColorBox.BackColor.G, (int)NewBlue.Value);
80 | }
81 |
82 | private void TrackBar_Alpha_Scroll(object sender, EventArgs e)
83 | {
84 | this.NewAlpha.Value = this.TrackBar_Alpha.Value;
85 | this.NewColorBox.BackColor = Color.FromArgb((int)NewAlpha.Value,
86 | this.NewColorBox.BackColor.R, this.NewColorBox.BackColor.G, this.NewColorBox.BackColor.B);
87 | }
88 |
89 | private void NewRed_ValueChanged(object sender, EventArgs e)
90 | {
91 | this.TrackBar_Red.Value = (int)NewRed.Value;
92 | this.NewColorBox.BackColor = Color.FromArgb(this.NewColorBox.BackColor.A,
93 | (int)NewRed.Value, this.NewColorBox.BackColor.G, this.NewColorBox.BackColor.B);
94 | }
95 |
96 | private void NewGreen_ValueChanged(object sender, EventArgs e)
97 | {
98 | this.TrackBar_Green.Value = (int)NewGreen.Value;
99 | this.NewColorBox.BackColor = Color.FromArgb(NewColorBox.BackColor.A,
100 | this.NewColorBox.BackColor.R, (int)NewGreen.Value, this.NewColorBox.BackColor.B);
101 | }
102 |
103 | private void NewBlue_ValueChanged(object sender, EventArgs e)
104 | {
105 | this.TrackBar_Blue.Value = (int)NewBlue.Value;
106 | this.NewColorBox.BackColor = Color.FromArgb(this.NewColorBox.BackColor.A,
107 | this.NewColorBox.BackColor.R, this.NewColorBox.BackColor.G, (int)NewBlue.Value);
108 | }
109 |
110 | private void NewAlpha_ValueChanged(object sender, EventArgs e)
111 | {
112 | this.TrackBar_Alpha.Value = (int)NewAlpha.Value;
113 | this.NewColorBox.BackColor = Color.FromArgb((int)NewAlpha.Value,
114 | this.NewColorBox.BackColor.R, this.NewColorBox.BackColor.G, this.NewColorBox.BackColor.B);
115 | }
116 |
117 | private void OpenWindowsColorForm_Click(object sender, EventArgs e)
118 | {
119 | if (this.SwatchDialog.ShowDialog() == DialogResult.OK)
120 | {
121 | this.TrackBar_Blue.Value = this.SwatchDialog.Color.B;
122 | this.TrackBar_Green.Value = this.SwatchDialog.Color.G;
123 | this.TrackBar_Red.Value = this.SwatchDialog.Color.R;
124 | this.NewBlue.Value = this.SwatchDialog.Color.B;
125 | this.NewGreen.Value = this.SwatchDialog.Color.G;
126 | this.NewRed.Value = this.SwatchDialog.Color.R;
127 | this.NewColorBox.BackColor = Color.FromArgb((int)this.NewAlpha.Value,
128 | (int)this.NewRed.Value, (int)this.NewGreen.Value, (int)this.NewBlue.Value);
129 | }
130 | }
131 |
132 | private void FEngEditor_Load(object sender, EventArgs e)
133 | {
134 | this.CurrentBackground.Controls.Add(this.CurrentColorBox);
135 | this.NewBackground.Controls.Add(this.NewColorBox);
136 | this.CurrentColorBox.Location = new Point(0, 0);
137 | this.NewColorBox.Location = new Point(0, 0);
138 | this.CurrentIndex.Text = this._index.ToString();
139 | this.CurrentOffset.Text = $"0x{this._color.Offset:X8}";
140 | this.CurrentAlpha.Text = this._color.Alpha.ToString();
141 | this.CurrentRed.Text = this._color.Red.ToString();
142 | this.CurrentGreen.Text = this._color.Green.ToString();
143 | this.CurrentBlue.Text = this._color.Blue.ToString();
144 |
145 | this.CurrentColorBox.BackColor = Color.FromArgb(this._color.Alpha, this._color.Red,
146 | this._color.Green, this._color.Blue);
147 | this.NewColorBox.BackColor = this.CurrentColorBox.BackColor;
148 |
149 | this.TrackBar_Alpha.Value = this.CurrentColorBox.BackColor.A;
150 | this.TrackBar_Red.Value = this.CurrentColorBox.BackColor.R;
151 | this.TrackBar_Green.Value = this.CurrentColorBox.BackColor.G;
152 | this.TrackBar_Blue.Value = this.CurrentColorBox.BackColor.B;
153 |
154 | this.NewAlpha.Value = this.CurrentColorBox.BackColor.A;
155 | this.NewRed.Value = this.CurrentColorBox.BackColor.R;
156 | this.NewGreen.Value = this.CurrentColorBox.BackColor.G;
157 | this.NewBlue.Value = this.CurrentColorBox.BackColor.B;
158 | }
159 |
160 | private void ButtonOK_Click(object sender, EventArgs e)
161 | {
162 | string path = $"{eCommands.update} {FNGroups} {this._color.ThisFNGroup.CollectionName}";
163 | string hex = SAT.ColorToHex(this.NewColorBox.BackColor.A, this.NewColorBox.BackColor.R,
164 | this.NewColorBox.BackColor.G, this.NewColorBox.BackColor.B);
165 | bool keepalpha = this.CheckKeepAlpha.Checked;
166 | if (this.CheckReplaceSame.Checked)
167 | {
168 | var newcolor = new FEngColor(null)
169 | {
170 | Alpha = this.NewColorBox.BackColor.A,
171 | Red = this.NewColorBox.BackColor.R,
172 | Green = this.NewColorBox.BackColor.G,
173 | Blue = this.NewColorBox.BackColor.B
174 | };
175 | this._color.ThisFNGroup.TrySetSame(this._index, newcolor, keepalpha);
176 | if (keepalpha)
177 | this.CommandProcessed = $"{path} {ReplaceSameNoAlpha}[{this._index}] {hex}";
178 | else
179 | this.CommandProcessed = $"{path} {ReplaceSameWithAlpha}[{this._index}] {hex}";
180 | }
181 | else
182 | {
183 | this._color.Alpha = this.NewColorBox.BackColor.A;
184 | this._color.Red = this.NewColorBox.BackColor.R;
185 | this._color.Green = this.NewColorBox.BackColor.G;
186 | this._color.Blue = this.NewColorBox.BackColor.B;
187 | if (this.CheckReplaceAll.Checked)
188 | {
189 | this._color.ThisFNGroup.TrySetAll(this._color, keepalpha);
190 | if (keepalpha)
191 | this.CommandProcessed = $"{path} {ReplaceAllNoAlpha} {hex}";
192 | else
193 | this.CommandProcessed = $"{path} {ReplaceAllWithAlpha} {hex}";
194 | }
195 | else
196 | this.CommandProcessed = $"{path} Color[{this._index}] {hex}";
197 | }
198 | this.DialogResult = DialogResult.OK;
199 | this.Close();
200 | }
201 |
202 | private void CheckReplaceAll_CheckedChanged(object sender, EventArgs e)
203 | {
204 | if (this.CheckReplaceAll.Checked) this.CheckKeepAlpha.Enabled = true;
205 | else if (!this.CheckReplaceSame.Checked)
206 | {
207 | this.CheckKeepAlpha.Enabled = false;
208 | this.CheckKeepAlpha.Checked = false;
209 | }
210 | }
211 |
212 | private void CheckReplaceSame_CheckedChanged(object sender, EventArgs e)
213 | {
214 | if (this.CheckReplaceSame.Checked) this.CheckKeepAlpha.Enabled = true;
215 | else if (!this.CheckReplaceAll.Checked)
216 | {
217 | this.CheckKeepAlpha.Enabled = false;
218 | this.CheckKeepAlpha.Checked = false;
219 | }
220 | }
221 | }
222 | }
--------------------------------------------------------------------------------
/Binary/Interact/Input.Designer.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Interact
28 | {
29 | partial class Input
30 | {
31 | ///
32 | /// Required designer variable.
33 | ///
34 | private System.ComponentModel.IContainer components = null;
35 |
36 | ///
37 | /// Clean up any resources being used.
38 | ///
39 | /// true if managed resources should be disposed; otherwise, false.
40 | protected override void Dispose(bool disposing)
41 | {
42 | if (disposing && (components != null))
43 | {
44 | components.Dispose();
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 |
51 | ///
52 | /// Required method for Designer support - do not modify
53 | /// the contents of this method with the code editor.
54 | ///
55 | private void InitializeComponent()
56 | {
57 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Input));
58 | this.ButtonOK = new System.Windows.Forms.Button();
59 | this.ButtonCancel = new System.Windows.Forms.Button();
60 | this.UserAskLabel = new System.Windows.Forms.Label();
61 | this.UserInput = new System.Windows.Forms.TextBox();
62 | this.SuspendLayout();
63 | //
64 | // ButtonOK
65 | //
66 | this.ButtonOK.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
67 | this.ButtonOK.FlatAppearance.BorderColor = System.Drawing.Color.Black;
68 | this.ButtonOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
69 | this.ButtonOK.ForeColor = System.Drawing.SystemColors.Info;
70 | this.ButtonOK.Location = new System.Drawing.Point(144, 67);
71 | this.ButtonOK.Name = "ButtonOK";
72 | this.ButtonOK.Size = new System.Drawing.Size(97, 23);
73 | this.ButtonOK.TabIndex = 7;
74 | this.ButtonOK.Text = "OK";
75 | this.ButtonOK.UseVisualStyleBackColor = false;
76 | this.ButtonOK.Click += new System.EventHandler(this.ButtonOK_Click);
77 | //
78 | // ButtonCancel
79 | //
80 | this.ButtonCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
81 | this.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
82 | this.ButtonCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
83 | this.ButtonCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
84 | this.ButtonCancel.ForeColor = System.Drawing.SystemColors.Info;
85 | this.ButtonCancel.Location = new System.Drawing.Point(247, 67);
86 | this.ButtonCancel.Name = "ButtonCancel";
87 | this.ButtonCancel.Size = new System.Drawing.Size(97, 23);
88 | this.ButtonCancel.TabIndex = 6;
89 | this.ButtonCancel.Text = "Cancel";
90 | this.ButtonCancel.UseVisualStyleBackColor = false;
91 | this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
92 | //
93 | // UserAskLabel
94 | //
95 | this.UserAskLabel.AutoSize = true;
96 | this.UserAskLabel.ForeColor = System.Drawing.SystemColors.Window;
97 | this.UserAskLabel.Location = new System.Drawing.Point(12, 18);
98 | this.UserAskLabel.Name = "UserAskLabel";
99 | this.UserAskLabel.Size = new System.Drawing.Size(135, 13);
100 | this.UserAskLabel.TabIndex = 5;
101 | this.UserAskLabel.Text = "Enter new Collection Name";
102 | //
103 | // UserInput
104 | //
105 | this.UserInput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
106 | this.UserInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
107 | this.UserInput.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
108 | this.UserInput.ForeColor = System.Drawing.SystemColors.Window;
109 | this.UserInput.Location = new System.Drawing.Point(12, 34);
110 | this.UserInput.Name = "UserInput";
111 | this.UserInput.Size = new System.Drawing.Size(332, 22);
112 | this.UserInput.TabIndex = 4;
113 | //
114 | // Input
115 | //
116 | this.AcceptButton = this.ButtonOK;
117 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
118 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
119 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(36)))), ((int)(((byte)(53)))));
120 | this.CancelButton = this.ButtonCancel;
121 | this.ClientSize = new System.Drawing.Size(356, 108);
122 | this.Controls.Add(this.ButtonOK);
123 | this.Controls.Add(this.ButtonCancel);
124 | this.Controls.Add(this.UserAskLabel);
125 | this.Controls.Add(this.UserInput);
126 | this.ForeColor = System.Drawing.SystemColors.Info;
127 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
128 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
129 | this.MaximizeBox = false;
130 | this.Name = "Input";
131 | this.Text = "Editor";
132 | this.ResumeLayout(false);
133 | this.PerformLayout();
134 |
135 | }
136 |
137 | #endregion
138 |
139 | private System.Windows.Forms.Button ButtonOK;
140 | private System.Windows.Forms.Button ButtonCancel;
141 | private System.Windows.Forms.Label UserAskLabel;
142 | private System.Windows.Forms.TextBox UserInput;
143 | }
144 | }
--------------------------------------------------------------------------------
/Binary/Interact/Input.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Windows.Forms;
29 |
30 |
31 |
32 | namespace Binary.Interact
33 | {
34 | public partial class Input : Form
35 | {
36 | public string CollectionName { get; private set; }
37 |
38 | public Input()
39 | {
40 | this.InitializeComponent();
41 | }
42 |
43 | public Input(string text)
44 | {
45 | this.InitializeComponent();
46 | this.UserAskLabel.Text = text;
47 | }
48 |
49 | private void ButtonCancel_Click(object sender, EventArgs e)
50 | {
51 | this.DialogResult = DialogResult.Cancel;
52 | this.Close();
53 | }
54 |
55 | private void ButtonOK_Click(object sender, EventArgs e)
56 | {
57 | if (string.IsNullOrWhiteSpace(this.UserInput.Text))
58 | {
59 | MessageBox.Show("This field cannot be left empty or be a whitespace.", "Warning");
60 | return;
61 | }
62 | this.CollectionName = this.UserInput.Text;
63 | this.DialogResult = DialogResult.OK;
64 | this.Close();
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Binary/Interact/STREditor.Designer.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Interact
28 | {
29 | partial class STREditor
30 | {
31 | ///
32 | /// Required designer variable.
33 | ///
34 | private System.ComponentModel.IContainer components = null;
35 |
36 | ///
37 | /// Clean up any resources being used.
38 | ///
39 | /// true if managed resources should be disposed; otherwise, false.
40 | protected override void Dispose(bool disposing)
41 | {
42 | if (disposing && (components != null))
43 | {
44 | components.Dispose();
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 |
51 | ///
52 | /// Required method for Designer support - do not modify
53 | /// the contents of this method with the code editor.
54 | ///
55 | private void InitializeComponent()
56 | {
57 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(STREditor));
58 | this.StringTextBox = new System.Windows.Forms.TextBox();
59 | this.AddString = new System.Windows.Forms.Button();
60 | this.FindString = new System.Windows.Forms.Button();
61 | this.DeleteString = new System.Windows.Forms.Button();
62 | this.ApplyChanges = new System.Windows.Forms.Button();
63 | this.StringKeyBox = new System.Windows.Forms.TextBox();
64 | this.StringLabelBox = new System.Windows.Forms.TextBox();
65 | this.LabelKey = new System.Windows.Forms.Label();
66 | this.label1 = new System.Windows.Forms.Label();
67 | this.UseCustomKeyCheckBox = new System.Windows.Forms.CheckBox();
68 | this.UseInvertedKeyCheckBox = new System.Windows.Forms.CheckBox();
69 | this.SuspendLayout();
70 | //
71 | // StringTextBox
72 | //
73 | this.StringTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
74 | this.StringTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
75 | this.StringTextBox.ForeColor = System.Drawing.SystemColors.Info;
76 | this.StringTextBox.Location = new System.Drawing.Point(12, 101);
77 | this.StringTextBox.Multiline = true;
78 | this.StringTextBox.Name = "StringTextBox";
79 | this.StringTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
80 | this.StringTextBox.Size = new System.Drawing.Size(620, 169);
81 | this.StringTextBox.TabIndex = 0;
82 | //
83 | // AddString
84 | //
85 | this.AddString.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
86 | this.AddString.FlatAppearance.BorderColor = System.Drawing.Color.Black;
87 | this.AddString.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
88 | this.AddString.ForeColor = System.Drawing.SystemColors.Info;
89 | this.AddString.Location = new System.Drawing.Point(12, 71);
90 | this.AddString.Name = "AddString";
91 | this.AddString.Size = new System.Drawing.Size(140, 24);
92 | this.AddString.TabIndex = 1;
93 | this.AddString.Text = "Add String";
94 | this.AddString.UseVisualStyleBackColor = false;
95 | this.AddString.Click += new System.EventHandler(this.AddString_Click);
96 | //
97 | // FindString
98 | //
99 | this.FindString.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
100 | this.FindString.FlatAppearance.BorderColor = System.Drawing.Color.Black;
101 | this.FindString.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
102 | this.FindString.ForeColor = System.Drawing.SystemColors.Info;
103 | this.FindString.Location = new System.Drawing.Point(332, 71);
104 | this.FindString.Name = "FindString";
105 | this.FindString.Size = new System.Drawing.Size(140, 24);
106 | this.FindString.TabIndex = 2;
107 | this.FindString.Text = "Find String";
108 | this.FindString.UseVisualStyleBackColor = false;
109 | this.FindString.Click += new System.EventHandler(this.FindString_Click);
110 | //
111 | // DeleteString
112 | //
113 | this.DeleteString.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
114 | this.DeleteString.FlatAppearance.BorderColor = System.Drawing.Color.Black;
115 | this.DeleteString.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
116 | this.DeleteString.ForeColor = System.Drawing.SystemColors.Info;
117 | this.DeleteString.Location = new System.Drawing.Point(172, 71);
118 | this.DeleteString.Name = "DeleteString";
119 | this.DeleteString.Size = new System.Drawing.Size(140, 24);
120 | this.DeleteString.TabIndex = 3;
121 | this.DeleteString.Text = "Delete String";
122 | this.DeleteString.UseVisualStyleBackColor = false;
123 | this.DeleteString.Click += new System.EventHandler(this.DeleteString_Click);
124 | //
125 | // ApplyChanges
126 | //
127 | this.ApplyChanges.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
128 | this.ApplyChanges.FlatAppearance.BorderColor = System.Drawing.Color.Black;
129 | this.ApplyChanges.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
130 | this.ApplyChanges.ForeColor = System.Drawing.SystemColors.Info;
131 | this.ApplyChanges.Location = new System.Drawing.Point(492, 71);
132 | this.ApplyChanges.Name = "ApplyChanges";
133 | this.ApplyChanges.Size = new System.Drawing.Size(140, 24);
134 | this.ApplyChanges.TabIndex = 4;
135 | this.ApplyChanges.Text = "Apply Changes";
136 | this.ApplyChanges.UseVisualStyleBackColor = false;
137 | this.ApplyChanges.Click += new System.EventHandler(this.ApplyChanges_Click);
138 | //
139 | // StringKeyBox
140 | //
141 | this.StringKeyBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
142 | this.StringKeyBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
143 | this.StringKeyBox.ForeColor = System.Drawing.SystemColors.Info;
144 | this.StringKeyBox.Location = new System.Drawing.Point(55, 12);
145 | this.StringKeyBox.Name = "StringKeyBox";
146 | this.StringKeyBox.ReadOnly = true;
147 | this.StringKeyBox.Size = new System.Drawing.Size(287, 20);
148 | this.StringKeyBox.TabIndex = 5;
149 | this.StringKeyBox.Validating += new System.ComponentModel.CancelEventHandler(this.StringKeyBox_Validating);
150 | //
151 | // StringLabelBox
152 | //
153 | this.StringLabelBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(70)))));
154 | this.StringLabelBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
155 | this.StringLabelBox.ForeColor = System.Drawing.SystemColors.Info;
156 | this.StringLabelBox.Location = new System.Drawing.Point(55, 38);
157 | this.StringLabelBox.Name = "StringLabelBox";
158 | this.StringLabelBox.Size = new System.Drawing.Size(287, 20);
159 | this.StringLabelBox.TabIndex = 6;
160 | this.StringLabelBox.TextChanged += new System.EventHandler(this.StringLabelBox_TextChanged);
161 | //
162 | // LabelKey
163 | //
164 | this.LabelKey.AutoSize = true;
165 | this.LabelKey.ForeColor = System.Drawing.SystemColors.Info;
166 | this.LabelKey.Location = new System.Drawing.Point(24, 15);
167 | this.LabelKey.Name = "LabelKey";
168 | this.LabelKey.Size = new System.Drawing.Size(25, 13);
169 | this.LabelKey.TabIndex = 7;
170 | this.LabelKey.Text = "Key";
171 | //
172 | // label1
173 | //
174 | this.label1.AutoSize = true;
175 | this.label1.ForeColor = System.Drawing.SystemColors.Info;
176 | this.label1.Location = new System.Drawing.Point(16, 41);
177 | this.label1.Name = "label1";
178 | this.label1.Size = new System.Drawing.Size(33, 13);
179 | this.label1.TabIndex = 8;
180 | this.label1.Text = "Label";
181 | //
182 | // UseCustomKeyCheckBox
183 | //
184 | this.UseCustomKeyCheckBox.AutoSize = true;
185 | this.UseCustomKeyCheckBox.ForeColor = System.Drawing.SystemColors.Info;
186 | this.UseCustomKeyCheckBox.Location = new System.Drawing.Point(348, 14);
187 | this.UseCustomKeyCheckBox.Name = "UseCustomKeyCheckBox";
188 | this.UseCustomKeyCheckBox.Size = new System.Drawing.Size(272, 17);
189 | this.UseCustomKeyCheckBox.TabIndex = 9;
190 | this.UseCustomKeyCheckBox.Text = "Use custom hash (should be a hexadecimal number)";
191 | this.UseCustomKeyCheckBox.UseVisualStyleBackColor = true;
192 | this.UseCustomKeyCheckBox.CheckedChanged += new System.EventHandler(this.UseCustomKeyCheckBox_CheckedChanged);
193 | //
194 | // UseInvertedKeyCheckBox
195 | //
196 | this.UseInvertedKeyCheckBox.AutoSize = true;
197 | this.UseInvertedKeyCheckBox.ForeColor = System.Drawing.SystemColors.Info;
198 | this.UseInvertedKeyCheckBox.Location = new System.Drawing.Point(348, 41);
199 | this.UseInvertedKeyCheckBox.Name = "UseInvertedKeyCheckBox";
200 | this.UseInvertedKeyCheckBox.Size = new System.Drawing.Size(287, 17);
201 | this.UseInvertedKeyCheckBox.TabIndex = 10;
202 | this.UseInvertedKeyCheckBox.Text = "Show inverted file hashes (AABBCCDD to DDCCBBAA)";
203 | this.UseInvertedKeyCheckBox.UseVisualStyleBackColor = true;
204 | this.UseInvertedKeyCheckBox.CheckedChanged += new System.EventHandler(this.UseInvertedKeyCheckBox_CheckedChanged);
205 | //
206 | // STREditor
207 | //
208 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
209 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
210 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(36)))), ((int)(((byte)(53)))));
211 | this.ClientSize = new System.Drawing.Size(644, 283);
212 | this.Controls.Add(this.UseInvertedKeyCheckBox);
213 | this.Controls.Add(this.UseCustomKeyCheckBox);
214 | this.Controls.Add(this.label1);
215 | this.Controls.Add(this.LabelKey);
216 | this.Controls.Add(this.StringLabelBox);
217 | this.Controls.Add(this.StringKeyBox);
218 | this.Controls.Add(this.ApplyChanges);
219 | this.Controls.Add(this.DeleteString);
220 | this.Controls.Add(this.FindString);
221 | this.Controls.Add(this.AddString);
222 | this.Controls.Add(this.StringTextBox);
223 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
224 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
225 | this.MaximizeBox = false;
226 | this.Name = "STREditor";
227 | this.Text = "String Editor by MaxHwoy";
228 | this.Load += new System.EventHandler(this.STREditor_Load);
229 | this.ResumeLayout(false);
230 | this.PerformLayout();
231 |
232 | }
233 |
234 | #endregion
235 |
236 | private System.Windows.Forms.TextBox StringTextBox;
237 | private System.Windows.Forms.Button AddString;
238 | private System.Windows.Forms.Button FindString;
239 | private System.Windows.Forms.Button DeleteString;
240 | private System.Windows.Forms.Button ApplyChanges;
241 | private System.Windows.Forms.TextBox StringKeyBox;
242 | private System.Windows.Forms.TextBox StringLabelBox;
243 | private System.Windows.Forms.Label LabelKey;
244 | private System.Windows.Forms.Label label1;
245 | private System.Windows.Forms.CheckBox UseCustomKeyCheckBox;
246 | private System.Windows.Forms.CheckBox UseInvertedKeyCheckBox;
247 | }
248 | }
--------------------------------------------------------------------------------
/Binary/Interact/STREditor.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Collections.Generic;
29 | using System.ComponentModel;
30 | using System.Windows.Forms;
31 | using Binary.Endscript;
32 | using GlobalLib.Utils;
33 | using GlobalLib.Reflection;
34 | using GlobalLib.Support.Shared.Parts.STRParts;
35 |
36 |
37 |
38 | namespace Binary.Interact
39 | {
40 | public partial class STREditor : Form
41 | {
42 | private bool labelchanged = false;
43 | private const string path = "STRBlocks GLOBAL";
44 | private const string key = "Key";
45 | private const string label = "Label";
46 | private const string text = "Text";
47 |
48 | public bool FindTexts { get; set; } = false;
49 | public string TextToFind { get; set; } = string.Empty;
50 |
51 | public List CommandsProcessed { get; set; } = new List();
52 |
53 | private StringRecord _record;
54 |
55 | public STREditor(StringRecord str)
56 | {
57 | this._record = str;
58 | this.InitializeComponent();
59 | }
60 |
61 | private void ApplyRecordChanges(uint newkey)
62 | {
63 | var prevs = $"0x{this._record.Key:X8}";
64 | var after = $"0x{newkey:X8}";
65 | this._record.Key = newkey;
66 | this._record.Label = this.labelchanged ? this.StringLabelBox.Text : this._record.Label;
67 | this._record.Text = this.StringTextBox.Text;
68 | this.CommandsProcessed.Add($"{eCommands.update} {path} {prevs} {key} {after}");
69 | this.CommandsProcessed.Add($"{eCommands.update} {path} {after} {label} \"{this._record.Label}\"");
70 | this.CommandsProcessed.Add($"{eCommands.update} {path} {after} {text} \"{this._record.Text}\"");
71 | }
72 |
73 | private void STREditor_Load(object sender, EventArgs e)
74 | {
75 | this.StringLabelBox.Text = string.IsNullOrEmpty(this._record.Label) ? "???" : this._record.Label;
76 | this.StringKeyBox.Text = $"0x{this._record.Key:X8}";
77 | this.StringTextBox.Text = this._record.Text;
78 | this.labelchanged = false;
79 | if (this._record.Key != Bin.Hash(this._record.Label))
80 | this.UseCustomKeyCheckBox.Checked = true;
81 | }
82 |
83 | private void StringLabelBox_TextChanged(object sender, EventArgs e)
84 | {
85 | if (!this.UseCustomKeyCheckBox.Checked)
86 | {
87 | var key = Bin.Hash(this.StringLabelBox.Text);
88 | if (this.UseInvertedKeyCheckBox.Checked)
89 | this.StringKeyBox.Text = $"0x{Bin.Reverse(key):X8}";
90 | else
91 | this.StringKeyBox.Text = $"0x{key:X8}";
92 | this.labelchanged = true;
93 | }
94 | }
95 |
96 | private void UseCustomKeyCheckBox_CheckedChanged(object sender, EventArgs e)
97 | {
98 | this.StringKeyBox.ReadOnly = !this.UseCustomKeyCheckBox.Checked;
99 | if (this.StringKeyBox.ReadOnly)
100 | this.StringKeyBox.Text = $"0x{Bin.Hash(this.StringLabelBox.Text):X8}";
101 | }
102 |
103 | private void UseInvertedKeyCheckBox_CheckedChanged(object sender, EventArgs e)
104 | {
105 | var key = ConvertX.ToUInt32(this.StringKeyBox.Text);
106 | key = Bin.Reverse(key);
107 | this.StringKeyBox.Text = $"0x{key:X8}";
108 | }
109 |
110 | private void ApplyChanges_Click(object sender, EventArgs e)
111 | {
112 | if (string.IsNullOrEmpty(this.StringKeyBox.Text) || string.IsNullOrEmpty(this.StringLabelBox.Text))
113 | {
114 | MessageBox.Show("Key value and label value cannot be left empty.", "Warning",
115 | MessageBoxButtons.OK, MessageBoxIcon.Warning);
116 | return;
117 | }
118 | uint key = ConvertX.ToUInt32(this.StringKeyBox.Text);
119 | if (this.UseInvertedKeyCheckBox.Checked) key = Bin.Reverse(key);
120 | if (key != this._record.Key) // if this is a different key from the one passed
121 | {
122 | var exist = this._record.ThisSTRBlock.GetRecord(key);
123 | if (exist != null)
124 | {
125 | MessageBox.Show($"StringRecord with key {this.StringKeyBox.Text} already exists", "Warning",
126 | MessageBoxButtons.OK, MessageBoxIcon.Warning);
127 | return;
128 | }
129 | }
130 | this.ApplyRecordChanges(key);
131 | this.DialogResult = DialogResult.OK;
132 | }
133 |
134 | private void DeleteString_Click(object sender, EventArgs e)
135 | {
136 | var key = $"0x{this._record.Key:X8}";
137 | this.CommandsProcessed.Add($"{eCommands.delete} {path} {key}");
138 | this._record.ThisSTRBlock.TryRemoveRecord(this._record.Key);
139 | this.DialogResult = DialogResult.OK;
140 | this.Close();
141 | }
142 |
143 | private void AddString_Click(object sender, EventArgs e)
144 | {
145 | string global = "GLOBAL_";
146 | int index = 0;
147 | while (!this._record.ThisSTRBlock.TryAddRecord(BaseArguments.AUTO,
148 | $"{global}{index}", string.Empty)) { ++index; }
149 | var newkey = Bin.Hash($"{global}{index}");
150 | var newrecord = this._record.ThisSTRBlock.GetRecord(newkey);
151 | this._record = newrecord;
152 | this.CommandsProcessed.Add($"{eCommands.add} {path} {BaseArguments.AUTO} {global}{index} \"\"");
153 | this.STREditor_Load(this, EventArgs.Empty);
154 | }
155 |
156 | private void FindString_Click(object sender, EventArgs e)
157 | {
158 | var InputWindow = new Input("Enter the text to be found (case sensitive only):");
159 | if (InputWindow.ShowDialog() == DialogResult.OK)
160 | {
161 | this.FindTexts = true;
162 | this.TextToFind = InputWindow.CollectionName;
163 | this.DialogResult = DialogResult.OK;
164 | this.Close();
165 | }
166 | }
167 |
168 | private void StringKeyBox_Validating(object sender, CancelEventArgs e)
169 | {
170 | if (ConvertX.ToUInt32(this.StringKeyBox.Text) == 0)
171 | {
172 | MessageBox.Show("Unable to convert key to a hexadecimal hash or it equals 0.", "Error",
173 | MessageBoxButtons.OK, MessageBoxIcon.Error);
174 | e.Cancel = true;
175 | }
176 | }
177 | }
178 | }
--------------------------------------------------------------------------------
/Binary/Interact/TPKEditor.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.IO;
29 | using System.Collections.Generic;
30 | using System.ComponentModel;
31 | using System.Drawing;
32 | using System.Windows.Forms;
33 | using Binary.Endscript;
34 | using GlobalLib.Utils;
35 | using GlobalLib.Reflection.Enum;
36 | using GlobalLib.Support.Shared.Class;
37 |
38 |
39 |
40 | namespace Binary.Interact
41 | {
42 | public partial class TPKEditor : Form
43 | {
44 | private TPKBlock TPK;
45 | private Texture _texture;
46 | private string OName;
47 | public List CommandsProcessed { get; set; } = new List();
48 | private const string tpkblock = "TPKBlock";
49 | private const string cname = "CollectionName";
50 | private const string tileable = "TileableUV";
51 |
52 | public TPKEditor(TPKBlock TPK, uint key)
53 | {
54 | this.TPK = TPK;
55 | this._texture = this.TPK.FindTexture(key, eKeyType.BINKEY);
56 | this.InitializeComponent();
57 | this.BackImage.Controls.Add(this.PreviewImage);
58 | this.PreviewImage.Location = new Point(0, 0);
59 | this.PreviewImage.BackColor = Color.FromArgb(0, 0, 0, 0);
60 | }
61 |
62 | private void DisposeImage()
63 | {
64 | var disposer = this.PreviewImage.Image;
65 | if (disposer != null) disposer.Dispose();
66 | }
67 |
68 | private void ChangeTileable()
69 | {
70 | if (this._texture.TileableUV == 0 && this.TileableUVEnabled.Checked)
71 | {
72 | this._texture.TileableUV = 3;
73 | this.CommandsProcessed.Add($"{eCommands.update} {tpkblock} {this.TPK.CollectionName} " +
74 | $"0x{this._texture.BinKey:X8} {tileable} 3");
75 | }
76 | else if (this._texture.TileableUV > 0 && !this.TileableUVEnabled.Checked)
77 | {
78 | this._texture.TileableUV = 0;
79 | this.CommandsProcessed.Add($"{eCommands.update} {tpkblock} {this.TPK.CollectionName} " +
80 | $"0x{this._texture.BinKey:X8} {tileable} 0");
81 | }
82 | }
83 |
84 | private void TPKEditor_Load(object sender, EventArgs e)
85 | {
86 | this.PreviewImage.Image = this._texture.GetImage();
87 | this.OName = this._texture.CollectionName;
88 | this.BoxCollectionName.Text = this._texture.CollectionName;
89 | this.BoxCompression.Text = this._texture.GetValue("Compression");
90 | this.BoxWidth.Text = this._texture.Width.ToString();
91 | this.BoxHeight.Text = this._texture.Height.ToString();
92 | this.BoxMipmaps.Text = this._texture.Mipmaps.ToString();
93 | this.TileableUVEnabled.Checked = (this._texture.TileableUV > 0) ? true : false;
94 | this.PreviewImage.Width = this._texture.Width;
95 | this.PreviewImage.Height = this._texture.Height;
96 | if (this.PreviewImage.Width > 512 || this.PreviewImage.Height > 512)
97 | this.PreviewImage.SizeMode = PictureBoxSizeMode.Zoom;
98 | }
99 |
100 | private void TPKEditor_FormClosed(object sender, FormClosedEventArgs e)
101 | {
102 | var disposer = this.PreviewImage.Image;
103 | if (disposer != null) disposer.Dispose();
104 | }
105 |
106 | private void DuplicateTexture_Click(object sender, EventArgs e)
107 | {
108 | var InputWindow = new Input();
109 | if (InputWindow.ShowDialog() == DialogResult.OK)
110 | {
111 | string newname = InputWindow.CollectionName;
112 | if (!this.TPK.TryCloneTexture(newname, this._texture.BinKey, eKeyType.BINKEY, out var error))
113 | {
114 | MessageBox.Show($"Error occured: {error}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
115 | this.DuplicateTexture_Click(sender, e);
116 | }
117 | else
118 | {
119 | this.CommandsProcessed.Add($"{eCommands.copy} {tpkblock} {this.TPK.CollectionName} " +
120 | $"0x{this._texture.BinKey:X8} {newname}");
121 | }
122 | }
123 | }
124 |
125 | private void AddTexture_Click(object sender, EventArgs e)
126 | {
127 | this.AddTextureDialog.ShowDialog();
128 | }
129 |
130 | private void AddTextureDialog_FileOk(object sender, CancelEventArgs e)
131 | {
132 | string CName = Path.GetFileNameWithoutExtension(AddTextureDialog.FileName);
133 | if (!this.TPK.TryAddTexture(CName, this.AddTextureDialog.FileName, out var error))
134 | {
135 | MessageBox.Show($"Error occured: {error}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
136 | e.Cancel = true;
137 | }
138 | }
139 |
140 | private void ReplaceTexture_Click(object sender, EventArgs e)
141 | {
142 | this.ReplaceTextureDialog.ShowDialog();
143 | }
144 |
145 | private void ReplaceTextureDialog_FileOk(object sender, CancelEventArgs e)
146 | {
147 | if (this.TPK.TryReplaceTexture(this._texture.BinKey, eKeyType.BINKEY,
148 | this.ReplaceTextureDialog.FileName, out var error))
149 | {
150 | this.DisposeImage();
151 | this.PreviewImage.Image = this._texture.GetImage();
152 | this.BoxCompression.Text = this._texture.GetValue("Compression");
153 | this.BoxWidth.Text = this._texture.Width.ToString();
154 | this.BoxHeight.Text = this._texture.Height.ToString();
155 | this.BoxMipmaps.Text = this._texture.Mipmaps.ToString();
156 | this.PreviewImage.Width = this._texture.Width;
157 | this.PreviewImage.Height = this._texture.Height;
158 | if (this.PreviewImage.Width > 512 || this.PreviewImage.Height > 512)
159 | this.PreviewImage.SizeMode = PictureBoxSizeMode.Zoom;
160 | }
161 | else
162 | {
163 | MessageBox.Show($"Error occured: {error}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
164 | e.Cancel = true;
165 | }
166 | }
167 |
168 | private void ExportOneAs_Click(object sender, EventArgs e)
169 | {
170 | string FilterExt = "Direct Draw Surface files|*.dds|";
171 | FilterExt += "Portable Network Graphics files|*.png|";
172 | FilterExt += "Joint Photographic Group files|*.jpg|";
173 | FilterExt += "Bitmap Pixel Format files|*.bmp|";
174 | FilterExt += "Tagged Image File Format files|*.tiff";
175 | this.ExportTextureDialog.Filter = FilterExt;
176 | if (this.ExportTextureDialog.ShowDialog() == DialogResult.OK)
177 | {
178 | string path = this.ExportTextureDialog.FileName;
179 | string ext = Path.GetExtension(path);
180 | if (this.TPK.TryExportTexture(this._texture.BinKey, eKeyType.BINKEY, path, ext, out var error))
181 | MessageBox.Show("Texture has been successfully exported.", "Success",
182 | MessageBoxButtons.OK, MessageBoxIcon.Information);
183 | else
184 | MessageBox.Show($"Error occured: {error}", "Error", MessageBoxButtons.OK,
185 | MessageBoxIcon.Error);
186 | }
187 | }
188 |
189 | private void DeleteTexture_Click(object sender, EventArgs e)
190 | {
191 | if (this.TPK.TryRemoveTexture(this._texture.BinKey, eKeyType.BINKEY, out var error))
192 | {
193 | this.CommandsProcessed.Add($"{eCommands.delete} {tpkblock} {this.TPK.CollectionName} " +
194 | $"0x{this._texture.BinKey:X8}");
195 | this.Close();
196 | }
197 | else
198 | MessageBox.Show($"Error occured: {error}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
199 | }
200 |
201 | private void ButtonCancel_Click(object sender, EventArgs e)
202 | {
203 | this.Close();
204 | }
205 |
206 | private void ButtonOK_Click(object sender, EventArgs e)
207 | {
208 | if (string.IsNullOrWhiteSpace(this.BoxCollectionName.Text))
209 | {
210 | MessageBox.Show("Collection Name cannot be empty or whitespace.", "Warning");
211 | return;
212 | }
213 | var CName = this.BoxCollectionName.Text;
214 | if (CName != this.OName)
215 | {
216 | var exist = this.TPK.FindTexture(Bin.Hash(CName), eKeyType.BINKEY);
217 | if (exist != null)
218 | {
219 | MessageBox.Show($"Texture with {cname} {CName} already exists.", "Warning",
220 | MessageBoxButtons.OK, MessageBoxIcon.Warning);
221 | return;
222 | }
223 | this.CommandsProcessed.Add($"{eCommands.update} {tpkblock} {this.TPK.CollectionName} " +
224 | $"0x{this._texture.BinKey:X8} {cname} {CName}");
225 | this._texture.CollectionName = CName;
226 | }
227 | this.ChangeTileable();
228 | this.DialogResult = DialogResult.OK;
229 | }
230 | }
231 | }
232 |
--------------------------------------------------------------------------------
/Binary/Interact/Welcome.Designer.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Interact
28 | {
29 | partial class Welcome
30 | {
31 | ///
32 | /// Required designer variable.
33 | ///
34 | private System.ComponentModel.IContainer components = null;
35 |
36 | ///
37 | /// Clean up any resources being used.
38 | ///
39 | /// true if managed resources should be disposed; otherwise, false.
40 | protected override void Dispose(bool disposing)
41 | {
42 | if (disposing && (components != null))
43 | {
44 | components.Dispose();
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 |
51 | ///
52 | /// Required method for Designer support - do not modify
53 | /// the contents of this method with the code editor.
54 | ///
55 | private void InitializeComponent()
56 | {
57 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Welcome));
58 | this.ExitButton = new System.Windows.Forms.Button();
59 | this.ConfirmButton = new System.Windows.Forms.Button();
60 | this.PasswordBox = new System.Windows.Forms.TextBox();
61 | this.label2 = new System.Windows.Forms.Label();
62 | this.label1 = new System.Windows.Forms.Label();
63 | this.SuspendLayout();
64 | //
65 | // ExitButton
66 | //
67 | this.ExitButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
68 | this.ExitButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
69 | this.ExitButton.ForeColor = System.Drawing.SystemColors.Info;
70 | this.ExitButton.Location = new System.Drawing.Point(214, 118);
71 | this.ExitButton.Name = "ExitButton";
72 | this.ExitButton.Size = new System.Drawing.Size(134, 27);
73 | this.ExitButton.TabIndex = 9;
74 | this.ExitButton.Text = "Exit";
75 | this.ExitButton.UseVisualStyleBackColor = false;
76 | this.ExitButton.Click += new System.EventHandler(this.ExitButton_Click);
77 | //
78 | // ConfirmButton
79 | //
80 | this.ConfirmButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
81 | this.ConfirmButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
82 | this.ConfirmButton.ForeColor = System.Drawing.SystemColors.Info;
83 | this.ConfirmButton.Location = new System.Drawing.Point(63, 118);
84 | this.ConfirmButton.Name = "ConfirmButton";
85 | this.ConfirmButton.Size = new System.Drawing.Size(134, 27);
86 | this.ConfirmButton.TabIndex = 8;
87 | this.ConfirmButton.Text = "Confirm";
88 | this.ConfirmButton.UseVisualStyleBackColor = false;
89 | this.ConfirmButton.Click += new System.EventHandler(this.ConfirmButton_Click);
90 | //
91 | // PasswordBox
92 | //
93 | this.PasswordBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(65)))), ((int)(((byte)(72)))));
94 | this.PasswordBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
95 | this.PasswordBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
96 | this.PasswordBox.ForeColor = System.Drawing.SystemColors.Info;
97 | this.PasswordBox.Location = new System.Drawing.Point(94, 82);
98 | this.PasswordBox.Name = "PasswordBox";
99 | this.PasswordBox.ShortcutsEnabled = false;
100 | this.PasswordBox.Size = new System.Drawing.Size(310, 22);
101 | this.PasswordBox.TabIndex = 7;
102 | //
103 | // label2
104 | //
105 | this.label2.AutoSize = true;
106 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
107 | this.label2.ForeColor = System.Drawing.SystemColors.Info;
108 | this.label2.Location = new System.Drawing.Point(17, 83);
109 | this.label2.Name = "label2";
110 | this.label2.Size = new System.Drawing.Size(71, 16);
111 | this.label2.TabIndex = 6;
112 | this.label2.Text = "Password:";
113 | //
114 | // label1
115 | //
116 | this.label1.AutoSize = true;
117 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
118 | this.label1.ForeColor = System.Drawing.SystemColors.Info;
119 | this.label1.Location = new System.Drawing.Point(17, 18);
120 | this.label1.Name = "label1";
121 | this.label1.Size = new System.Drawing.Size(381, 48);
122 | this.label1.TabIndex = 5;
123 | this.label1.Text = "Welcome to Binary! Before we continue, please enter the\r\npassword that you found " +
124 | "in Readme.txt file. This is a one-time\r\nlog-in, once you enter the password you " +
125 | "won\'t need to reenter it.\r\n";
126 | //
127 | // Welcome
128 | //
129 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
130 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
131 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(36)))), ((int)(((byte)(53)))));
132 | this.ClientSize = new System.Drawing.Size(424, 162);
133 | this.Controls.Add(this.ExitButton);
134 | this.Controls.Add(this.ConfirmButton);
135 | this.Controls.Add(this.PasswordBox);
136 | this.Controls.Add(this.label2);
137 | this.Controls.Add(this.label1);
138 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
139 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
140 | this.MaximizeBox = false;
141 | this.Name = "Welcome";
142 | this.Text = "Welcome";
143 | this.ResumeLayout(false);
144 | this.PerformLayout();
145 |
146 | }
147 |
148 | #endregion
149 |
150 | private System.Windows.Forms.Button ExitButton;
151 | private System.Windows.Forms.Button ConfirmButton;
152 | private System.Windows.Forms.TextBox PasswordBox;
153 | private System.Windows.Forms.Label label2;
154 | private System.Windows.Forms.Label label1;
155 | }
156 | }
--------------------------------------------------------------------------------
/Binary/Interact/Welcome.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Windows.Forms;
29 | using Binary.Properties;
30 |
31 |
32 |
33 | namespace Binary.Interact
34 | {
35 | public partial class Welcome : Form
36 | {
37 | public Welcome()
38 | {
39 | this.InitializeComponent();
40 | }
41 |
42 | private void ExitButton_Click(object sender, EventArgs e)
43 | {
44 | Application.Exit();
45 | }
46 |
47 | private void ConfirmButton_Click(object sender, EventArgs e)
48 | {
49 | string PasswordPassed = "I_Am_The_Most_Wanted";
50 | string PasswordEntered = this.PasswordBox.Text;
51 | if (PasswordPassed == PasswordEntered)
52 | {
53 | Settings.Default.PasswordPassed = true;
54 | Settings.Default.Save();
55 | this.Close();
56 | }
57 | else
58 | {
59 | this.PasswordBox.Text = "";
60 | MessageBox.Show("Incorrect password. Please read Readme.txt to find the correct one.", "Warning");
61 | }
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Binary/Program.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Threading;
29 | using System.Globalization;
30 | using System.Windows.Forms;
31 | using System.Security.Principal;
32 |
33 |
34 |
35 | namespace Binary
36 | {
37 | static class Program
38 | {
39 | ///
40 | /// The main entry point for the application.
41 | ///
42 | [STAThread]
43 | [Obsolete]
44 | static void Main()
45 | {
46 | // Skip administator check if in the debug mode
47 | if (System.Diagnostics.Debugger.IsAttached)
48 | goto LABEL_DEBUG_SKIP;
49 |
50 | // Check if the program is run as administator, exit if not
51 | using (var identity = WindowsIdentity.GetCurrent())
52 | {
53 | var principal = new WindowsPrincipal(identity);
54 | if (!principal.IsInRole(WindowsBuiltInRole.Administrator))
55 | {
56 | MessageBox.Show("Run Binary in Administrator mode!", "Warning",
57 | MessageBoxButtons.OK, MessageBoxIcon.Warning);
58 | return;
59 | }
60 | }
61 |
62 | LABEL_DEBUG_SKIP:
63 | AppDomain.CurrentDomain.AppendPrivatePath("Libraries");
64 | Application.EnableVisualStyles();
65 | Application.SetCompatibleTextRenderingDefault(false);
66 |
67 | var culture = CultureInfo.CreateSpecificCulture("en-US");
68 | Thread.CurrentThread.CurrentCulture = culture;
69 | CultureInfo.DefaultThreadCurrentCulture = culture;
70 | CultureInfo.DefaultThreadCurrentUICulture = culture;
71 |
72 | // If password check was not done yet
73 | if (!Properties.Settings.Default.PasswordPassed)
74 | {
75 | Application.Run(new Interact.Welcome());
76 | }
77 |
78 | // Run if was done/entered
79 | if (Properties.Settings.Default.PasswordPassed)
80 | {
81 | Application.Run(new Main.Main());
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/Binary/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 | using System.Reflection;
27 | using System.Runtime.CompilerServices;
28 | using System.Runtime.InteropServices;
29 |
30 | // General Information about an assembly is controlled through the following
31 | // set of attributes. Change these attribute values to modify the information
32 | // associated with an assembly.
33 | [assembly: AssemblyTitle("Binary")]
34 | [assembly: AssemblyDescription("")]
35 | [assembly: AssemblyConfiguration("")]
36 | [assembly: AssemblyCompany("MaxHwoy")]
37 | [assembly: AssemblyProduct("Binary")]
38 | [assembly: AssemblyCopyright("Copyright © MaxHwoy, 2020")]
39 | [assembly: AssemblyTrademark("")]
40 | [assembly: AssemblyCulture("")]
41 |
42 | // Setting ComVisible to false makes the types in this assembly not visible
43 | // to COM components. If you need to access a type in this assembly from
44 | // COM, set the ComVisible attribute to true on that type.
45 | [assembly: ComVisible(false)]
46 |
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM
48 | [assembly: Guid("9623900b-df9e-404c-b2cc-6ff14616c1d1")]
49 |
50 | // Version information for an assembly consists of the following four values:
51 | //
52 | // Major Version
53 | // Minor Version
54 | // Build Number
55 | // Revision
56 | //
57 | // You can specify all the values or you can default the Build and Revision Numbers
58 | // by using the '*' as shown below:
59 | // [assembly: AssemblyVersion("1.0.*")]
60 | [assembly: AssemblyVersion("1.0.5")]
61 | [assembly: AssemblyFileVersion("1.0.5")]
62 |
--------------------------------------------------------------------------------
/Binary/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Binary.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Binary.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap About1 {
67 | get {
68 | object obj = ResourceManager.GetObject("About1", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// Looks up a localized resource of type System.Drawing.Bitmap.
75 | ///
76 | internal static System.Drawing.Bitmap background {
77 | get {
78 | object obj = ResourceManager.GetObject("background", resourceCulture);
79 | return ((System.Drawing.Bitmap)(obj));
80 | }
81 | }
82 |
83 | ///
84 | /// Looks up a localized resource of type System.Drawing.Bitmap.
85 | ///
86 | internal static System.Drawing.Bitmap background1 {
87 | get {
88 | object obj = ResourceManager.GetObject("background1", resourceCulture);
89 | return ((System.Drawing.Bitmap)(obj));
90 | }
91 | }
92 |
93 | ///
94 | /// Looks up a localized resource of type System.Drawing.Bitmap.
95 | ///
96 | internal static System.Drawing.Bitmap binary {
97 | get {
98 | object obj = ResourceManager.GetObject("binary", resourceCulture);
99 | return ((System.Drawing.Bitmap)(obj));
100 | }
101 | }
102 |
103 | ///
104 | /// Looks up a localized resource of type System.Drawing.Bitmap.
105 | ///
106 | internal static System.Drawing.Bitmap Hasher1 {
107 | get {
108 | object obj = ResourceManager.GetObject("Hasher1", resourceCulture);
109 | return ((System.Drawing.Bitmap)(obj));
110 | }
111 | }
112 |
113 | ///
114 | /// Looks up a localized resource of type System.Drawing.Bitmap.
115 | ///
116 | internal static System.Drawing.Bitmap Picker1 {
117 | get {
118 | object obj = ResourceManager.GetObject("Picker1", resourceCulture);
119 | return ((System.Drawing.Bitmap)(obj));
120 | }
121 | }
122 |
123 | ///
124 | /// Looks up a localized resource of type System.Drawing.Bitmap.
125 | ///
126 | internal static System.Drawing.Bitmap Raider {
127 | get {
128 | object obj = ResourceManager.GetObject("Raider", resourceCulture);
129 | return ((System.Drawing.Bitmap)(obj));
130 | }
131 | }
132 |
133 | ///
134 | /// Looks up a localized resource of type System.Drawing.Bitmap.
135 | ///
136 | internal static System.Drawing.Bitmap Readme1 {
137 | get {
138 | object obj = ResourceManager.GetObject("Readme1", resourceCulture);
139 | return ((System.Drawing.Bitmap)(obj));
140 | }
141 | }
142 |
143 | ///
144 | /// Looks up a localized resource of type System.Drawing.Bitmap.
145 | ///
146 | internal static System.Drawing.Bitmap Swatcher {
147 | get {
148 | object obj = ResourceManager.GetObject("Swatcher", resourceCulture);
149 | return ((System.Drawing.Bitmap)(obj));
150 | }
151 | }
152 |
153 | ///
154 | /// Looks up a localized resource of type System.Drawing.Bitmap.
155 | ///
156 | internal static System.Drawing.Bitmap Unlock1 {
157 | get {
158 | object obj = ResourceManager.GetObject("Unlock1", resourceCulture);
159 | return ((System.Drawing.Bitmap)(obj));
160 | }
161 | }
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/Binary/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\Picker1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
125 | ..\Resources\binary.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
126 |
127 |
128 | ..\Resources\Raider.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
129 |
130 |
131 | ..\Resources\Readme1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
132 |
133 |
134 | ..\Resources\Hasher1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
135 |
136 |
137 | ..\Resources\Unlock1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
138 |
139 |
140 | ..\Resources\Swatcher.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
141 |
142 |
143 | ..\Resources\About1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
144 |
145 |
146 | ..\Resources\background.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
147 |
148 |
149 | ..\Resources\background1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
150 |
151 |
--------------------------------------------------------------------------------
/Binary/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Binary.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
29 | public bool PasswordPassed {
30 | get {
31 | return ((bool)(this["PasswordPassed"]));
32 | }
33 | set {
34 | this["PasswordPassed"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("")]
41 | public string DirectoryC {
42 | get {
43 | return ((string)(this["DirectoryC"]));
44 | }
45 | set {
46 | this["DirectoryC"] = value;
47 | }
48 | }
49 |
50 | [global::System.Configuration.UserScopedSettingAttribute()]
51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
52 | [global::System.Configuration.DefaultSettingValueAttribute("")]
53 | public string DirectoryMW {
54 | get {
55 | return ((string)(this["DirectoryMW"]));
56 | }
57 | set {
58 | this["DirectoryMW"] = value;
59 | }
60 | }
61 |
62 | [global::System.Configuration.UserScopedSettingAttribute()]
63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
64 | [global::System.Configuration.DefaultSettingValueAttribute("")]
65 | public string DirectoryUG2 {
66 | get {
67 | return ((string)(this["DirectoryUG2"]));
68 | }
69 | set {
70 | this["DirectoryUG2"] = value;
71 | }
72 | }
73 |
74 | [global::System.Configuration.UserScopedSettingAttribute()]
75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
76 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
77 | public bool EnableAutobackup {
78 | get {
79 | return ((bool)(this["EnableAutobackup"]));
80 | }
81 | set {
82 | this["EnableAutobackup"] = value;
83 | }
84 | }
85 |
86 | [global::System.Configuration.UserScopedSettingAttribute()]
87 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
88 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
89 | public bool EnableCompression {
90 | get {
91 | return ((bool)(this["EnableCompression"]));
92 | }
93 | set {
94 | this["EnableCompression"] = value;
95 | }
96 | }
97 |
98 | [global::System.Configuration.UserScopedSettingAttribute()]
99 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
100 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
101 | public bool EnableEndscriptLog {
102 | get {
103 | return ((bool)(this["EnableEndscriptLog"]));
104 | }
105 | set {
106 | this["EnableEndscriptLog"] = value;
107 | }
108 | }
109 |
110 | [global::System.Configuration.UserScopedSettingAttribute()]
111 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
112 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
113 | public bool EnableStaticEnd {
114 | get {
115 | return ((bool)(this["EnableStaticEnd"]));
116 | }
117 | set {
118 | this["EnableStaticEnd"] = value;
119 | }
120 | }
121 |
122 | [global::System.Configuration.UserScopedSettingAttribute()]
123 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
124 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
125 | public bool EnableMaximized {
126 | get {
127 | return ((bool)(this["EnableMaximized"]));
128 | }
129 | set {
130 | this["EnableMaximized"] = value;
131 | }
132 | }
133 |
134 | [global::System.Configuration.UserScopedSettingAttribute()]
135 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
136 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
137 | public bool EnableWatermarks {
138 | get {
139 | return ((bool)(this["EnableWatermarks"]));
140 | }
141 | set {
142 | this["EnableWatermarks"] = value;
143 | }
144 | }
145 |
146 | [global::System.Configuration.UserScopedSettingAttribute()]
147 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
148 | [global::System.Configuration.DefaultSettingValueAttribute("NULL")]
149 | public string YAMLDirectory {
150 | get {
151 | return ((string)(this["YAMLDirectory"]));
152 | }
153 | set {
154 | this["YAMLDirectory"] = value;
155 | }
156 | }
157 |
158 | [global::System.Configuration.UserScopedSettingAttribute()]
159 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
160 | [global::System.Configuration.DefaultSettingValueAttribute("")]
161 | public string BinaryUsername {
162 | get {
163 | return ((string)(this["BinaryUsername"]));
164 | }
165 | set {
166 | this["BinaryUsername"] = value;
167 | }
168 | }
169 |
170 | [global::System.Configuration.UserScopedSettingAttribute()]
171 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
172 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
173 | public bool EnableSuppressABCI {
174 | get {
175 | return ((bool)(this["EnableSuppressABCI"]));
176 | }
177 | set {
178 | this["EnableSuppressABCI"] = value;
179 | }
180 | }
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/Binary/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | False
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | True
19 |
20 |
21 | False
22 |
23 |
24 | True
25 |
26 |
27 | False
28 |
29 |
30 | False
31 |
32 |
33 | False
34 |
35 |
36 | NULL
37 |
38 |
39 |
40 |
41 |
42 | False
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Binary/Resources/About1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/About1.png
--------------------------------------------------------------------------------
/Binary/Resources/Hasher1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/Hasher1.png
--------------------------------------------------------------------------------
/Binary/Resources/Picker1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/Picker1.png
--------------------------------------------------------------------------------
/Binary/Resources/Raider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/Raider.png
--------------------------------------------------------------------------------
/Binary/Resources/Readme1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/Readme1.png
--------------------------------------------------------------------------------
/Binary/Resources/Swatcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/Swatcher.png
--------------------------------------------------------------------------------
/Binary/Resources/Unlock1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/Unlock1.png
--------------------------------------------------------------------------------
/Binary/Resources/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/background.png
--------------------------------------------------------------------------------
/Binary/Resources/background1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/background1.png
--------------------------------------------------------------------------------
/Binary/Resources/binary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/Resources/binary.png
--------------------------------------------------------------------------------
/Binary/Support/eRootType.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | namespace Binary.Support
28 | {
29 | public enum eRootType : int
30 | {
31 | Empty = 0,
32 | FNGroups = 1,
33 | TPKBlocks = 2,
34 | STRBlocks = 3,
35 | Regular = 4,
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Binary/Tools/ColorPicker.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Drawing;
29 | using System.Windows.Forms;
30 |
31 |
32 |
33 | namespace Binary.Tools
34 | {
35 | public partial class ColorPicker : Form
36 | {
37 | public ColorPicker()
38 | {
39 | this.InitializeComponent();
40 | this.ColorBackground.Controls.Add(this.ColorPreview);
41 | this.ColorPreview.Location = new Point(0, 0);
42 | this.ComboTypeSelection.Text = this.ComboTypeSelection.Items[0].ToString();
43 | }
44 |
45 | private void TrackBar_Red_Scroll(object sender, EventArgs e)
46 | {
47 | if (this.ComboTypeSelection.SelectedIndex == 0)
48 | {
49 | float red = Convert.ToSingle(this.TrackBar_Red.Value) / 255;
50 | this.TextBoxRed.Text = red.ToString();
51 | }
52 | else
53 | {
54 | this.TextBoxRed.Text = this.TrackBar_Red.Value.ToString();
55 | }
56 | this.ColorPreview.BackColor = Color.FromArgb(this.ColorPreview.BackColor.A,
57 | this.TrackBar_Red.Value, this.ColorPreview.BackColor.G, this.ColorPreview.BackColor.B);
58 | }
59 |
60 | private void TrackBar_Green_Scroll(object sender, EventArgs e)
61 | {
62 | if (this.ComboTypeSelection.SelectedIndex == 0)
63 | {
64 | float green = Convert.ToSingle(this.TrackBar_Green.Value) / 255;
65 | this.TextBoxGreen.Text = green.ToString();
66 | }
67 | else
68 | {
69 | this.TextBoxGreen.Text = this.TrackBar_Green.Value.ToString();
70 | }
71 | this.ColorPreview.BackColor = Color.FromArgb(this.ColorPreview.BackColor.A,
72 | this.ColorPreview.BackColor.R, this.TrackBar_Green.Value, this.ColorPreview.BackColor.B);
73 | }
74 |
75 | private void TrackBar_Blue_Scroll(object sender, EventArgs e)
76 | {
77 | if (this.ComboTypeSelection.SelectedIndex == 0)
78 | {
79 | float blue = Convert.ToSingle(this.TrackBar_Blue.Value) / 255;
80 | this.TextBoxBlue.Text = blue.ToString();
81 | }
82 | else
83 | {
84 | this.TextBoxBlue.Text = this.TrackBar_Blue.Value.ToString();
85 | }
86 | this.ColorPreview.BackColor = Color.FromArgb(this.ColorPreview.BackColor.A,
87 | this.ColorPreview.BackColor.R, this.ColorPreview.BackColor.G, this.TrackBar_Blue.Value);
88 | }
89 |
90 | private void TrackBar_Level_Scroll(object sender, EventArgs e)
91 | {
92 | if (this.ComboTypeSelection.SelectedIndex == 0)
93 | {
94 | float level = Convert.ToSingle(this.TrackBar_Level.Value) / 255;
95 | this.TextBoxLevel.Text = level.ToString();
96 | }
97 | else
98 | {
99 | this.TextBoxLevel.Text = this.TrackBar_Level.Value.ToString();
100 | }
101 | this.ColorPreview.BackColor = Color.FromArgb(this.TrackBar_Level.Value,
102 | this.ColorPreview.BackColor.R, this.ColorPreview.BackColor.G, this.ColorPreview.BackColor.B);
103 | }
104 |
105 | private void OpenWindowsColorForm_Click(object sender, EventArgs e)
106 | {
107 | if (this.SwatchDialog.ShowDialog() == DialogResult.OK)
108 | {
109 |
110 | this.TrackBar_Red.Value = this.SwatchDialog.Color.R;
111 | this.TrackBar_Green.Value = this.SwatchDialog.Color.G;
112 | this.TrackBar_Blue.Value = this.SwatchDialog.Color.B;
113 |
114 | if (this.ComboTypeSelection.SelectedIndex == 0)
115 | {
116 | float red = Convert.ToSingle(this.TrackBar_Red.Value) / 255;
117 | float green = Convert.ToSingle(this.TrackBar_Green.Value) / 255;
118 | float blue = Convert.ToSingle(this.TrackBar_Blue.Value) / 255;
119 |
120 | this.TextBoxRed.Text = red.ToString();
121 | this.TextBoxGreen.Text = green.ToString();
122 | this.TextBoxBlue.Text = blue.ToString();
123 |
124 | }
125 | else
126 | {
127 | this.TextBoxRed.Text = this.TrackBar_Red.Value.ToString();
128 | this.TextBoxGreen.Text = this.TrackBar_Green.Value.ToString();
129 | this.TextBoxBlue.Text = this.TrackBar_Blue.Value.ToString();
130 | }
131 |
132 | this.ColorPreview.BackColor = Color.FromArgb(this.TrackBar_Level.Value,
133 | this.SwatchDialog.Color.R, this.SwatchDialog.Color.G, this.SwatchDialog.Color.B);
134 | }
135 | }
136 |
137 | private void CopyRedValue_Click(object sender, EventArgs e)
138 | {
139 | Clipboard.SetText(this.TextBoxRed.Text);
140 | }
141 |
142 | private void CopyGreenValue_Click(object sender, EventArgs e)
143 | {
144 | Clipboard.SetText(this.TextBoxGreen.Text);
145 | }
146 |
147 | private void CopyBlueValue_Click(object sender, EventArgs e)
148 | {
149 | Clipboard.SetText(this.TextBoxBlue.Text);
150 | }
151 |
152 | private void CopyLevelValue_Click(object sender, EventArgs e)
153 | {
154 | Clipboard.SetText(this.TextBoxLevel.Text);
155 | }
156 |
157 | private void ComboTypeSelection_SelectedIndexChanged(object sender, EventArgs e)
158 | {
159 | if (this.ComboTypeSelection.SelectedIndex == 0)
160 | {
161 | this.MainGroupBox.Text = "Material/Paint Color Picker";
162 | this.LabelLevel.Text = "Level";
163 | this.TextBoxLevel.Text = (Convert.ToSingle(this.TrackBar_Level.Value) / 255).ToString();
164 | this.TextBoxRed.Text = (Convert.ToSingle(this.TrackBar_Red.Value) / 255).ToString();
165 | this.TextBoxGreen.Text = (Convert.ToSingle(this.TrackBar_Green.Value) / 255).ToString();
166 | this.TextBoxBlue.Text = (Convert.ToSingle(this.TrackBar_Blue.Value) / 255).ToString();
167 | }
168 | else
169 | {
170 | this.MainGroupBox.Text = "FEng/Vinyl Color Picker";
171 | this.LabelLevel.Text = "Alpha";
172 | this.TextBoxLevel.Text = this.TrackBar_Level.Value.ToString();
173 | this.TextBoxRed.Text = this.TrackBar_Red.Value.ToString();
174 | this.TextBoxGreen.Text = this.TrackBar_Green.Value.ToString();
175 | this.TextBoxBlue.Text = this.TrackBar_Blue.Value.ToString();
176 | }
177 | }
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/Binary/Tools/Hasher.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Windows.Forms;
29 | using GlobalLib.Utils;
30 |
31 |
32 | namespace Binary.Tools
33 | {
34 | public partial class Hasher : Form
35 | {
36 | public Hasher()
37 | {
38 | this.InitializeComponent();
39 | }
40 |
41 | private void StringTextbox_TextChanged(object sender, EventArgs e)
42 | {
43 | var str = this.StringTextbox.Text;
44 |
45 | uint result = 0;
46 | string _0x = "0x";
47 |
48 | // Bin memory hash
49 | result = Bin.Hash(str);
50 | this.BinHashTextbox.Text = $"{_0x}{result:X8}";
51 |
52 | // Bin file hash
53 | result = Bin.Reverse(result);
54 | this.BinFileTextbox.Text = $"{_0x}{result:X8}";
55 |
56 | // Vlt memory hash
57 | result = Vlt.Hash(str);
58 | this.VltHashTextbox.Text = $"{_0x}{result:X8}";
59 |
60 | // Vlt file hash
61 | result = Vlt.Reverse(result);
62 | this.VltFileTextbox.Text = $"{_0x}{result:X8}";
63 | }
64 |
65 | private void CopyString_Click(object sender, EventArgs e)
66 | {
67 | Clipboard.SetText(this.StringTextbox.Text);
68 | }
69 |
70 | private void CopyBinHash_Click(object sender, EventArgs e)
71 | {
72 | Clipboard.SetText(this.BinHashTextbox.Text);
73 | }
74 |
75 | private void CopyBinFile_Click(object sender, EventArgs e)
76 | {
77 | Clipboard.SetText(this.BinFileTextbox.Text);
78 | }
79 |
80 | private void CopyVltHash_Click(object sender, EventArgs e)
81 | {
82 | Clipboard.SetText(this.VltHashTextbox.Text);
83 | }
84 |
85 | private void CopyVltFile_Click(object sender, EventArgs e)
86 | {
87 | Clipboard.SetText(this.VltFileTextbox.Text);
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Binary/Tools/Raider.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Windows.Forms;
29 | using GlobalLib.Core;
30 | using GlobalLib.Utils;
31 |
32 |
33 |
34 | namespace Binary.Tools
35 | {
36 | public partial class Raider : Form
37 | {
38 | public Raider()
39 | {
40 | this.InitializeComponent();
41 | }
42 |
43 | private void ChooseSearchMode_SelectedIndexChanged(object sender, EventArgs e)
44 | {
45 | if (this.ChooseSearchMode.Text == "Use Bin Memory Hash search")
46 | {
47 | this.BinHashInput.ReadOnly = false;
48 | this.BinFileInput.ReadOnly = true;
49 | }
50 | else
51 | {
52 | this.BinFileInput.ReadOnly = false;
53 | this.BinHashInput.ReadOnly = true;
54 | }
55 | }
56 |
57 | private void BinHashInput_TextChanged(object sender, EventArgs e)
58 | {
59 | if (!this.BinHashInput.ReadOnly)
60 | {
61 | uint key = 0;
62 | var temp = this.BinHashInput.Text;
63 | try
64 | {
65 | key = Convert.ToUInt32(temp, 16);
66 |
67 | // Try looking for the hash
68 | string result = Map.Lookup(key, true);
69 | key = Bin.Reverse(key);
70 | this.BinFileInput.Text = $"0x{key:X8}";
71 | this.StringGuessed.Text = result;
72 | }
73 | catch (Exception)
74 | {
75 | this.StringGuessed.Text = "N/A";
76 | this.BinFileInput.Text = null;
77 | }
78 | }
79 | }
80 |
81 | private void BinFileInput_TextChanged(object sender, EventArgs e)
82 | {
83 | if (!this.BinFileInput.ReadOnly)
84 | {
85 | uint key = 0;
86 | var temp = this.BinFileInput.Text;
87 | try
88 | {
89 | key = ConvertX.ToUInt32(temp);
90 | key = Bin.Reverse(key);
91 |
92 | // Try looking for the hash
93 | string result = Map.Lookup(key, true);
94 | this.BinHashInput.Text = $"0x{key:X8}";
95 | this.StringGuessed.Text = result;
96 | }
97 | catch (Exception)
98 | {
99 | this.StringGuessed.Text = "N/A";
100 | this.BinHashInput.Text = null;
101 | }
102 | }
103 | }
104 |
105 | private void CopyBinHash_Click(object sender, EventArgs e)
106 | {
107 | Clipboard.SetText(this.BinHashInput.Text);
108 | }
109 |
110 | private void CopyBinFile_Click(object sender, EventArgs e)
111 | {
112 | Clipboard.SetText(this.BinFileInput.Text);
113 | }
114 |
115 | private void CopyString_Click(object sender, EventArgs e)
116 | {
117 | Clipboard.SetText(this.StringGuessed.Text);
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/Binary/Tools/SwatchPicker.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using System.Drawing;
29 | using System.Windows.Forms;
30 |
31 |
32 |
33 | namespace Binary.Tools
34 | {
35 | public partial class SwatchPicker : Form
36 | {
37 | public SwatchPicker()
38 | {
39 | this.InitializeComponent();
40 | }
41 |
42 | private void RGBtoHSV(float red, float green, float blue)
43 | {
44 | float hue = 0; // paintswatch
45 | float sat = 0; // saturation
46 | float brt = 0; // brightness
47 |
48 | float min = 0; // min rgb value
49 | float max = 0; // max rgb value
50 | float dif = 0; // delta of max & min
51 |
52 | max = (red > green) ? red : green;
53 | max = (max > blue) ? max : blue;
54 | min = (red < green) ? red : green;
55 | min = (min < blue) ? min : blue;
56 |
57 | brt = max; // set brightness
58 | dif = max - min;
59 |
60 | if (max == 0)
61 | sat = 0; // set brightness
62 | else
63 | sat = dif / max;
64 |
65 | if (max == min)
66 | hue = 0;
67 | else if (max == red)
68 | hue = (60 * ((green - blue) / dif) + 360) % 360;
69 | else if (max == green)
70 | hue = (60 * ((blue - red) / dif) + 120) % 360;
71 | else if (max == blue)
72 | hue = (60 * ((red - green) / dif) + 240) % 360;
73 |
74 | hue = 90 - (hue / 4);
75 |
76 | this.TextBoxPaintSwatch.Text = ((int)hue).ToString();
77 | this.TextBoxSaturation.Text = sat.ToString();
78 | this.TextBoxBrightness.Text = brt.ToString();
79 | this.ColorPreview.BackColor = Color.FromArgb(this.TrackBar_Red.Value, this.TrackBar_Green.Value, this.TrackBar_Blue.Value);
80 | }
81 |
82 | private void TrackBar_Red_Scroll(object sender, EventArgs e)
83 | {
84 | float red = Convert.ToSingle(this.TrackBar_Red.Value) / 255;
85 | float green = Convert.ToSingle(this.TrackBar_Green.Value) / 255;
86 | float blue = Convert.ToSingle(this.TrackBar_Blue.Value) / 255;
87 | this.RGBtoHSV(red, green, blue);
88 | }
89 |
90 | private void TrackBar_Green_Scroll(object sender, EventArgs e)
91 | {
92 | float red = Convert.ToSingle(this.TrackBar_Red.Value) / 255;
93 | float green = Convert.ToSingle(this.TrackBar_Green.Value) / 255;
94 | float blue = Convert.ToSingle(this.TrackBar_Blue.Value) / 255;
95 | this.RGBtoHSV(red, green, blue);
96 | }
97 |
98 | private void TrackBar_Blue_Scroll(object sender, EventArgs e)
99 | {
100 | float red = Convert.ToSingle(this.TrackBar_Red.Value) / 255;
101 | float green = Convert.ToSingle(this.TrackBar_Green.Value) / 255;
102 | float blue = Convert.ToSingle(this.TrackBar_Blue.Value) / 255;
103 | this.RGBtoHSV(red, green, blue);
104 | }
105 |
106 | private void OpenWindowsColorForm_Click(object sender, EventArgs e)
107 | {
108 | if (this.SwatchDialog.ShowDialog() == DialogResult.OK)
109 | {
110 |
111 | this.TrackBar_Red.Value = this.SwatchDialog.Color.R;
112 | this.TrackBar_Green.Value = this.SwatchDialog.Color.G;
113 | this.TrackBar_Blue.Value = this.SwatchDialog.Color.B;
114 |
115 | float red = Convert.ToSingle(this.TrackBar_Red.Value) / 255;
116 | float green = Convert.ToSingle(this.TrackBar_Green.Value) / 255;
117 | float blue = Convert.ToSingle(this.TrackBar_Blue.Value) / 255;
118 |
119 | this.RGBtoHSV(red, green, blue);
120 | }
121 | }
122 |
123 | private void CopyPaintSwatchValue_Click(object sender, EventArgs e)
124 | {
125 | Clipboard.SetText(this.TextBoxPaintSwatch.Text);
126 | }
127 |
128 | private void CopySaturationValue_Click(object sender, EventArgs e)
129 | {
130 | Clipboard.SetText(this.TextBoxSaturation.Text);
131 | }
132 |
133 | private void CopyBrightnessValue_Click(object sender, EventArgs e)
134 | {
135 | Clipboard.SetText(this.TextBoxBrightness.Text);
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/Binary/Utils/CleanUp.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 | using GlobalLib.Utils;
29 |
30 |
31 |
32 | namespace Binary.Utils
33 | {
34 | public static class CleanUp
35 | {
36 | public static void GCCollect()
37 | {
38 | for (int a1 = 0; a1 < GC.MaxGeneration; ++a1)
39 | GC.Collect(a1, GCCollectionMode.Forced);
40 | }
41 |
42 | public static (string, string) SplitScriptString(string line)
43 | {
44 | if (line.Contains("//"))
45 | line = line.Substring(0, line.IndexOf("//"));
46 | var keyword = line.Substring(0, line.IndexOf('='));
47 | var value = line.Substring(line.IndexOf('=') + 1);
48 | keyword = ScriptX.CleanString(keyword, true);
49 | value = ScriptX.CleanString(value, true);
50 | return (keyword, value);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Binary/Utils/Filenames.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System.Collections.Generic;
28 |
29 |
30 |
31 | namespace Binary.Utils
32 | {
33 | public static class Filenames
34 | {
35 | public static List<(string, string)> Carbon { get; set; } = new List<(string, string)>()
36 | {
37 | (@"\GLOBAL\GlobalA.bun", @"\GLOBAL\GlobalA.bun.bacc"),
38 | (@"\GLOBAL\GlobalB.lzc", @"\GLOBAL\GlobalB.lzc.bacc"),
39 | (@"\LANGUAGES\English_Global.bin", @"\LANGUAGES\English_Global.bin.bacc"),
40 | (@"\LANGUAGES\Labels_Global.bin", @"\LANGUAGES\Labels_Global.bin.bacc"),
41 | };
42 |
43 | public static List<(string, string)> MostWanted { get; set; } = new List<(string, string)>()
44 | {
45 | (@"\GLOBAL\GlobalA.bun", @"\GLOBAL\GlobalA.bun.bacc"),
46 | (@"\GLOBAL\GlobalB.lzc", @"\GLOBAL\GlobalB.lzc.bacc"),
47 | (@"\LANGUAGES\English.bin", @"\LANGUAGES\English.bin.bacc"),
48 | (@"\LANGUAGES\Labels.bin", @"\LANGUAGES\Labels.bin.bacc"),
49 | };
50 |
51 | public static List<(string, string)> Underground2 { get; set; } = new List<(string, string)>()
52 | {
53 | (@"\GLOBAL\GlobalA.bun", @"\GLOBAL\GlobalA.bun.bacc"),
54 | (@"\GLOBAL\GlobalB.lzc", @"\GLOBAL\GlobalB.lzc.bacc"),
55 | (@"\LANGUAGES\English.bin", @"\LANGUAGES\English.bin.bacc"),
56 | (@"\LANGUAGES\Labels.bin", @"\LANGUAGES\Labels.bin.bacc"),
57 | };
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Binary/Utils/Path.cs:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 MaxHwoy & NFS Tools
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | ********************************************************************************/
24 |
25 |
26 |
27 | using System;
28 |
29 |
30 |
31 | namespace Binary.Utils
32 | {
33 | public static class Path
34 | {
35 | public static string[] SplitPath(string path)
36 | {
37 | return path.Split(new char[] { ' ', '\\', '/', '|' }, StringSplitOptions.RemoveEmptyEntries);
38 | }
39 |
40 | public static string CombinePath(char splitter, params string[] path)
41 | {
42 | string result = string.Empty;
43 | foreach (var str in path)
44 | result += str + splitter.ToString();
45 | return result.Substring(0, result.Length - 1);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Binary/binary.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NFSTools/Binary/65226109fca2be001165dc108fe5db353a268bde/Binary/binary.ico
--------------------------------------------------------------------------------
/Binary/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 |
4 | # Binary
5 | Binary is a tool for editing Black Box Need for Speed games Global files, powered by [GlobalLib](https://github.com/NFSTools/GlobalLib "GlobalLib")
6 |
7 |
8 | ## Features
9 | - UI to edit collection data of databases built using GlobalLib library.
10 | - Ability to use various commands, create and restore backups, import and export collections.
11 | - Endscript support: special .end files that are imported to edit databases.
12 | - Easy to use; simple API
13 | - Built-in tools, such as:
14 | - NFS-Hasher
15 | - NFS-Raider
16 | - Color Picker
17 | - Swatch Picker
18 | - Texture Editor
19 | - String Editor
20 | - FEng Color Editor
21 | - User configuration settings that can be changed and applied any time
22 |
23 | ## Motivation
24 | - Lack of tools with UI to edit Need for Speed Global files
25 | - Desire to build a universal tool for the reason stated above
26 | - Desire to build a tool similar to process BIN data, similar to those that process VLT data
27 |
--------------------------------------------------------------------------------