mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-07 13:52:12 +00:00
Compare commits
77 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e72336a835 | ||
|
|
886a0a4f07 | ||
|
|
093435e7b0 | ||
|
|
59a427963d | ||
|
|
19d6006aff | ||
|
|
617b0ba2c5 | ||
|
|
195c83499c | ||
|
|
e5b02c27a8 | ||
|
|
c7b6b08397 | ||
|
|
da6b2f0e24 | ||
|
|
c50c3edcc5 | ||
|
|
d628b2a0dd | ||
|
|
f6baaa6f5e | ||
|
|
b05c82e903 | ||
|
|
65f472c4c9 | ||
|
|
104dd4348b | ||
|
|
2337a2ed86 | ||
|
|
2ce632f8b4 | ||
|
|
ce917f4f61 | ||
|
|
d029cf4164 | ||
|
|
74d52c2f3b | ||
|
|
785786c3a9 | ||
|
|
466d8f58b0 | ||
|
|
bc690614e6 | ||
|
|
d44798b27c | ||
|
|
595cd0d60f | ||
|
|
68fd5a2aa0 | ||
|
|
6da98aa65c | ||
|
|
d8d149446f | ||
|
|
4d0f48be10 | ||
|
|
8a048c8a57 | ||
|
|
d51db072fc | ||
|
|
468c9937da | ||
|
|
206ac76633 | ||
|
|
339b0d93d1 | ||
|
|
fd5da5de74 | ||
|
|
42146f991d | ||
|
|
f3f05eee48 | ||
|
|
61bf2f69aa | ||
|
|
546aa70b69 | ||
|
|
65cd1cede3 | ||
|
|
dffa16139a | ||
|
|
98bacf11fc | ||
|
|
ee0ccecfb2 | ||
|
|
a0825f276b | ||
|
|
66d61e20de | ||
|
|
6455ebd434 | ||
|
|
f4436fddfa | ||
|
|
317777cf93 | ||
|
|
da6dbe136e | ||
|
|
13d7cf8124 | ||
|
|
bb8fea625b | ||
|
|
15a0659867 | ||
|
|
988a5f6d2b | ||
|
|
1941639473 | ||
|
|
d1772f743e | ||
|
|
870c2d1cec | ||
|
|
f7f6ae1eee | ||
|
|
dd9e527592 | ||
|
|
e1122fa976 | ||
|
|
8a44fa3355 | ||
|
|
51a9e3005f | ||
|
|
413b6da24b | ||
|
|
172a0fb5dc | ||
|
|
83a189a5d3 | ||
|
|
60c27ec89b | ||
|
|
51733557cd | ||
|
|
93d964c603 | ||
|
|
2925f2262b | ||
|
|
5b211a7345 | ||
|
|
ed4bd24fcb | ||
|
|
8a7761753b | ||
|
|
1b8cca9999 | ||
|
|
b75391b1c6 | ||
|
|
e9c2fd9245 | ||
|
|
fb24bbd8a5 | ||
|
|
4e3083c8e6 |
2
.github/ISSUE_TEMPLATE/feature-request.md
vendored
2
.github/ISSUE_TEMPLATE/feature-request.md
vendored
@@ -9,7 +9,7 @@ assignees: mnadareski
|
||||
|
||||
**Before You Submit**
|
||||
|
||||
- Remember to try the [latest WIP build](https://ci.appveyor.com/project/mnadareski/mpf/build/artifacts) to see if the feature already exists.
|
||||
- Remember to try the [latest WIP build](https://github.com/SabreTools/MPF/releases/tag/rolling) to see if the feature already exists.
|
||||
- Is it copy protection related? If so, report the issue [here](https://github.com/SabreTools/BinaryObjectScanner/issues) instead.
|
||||
- Check [previous issues](https://github.com/SabreTools/MPF/issues) to see if any of those are related to what you're about to ask for.
|
||||
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/informational.md
vendored
2
.github/ISSUE_TEMPLATE/informational.md
vendored
@@ -9,7 +9,7 @@ assignees: mnadareski
|
||||
|
||||
**Before You Submit**
|
||||
|
||||
- Remember to try the [latest WIP build](https://ci.appveyor.com/project/mnadareski/mpf/build/artifacts) to see if the feature already exists.
|
||||
- Remember to try the [latest WIP build](https://github.com/SabreTools/MPF/releases/tag/rolling) to see if the feature already exists.
|
||||
- Is it copy protection related? If so, report the issue [here](https://github.com/SabreTools/BinaryObjectScanner/issues) instead.
|
||||
- Check [previous issues](https://github.com/SabreTools/MPF/issues) to see if any of those are related to what you're about to ask for.
|
||||
|
||||
|
||||
5
.github/ISSUE_TEMPLATE/issue-report.md
vendored
5
.github/ISSUE_TEMPLATE/issue-report.md
vendored
@@ -9,7 +9,7 @@ assignees: mnadareski
|
||||
|
||||
**Before You Submit**
|
||||
|
||||
- Remember to try the [latest WIP build](https://ci.appveyor.com/project/mnadareski/mpf/build/artifacts) to see if the issue has already been addressed.
|
||||
- Remember to try the [latest WIP build](https://github.com/SabreTools/MPF/releases/tag/rolling) to see if the issue has already been addressed.
|
||||
- Is it copy protection related? If so, report the issue [here](https://github.com/SabreTools/BinaryObjectScanner/issues) instead.
|
||||
- Check multiple discs to help narrow down the issue
|
||||
- Check the Options to see if changing any of those affects your issue.
|
||||
@@ -25,8 +25,7 @@ What version are you using?
|
||||
**Build**
|
||||
What runtime version are you using?
|
||||
|
||||
- [ ] .NET 6.0 running on (Operating System)
|
||||
- [ ] .NET 8.0 running on (Operating System)
|
||||
- [ ] .NET 9.0 running on (Operating System)
|
||||
|
||||
**Describe the issue**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
17
.github/workflows/build_check.yml
vendored
17
.github/workflows/build_check.yml
vendored
@@ -12,7 +12,8 @@ jobs:
|
||||
matrix:
|
||||
project: [MPF.Check]
|
||||
runtime: [win-x86, win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64]
|
||||
framework: [net8.0] #[net20, net35, net40, net452, net472, net48, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0]
|
||||
framework: [net9.0] #[net20, net35, net40, net452, net472, net48, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0, net9.0]
|
||||
conf: [Debug] #[Release, Debug]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -20,28 +21,30 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c Debug --self-contained true --version-suffix ${{ github.sha }} ${{ (startsWith(matrix.framework, 'net5') || startsWith(matrix.framework, 'net6') || startsWith(matrix.framework, 'net7') || startsWith(matrix.framework, 'net8')) && '-p:PublishSingleFile=true' || ''}}
|
||||
run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c ${{ matrix.conf == 'Release' && 'Release -p:DebugType=None -p:DebugSymbols=false' || 'Debug'}} --self-contained true --version-suffix ${{ github.sha }} ${{ (startsWith(matrix.framework, 'net5') || startsWith(matrix.framework, 'net6') || startsWith(matrix.framework, 'net7') || startsWith(matrix.framework, 'net8') || startsWith(matrix.framework, 'net9')) && '-p:PublishSingleFile=true' || ''}}
|
||||
|
||||
- name: Archive build
|
||||
run: zip -r ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip ${{ matrix.project }}/bin/Debug/${{ matrix.framework }}/${{ matrix.runtime }}/publish/
|
||||
run: |
|
||||
cd ${{ matrix.project }}/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/
|
||||
zip -r ${{ github.workspace }}/${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip ./
|
||||
|
||||
- name: Upload build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug
|
||||
path: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip
|
||||
name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}
|
||||
path: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip
|
||||
artifacts: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip
|
||||
body: 'Last built commit: ${{ github.sha }}'
|
||||
name: 'Rolling Release'
|
||||
prerelease: True
|
||||
|
||||
17
.github/workflows/build_cli.yml
vendored
17
.github/workflows/build_cli.yml
vendored
@@ -12,7 +12,8 @@ jobs:
|
||||
matrix:
|
||||
project: [MPF.CLI]
|
||||
runtime: [win-x86, win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64]
|
||||
framework: [net8.0] #[net20, net35, net40, net452, net472, net48, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0]
|
||||
framework: [net9.0] #[net20, net35, net40, net452, net472, net48, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0, net9.0]
|
||||
conf: [Debug] #[Release, Debug]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -20,28 +21,30 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c Debug --self-contained true --version-suffix ${{ github.sha }} ${{ (startsWith(matrix.framework, 'net5') || startsWith(matrix.framework, 'net6') || startsWith(matrix.framework, 'net7') || startsWith(matrix.framework, 'net8')) && '-p:PublishSingleFile=true' || ''}}
|
||||
run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c ${{ matrix.conf == 'Release' && 'Release -p:DebugType=None -p:DebugSymbols=false' || 'Debug'}} --self-contained true --version-suffix ${{ github.sha }} ${{ (startsWith(matrix.framework, 'net5') || startsWith(matrix.framework, 'net6') || startsWith(matrix.framework, 'net7') || startsWith(matrix.framework, 'net8') || startsWith(matrix.framework, 'net9')) && '-p:PublishSingleFile=true' || ''}}
|
||||
|
||||
- name: Archive build
|
||||
run: zip -r ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip ${{ matrix.project }}/bin/Debug/${{ matrix.framework }}/${{ matrix.runtime }}/publish/
|
||||
run: |
|
||||
cd ${{ matrix.project }}/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/
|
||||
zip -r ${{ github.workspace }}/${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip ./
|
||||
|
||||
- name: Upload build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug
|
||||
path: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip
|
||||
name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}
|
||||
path: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip
|
||||
artifacts: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip
|
||||
body: 'Last built commit: ${{ github.sha }}'
|
||||
name: 'Rolling Release'
|
||||
prerelease: True
|
||||
|
||||
2
.github/workflows/build_nupkg.yml
vendored
2
.github/workflows/build_nupkg.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
33
.github/workflows/build_ui.yml
vendored
33
.github/workflows/build_ui.yml
vendored
@@ -12,7 +12,8 @@ jobs:
|
||||
matrix:
|
||||
project: [MPF.UI]
|
||||
runtime: [win-x86, win-x64]
|
||||
framework: [net8.0-windows] #[net40, net452, net472, net48, netcoreapp3.1, net5.0-windows, net6.0-windows, net7.0-windows, net8.0-windows]
|
||||
framework: [net9.0-windows] #[net40, net452, net472, net48, netcoreapp3.1, net5.0-windows, net6.0-windows, net7.0-windows, net8.0-windows, net9.0-windows]
|
||||
conf: [Debug] #[Release, Debug]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -20,42 +21,44 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c Debug --self-contained true --version-suffix ${{ github.sha }} ${{ (startsWith(matrix.framework, 'net5') || startsWith(matrix.framework, 'net6') || startsWith(matrix.framework, 'net7') || startsWith(matrix.framework, 'net8')) && '-p:PublishSingleFile=true' || ''}}
|
||||
run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c ${{ matrix.conf == 'Release' && 'Release -p:DebugType=None -p:DebugSymbols=false' || 'Debug'}} --self-contained true --version-suffix ${{ github.sha }} ${{ (startsWith(matrix.framework, 'net5') || startsWith(matrix.framework, 'net6') || startsWith(matrix.framework, 'net7') || startsWith(matrix.framework, 'net8') || startsWith(matrix.framework, 'net9')) && '-p:PublishSingleFile=true' || ''}}
|
||||
|
||||
- name: Bundle DiscImageCreator
|
||||
run: |
|
||||
wget https://github.com/user-attachments/files/15521936/DiscImageCreator_20240601.zip
|
||||
unzip -u DiscImageCreator_20240601.zip
|
||||
mkdir -p MPF.UI/bin/Debug/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Creator
|
||||
mv Release_ANSI/* MPF.UI/bin/Debug/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Creator/
|
||||
wget https://github.com/user-attachments/files/17211434/DiscImageCreator_20241001.zip
|
||||
unzip -u DiscImageCreator_20241001.zip
|
||||
mkdir -p MPF.UI/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Creator
|
||||
mv Release_ANSI/* MPF.UI/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Creator/
|
||||
|
||||
- name: Bundle Redumper
|
||||
run: |
|
||||
wget https://github.com/superg/redumper/releases/download/build_371/redumper-2024.05.27_build371-win64.zip
|
||||
unzip redumper-2024.05.27_build371-win64.zip
|
||||
mkdir -p MPF.UI/bin/Debug/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Redumper
|
||||
mv redumper-2024.05.27_build371-win64/bin/redumper.exe MPF.UI/bin/Debug/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Redumper/
|
||||
wget https://github.com/superg/redumper/releases/download/build_438/redumper-2024.11.03_build438-win64.zip
|
||||
unzip redumper-2024.11.03_build438-win64.zip
|
||||
mkdir -p MPF.UI/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Redumper
|
||||
mv redumper-2024.11.03_build438-win64/bin/redumper.exe MPF.UI/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/Programs/Redumper/
|
||||
|
||||
- name: Archive build
|
||||
run: zip -r ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip ${{ matrix.project }}/bin/Debug/${{ matrix.framework }}/${{ matrix.runtime }}/publish/
|
||||
run: |
|
||||
cd ${{ matrix.project }}/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/
|
||||
zip -r ${{ github.workspace }}/${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip ./
|
||||
|
||||
- name: Upload build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug
|
||||
path: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip
|
||||
name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}
|
||||
path: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_debug.zip
|
||||
artifacts: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip
|
||||
body: 'Last built commit: ${{ github.sha }}'
|
||||
name: 'Rolling Release'
|
||||
prerelease: True
|
||||
|
||||
2
.github/workflows/check_pr.yml
vendored
2
.github/workflows/check_pr.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -10,7 +10,7 @@
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/MPF.Check/bin/Debug/net8.0/MPF.Check.dll",
|
||||
"program": "${workspaceFolder}/MPF.Check/bin/Debug/net9.0/MPF.Check.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/MPF.Check",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
|
||||
@@ -1,4 +1,81 @@
|
||||
### 3.2.2 (2024-09-xx)
|
||||
### 3.2.4 (2024-11-24)
|
||||
|
||||
- Update Redumper to build 438
|
||||
- Be smarter about Linq usage
|
||||
- Add .NET 9 to target frameworks
|
||||
- Be smarter about some data types
|
||||
- Consolidate parameter string splitting
|
||||
- Fix fully matching when multiple matches found
|
||||
- Remove usages of `this.` in more places
|
||||
- Add `skeleton` to Redumper CD by default
|
||||
- Add unused "Generic" processor
|
||||
- Add Track 0/00/A/AA to Generic
|
||||
- Add IMA extension for floppy disks
|
||||
- Remove usages of `this.` from themes
|
||||
- Fix PIC parser
|
||||
- Use expanded version of split regex
|
||||
- Update packages for bugfixes
|
||||
- Fix minor efficiency issues
|
||||
- Remove usages of `this.` from UI code
|
||||
- Reduce unnecessary use of IEnumerable
|
||||
- Use List in protection formatting
|
||||
- Don't preemptively sort protections
|
||||
- Remove unncessary .NET Framework 4.0 gating
|
||||
- Improve parameters for default output path
|
||||
- Replace some uses of Regex.Replace
|
||||
- Clean up usings after last commit
|
||||
- Version gate remaining Linq statements
|
||||
- Cleanup CleanSS check
|
||||
- Fix PS3 firmware version being omitted
|
||||
- Don't add trailing spaces to BCA output
|
||||
- Add support for Redumper Xbox dumps
|
||||
|
||||
### 3.2.3 (2024-11-06)
|
||||
|
||||
- Update to DIC 20240901
|
||||
- Update BinaryObjectScanner to 3.1.14
|
||||
- Fix SafeDisc filtering (TheRogueArchivist)
|
||||
- Update to DIC 20241001
|
||||
- Include all DIC write offsets
|
||||
- Fix faulty offset dedupe logic
|
||||
- Change multiple offset delimiter
|
||||
- Make .NET 8 the default in issue reports
|
||||
- Remove ReadLine in list commands
|
||||
- Sum track errors in Redumper
|
||||
- Format CleanRip BCA wtih 2-byte blocks
|
||||
- Update Redumper to build 416
|
||||
- Fix trimming of header output
|
||||
- Use fake filename for Redumper DAT
|
||||
- Ensure that the full base path is being used
|
||||
- Ensure consistency in output file path checking
|
||||
- Use new output file logic in processors
|
||||
- Ensure Regex directories are unescaped
|
||||
- Add separate field for Regex; assorted cleanup
|
||||
- Reduce cleverness in output file code
|
||||
- No directory means no files
|
||||
- Update RedumpLib to 1.4.4
|
||||
- Use rolling release, not AppVeyor, in issue templates
|
||||
- Update BinaryObjectScanner to 3.1.15
|
||||
- Remove unused IndexRange library
|
||||
- Remove unnecessary System.ValueTuple usage
|
||||
- Remove old .NET version of ValueTuple where possible
|
||||
- Remove unused CompilerServices.Unsafe library
|
||||
- Simplify GetMediaType return
|
||||
- Reduce call complexity for login result
|
||||
- Use new ProtectionDictionary type
|
||||
- Replace user info func with ProcessUserInfoDelegate
|
||||
- Reduce tupling even more
|
||||
- Remove tupling from everything except CLI programs
|
||||
- Remove last instances of ValueTuple usage
|
||||
- Update BinaryObjectScanner to 3.1.16
|
||||
- Attempt to reduce nesting in GHA builds
|
||||
- Add conf to build matrix
|
||||
- Ensure debug symbols are stripped
|
||||
- Fix missed GetOutputFiles invocation
|
||||
- Reduce null use in BaseProcessor
|
||||
- Force rebuild of rolling
|
||||
|
||||
### 3.2.2 (2024-09-24)
|
||||
|
||||
- Clean up some Check options, add IRD option
|
||||
- Add Check flags for protection scan extras
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>NU1902;NU1903</NoWarn>
|
||||
<Nullable>enable</Nullable>
|
||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<VersionPrefix>3.2.2</VersionPrefix>
|
||||
<VersionPrefix>3.2.4</VersionPrefix>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Title>MPF CLI</Title>
|
||||
@@ -29,29 +30,22 @@
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`))">
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`)) OR $(TargetFramework.StartsWith(`net9`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Support for old .NET versions -->
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="MinAsyncBridge" Version="0.12.4" />
|
||||
<PackageReference Include="MinTasksExtensionsBridge" Version="0.3.4" />
|
||||
<PackageReference Include="MinThreadingBridge" Version="0.11.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MPF.Frontend\MPF.Frontend.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.1.13" GeneratePathProperty="true">
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.2.3" GeneratePathProperty="true">
|
||||
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.4.1" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace MPF.CLI
|
||||
}
|
||||
|
||||
// Try processing the common arguments
|
||||
(bool success, MediaType mediaType, RedumpSystem? knownSystem, var error) = OptionsLoader.ProcessCommonArguments(args);
|
||||
bool success = OptionsLoader.ProcessCommonArguments(args, out MediaType mediaType, out RedumpSystem? knownSystem, out var error);
|
||||
if (!success)
|
||||
{
|
||||
DisplayHelp(error);
|
||||
@@ -48,12 +48,20 @@ namespace MPF.CLI
|
||||
}
|
||||
|
||||
// Validate the supplied credentials
|
||||
(bool? _, string? message) = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult();
|
||||
bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult();
|
||||
string message = validated switch
|
||||
{
|
||||
true => "Redump username and password accepted!",
|
||||
false => "Redump username and password denied!",
|
||||
null => "An error occurred validating your credentials!",
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
Console.WriteLine(message);
|
||||
|
||||
// Process any custom parameters
|
||||
(CommandOptions opts, int startIndex) = LoadFromArguments(args, options, startIndex: 2);
|
||||
int startIndex = 2;
|
||||
CommandOptions opts = LoadFromArguments(args, options, ref startIndex);
|
||||
|
||||
// Validate the internal program
|
||||
switch (options.InternalProgram)
|
||||
@@ -150,13 +158,8 @@ namespace MPF.CLI
|
||||
}
|
||||
|
||||
// Finally, attempt to do the output dance
|
||||
#if NET40
|
||||
var verifyTask = env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress);
|
||||
verifyTask.Wait();
|
||||
var verifyResult = verifyTask.Result;
|
||||
#else
|
||||
var verifyResult = env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
#endif
|
||||
var verifyResult = env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress)
|
||||
.ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
Console.WriteLine(verifyResult.Message);
|
||||
}
|
||||
|
||||
@@ -202,18 +205,21 @@ namespace MPF.CLI
|
||||
/// <summary>
|
||||
/// Load the current set of options from application arguments
|
||||
/// </summary>
|
||||
private static (CommandOptions, int) LoadFromArguments(string[] args, Frontend.Options options, int startIndex = 0)
|
||||
private static CommandOptions LoadFromArguments(string[] args, Frontend.Options options, ref int startIndex)
|
||||
{
|
||||
// Create return values
|
||||
var opts = new CommandOptions();
|
||||
|
||||
// If we have no arguments, just return
|
||||
if (args == null || args.Length == 0)
|
||||
return (opts, 0);
|
||||
{
|
||||
startIndex = 0;
|
||||
return opts;
|
||||
}
|
||||
|
||||
// If we have an invalid start index, just return
|
||||
if (startIndex < 0 || startIndex >= args.Length)
|
||||
return (opts, startIndex);
|
||||
return opts;
|
||||
|
||||
// Loop through the arguments and parse out values
|
||||
for (; startIndex < args.Length; startIndex++)
|
||||
@@ -299,7 +305,7 @@ namespace MPF.CLI
|
||||
}
|
||||
}
|
||||
|
||||
return (opts, startIndex);
|
||||
return opts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>NU1902;NU1903</NoWarn>
|
||||
<Nullable>enable</Nullable>
|
||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<VersionPrefix>3.2.2</VersionPrefix>
|
||||
<VersionPrefix>3.2.4</VersionPrefix>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Title>MPF Check</Title>
|
||||
@@ -29,33 +30,26 @@
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`))">
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`)) OR $(TargetFramework.StartsWith(`net9`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Support for old .NET versions -->
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="MinAsyncBridge" Version="0.12.4" />
|
||||
<PackageReference Include="MinTasksExtensionsBridge" Version="0.3.4" />
|
||||
<PackageReference Include="MinThreadingBridge" Version="0.11.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MPF.Frontend\MPF.Frontend.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.1.13" GeneratePathProperty="true">
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.2.3" GeneratePathProperty="true">
|
||||
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.4.1" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
#if NET40
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using BinaryObjectScanner;
|
||||
@@ -55,7 +54,7 @@ namespace MPF.Check
|
||||
}
|
||||
|
||||
// Try processing the common arguments
|
||||
(bool success, MediaType mediaType, RedumpSystem? knownSystem, var error) = OptionsLoader.ProcessCommonArguments(args);
|
||||
bool success = OptionsLoader.ProcessCommonArguments(args, out MediaType mediaType, out RedumpSystem? knownSystem, out var error);
|
||||
if (!success)
|
||||
{
|
||||
DisplayHelp(error);
|
||||
@@ -63,7 +62,8 @@ namespace MPF.Check
|
||||
}
|
||||
|
||||
// Loop through and process options
|
||||
(CommandOptions opts, int startIndex) = LoadFromArguments(args, options, startIndex: 2);
|
||||
int startIndex = 2;
|
||||
CommandOptions opts = LoadFromArguments(args, options, ref startIndex);
|
||||
if (options.InternalProgram == InternalProgram.NONE)
|
||||
{
|
||||
DisplayHelp("A program name needs to be provided");
|
||||
@@ -77,7 +77,14 @@ namespace MPF.Check
|
||||
protectionProgress.ProgressChanged += ConsoleLogger.ProgressUpdated;
|
||||
|
||||
// Validate the supplied credentials
|
||||
(bool? _, string? message) = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult();
|
||||
bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult();
|
||||
string message = validated switch
|
||||
{
|
||||
true => "Redump username and password accepted!",
|
||||
false => "Redump username and password denied!",
|
||||
null => "An error occurred validating your credentials!",
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
Console.WriteLine(message);
|
||||
|
||||
@@ -102,7 +109,8 @@ namespace MPF.Check
|
||||
var env = new DumpEnvironment(options, filepath, drive, knownSystem, mediaType, internalProgram: null, parameters: null);
|
||||
|
||||
// Finally, attempt to do the output dance
|
||||
var result = env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress, seedInfo: opts.Seed).GetAwaiter().GetResult();
|
||||
var result = env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress, seedInfo: opts.Seed)
|
||||
.ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
Console.WriteLine(result.Message);
|
||||
}
|
||||
}
|
||||
@@ -151,7 +159,7 @@ namespace MPF.Check
|
||||
/// <summary>
|
||||
/// Load the current set of options from application arguments
|
||||
/// </summary>
|
||||
private static (CommandOptions, int) LoadFromArguments(string[] args, Frontend.Options options, int startIndex = 0)
|
||||
private static CommandOptions LoadFromArguments(string[] args, Frontend.Options options, ref int startIndex)
|
||||
{
|
||||
// Create return values
|
||||
var opts = new CommandOptions();
|
||||
@@ -165,11 +173,14 @@ namespace MPF.Check
|
||||
|
||||
// If we have no arguments, just return
|
||||
if (args == null || args.Length == 0)
|
||||
return (opts, 0);
|
||||
{
|
||||
startIndex = 0;
|
||||
return opts;
|
||||
}
|
||||
|
||||
// If we have an invalid start index, just return
|
||||
if (startIndex < 0 || startIndex >= args.Length)
|
||||
return (opts, startIndex);
|
||||
return opts;
|
||||
|
||||
// Loop through the arguments and parse out values
|
||||
for (; startIndex < args.Length; startIndex++)
|
||||
@@ -317,7 +328,7 @@ namespace MPF.Check
|
||||
options.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(opts.DevicePath);
|
||||
options.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(opts.DevicePath);
|
||||
|
||||
return (opts, startIndex);
|
||||
return opts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.ExecutionContexts.Aaru
|
||||
@@ -116,7 +114,12 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
public ExecutionContext(string? parameters) : base(parameters) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ExecutionContext(RedumpSystem? system, MediaType? type, string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options)
|
||||
public ExecutionContext(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
: base(system, type, drivePath, filename, driveSpeed, options)
|
||||
{
|
||||
}
|
||||
@@ -1082,7 +1085,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
if (string.IsNullOrEmpty(InputValue))
|
||||
return null;
|
||||
|
||||
if (InputValue.Contains(' '))
|
||||
if (InputValue!.Contains(" "))
|
||||
parameters.Add($"\"{InputValue!.TrimEnd('\\')}\"");
|
||||
else
|
||||
parameters.Add(InputValue!.TrimEnd('\\'));
|
||||
@@ -1193,7 +1196,10 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetDefaultParameters(string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options)
|
||||
protected override void SetDefaultParameters(string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
{
|
||||
BaseCommand = $"{CommandStrings.MediaPrefixLong} {CommandStrings.MediaDump}";
|
||||
|
||||
@@ -1207,8 +1213,8 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
}
|
||||
|
||||
// First check to see if the combination of system and MediaType is valid
|
||||
var validTypes = this.System.MediaTypes();
|
||||
if (!validTypes.Contains(this.Type))
|
||||
var validTypes = RedumpSystem.MediaTypes();
|
||||
if (!validTypes.Contains(MediaType))
|
||||
return;
|
||||
|
||||
// Set retry count
|
||||
@@ -1231,40 +1237,40 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
|
||||
// TODO: Look at dump-media formats and the like and see what options there are there to fill in defaults
|
||||
// Now sort based on disc type
|
||||
switch (this.Type)
|
||||
switch (MediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case SabreTools.RedumpLib.Data.MediaType.CDROM:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case MediaType.DVD:
|
||||
case SabreTools.RedumpLib.Data.MediaType.DVD:
|
||||
this[FlagStrings.StoreEncryptedLong] = true; // TODO: Make this configurable
|
||||
this[FlagStrings.TitleKeysLong] = false; // TODO: Make this configurable
|
||||
this[FlagStrings.TrimLong] = true; // TODO: Make this configurable
|
||||
break;
|
||||
case MediaType.GDROM:
|
||||
case SabreTools.RedumpLib.Data.MediaType.GDROM:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case MediaType.HDDVD:
|
||||
case SabreTools.RedumpLib.Data.MediaType.HDDVD:
|
||||
this[FlagStrings.StoreEncryptedLong] = true; // TODO: Make this configurable
|
||||
this[FlagStrings.TitleKeysLong] = false; // TODO: Make this configurable
|
||||
this[FlagStrings.TrimLong] = true; // TODO: Make this configurable
|
||||
break;
|
||||
case MediaType.BluRay:
|
||||
case SabreTools.RedumpLib.Data.MediaType.BluRay:
|
||||
this[FlagStrings.StoreEncryptedLong] = true; // TODO: Make this configurable
|
||||
this[FlagStrings.TitleKeysLong] = false; // TODO: Make this configurable
|
||||
this[FlagStrings.TrimLong] = true; // TODO: Make this configurable
|
||||
break;
|
||||
|
||||
// Special Formats
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case SabreTools.RedumpLib.Data.MediaType.NintendoGameCubeGameDisc:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
case SabreTools.RedumpLib.Data.MediaType.NintendoWiiOpticalDisc:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
|
||||
// Non-optical
|
||||
case MediaType.FloppyDisk:
|
||||
case SabreTools.RedumpLib.Data.MediaType.FloppyDisk:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
}
|
||||
@@ -1280,19 +1286,14 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
return false;
|
||||
|
||||
// Now split the string into parts for easier validation
|
||||
// https://stackoverflow.com/questions/14655023/split-a-string-that-has-white-spaces-unless-they-are-enclosed-within-quotes
|
||||
parameters = parameters!.Trim();
|
||||
List<string> parts = Regex.Matches(parameters, @"[\""].+?[\""]|[^ ]+", RegexOptions.Compiled)
|
||||
.Cast<Match>()
|
||||
.Select(m => m.Value)
|
||||
.ToList();
|
||||
List<string> parts = SplitParameterString(parameters!);
|
||||
|
||||
// Search for pre-command flags first
|
||||
int start = 0;
|
||||
for (start = 0; start < parts.Count; start++)
|
||||
{
|
||||
// Keep a count of keys to determine if we should break out to command handling or not
|
||||
int keyCount = Keys.Count();
|
||||
int keyCount = Keys.Count;
|
||||
|
||||
// Debug
|
||||
ProcessBooleanParameter(parts, FlagStrings.DebugShort, FlagStrings.DebugLong, ref start, true);
|
||||
@@ -1311,7 +1312,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
ProcessBooleanParameter(parts, FlagStrings.HelpShortAlt, FlagStrings.HelpLong, ref start, true);
|
||||
|
||||
// If we didn't add any new flags, break out since we might be at command handling
|
||||
if (keyCount == Keys.Count())
|
||||
if (keyCount == Keys.Count)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1339,7 +1340,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
string? stringValue = null;
|
||||
|
||||
// Keep a count of keys to determine if we should break out to filename handling or not
|
||||
int keyCount = Keys.Count();
|
||||
int keyCount = Keys.Count;
|
||||
|
||||
#region Boolean flags
|
||||
|
||||
@@ -1706,7 +1707,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
#endregion
|
||||
|
||||
// If we didn't add any new flags, break out since we might be at filename handling
|
||||
if (keyCount == Keys.Count())
|
||||
if (keyCount == Keys.Count)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace MPF.ExecutionContexts
|
||||
/// Set of flags to pass to the executable
|
||||
/// </summary>
|
||||
protected Dictionary<string, bool?> flags = [];
|
||||
protected internal IEnumerable<string> Keys => flags.Keys;
|
||||
protected internal List<string> Keys => [.. flags.Keys];
|
||||
|
||||
/// <summary>
|
||||
/// Safe access to currently set flags
|
||||
@@ -82,12 +82,12 @@ namespace MPF.ExecutionContexts
|
||||
/// <summary>
|
||||
/// Currently represented system
|
||||
/// </summary>
|
||||
public RedumpSystem? System { get; set; }
|
||||
public RedumpSystem? RedumpSystem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Currently represented media type
|
||||
/// </summary>
|
||||
public MediaType? Type { get; set; }
|
||||
public MediaType? MediaType { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -111,10 +111,15 @@ namespace MPF.ExecutionContexts
|
||||
/// <param name="filename">Filename to use</param>
|
||||
/// <param name="driveSpeed">Drive speed to use</param>
|
||||
/// <param name="options">Dictionary object containing all settings that may be used for setting parameters</param>
|
||||
public BaseExecutionContext(RedumpSystem? system, MediaType? type, string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options)
|
||||
public BaseExecutionContext(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
{
|
||||
this.System = system;
|
||||
this.Type = type;
|
||||
RedumpSystem = system;
|
||||
MediaType = type;
|
||||
SetDefaultParameters(drivePath, filename, driveSpeed, options);
|
||||
}
|
||||
|
||||
@@ -169,7 +174,10 @@ namespace MPF.ExecutionContexts
|
||||
/// <param name="filename">Filename to use</param>
|
||||
/// <param name="driveSpeed">Drive speed to use</param>
|
||||
/// <param name="options">Dictionary containing all settings that may be used for setting parameters</param>
|
||||
protected abstract void SetDefaultParameters(string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options);
|
||||
protected abstract void SetDefaultParameters(string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options);
|
||||
|
||||
/// <summary>
|
||||
/// Scan a possible parameter string and populate whatever possible
|
||||
@@ -290,6 +298,24 @@ namespace MPF.ExecutionContexts
|
||||
|
||||
#region Parameter Parsing
|
||||
|
||||
/// <summary>
|
||||
/// Split a parameters string into a list while taking quotes into account
|
||||
/// </summary>
|
||||
/// <see href="https://stackoverflow.com/questions/14655023/split-a-string-that-has-white-spaces-unless-they-are-enclosed-within-quotes"/>
|
||||
protected static List<string> SplitParameterString(string parameters)
|
||||
{
|
||||
// Ensure the parameter string is trimmed
|
||||
parameters = parameters.Trim();
|
||||
|
||||
// Split the string using Regex
|
||||
var matches = Regex.Matches(parameters, @"([a-zA-Z\-]*=)?[\""].+?[\""]|[^ ]+", RegexOptions.Compiled);
|
||||
|
||||
// Get just the values from the matches
|
||||
var matchArr = new Match[matches.Count];
|
||||
matches.CopyTo(matchArr, 0);
|
||||
return [.. Array.ConvertAll(matchArr, m => m.Value)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether or not the selected item exists
|
||||
/// </summary>
|
||||
@@ -308,9 +334,9 @@ namespace MPF.ExecutionContexts
|
||||
{
|
||||
if (CommandSupport == null)
|
||||
return false;
|
||||
if (this.BaseCommand == null)
|
||||
if (BaseCommand == null)
|
||||
return false;
|
||||
if (!CommandSupport.TryGetValue(this.BaseCommand, out var supported))
|
||||
if (!CommandSupport.TryGetValue(BaseCommand, out var supported))
|
||||
return false;
|
||||
return supported.Contains(flag);
|
||||
}
|
||||
@@ -332,7 +358,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>True if it's a valid byte, false otherwise</returns>
|
||||
protected static bool IsValidInt8(string parameter, sbyte lowerBound = -1, sbyte upperBound = -1)
|
||||
{
|
||||
(string value, long _) = ExtractFactorFromValue(parameter);
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!sbyte.TryParse(value, out sbyte temp))
|
||||
return false;
|
||||
else if (lowerBound != -1 && temp < lowerBound)
|
||||
@@ -352,7 +378,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>True if it's a valid Int16, false otherwise</returns>
|
||||
protected static bool IsValidInt16(string parameter, short lowerBound = -1, short upperBound = -1)
|
||||
{
|
||||
(string value, long _) = ExtractFactorFromValue(parameter);
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!short.TryParse(value, out short temp))
|
||||
return false;
|
||||
else if (lowerBound != -1 && temp < lowerBound)
|
||||
@@ -372,7 +398,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>True if it's a valid Int32, false otherwise</returns>
|
||||
protected static bool IsValidInt32(string parameter, int lowerBound = -1, int upperBound = -1)
|
||||
{
|
||||
(string value, long _) = ExtractFactorFromValue(parameter);
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!int.TryParse(value, out int temp))
|
||||
return false;
|
||||
else if (lowerBound != -1 && temp < lowerBound)
|
||||
@@ -392,7 +418,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>True if it's a valid Int64, false otherwise</returns>
|
||||
protected static bool IsValidInt64(string parameter, long lowerBound = -1, long upperBound = -1)
|
||||
{
|
||||
(string value, long _) = ExtractFactorFromValue(parameter);
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!long.TryParse(value, out long temp))
|
||||
return false;
|
||||
else if (lowerBound != -1 && temp < lowerBound)
|
||||
@@ -568,7 +594,7 @@ namespace MPF.ExecutionContexts
|
||||
this[longFlagString] = true;
|
||||
i++;
|
||||
|
||||
(string value, long factor) = ExtractFactorFromValue(parts[i]);
|
||||
string value = ExtractFactorFromValue(parts[i], out long factor);
|
||||
if (sbyte.TryParse(value, out sbyte sByteValue))
|
||||
return (sbyte)(sByteValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -588,7 +614,7 @@ namespace MPF.ExecutionContexts
|
||||
string valuePart = commandParts[1];
|
||||
|
||||
this[longFlagString] = true;
|
||||
(string value, long factor) = ExtractFactorFromValue(valuePart);
|
||||
string value = ExtractFactorFromValue(valuePart, out long factor);
|
||||
if (sbyte.TryParse(value, out sbyte sByteValue))
|
||||
return (sbyte)(sByteValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -655,7 +681,7 @@ namespace MPF.ExecutionContexts
|
||||
|
||||
this[longFlagString] = true;
|
||||
i++;
|
||||
(string value, long factor) = ExtractFactorFromValue(parts[i]);
|
||||
string value = ExtractFactorFromValue(parts[i], out long factor);
|
||||
if (short.TryParse(value, out short shortValue))
|
||||
return (short)(shortValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -675,7 +701,7 @@ namespace MPF.ExecutionContexts
|
||||
string valuePart = commandParts[1];
|
||||
|
||||
this[longFlagString] = true;
|
||||
(string value, long factor) = ExtractFactorFromValue(valuePart);
|
||||
string value = ExtractFactorFromValue(valuePart, out long factor);
|
||||
if (short.TryParse(value, out short shortValue))
|
||||
return (short)(shortValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -742,7 +768,7 @@ namespace MPF.ExecutionContexts
|
||||
|
||||
this[longFlagString] = true;
|
||||
i++;
|
||||
(string value, long factor) = ExtractFactorFromValue(parts[i]);
|
||||
string value = ExtractFactorFromValue(parts[i], out long factor);
|
||||
if (int.TryParse(value, out int intValue))
|
||||
return (int)(intValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -762,7 +788,7 @@ namespace MPF.ExecutionContexts
|
||||
string valuePart = commandParts[1];
|
||||
|
||||
this[longFlagString] = true;
|
||||
(string value, long factor) = ExtractFactorFromValue(valuePart);
|
||||
string value = ExtractFactorFromValue(valuePart, out long factor);
|
||||
if (int.TryParse(value, out int intValue))
|
||||
return (int)(intValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -829,7 +855,7 @@ namespace MPF.ExecutionContexts
|
||||
|
||||
this[longFlagString] = true;
|
||||
i++;
|
||||
(string value, long factor) = ExtractFactorFromValue(parts[i]);
|
||||
string value = ExtractFactorFromValue(parts[i], out long factor);
|
||||
if (long.TryParse(value, out long longValue))
|
||||
return (long)(longValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -849,7 +875,7 @@ namespace MPF.ExecutionContexts
|
||||
string valuePart = commandParts[1];
|
||||
|
||||
this[longFlagString] = true;
|
||||
(string value, long factor) = ExtractFactorFromValue(valuePart);
|
||||
string value = ExtractFactorFromValue(valuePart, out long factor);
|
||||
if (long.TryParse(value, out long longValue))
|
||||
return (long)(longValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -990,7 +1016,7 @@ namespace MPF.ExecutionContexts
|
||||
this[longFlagString] = true;
|
||||
i++;
|
||||
|
||||
(string value, long factor) = ExtractFactorFromValue(parts[i]);
|
||||
string value = ExtractFactorFromValue(parts[i], out long factor);
|
||||
if (byte.TryParse(value, out byte byteValue))
|
||||
return (byte)(byteValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -1010,7 +1036,7 @@ namespace MPF.ExecutionContexts
|
||||
string valuePart = commandParts[1];
|
||||
|
||||
this[longFlagString] = true;
|
||||
(string value, long factor) = ExtractFactorFromValue(valuePart);
|
||||
string value = ExtractFactorFromValue(valuePart, out long factor);
|
||||
if (byte.TryParse(value, out byte byteValue))
|
||||
return (byte)(byteValue * factor);
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
@@ -1027,10 +1053,10 @@ namespace MPF.ExecutionContexts
|
||||
/// </summary>
|
||||
/// <param name="value">String value to treat as suffixed number</param>
|
||||
/// <returns>Trimmed value and multiplication factor</returns>
|
||||
private static (string trimmed, long factor) ExtractFactorFromValue(string value)
|
||||
private static string ExtractFactorFromValue(string value, out long factor)
|
||||
{
|
||||
value = value.Trim('"');
|
||||
long factor = 1;
|
||||
factor = 1;
|
||||
|
||||
// Characters
|
||||
if (value.EndsWith("c", StringComparison.Ordinal))
|
||||
@@ -1081,7 +1107,7 @@ namespace MPF.ExecutionContexts
|
||||
value = value.TrimEnd('G');
|
||||
}
|
||||
|
||||
return (value, factor);
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
@@ -166,7 +164,12 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
public ExecutionContext(string? parameters) : base(parameters) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ExecutionContext(RedumpSystem? system, MediaType? type, string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options)
|
||||
public ExecutionContext(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
: base(system, type, drivePath, filename, driveSpeed, options)
|
||||
{
|
||||
}
|
||||
@@ -204,6 +207,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
FlagStrings.DisableBeep,
|
||||
FlagStrings.DVDReread,
|
||||
FlagStrings.ForceUnitAccess,
|
||||
FlagStrings.Range,
|
||||
FlagStrings.UseAnchorVolumeDescriptorPointer,
|
||||
],
|
||||
|
||||
@@ -232,6 +236,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
FlagStrings.ScanSectorProtect,
|
||||
FlagStrings.SeventyFour,
|
||||
FlagStrings.SubchannelReadLevel,
|
||||
FlagStrings.TryReadingPregap,
|
||||
FlagStrings.VideoNow,
|
||||
FlagStrings.VideoNowColor,
|
||||
FlagStrings.VideoNowXP,
|
||||
@@ -340,6 +345,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
FlagStrings.ScanSectorProtect,
|
||||
FlagStrings.SeventyFour,
|
||||
FlagStrings.SubchannelReadLevel,
|
||||
FlagStrings.TryReadingPregap,
|
||||
FlagStrings.VideoNow,
|
||||
FlagStrings.VideoNowColor,
|
||||
FlagStrings.VideoNowXP,
|
||||
@@ -420,7 +426,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
{
|
||||
if (DrivePath != null)
|
||||
{
|
||||
if (DrivePath.Contains(' '))
|
||||
if (DrivePath.Contains(" "))
|
||||
parameters.Add($"\"{DrivePath}\"");
|
||||
else
|
||||
parameters.Add(DrivePath);
|
||||
@@ -852,6 +858,13 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
parameters.Add(FlagStrings.Tages);
|
||||
}
|
||||
|
||||
// Try Reading Pregap
|
||||
if (IsFlagSupported(FlagStrings.TryReadingPregap))
|
||||
{
|
||||
if (this[FlagStrings.TryReadingPregap] == true)
|
||||
parameters.Add(FlagStrings.TryReadingPregap);
|
||||
}
|
||||
|
||||
// Use Anchor Volume Descriptor Pointer
|
||||
if (IsFlagSupported(FlagStrings.UseAnchorVolumeDescriptorPointer))
|
||||
{
|
||||
@@ -950,17 +963,20 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetDefaultParameters(string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options)
|
||||
protected override void SetDefaultParameters(string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
{
|
||||
SetBaseCommand(this.System, this.Type);
|
||||
SetBaseCommand(RedumpSystem, MediaType);
|
||||
|
||||
DrivePath = drivePath;
|
||||
DriveSpeed = driveSpeed;
|
||||
Filename = filename;
|
||||
|
||||
// First check to see if the combination of system and MediaType is valid
|
||||
var validTypes = this.System.MediaTypes();
|
||||
if (!validTypes.Contains(this.Type))
|
||||
var validTypes = RedumpSystem.MediaTypes();
|
||||
if (!validTypes.Contains(MediaType))
|
||||
return;
|
||||
|
||||
// Set disable beep flag, if needed
|
||||
@@ -986,18 +1002,18 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
};
|
||||
|
||||
// Now sort based on disc type
|
||||
switch (this.Type)
|
||||
switch (MediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case SabreTools.RedumpLib.Data.MediaType.CDROM:
|
||||
this[FlagStrings.C2Opcode] = true;
|
||||
this[FlagStrings.MultiSectorRead] = GetBooleanSetting(options, SettingConstants.MultiSectorRead, SettingConstants.MultiSectorReadDefault);
|
||||
if (this[FlagStrings.MultiSectorRead] == true)
|
||||
this.MultiSectorReadValue = GetInt32Setting(options, SettingConstants.MultiSectorReadValue, SettingConstants.MultiSectorReadValueDefault);
|
||||
MultiSectorReadValue = GetInt32Setting(options, SettingConstants.MultiSectorReadValue, SettingConstants.MultiSectorReadValueDefault);
|
||||
|
||||
switch (this.System)
|
||||
switch (RedumpSystem)
|
||||
{
|
||||
case RedumpSystem.AppleMacintosh:
|
||||
case RedumpSystem.IBMPCcompatible:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.AppleMacintosh:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.IBMPCcompatible:
|
||||
this[FlagStrings.NoFixSubQSecuROM] = true;
|
||||
this[FlagStrings.ScanFileProtect] = true;
|
||||
this[FlagStrings.ScanSectorProtect] = GetBooleanSetting(options, SettingConstants.ParanoidMode, SettingConstants.ParanoidModeDefault);
|
||||
@@ -1006,48 +1022,48 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
SubchannelReadLevelValue = 2;
|
||||
|
||||
break;
|
||||
case RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem:
|
||||
this[FlagStrings.AtariJaguar] = true;
|
||||
break;
|
||||
case RedumpSystem.HasbroVideoNow:
|
||||
case RedumpSystem.HasbroVideoNowColor:
|
||||
case RedumpSystem.HasbroVideoNowJr:
|
||||
case RedumpSystem.HasbroVideoNowXP:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.HasbroVideoNow:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.HasbroVideoNowColor:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.HasbroVideoNowJr:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.HasbroVideoNowXP:
|
||||
this[FlagStrings.AddOffset] = true;
|
||||
this.AddOffsetValue = 0; // Value needed for first run and placeholder after
|
||||
AddOffsetValue = 0; // Value needed for first run and placeholder after
|
||||
break;
|
||||
case RedumpSystem.SonyPlayStation:
|
||||
case SabreTools.RedumpLib.Data.RedumpSystem.SonyPlayStation:
|
||||
this[FlagStrings.ScanAntiMod] = true;
|
||||
this[FlagStrings.NoFixSubQLibCrypt] = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MediaType.DVD:
|
||||
case SabreTools.RedumpLib.Data.MediaType.DVD:
|
||||
this[FlagStrings.CopyrightManagementInformation] = GetBooleanSetting(options, SettingConstants.UseCMIFlag, SettingConstants.UseCMIFlagDefault);
|
||||
this[FlagStrings.ScanFileProtect] = GetBooleanSetting(options, SettingConstants.ParanoidMode, SettingConstants.ParanoidModeDefault);
|
||||
this[FlagStrings.DVDReread] = true;
|
||||
break;
|
||||
case MediaType.GDROM:
|
||||
case SabreTools.RedumpLib.Data.MediaType.GDROM:
|
||||
this[FlagStrings.C2Opcode] = true;
|
||||
break;
|
||||
case MediaType.HDDVD:
|
||||
case SabreTools.RedumpLib.Data.MediaType.HDDVD:
|
||||
this[FlagStrings.CopyrightManagementInformation] = GetBooleanSetting(options, SettingConstants.UseCMIFlag, SettingConstants.UseCMIFlagDefault);
|
||||
this[FlagStrings.DVDReread] = true;
|
||||
break;
|
||||
case MediaType.BluRay:
|
||||
case SabreTools.RedumpLib.Data.MediaType.BluRay:
|
||||
this[FlagStrings.DVDReread] = true;
|
||||
break;
|
||||
|
||||
// Special Formats
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case SabreTools.RedumpLib.Data.MediaType.NintendoGameCubeGameDisc:
|
||||
this[FlagStrings.Raw] = true;
|
||||
break;
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
case SabreTools.RedumpLib.Data.MediaType.NintendoWiiOpticalDisc:
|
||||
this[FlagStrings.Raw] = true;
|
||||
break;
|
||||
|
||||
// Non-optical
|
||||
case MediaType.FloppyDisk:
|
||||
case SabreTools.RedumpLib.Data.MediaType.FloppyDisk:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
}
|
||||
@@ -1063,12 +1079,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
return false;
|
||||
|
||||
// Now split the string into parts for easier validation
|
||||
// https://stackoverflow.com/questions/14655023/split-a-string-that-has-white-spaces-unless-they-are-enclosed-within-quotes
|
||||
parameters = parameters!.Trim();
|
||||
List<string> parts = Regex.Matches(parameters, @"[\""].+?[\""]|[^ ]+", RegexOptions.Compiled)
|
||||
.Cast<Match>()
|
||||
.Select(m => m.Value)
|
||||
.ToList();
|
||||
List<string> parts = SplitParameterString(parameters!);
|
||||
|
||||
// Determine what the commandline should look like given the first item
|
||||
BaseCommand = parts[0];
|
||||
@@ -1692,43 +1703,43 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
if (system == RedumpSystem.SuperAudioCD)
|
||||
case SabreTools.RedumpLib.Data.MediaType.CDROM:
|
||||
if (system == SabreTools.RedumpLib.Data.RedumpSystem.SuperAudioCD)
|
||||
BaseCommand = CommandStrings.SACD;
|
||||
else
|
||||
BaseCommand = CommandStrings.CompactDisc;
|
||||
return;
|
||||
case MediaType.DVD:
|
||||
if (system == RedumpSystem.MicrosoftXbox
|
||||
|| system == RedumpSystem.MicrosoftXbox360)
|
||||
case SabreTools.RedumpLib.Data.MediaType.DVD:
|
||||
if (system == SabreTools.RedumpLib.Data.RedumpSystem.MicrosoftXbox
|
||||
|| system == SabreTools.RedumpLib.Data.RedumpSystem.MicrosoftXbox360)
|
||||
{
|
||||
BaseCommand = CommandStrings.XBOX;
|
||||
return;
|
||||
}
|
||||
BaseCommand = CommandStrings.DigitalVideoDisc;
|
||||
return;
|
||||
case MediaType.GDROM:
|
||||
case SabreTools.RedumpLib.Data.MediaType.GDROM:
|
||||
BaseCommand = CommandStrings.GDROM;
|
||||
return;
|
||||
case MediaType.HDDVD:
|
||||
case SabreTools.RedumpLib.Data.MediaType.HDDVD:
|
||||
BaseCommand = CommandStrings.DigitalVideoDisc;
|
||||
return;
|
||||
case MediaType.BluRay:
|
||||
case SabreTools.RedumpLib.Data.MediaType.BluRay:
|
||||
BaseCommand = CommandStrings.BluRay;
|
||||
return;
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case SabreTools.RedumpLib.Data.MediaType.NintendoGameCubeGameDisc:
|
||||
BaseCommand = CommandStrings.DigitalVideoDisc;
|
||||
return;
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
case SabreTools.RedumpLib.Data.MediaType.NintendoWiiOpticalDisc:
|
||||
BaseCommand = CommandStrings.DigitalVideoDisc;
|
||||
return;
|
||||
case MediaType.FloppyDisk:
|
||||
case SabreTools.RedumpLib.Data.MediaType.FloppyDisk:
|
||||
BaseCommand = CommandStrings.Floppy;
|
||||
return;
|
||||
case MediaType.HardDisk:
|
||||
case SabreTools.RedumpLib.Data.MediaType.HardDisk:
|
||||
BaseCommand = CommandStrings.Disk;
|
||||
return;
|
||||
case MediaType.DataCartridge:
|
||||
case SabreTools.RedumpLib.Data.MediaType.DataCartridge:
|
||||
BaseCommand = CommandStrings.Tape;
|
||||
return;
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
public const string SkipSector = "/sk";
|
||||
public const string SubchannelReadLevel = "/s";
|
||||
public const string Tages = "/t";
|
||||
public const string TryReadingPregap = "/trp";
|
||||
public const string UseAnchorVolumeDescriptorPointer = "/avdp";
|
||||
public const string VideoNow = "/vn";
|
||||
public const string VideoNowColor = "/vnc";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<VersionPrefix>3.2.2</VersionPrefix>
|
||||
<VersionPrefix>3.2.4</VersionPrefix>
|
||||
<WarningsNotAsErrors>NU5104</WarningsNotAsErrors>
|
||||
|
||||
<!-- Package Properties -->
|
||||
@@ -25,35 +25,8 @@
|
||||
<InternalsVisibleTo Include="MPF.Test" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Support All Frameworks -->
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net4`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Support for old .NET versions -->
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="MinAsyncBridge" Version="0.12.4" />
|
||||
<PackageReference Include="MinTasksExtensionsBridge" Version="0.3.4" />
|
||||
<PackageReference Include="MinThreadingBridge" Version="0.11.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`)) AND !$(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="IndexRange" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))">
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.4.1" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -18,11 +18,14 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public const string RefineNew = "refinenew"; // Temporary command, to be removed later
|
||||
public const string Verify = "verify";
|
||||
public const string DVDKey = "dvdkey";
|
||||
public const string Eject = "eject";
|
||||
public const string DVDIsoKey = "dvdisokey";
|
||||
public const string Protection = "protection";
|
||||
public const string Split = "split";
|
||||
public const string Hash = "hash";
|
||||
public const string Info = "info";
|
||||
public const string Skeleton = "skeleton";
|
||||
public const string Debug = "debug";
|
||||
public const string FixMSF = "fixmsf";
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.ExecutionContexts.Redumper
|
||||
@@ -21,7 +19,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public override string? OutputPath => Path.Combine(
|
||||
ImagePathValue?.Trim('"') ?? string.Empty,
|
||||
ImageNameValue?.Trim('"') ?? string.Empty)
|
||||
+ GetDefaultExtension(this.Type);
|
||||
+ GetDefaultExtension(MediaType);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int? Speed => SpeedValue;
|
||||
@@ -161,7 +159,12 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public ExecutionContext(string? parameters) : base(parameters) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ExecutionContext(RedumpSystem? system, MediaType? type, string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options)
|
||||
public ExecutionContext(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
: base(system, type, drivePath, filename, driveSpeed, options)
|
||||
{
|
||||
}
|
||||
@@ -181,6 +184,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
FlagStrings.HelpShort,
|
||||
FlagStrings.Version,
|
||||
FlagStrings.Verbose,
|
||||
FlagStrings.AutoEject,
|
||||
FlagStrings.Debug,
|
||||
FlagStrings.Drive,
|
||||
FlagStrings.Speed,
|
||||
@@ -259,6 +263,10 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
if (this[FlagStrings.Verbose] == true)
|
||||
parameters.Add(FlagStrings.Verbose);
|
||||
|
||||
// Auto Eject
|
||||
if (this[FlagStrings.AutoEject] == true)
|
||||
parameters.Add(FlagStrings.AutoEject);
|
||||
|
||||
// Debug
|
||||
if (this[FlagStrings.Debug] == true)
|
||||
parameters.Add(FlagStrings.Debug);
|
||||
@@ -268,7 +276,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
{
|
||||
if (DriveValue != null)
|
||||
{
|
||||
if (DriveValue.Contains(' '))
|
||||
if (DriveValue.Contains(" "))
|
||||
parameters.Add($"{FlagStrings.Drive}=\"{DriveValue}\"");
|
||||
else
|
||||
parameters.Add($"{FlagStrings.Drive}={DriveValue}");
|
||||
@@ -498,14 +506,14 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
/// <inheritdoc/>
|
||||
public override bool IsDumpingCommand()
|
||||
{
|
||||
return this.BaseCommand == CommandStrings.NONE
|
||||
|| this.BaseCommand?.Contains(CommandStrings.CD) == true
|
||||
|| this.BaseCommand?.Contains(CommandStrings.DVD) == true
|
||||
|| this.BaseCommand?.Contains(CommandStrings.BluRay) == true
|
||||
|| this.BaseCommand?.Contains(CommandStrings.SACD) == true
|
||||
|| this.BaseCommand?.Contains(CommandStrings.New) == true
|
||||
|| this.BaseCommand?.Contains(CommandStrings.Dump) == true
|
||||
|| this.BaseCommand?.Contains(CommandStrings.DumpNew) == true;
|
||||
return BaseCommand == CommandStrings.NONE
|
||||
|| BaseCommand?.Contains(CommandStrings.CD) == true
|
||||
|| BaseCommand?.Contains(CommandStrings.DVD) == true
|
||||
|| BaseCommand?.Contains(CommandStrings.BluRay) == true
|
||||
|| BaseCommand?.Contains(CommandStrings.SACD) == true
|
||||
|| BaseCommand?.Contains(CommandStrings.New) == true
|
||||
|| BaseCommand?.Contains(CommandStrings.Dump) == true
|
||||
|| BaseCommand?.Contains(CommandStrings.DumpNew) == true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -545,34 +553,37 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetDefaultParameters(string? drivePath, string filename, int? driveSpeed, Dictionary<string, string?> options)
|
||||
protected override void SetDefaultParameters(string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
{
|
||||
// If we don't have a CD, DVD, HD-DVD, or BD, we can't dump using redumper
|
||||
if (this.Type != MediaType.CDROM
|
||||
&& this.Type != MediaType.DVD
|
||||
&& this.Type != MediaType.HDDVD
|
||||
&& this.Type != MediaType.BluRay)
|
||||
if (MediaType != SabreTools.RedumpLib.Data.MediaType.CDROM
|
||||
&& MediaType != SabreTools.RedumpLib.Data.MediaType.DVD
|
||||
&& MediaType != SabreTools.RedumpLib.Data.MediaType.HDDVD
|
||||
&& MediaType != SabreTools.RedumpLib.Data.MediaType.BluRay)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BaseCommand = CommandStrings.NONE;
|
||||
switch (this.Type)
|
||||
switch (MediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
ModeValues = this.System switch
|
||||
case SabreTools.RedumpLib.Data.MediaType.CDROM:
|
||||
ModeValues = RedumpSystem switch
|
||||
{
|
||||
RedumpSystem.SuperAudioCD => [CommandStrings.SACD],
|
||||
_ => [CommandStrings.CD],
|
||||
SabreTools.RedumpLib.Data.RedumpSystem.SuperAudioCD => [CommandStrings.SACD],
|
||||
_ => [CommandStrings.CD, CommandStrings.Skeleton],
|
||||
};
|
||||
break;
|
||||
case MediaType.DVD:
|
||||
case SabreTools.RedumpLib.Data.MediaType.DVD:
|
||||
ModeValues = [CommandStrings.DVD];
|
||||
break;
|
||||
case MediaType.HDDVD: // TODO: Keep in sync if another command string shows up
|
||||
case SabreTools.RedumpLib.Data.MediaType.HDDVD: // TODO: Keep in sync if another command string shows up
|
||||
ModeValues = [CommandStrings.DVD];
|
||||
break;
|
||||
case MediaType.BluRay:
|
||||
case SabreTools.RedumpLib.Data.MediaType.BluRay:
|
||||
ModeValues = [CommandStrings.BluRay];
|
||||
break;
|
||||
default:
|
||||
@@ -651,12 +662,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
return false;
|
||||
|
||||
// Now split the string into parts for easier validation
|
||||
// https://stackoverflow.com/questions/14655023/split-a-string-that-has-white-spaces-unless-they-are-enclosed-within-quotes
|
||||
parameters = parameters!.Trim();
|
||||
List<string> parts = Regex.Matches(parameters, @"([a-zA-Z\-]*=)?[\""].+?[\""]|[^ ]+", RegexOptions.Compiled)
|
||||
.Cast<Match>()
|
||||
.Select(m => m.Value)
|
||||
.ToList();
|
||||
List<string> parts = SplitParameterString(parameters!);
|
||||
|
||||
// Setup the modes
|
||||
ModeValues = [];
|
||||
@@ -683,12 +689,15 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
case CommandStrings.RefineNew: // Temporary command, to be removed later
|
||||
case CommandStrings.Verify:
|
||||
case CommandStrings.DVDKey:
|
||||
case CommandStrings.Eject:
|
||||
case CommandStrings.DVDIsoKey:
|
||||
case CommandStrings.Protection:
|
||||
case CommandStrings.Split:
|
||||
case CommandStrings.Hash:
|
||||
case CommandStrings.Info:
|
||||
case CommandStrings.Skeleton:
|
||||
case CommandStrings.Debug:
|
||||
//case CommandStrings.FixMSF:
|
||||
ModeValues.Add(part);
|
||||
break;
|
||||
|
||||
@@ -898,8 +907,8 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
}
|
||||
|
||||
// If the image name was not set, set it with a default value
|
||||
if (string.IsNullOrEmpty(this.ImageNameValue))
|
||||
this.ImageNameValue = "track";
|
||||
if (string.IsNullOrEmpty(ImageNameValue))
|
||||
ImageNameValue = "track";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public const string HelpShort = "-h";
|
||||
public const string Version = "--version";
|
||||
public const string Verbose = "--verbose";
|
||||
public const string AutoEject = "--auto-eject";
|
||||
public const string Debug = "--debug";
|
||||
public const string Drive = "--drive";
|
||||
public const string Speed = "--speed";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MPF.Frontend.ComboBoxItems
|
||||
{
|
||||
@@ -40,11 +39,10 @@ namespace MPF.Frontend.ComboBoxItems
|
||||
/// Generate all elements associated with the data enum type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Element<T>> GenerateElements()
|
||||
public static List<Element<T>> GenerateElements()
|
||||
{
|
||||
return Enum.GetValues(typeof(T))
|
||||
.OfType<T>()
|
||||
.Select(e => new Element<T>(e));
|
||||
var enumArr = (T[])Enum.GetValues(typeof(T));
|
||||
return [.. Array.ConvertAll(enumArr, e => new Element<T>(e))];
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.Frontend.ComboBoxItems
|
||||
@@ -50,13 +52,26 @@ namespace MPF.Frontend.ComboBoxItems
|
||||
/// Generate all elements for the known system combo box
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<RedumpSystemComboBoxItem> GenerateElements()
|
||||
public static List<RedumpSystemComboBoxItem> GenerateElements()
|
||||
{
|
||||
var knownSystems = Enum.GetValues(typeof(RedumpSystem))
|
||||
.OfType<RedumpSystem?>()
|
||||
.Where(s => !s.IsMarker() && s.GetCategory() != SystemCategory.NONE)
|
||||
.ToList();
|
||||
var enumArr = (RedumpSystem[])Enum.GetValues(typeof(RedumpSystem));
|
||||
var nullableArr = Array.ConvertAll(enumArr, s => (RedumpSystem?)s);
|
||||
var knownSystems = Array.FindAll(nullableArr,
|
||||
s => !s.IsMarker() && s.GetCategory() != SystemCategory.NONE);
|
||||
|
||||
#if NET20
|
||||
// The resulting dictionary does not have ordered value lists
|
||||
var mapping = new Dictionary<SystemCategory, List<RedumpSystem?>>();
|
||||
foreach (var knownSystem in knownSystems)
|
||||
{
|
||||
var category = knownSystem.GetCategory();
|
||||
if (!mapping.ContainsKey(category))
|
||||
mapping[category] = [];
|
||||
|
||||
mapping[category].Add(knownSystem);
|
||||
}
|
||||
#else
|
||||
// The resulting dictionary has ordered value lists
|
||||
Dictionary<SystemCategory, List<RedumpSystem?>> mapping = knownSystems
|
||||
.GroupBy(s => s.GetCategory())
|
||||
.ToDictionary(
|
||||
@@ -65,6 +80,7 @@ namespace MPF.Frontend.ComboBoxItems
|
||||
.OrderBy(s => s.LongName())
|
||||
.ToList()
|
||||
);
|
||||
#endif
|
||||
|
||||
var systemsValues = new List<RedumpSystemComboBoxItem>
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if NET462_OR_GREATER || NETCOREAPP
|
||||
using Microsoft.Management.Infrastructure;
|
||||
using Microsoft.Management.Infrastructure.Generic;
|
||||
@@ -136,26 +136,31 @@ namespace MPF.Frontend
|
||||
public static List<Drive> CreateListOfDrives(bool ignoreFixedDrives)
|
||||
{
|
||||
var drives = GetDriveList(ignoreFixedDrives);
|
||||
drives = [.. drives.OrderBy(i => i == null ? "\0" : i.Name)];
|
||||
return drives;
|
||||
drives.Sort((d1, d2) =>
|
||||
{
|
||||
string d1Name = d1?.Name == null ? "\0" : d1.Name;
|
||||
string d2Name = d2?.Name == null ? "\0" : d2.Name;
|
||||
return d1Name.CompareTo(d2Name);
|
||||
});
|
||||
return [.. drives];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current media type from drive letter
|
||||
/// </summary>
|
||||
/// <param name="system"></param>
|
||||
/// <returns></returns>
|
||||
public (MediaType?, string?) GetMediaType(RedumpSystem? system)
|
||||
/// <param name="system">Currently selected system</param>
|
||||
/// <returns>The detected media type, if possible</returns>
|
||||
public MediaType? GetMediaType(RedumpSystem? system)
|
||||
{
|
||||
// Take care of the non-optical stuff first
|
||||
switch (InternalDriveType)
|
||||
{
|
||||
case Frontend.InternalDriveType.Floppy:
|
||||
return (MediaType.FloppyDisk, null);
|
||||
return MediaType.FloppyDisk;
|
||||
case Frontend.InternalDriveType.HardDisk:
|
||||
return (MediaType.HardDisk, null);
|
||||
return MediaType.HardDisk;
|
||||
case Frontend.InternalDriveType.Removable:
|
||||
return (MediaType.FlashDrive, null);
|
||||
return MediaType.FlashDrive;
|
||||
}
|
||||
|
||||
// Some systems should default to certain media types
|
||||
@@ -168,18 +173,18 @@ namespace MPF.Frontend
|
||||
case RedumpSystem.SegaSaturn:
|
||||
case RedumpSystem.SonyPlayStation:
|
||||
case RedumpSystem.VideoCD:
|
||||
return (MediaType.CDROM, null);
|
||||
return MediaType.CDROM;
|
||||
|
||||
// DVD
|
||||
case RedumpSystem.DVDAudio:
|
||||
case RedumpSystem.DVDVideo:
|
||||
case RedumpSystem.MicrosoftXbox:
|
||||
case RedumpSystem.MicrosoftXbox360:
|
||||
return (MediaType.DVD, null);
|
||||
return MediaType.DVD;
|
||||
|
||||
// HD-DVD
|
||||
case RedumpSystem.HDDVDVideo:
|
||||
return (MediaType.HDDVD, null);
|
||||
return MediaType.HDDVD;
|
||||
|
||||
// Blu-ray
|
||||
case RedumpSystem.BDVideo:
|
||||
@@ -188,34 +193,34 @@ namespace MPF.Frontend
|
||||
case RedumpSystem.SonyPlayStation3:
|
||||
case RedumpSystem.SonyPlayStation4:
|
||||
case RedumpSystem.SonyPlayStation5:
|
||||
return (MediaType.BluRay, null);
|
||||
return MediaType.BluRay;
|
||||
|
||||
// GameCube
|
||||
case RedumpSystem.NintendoGameCube:
|
||||
return (MediaType.NintendoGameCubeGameDisc, null);
|
||||
return MediaType.NintendoGameCubeGameDisc;
|
||||
|
||||
// Wii
|
||||
case RedumpSystem.NintendoWii:
|
||||
return (MediaType.NintendoWiiOpticalDisc, null);
|
||||
return MediaType.NintendoWiiOpticalDisc;
|
||||
|
||||
// WiiU
|
||||
case RedumpSystem.NintendoWiiU:
|
||||
return (MediaType.NintendoWiiUOpticalDisc, null);
|
||||
return MediaType.NintendoWiiUOpticalDisc;
|
||||
|
||||
// PSP
|
||||
case RedumpSystem.SonyPlayStationPortable:
|
||||
return (MediaType.UMD, null);
|
||||
return MediaType.UMD;
|
||||
}
|
||||
|
||||
// Handle optical media by size and filesystem
|
||||
if (TotalSize >= 0 && TotalSize <= 800_000_000 && (DriveFormat == "CDFS" || DriveFormat == "UDF"))
|
||||
return (MediaType.CDROM, null);
|
||||
return MediaType.CDROM;
|
||||
else if (TotalSize > 800_000_000 && TotalSize <= 8_540_000_000 && (DriveFormat == "CDFS" || DriveFormat == "UDF"))
|
||||
return (MediaType.DVD, null);
|
||||
return MediaType.DVD;
|
||||
else if (TotalSize > 8_540_000_000)
|
||||
return (MediaType.BluRay, null);
|
||||
return MediaType.BluRay;
|
||||
|
||||
return (null, "Could not determine media type!");
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -223,7 +228,7 @@ namespace MPF.Frontend
|
||||
/// </summary>
|
||||
public void RefreshDrive()
|
||||
{
|
||||
var driveInfo = DriveInfo.GetDrives().FirstOrDefault(d => d?.Name == Name);
|
||||
var driveInfo = Array.Find(DriveInfo.GetDrives(), d => d?.Name == Name);
|
||||
PopulateFromDriveInfo(driveInfo);
|
||||
}
|
||||
|
||||
@@ -252,20 +257,18 @@ namespace MPF.Frontend
|
||||
// TODO: Reduce reliance on `DriveInfo`
|
||||
// https://github.com/aaru-dps/Aaru/blob/5164a154e2145941472f2ee0aeb2eff3338ecbb3/Aaru.Devices/Windows/ListDevices.cs#L66
|
||||
|
||||
// Create an output drive list
|
||||
var drives = new List<Drive>();
|
||||
// Create an output drive array
|
||||
Drive[] drives = [];
|
||||
|
||||
// Get all standard supported drive types
|
||||
try
|
||||
{
|
||||
drives = DriveInfo.GetDrives()
|
||||
.Where(d => desiredDriveTypes.Contains(d.DriveType))
|
||||
.Select(d => Create(ToInternalDriveType(d.DriveType), d.Name) ?? new Drive())
|
||||
.ToList();
|
||||
var filteredDrives = Array.FindAll(DriveInfo.GetDrives(), d => desiredDriveTypes.Contains(d.DriveType));
|
||||
drives = Array.ConvertAll(filteredDrives, d => Create(ToInternalDriveType(d.DriveType), d.Name) ?? new Drive());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return drives;
|
||||
return [.. drives];
|
||||
}
|
||||
|
||||
// Find and update all floppy drives
|
||||
@@ -282,7 +285,11 @@ namespace MPF.Frontend
|
||||
if (mediaType != null && ((mediaType > 0 && mediaType < 11) || (mediaType > 12 && mediaType < 22)))
|
||||
{
|
||||
char devId = (properties["Caption"].Value as string ?? string.Empty)[0];
|
||||
drives.ForEach(d => { if (d?.Name != null && d.Name[0] == devId) { d.InternalDriveType = Frontend.InternalDriveType.Floppy; } });
|
||||
Array.ForEach(drives, d =>
|
||||
{
|
||||
if (d?.Name != null && d.Name[0] == devId)
|
||||
d.InternalDriveType = Frontend.InternalDriveType.Floppy;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,7 +299,7 @@ namespace MPF.Frontend
|
||||
}
|
||||
#endif
|
||||
|
||||
return drives;
|
||||
return [.. drives];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
#if NET40
|
||||
using System.Threading;
|
||||
@@ -158,22 +157,22 @@ namespace MPF.Frontend
|
||||
if (programFound == null && _internalProgram != InternalProgram.Aaru)
|
||||
{
|
||||
var processor = new Processors.Aaru(_system, _type);
|
||||
(bool foundOtherFiles, _) = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (foundOtherFiles)
|
||||
var missingFiles = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (missingFiles.Count == 0)
|
||||
programFound = InternalProgram.Aaru;
|
||||
}
|
||||
if (programFound == null && _internalProgram != InternalProgram.DiscImageCreator)
|
||||
{
|
||||
var processor = new Processors.DiscImageCreator(_system, _type);
|
||||
(bool foundOtherFiles, _) = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (foundOtherFiles)
|
||||
var missingFiles = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (missingFiles.Count == 0)
|
||||
programFound = InternalProgram.DiscImageCreator;
|
||||
}
|
||||
if (programFound == null && _internalProgram != InternalProgram.Redumper)
|
||||
{
|
||||
var processor = new Processors.Redumper(_system, _type);
|
||||
(bool foundOtherFiles, _) = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (foundOtherFiles)
|
||||
var missingFiles = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (missingFiles.Count == 0)
|
||||
programFound = InternalProgram.Redumper;
|
||||
}
|
||||
|
||||
@@ -200,8 +199,8 @@ namespace MPF.Frontend
|
||||
// Set system, type, and drive
|
||||
if (_executionContext != null)
|
||||
{
|
||||
_executionContext.System = _system;
|
||||
_executionContext.Type = _type;
|
||||
_executionContext.RedumpSystem = _system;
|
||||
_executionContext.MediaType = _type;
|
||||
|
||||
// Set some parameters, if not already set
|
||||
OutputPath ??= _executionContext.OutputPath!;
|
||||
@@ -300,7 +299,7 @@ namespace MPF.Frontend
|
||||
if (_processor == null)
|
||||
return false;
|
||||
|
||||
return _processor.FoundAllFiles(outputDirectory, outputFilename).Item1;
|
||||
return _processor.FoundAllFiles(outputDirectory, outputFilename).Count == 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BaseExecutionContext.GetDefaultExtension(MediaType?)"/>
|
||||
@@ -424,7 +423,7 @@ namespace MPF.Frontend
|
||||
public async Task<ResultEventArgs> VerifyAndSaveDumpOutput(
|
||||
IProgress<ResultEventArgs>? resultProgress = null,
|
||||
IProgress<ProtectionProgress>? protectionProgress = null,
|
||||
Func<SubmissionInfo?, (bool?, SubmissionInfo?)>? processUserInfo = null,
|
||||
ProcessUserInfoDelegate? processUserInfo = null,
|
||||
SubmissionInfo? seedInfo = null)
|
||||
{
|
||||
if (_processor == null)
|
||||
@@ -437,8 +436,8 @@ namespace MPF.Frontend
|
||||
var outputFilename = Path.GetFileName(OutputPath);
|
||||
|
||||
// Check to make sure that the output had all the correct files
|
||||
(bool foundFiles, List<string> missingFiles) = _processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (!foundFiles)
|
||||
List<string> missingFiles = _processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (missingFiles.Count > 0)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Failure($"There were files missing from the output:\n{string.Join("\n", [.. missingFiles])}"));
|
||||
return ResultEventArgs.Failure("Error! Please check output directory as dump may be incomplete!");
|
||||
@@ -470,8 +469,7 @@ namespace MPF.Frontend
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Success("Waiting for additional disc information..."));
|
||||
|
||||
bool? filledInfo;
|
||||
(filledInfo, submissionInfo) = processUserInfo(submissionInfo);
|
||||
bool? filledInfo = processUserInfo(ref submissionInfo);
|
||||
|
||||
if (filledInfo == true)
|
||||
resultProgress?.Report(ResultEventArgs.Success("Additional disc information added!"));
|
||||
@@ -486,7 +484,7 @@ namespace MPF.Frontend
|
||||
|
||||
// Format the information for the text output
|
||||
resultProgress?.Report(ResultEventArgs.Success("Formatting information..."));
|
||||
(var formattedValues, var formatResult) = Formatter.FormatOutputData(submissionInfo, _options.EnableRedumpCompatibility);
|
||||
var formattedValues = Formatter.FormatOutputData(submissionInfo, _options.EnableRedumpCompatibility, out string? formatResult);
|
||||
if (formattedValues == null)
|
||||
resultProgress?.Report(ResultEventArgs.Failure(formatResult));
|
||||
else
|
||||
@@ -497,14 +495,14 @@ namespace MPF.Frontend
|
||||
|
||||
// Write the text output
|
||||
resultProgress?.Report(ResultEventArgs.Success("Writing submission information file..."));
|
||||
(bool txtSuccess, string txtResult) = WriteOutputData(outputDirectory, filenameSuffix, formattedValues);
|
||||
bool txtSuccess = WriteOutputData(outputDirectory, filenameSuffix, formattedValues, out string txtResult);
|
||||
if (txtSuccess)
|
||||
resultProgress?.Report(ResultEventArgs.Success(txtResult));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(txtResult));
|
||||
|
||||
// Write the copy protection output
|
||||
if (submissionInfo?.CopyProtection?.FullProtections != null && submissionInfo.CopyProtection.FullProtections.Any())
|
||||
if (submissionInfo?.CopyProtection?.FullProtections != null && submissionInfo.CopyProtection.FullProtections.Count > 0)
|
||||
{
|
||||
if (_options.ScanForProtection)
|
||||
{
|
||||
@@ -532,33 +530,47 @@ namespace MPF.Frontend
|
||||
if (_options.CompressLogFiles)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Success("Compressing log files..."));
|
||||
(bool compressSuccess, string compressResult) = _processor?.CompressLogFiles(outputDirectory, filenameSuffix, outputFilename) ?? (false, "No processor provided!");
|
||||
if (compressSuccess)
|
||||
resultProgress?.Report(ResultEventArgs.Success(compressResult));
|
||||
if (_processor == null)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Failure("No processor provided!"));
|
||||
}
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(compressResult));
|
||||
{
|
||||
bool compressSuccess = _processor.CompressLogFiles(outputDirectory, filenameSuffix, outputFilename, out string compressResult);
|
||||
if (compressSuccess)
|
||||
resultProgress?.Report(ResultEventArgs.Success(compressResult));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(compressResult));
|
||||
}
|
||||
}
|
||||
|
||||
// Delete unnecessary files, if required
|
||||
if (_options.DeleteUnnecessaryFiles)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Success("Deleting unnecessary files..."));
|
||||
(bool deleteSuccess, string deleteResult) = _processor?.DeleteUnnecessaryFiles(outputDirectory, outputFilename) ?? (false, "No processor provided!");
|
||||
if (deleteSuccess)
|
||||
resultProgress?.Report(ResultEventArgs.Success(deleteResult));
|
||||
if (_processor == null)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Failure("No processor provided!"));
|
||||
}
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(deleteResult));
|
||||
{
|
||||
bool deleteSuccess = _processor.DeleteUnnecessaryFiles(outputDirectory, outputFilename, out string deleteResult);
|
||||
if (deleteSuccess)
|
||||
resultProgress?.Report(ResultEventArgs.Success(deleteResult));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(deleteResult));
|
||||
}
|
||||
}
|
||||
|
||||
// Create PS3 IRD, if required
|
||||
if (_options.CreateIRDAfterDumping && _system == RedumpSystem.SonyPlayStation3 && _type == MediaType.BluRay)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Success("Creating IRD... please wait!"));
|
||||
(bool deleteSuccess, string deleteResult) = await WriteIRD(OutputPath, submissionInfo?.Extras?.DiscKey, submissionInfo?.Extras?.DiscID, submissionInfo?.Extras?.PIC, submissionInfo?.SizeAndChecksums?.Layerbreak, submissionInfo?.SizeAndChecksums?.CRC32);
|
||||
bool deleteSuccess = await WriteIRD(OutputPath, submissionInfo?.Extras?.DiscKey, submissionInfo?.Extras?.DiscID, submissionInfo?.Extras?.PIC, submissionInfo?.SizeAndChecksums?.Layerbreak, submissionInfo?.SizeAndChecksums?.CRC32);
|
||||
if (deleteSuccess)
|
||||
resultProgress?.Report(ResultEventArgs.Success(deleteResult));
|
||||
resultProgress?.Report(ResultEventArgs.Success("IRD created!"));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(deleteResult));
|
||||
resultProgress?.Report(ResultEventArgs.Failure("Failed to create IRD"));
|
||||
}
|
||||
|
||||
resultProgress?.Report(ResultEventArgs.Success("Submission information process complete!"));
|
||||
@@ -626,11 +638,14 @@ namespace MPF.Frontend
|
||||
/// <param name="filenameSuffix">Optional suffix to append to the filename</param>
|
||||
/// <param name="lines">Preformatted list of lines to write out to the file</param>
|
||||
/// <returns>True on success, false on error</returns>
|
||||
private static (bool, string) WriteOutputData(string? outputDirectory, string? filenameSuffix, List<string>? lines)
|
||||
private static bool WriteOutputData(string? outputDirectory, string? filenameSuffix, List<string>? lines, out string status)
|
||||
{
|
||||
// Check to see if the inputs are valid
|
||||
if (lines == null)
|
||||
return (false, "No formatted data found to write!");
|
||||
{
|
||||
status = "No formatted data found to write!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now write out to a generic file
|
||||
try
|
||||
@@ -654,10 +669,12 @@ namespace MPF.Frontend
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return (false, $"Writing could not complete: {ex}");
|
||||
status = $"Writing could not complete: {ex}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return (true, "Writing complete!");
|
||||
status = "Writing complete!";
|
||||
return true;
|
||||
}
|
||||
|
||||
// MOVE TO REDUMPLIB
|
||||
@@ -737,7 +754,7 @@ namespace MPF.Frontend
|
||||
private static bool WriteProtectionData(string? outputDirectory, string? filenameSuffix, SubmissionInfo? info, bool hideDriveLetters)
|
||||
{
|
||||
// Check to see if the inputs are valid
|
||||
if (info?.CopyProtection?.FullProtections == null || !info.CopyProtection.FullProtections.Any())
|
||||
if (info?.CopyProtection?.FullProtections == null || info.CopyProtection.FullProtections.Count == 0)
|
||||
return true;
|
||||
|
||||
// Now write out to a generic file
|
||||
@@ -755,7 +772,9 @@ namespace MPF.Frontend
|
||||
|
||||
using var sw = new StreamWriter(File.Open(path, FileMode.Create, FileAccess.Write), Encoding.UTF8);
|
||||
|
||||
List<string> sortedKeys = [.. info.CopyProtection.FullProtections.Keys.OrderBy(k => k)];
|
||||
List<string> sortedKeys = [.. info.CopyProtection.FullProtections.Keys];
|
||||
sortedKeys.Sort();
|
||||
|
||||
foreach (string key in sortedKeys)
|
||||
{
|
||||
string scanPath = key;
|
||||
@@ -786,7 +805,12 @@ namespace MPF.Frontend
|
||||
/// <param name="filenameSuffix">Optional suffix to append to the filename</param>
|
||||
/// <param name="outputFilename">Output filename to use as the base path</param>
|
||||
/// <returns>True on success, false on error</returns>
|
||||
private static async Task<(bool, string)> WriteIRD(string isoPath, string? discKeyString, string? discIDString, string? picString, long? layerbreak, string? crc32)
|
||||
private static async Task<bool> WriteIRD(string isoPath,
|
||||
string? discKeyString,
|
||||
string? discIDString,
|
||||
string? picString,
|
||||
long? layerbreak,
|
||||
string? crc32)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -796,7 +820,7 @@ namespace MPF.Frontend
|
||||
// Parse disc key from submission info (Required)
|
||||
byte[]? discKey = ProcessingTool.ParseHexKey(discKeyString);
|
||||
if (discKey == null)
|
||||
return (false, "Failed to create IRD: No key provided");
|
||||
return false;
|
||||
|
||||
// Parse Disc ID from submission info (Optional)
|
||||
byte[]? discID = ProcessingTool.ParseDiscID(discIDString);
|
||||
@@ -825,12 +849,12 @@ namespace MPF.Frontend
|
||||
// Write IRD to file
|
||||
ird.Write(irdPath);
|
||||
|
||||
return (true, "IRD created!");
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// We don't care what the error is
|
||||
return (false, "Failed to create IRD");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.Frontend
|
||||
@@ -17,34 +16,34 @@ namespace MPF.Frontend
|
||||
/// <summary>
|
||||
/// Set of accepted speeds for CD and GD media
|
||||
/// </summary>
|
||||
public static IList<int> CD => _speedValues.Where(s => s <= 72).ToList();
|
||||
public static List<int> CD => _speedValues.FindAll(s => s <= 72);
|
||||
|
||||
/// <summary>
|
||||
/// Set of accepted speeds for DVD media
|
||||
/// </summary>
|
||||
public static IList<int> DVD => _speedValues.Where(s => s <= 24).ToList();
|
||||
public static List<int> DVD => _speedValues.FindAll(s => s <= 24);
|
||||
|
||||
/// <summary>
|
||||
/// Set of accepted speeds for HD-DVD media
|
||||
/// </summary>
|
||||
public static IList<int> HDDVD => _speedValues.Where(s => s <= 24).ToList();
|
||||
public static List<int> HDDVD => _speedValues.FindAll(s => s <= 24);
|
||||
|
||||
/// <summary>
|
||||
/// Set of accepted speeds for BD media
|
||||
/// </summary>
|
||||
public static IList<int> BD => _speedValues.Where(s => s <= 16).ToList();
|
||||
public static List<int> BD => _speedValues.FindAll(s => s <= 16);
|
||||
|
||||
/// <summary>
|
||||
/// Set of accepted speeds for all other media
|
||||
/// </summary>
|
||||
public static IList<int> Unknown => _speedValues.Where(s => s <= 1).ToList();
|
||||
public static List<int> Unknown => _speedValues.FindAll(s => s <= 1);
|
||||
|
||||
/// <summary>
|
||||
/// Get list of all drive speeds for a given MediaType
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType? that represents the current item</param>
|
||||
/// <returns>Read-only list of drive speeds</returns>
|
||||
public static IList<int> GetSpeedsForMediaType(MediaType? type)
|
||||
public static List<int> GetSpeedsForMediaType(MediaType? type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>NU1902;NU1903</NoWarn>
|
||||
<Nullable>enable</Nullable>
|
||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<VersionPrefix>3.2.2</VersionPrefix>
|
||||
<VersionPrefix>3.2.4</VersionPrefix>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski;ReignStumble;Jakz</Authors>
|
||||
@@ -24,50 +25,27 @@
|
||||
<InternalsVisibleTo Include="MPF.Test" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Support All Frameworks -->
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net4`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MPF.ExecutionContexts\MPF.ExecutionContexts.csproj" />
|
||||
<ProjectReference Include="..\MPF.Processors\MPF.Processors.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Support for old .NET versions -->
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="MinAsyncBridge" Version="0.12.4" />
|
||||
<PackageReference Include="MinTasksExtensionsBridge" Version="0.3.4" />
|
||||
<PackageReference Include="MinThreadingBridge" Version="0.11.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`)) AND !$(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="IndexRange" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net452`))">
|
||||
<PackageReference Include="Microsoft.Net.Http" Version="2.2.29" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))">
|
||||
<PackageReference Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.1.13" GeneratePathProperty="true">
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.2.3" GeneratePathProperty="true">
|
||||
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="LibIRD" Version="0.9.1" />
|
||||
<PackageReference Include="LibIRD" Version="0.9.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.4.1" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -671,7 +671,7 @@ namespace MPF.Frontend
|
||||
/// <param name="settings"></param>
|
||||
public Options(Dictionary<string, string?>? settings = null)
|
||||
{
|
||||
this.Settings = settings ?? [];
|
||||
Settings = settings ?? [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -688,8 +688,8 @@ namespace MPF.Frontend
|
||||
/// </summary>
|
||||
public string? this[string key]
|
||||
{
|
||||
get => this.Settings[key];
|
||||
set => this.Settings[key] = value;
|
||||
get => Settings[key];
|
||||
set => Settings[key] = value;
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
11
MPF.Frontend/ProcessUserInfoDelegate.cs
Normal file
11
MPF.Frontend/ProcessUserInfoDelegate.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.Frontend
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines how user information is processed, if at all
|
||||
/// </summary>
|
||||
/// <param name="info">Submission info that may be overwritten</param>
|
||||
/// <returns>True for successful updating, false or null otherwise</returns>
|
||||
public delegate bool? ProcessUserInfoDelegate(ref SubmissionInfo? info);
|
||||
}
|
||||
@@ -32,11 +32,7 @@ namespace MPF.Frontend
|
||||
|
||||
public ProcessingQueue(Action<T> customProcessing)
|
||||
{
|
||||
#if NET20 || NET35
|
||||
_internalQueue = new Queue<T>();
|
||||
#else
|
||||
_internalQueue = new ConcurrentQueue<T>();
|
||||
#endif
|
||||
_internalQueue = [];
|
||||
_customProcessing = customProcessing;
|
||||
_tokenSource = new CancellationTokenSource();
|
||||
#if NET20 || NET35
|
||||
@@ -72,11 +68,7 @@ namespace MPF.Frontend
|
||||
while (true)
|
||||
{
|
||||
// Nothing in the queue means we get to idle
|
||||
#if NET20 || NET35
|
||||
if (_internalQueue.Count == 0)
|
||||
#else
|
||||
if (_internalQueue.IsEmpty)
|
||||
#endif
|
||||
{
|
||||
if (_tokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
@@ -115,7 +114,7 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
|
||||
// If we didn't already try English, try it now
|
||||
if (!languages.Contains(Language.English))
|
||||
if (!Array.Exists(languages, l => l == Language.English))
|
||||
return NormalizeDiscTitle(title, Language.English);
|
||||
|
||||
// If all fails, then the title didn't need normalization
|
||||
@@ -143,7 +142,7 @@ namespace MPF.Frontend.Tools
|
||||
language = Language.English;
|
||||
|
||||
// Get the title split into parts
|
||||
string[] splitTitle = title!.Split(' ').Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
string[] splitTitle = Array.FindAll(title!.Split(' '), s => !string.IsNullOrEmpty(s));
|
||||
|
||||
// If we only have one part, we can't do anything
|
||||
if (splitTitle.Length <= 1)
|
||||
@@ -561,32 +560,37 @@ namespace MPF.Frontend.Tools
|
||||
/// String representing the message to display the the user.
|
||||
/// String representing the new release URL.
|
||||
/// </returns>
|
||||
public static (bool different, string message, string? url) CheckForNewVersion()
|
||||
public static void CheckForNewVersion(out bool different, out string message, out string? url)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get current assembly version
|
||||
var assemblyVersion = Assembly.GetEntryAssembly()?.GetName()?.Version;
|
||||
if (assemblyVersion == null)
|
||||
return (false, "Assembly version could not be determined", null);
|
||||
{
|
||||
different = false;
|
||||
message = "Assembly version could not be determined";
|
||||
url = null;
|
||||
return;
|
||||
}
|
||||
|
||||
string version = $"{assemblyVersion.Major}.{assemblyVersion.Minor}.{assemblyVersion.Build}";
|
||||
|
||||
// Get the latest tag from GitHub
|
||||
var (tag, url) = GetRemoteVersionAndUrl();
|
||||
bool different = version != tag && tag != null;
|
||||
_ = GetRemoteVersionAndUrl(out string? tag, out url);
|
||||
different = version != tag && tag != null;
|
||||
|
||||
string message = $"Local version: {version}"
|
||||
message = $"Local version: {version}"
|
||||
+ $"{Environment.NewLine}Remote version: {tag}"
|
||||
+ (different
|
||||
? $"{Environment.NewLine}The update URL has been added copied to your clipboard"
|
||||
: $"{Environment.NewLine}You have the newest version!");
|
||||
|
||||
return (different, message, url);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return (false, ex.ToString(), null);
|
||||
different = false;
|
||||
message = ex.ToString();
|
||||
url = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,11 +617,12 @@ namespace MPF.Frontend.Tools
|
||||
/// <summary>
|
||||
/// Get the latest version of MPF from GitHub and the release URL
|
||||
/// </summary>
|
||||
private static (string? tag, string? url) GetRemoteVersionAndUrl()
|
||||
private static bool GetRemoteVersionAndUrl(out string? tag, out string? url)
|
||||
{
|
||||
tag = null; url = null;
|
||||
#if NET20 || NET35 || NET40
|
||||
// Not supported in .NET Frameworks 2.0, 3.5, or 4.0
|
||||
return (null, null);
|
||||
return false;
|
||||
#else
|
||||
using var hc = new System.Net.Http.HttpClient();
|
||||
#if NET452
|
||||
@@ -625,22 +630,22 @@ namespace MPF.Frontend.Tools
|
||||
#endif
|
||||
|
||||
// TODO: Figure out a better way than having this hardcoded...
|
||||
string url = "https://api.github.com/repos/SabreTools/MPF/releases/latest";
|
||||
var message = new System.Net.Http.HttpRequestMessage(System.Net.Http.HttpMethod.Get, url);
|
||||
string releaseUrl = "https://api.github.com/repos/SabreTools/MPF/releases/latest";
|
||||
var message = new System.Net.Http.HttpRequestMessage(System.Net.Http.HttpMethod.Get, releaseUrl);
|
||||
message.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0");
|
||||
var latestReleaseJsonString = hc.SendAsync(message)?.ConfigureAwait(false).GetAwaiter().GetResult()
|
||||
.Content?.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
if (latestReleaseJsonString == null)
|
||||
return (null, null);
|
||||
return false;
|
||||
|
||||
var latestReleaseJson = Newtonsoft.Json.Linq.JObject.Parse(latestReleaseJsonString);
|
||||
if (latestReleaseJson == null)
|
||||
return (null, null);
|
||||
return false;
|
||||
|
||||
var latestTag = latestReleaseJson["tag_name"]?.ToString();
|
||||
var releaseUrl = latestReleaseJson["html_url"]?.ToString();
|
||||
tag = latestReleaseJson["tag_name"]?.ToString();
|
||||
url = latestReleaseJson["html_url"]?.ToString();
|
||||
|
||||
return (latestTag, releaseUrl);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
// Help options
|
||||
if (args.Length == 0 || args[0] == "-h" || args[0] == "-?")
|
||||
return false;
|
||||
return null;
|
||||
|
||||
// List options
|
||||
if (args[0] == "-lc" || args[0] == "--listcodes")
|
||||
@@ -38,7 +38,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
Console.WriteLine(siteCode);
|
||||
}
|
||||
Console.ReadLine();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (args[0] == "-lm" || args[0] == "--listmedia")
|
||||
@@ -48,7 +48,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
Console.WriteLine(mediaType);
|
||||
}
|
||||
Console.ReadLine();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (args[0] == "-lp" || args[0] == "--listprograms")
|
||||
@@ -58,7 +58,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
Console.WriteLine(program);
|
||||
}
|
||||
Console.ReadLine();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (args[0] == "-ls" || args[0] == "--listsystems")
|
||||
@@ -68,7 +68,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
Console.WriteLine(system);
|
||||
}
|
||||
Console.ReadLine();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,23 +79,36 @@ namespace MPF.Frontend.Tools
|
||||
/// Process common arguments for all functionality
|
||||
/// </summary>
|
||||
/// <returns>True if all arguments pass, false otherwise</returns>
|
||||
public static (bool, MediaType, RedumpSystem?, string?) ProcessCommonArguments(string[] args)
|
||||
public static bool ProcessCommonArguments(string[] args, out MediaType mediaType, out RedumpSystem? system, out string? message)
|
||||
{
|
||||
// All other use requires at least 3 arguments
|
||||
if (args.Length < 3)
|
||||
return (false, MediaType.NONE, null, "Invalid number of arguments");
|
||||
{
|
||||
mediaType = MediaType.NONE;
|
||||
system = null;
|
||||
message = "Invalid number of arguments";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the MediaType
|
||||
var mediaType = ToMediaType(args[0].Trim('"'));
|
||||
mediaType = ToMediaType(args[0].Trim('"'));
|
||||
if (mediaType == MediaType.NONE)
|
||||
return (false, MediaType.NONE, null, $"{args[0]} is not a recognized media type");
|
||||
{
|
||||
system = null;
|
||||
message = $"{args[0]} is not a recognized media type";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the RedumpSystem
|
||||
var knownSystem = Extensions.ToRedumpSystem(args[1].Trim('"'));
|
||||
if (knownSystem == null)
|
||||
return (false, MediaType.NONE, null, $"{args[1]} is not a recognized system");
|
||||
system = Extensions.ToRedumpSystem(args[1].Trim('"'));
|
||||
if (system == null)
|
||||
{
|
||||
message = $"{args[1]} is not a recognized system";
|
||||
return false;
|
||||
}
|
||||
|
||||
return (true, mediaType, knownSystem, null);
|
||||
message = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
@@ -576,7 +575,7 @@ namespace MPF.Frontend.Tools
|
||||
try
|
||||
{
|
||||
var files = Directory.GetFiles(msxc, "*", SearchOption.TopDirectoryOnly);
|
||||
var filenames = files.Select(Path.GetFileName).ToArray();
|
||||
var filenames = Array.ConvertAll(files, Path.GetFileName);
|
||||
return string.Join("\n", filenames);
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -1,37 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using BinaryObjectScanner;
|
||||
|
||||
#pragma warning disable SYSLIB1045 // Convert to 'GeneratedRegexAttribute'.
|
||||
using SabreTools.IO.Extensions;
|
||||
|
||||
namespace MPF.Frontend.Tools
|
||||
{
|
||||
public static class ProtectionTool
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the current detected copy protection(s), if possible
|
||||
/// </summary>
|
||||
/// <param name="drive">Drive object representing the current drive</param>
|
||||
/// <param name="options">Options object that determines what to scan</param>
|
||||
/// <param name="progress">Optional progress callback</param>
|
||||
/// <returns>Detected copy protection(s) if possible, null on error</returns>
|
||||
public static async Task<(string?, Dictionary<string, List<string>>?)> GetCopyProtection(Drive? drive,
|
||||
Frontend.Options options,
|
||||
IProgress<ProtectionProgress>? progress = null)
|
||||
{
|
||||
if (options.ScanForProtection && drive?.Name != null)
|
||||
{
|
||||
(var protection, _) = await RunProtectionScanOnPath(drive.Name, options, progress);
|
||||
return (FormatProtections(protection), protection);
|
||||
}
|
||||
|
||||
return ("(CHECK WITH PROTECTIONID)", null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run protection scan on a given path
|
||||
/// </summary>
|
||||
@@ -39,68 +20,37 @@ namespace MPF.Frontend.Tools
|
||||
/// <param name="options">Options object that determines what to scan</param>
|
||||
/// <param name="progress">Optional progress callback</param>
|
||||
/// <returns>Set of all detected copy protections with an optional error string</returns>
|
||||
public static async Task<(Dictionary<string, List<string>>?, string?)> RunProtectionScanOnPath(string path,
|
||||
public static async Task<ProtectionDictionary> RunProtectionScanOnPath(string path,
|
||||
Frontend.Options options,
|
||||
IProgress<ProtectionProgress>? progress = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
#if NET40
|
||||
var found = await Task.Factory.StartNew(() =>
|
||||
{
|
||||
var scanner = new Scanner(
|
||||
options.ScanArchivesForProtection,
|
||||
scanContents: true, // Hardcoded value to avoid issues
|
||||
scanGameEngines: false, // Hardcoded value to avoid issues
|
||||
options.ScanPackersForProtection,
|
||||
scanPaths: true, // Hardcoded value to avoid issues
|
||||
options.IncludeDebugProtectionInformation,
|
||||
progress);
|
||||
|
||||
return scanner.GetProtections(path);
|
||||
});
|
||||
var found = await Task.Factory.StartNew(() =>
|
||||
#else
|
||||
var found = await Task.Run(() =>
|
||||
{
|
||||
var scanner = new Scanner(
|
||||
options.ScanArchivesForProtection,
|
||||
scanContents: true, // Hardcoded value to avoid issues
|
||||
scanGameEngines: false, // Hardcoded value to avoid issues
|
||||
options.ScanPackersForProtection,
|
||||
scanPaths: true, // Hardcoded value to avoid issues
|
||||
options.IncludeDebugProtectionInformation,
|
||||
progress);
|
||||
|
||||
return scanner.GetProtections(path);
|
||||
});
|
||||
var found = await Task.Run(() =>
|
||||
#endif
|
||||
|
||||
// If nothing was returned, return
|
||||
#if NET20 || NET35
|
||||
if (found == null || found.Count == 0)
|
||||
#else
|
||||
if (found == null || found.IsEmpty)
|
||||
#endif
|
||||
return (null, null);
|
||||
|
||||
// Filter out any empty protections
|
||||
var filteredProtections = found
|
||||
#if NET20 || NET35
|
||||
.Where(kvp => kvp.Value != null && kvp.Value.Count > 0)
|
||||
#else
|
||||
.Where(kvp => kvp.Value != null && !kvp.Value.IsEmpty)
|
||||
#endif
|
||||
.ToDictionary(
|
||||
kvp => kvp.Key,
|
||||
kvp => kvp.Value.OrderBy(s => s).ToList());
|
||||
|
||||
// Return the filtered set of protections
|
||||
return (filteredProtections, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return (null, ex.ToString());
|
||||
}
|
||||
var scanner = new Scanner(
|
||||
options.ScanArchivesForProtection,
|
||||
scanContents: true, // Hardcoded value to avoid issues
|
||||
scanGameEngines: false, // Hardcoded value to avoid issues
|
||||
options.ScanPackersForProtection,
|
||||
scanPaths: true, // Hardcoded value to avoid issues
|
||||
options.IncludeDebugProtectionInformation,
|
||||
progress);
|
||||
|
||||
return scanner.GetProtections(path);
|
||||
});
|
||||
|
||||
// If nothing was returned, return
|
||||
if (found == null || found.Count == 0)
|
||||
return [];
|
||||
|
||||
// Filter out any empty protections
|
||||
found.ClearEmptyKeys();
|
||||
|
||||
// Return the filtered set of protections
|
||||
return found;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,20 +58,37 @@ namespace MPF.Frontend.Tools
|
||||
/// </summary>
|
||||
/// <param name="protections">Dictionary of file to list of protection mappings</param>
|
||||
/// <returns>Detected protections, if any</returns>
|
||||
public static string? FormatProtections(Dictionary<string, List<string>>? protections)
|
||||
public static string? FormatProtections(ProtectionDictionary? protections)
|
||||
{
|
||||
// If the filtered list is empty in some way, return
|
||||
if (protections == null || !protections.Any())
|
||||
if (protections == null)
|
||||
return "(CHECK WITH PROTECTIONID)";
|
||||
else if (protections.Count == 0)
|
||||
return "None found [OMIT FROM SUBMISSION]";
|
||||
|
||||
// Get an ordered list of distinct found protections
|
||||
var orderedDistinctProtections = protections
|
||||
// Get a list of distinct found protections
|
||||
#if NET20
|
||||
var protectionValues = new List<string>();
|
||||
foreach (var value in protections.Values)
|
||||
{
|
||||
if (value.Count == 0)
|
||||
continue;
|
||||
|
||||
foreach (var prot in value)
|
||||
{
|
||||
if (!protectionValues.Contains(prot))
|
||||
protectionValues.Add(prot);
|
||||
}
|
||||
}
|
||||
#else
|
||||
var protectionValues = protections
|
||||
.SelectMany(kvp => kvp.Value)
|
||||
.Distinct()
|
||||
.OrderBy(p => p);
|
||||
.ToList();
|
||||
#endif
|
||||
|
||||
// Sanitize and join protections for writing
|
||||
string protectionString = SanitizeFoundProtections(orderedDistinctProtections);
|
||||
string protectionString = SanitizeFoundProtections(protectionValues);
|
||||
if (string.IsNullOrEmpty(protectionString))
|
||||
return "None found [OMIT FROM SUBMISSION]";
|
||||
|
||||
@@ -141,37 +108,14 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
#if NET40
|
||||
return await Task.Factory.StartNew(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var antiModchip = new BinaryObjectScanner.Protection.PSXAntiModchip();
|
||||
foreach (string file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] fileContent = File.ReadAllBytes(file);
|
||||
var protection = antiModchip.CheckContents(file, fileContent, false);
|
||||
if (!string.IsNullOrEmpty(protection))
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
return false;
|
||||
});
|
||||
#else
|
||||
return await Task.Run(() =>
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
var antiModchip = new BinaryObjectScanner.Protection.PSXAntiModchip();
|
||||
#if NET20 || NET35
|
||||
foreach (string file in Directory.GetFiles(path, "*", SearchOption.AllDirectories))
|
||||
#else
|
||||
foreach (string file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories))
|
||||
#endif
|
||||
foreach (string file in IOExtensions.SafeGetFiles(path!, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -187,86 +131,99 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
return false;
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sanitize unnecessary protection duplication from output
|
||||
/// </summary>
|
||||
/// <param name="foundProtections">Enumerable of found protections</param>
|
||||
public static string SanitizeFoundProtections(IEnumerable<string> foundProtections)
|
||||
public static string SanitizeFoundProtections(List<string> foundProtections)
|
||||
{
|
||||
// EXCEPTIONS
|
||||
if (foundProtections.Any(p => p.StartsWith("[Exception opening file")))
|
||||
if (foundProtections.Exists(p => p.StartsWith("[Exception opening file")))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("[Exception opening file"));
|
||||
#if NET20 || NET35 || NET40 || NET452 || NET462
|
||||
var tempList = new List<string> { "Exception occurred while scanning [RESCAN NEEDED]" };
|
||||
tempList.AddRange(foundProtections);
|
||||
foundProtections = tempList.OrderBy(p => p);
|
||||
#else
|
||||
foundProtections = foundProtections
|
||||
.Prepend("Exception occurred while scanning [RESCAN NEEDED]")
|
||||
.OrderBy(p => p);
|
||||
#endif
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("[Exception opening file"));
|
||||
foundProtections.Add("Exception occurred while scanning [RESCAN NEEDED]");
|
||||
}
|
||||
|
||||
// ActiveMARK
|
||||
if (foundProtections.Any(p => p == "ActiveMARK 5") && foundProtections.Any(p => p == "ActiveMARK"))
|
||||
foundProtections = foundProtections.Where(p => p != "ActiveMARK");
|
||||
if (foundProtections.Exists(p => p == "ActiveMARK 5")
|
||||
&& foundProtections.Exists(p => p == "ActiveMARK"))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "ActiveMARK");
|
||||
}
|
||||
|
||||
// Cactus Data Shield
|
||||
if (foundProtections.Any(p => Regex.IsMatch(p, @"Cactus Data Shield [0-9]{3} .+", RegexOptions.Compiled)) && foundProtections.Any(p => p == "Cactus Data Shield 200"))
|
||||
foundProtections = foundProtections.Where(p => p != "Cactus Data Shield 200");
|
||||
if (foundProtections.Exists(p => Regex.IsMatch(p, @"Cactus Data Shield [0-9]{3} .+", RegexOptions.Compiled))
|
||||
&& foundProtections.Exists(p => p == "Cactus Data Shield 200"))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "Cactus Data Shield 200");
|
||||
}
|
||||
|
||||
// CD-Check
|
||||
foundProtections = foundProtections.Where(p => p != "Executable-Based CD Check");
|
||||
foundProtections = foundProtections.FindAll(p => p != "Executable-Based CD Check");
|
||||
|
||||
// CD-Cops
|
||||
if (foundProtections.Any(p => p == "CD-Cops") && foundProtections.Any(p => p.StartsWith("CD-Cops") && p.Length > "CD-Cops".Length))
|
||||
foundProtections = foundProtections.Where(p => p != "CD-Cops");
|
||||
if (foundProtections.Exists(p => p == "CD-Cops") && foundProtections.Exists(p => p.StartsWith("CD-Cops") && p.Length > "CD-Cops".Length))
|
||||
foundProtections = foundProtections.FindAll(p => p != "CD-Cops");
|
||||
|
||||
// CD-Key / Serial
|
||||
foundProtections = foundProtections.Where(p => p != "CD-Key / Serial");
|
||||
foundProtections = foundProtections.FindAll(p => p != "CD-Key / Serial");
|
||||
|
||||
// Electronic Arts
|
||||
if (foundProtections.Any(p => p == "EA CdKey Registration Module") && foundProtections.Any(p => p.StartsWith("EA CdKey Registration Module") && p.Length > "EA CdKey Registration Module".Length))
|
||||
foundProtections = foundProtections.Where(p => p != "EA CdKey Registration Module");
|
||||
if (foundProtections.Any(p => p == "EA DRM Protection") && foundProtections.Any(p => p.StartsWith("EA DRM Protection") && p.Length > "EA DRM Protection".Length))
|
||||
foundProtections = foundProtections.Where(p => p != "EA DRM Protection");
|
||||
if (foundProtections.Exists(p => p == "EA CdKey Registration Module")
|
||||
&& foundProtections.Exists(p => p.StartsWith("EA CdKey Registration Module")
|
||||
&& p.Length > "EA CdKey Registration Module".Length))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "EA CdKey Registration Module");
|
||||
}
|
||||
if (foundProtections.Exists(p => p == "EA DRM Protection")
|
||||
&& foundProtections.Exists(p => p.StartsWith("EA DRM Protection")
|
||||
&& p.Length > "EA DRM Protection".Length))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "EA DRM Protection");
|
||||
}
|
||||
|
||||
// Games for Windows LIVE
|
||||
if (foundProtections.Any(p => p == "Games for Windows LIVE") && foundProtections.Any(p => p.StartsWith("Games for Windows LIVE") && !p.Contains("Zero Day Piracy Protection") && p.Length > "Games for Windows LIVE".Length))
|
||||
foundProtections = foundProtections.Where(p => p != "Games for Windows LIVE");
|
||||
if (foundProtections.Exists(p => p == "Games for Windows LIVE")
|
||||
&& foundProtections.Exists(p => p.StartsWith("Games for Windows LIVE")
|
||||
&& !p.Contains("Zero Day Piracy Protection")
|
||||
&& p.Length > "Games for Windows LIVE".Length))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "Games for Windows LIVE");
|
||||
}
|
||||
|
||||
// Impulse Reactor
|
||||
if (foundProtections.Any(p => p.StartsWith("Impulse Reactor Core Module")) && foundProtections.Any(p => p == "Impulse Reactor"))
|
||||
foundProtections = foundProtections.Where(p => p != "Impulse Reactor");
|
||||
if (foundProtections.Exists(p => p.StartsWith("Impulse Reactor Core Module"))
|
||||
&& foundProtections.Exists(p => p == "Impulse Reactor"))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "Impulse Reactor");
|
||||
}
|
||||
|
||||
// JoWood X-Prot
|
||||
if (foundProtections.Any(p => p.StartsWith("JoWood X-Prot")))
|
||||
if (foundProtections.Exists(p => p.StartsWith("JoWood X-Prot")))
|
||||
{
|
||||
if (foundProtections.Any(p => Regex.IsMatch(p, @"JoWood X-Prot [0-9]\.[0-9]\.[0-9]\.[0-9]{2}", RegexOptions.Compiled)))
|
||||
if (foundProtections.Exists(p => Regex.IsMatch(p, @"JoWood X-Prot [0-9]\.[0-9]\.[0-9]\.[0-9]{2}", RegexOptions.Compiled)))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "JoWood X-Prot")
|
||||
.Where(p => p != "JoWood X-Prot v1.0-v1.3")
|
||||
.Where(p => p != "JoWood X-Prot v1.4+")
|
||||
.Where(p => p != "JoWood X-Prot v2");
|
||||
foundProtections = foundProtections.FindAll(p => p != "JoWood X-Prot")
|
||||
.FindAll(p => p != "JoWood X-Prot v1.0-v1.3")
|
||||
.FindAll(p => p != "JoWood X-Prot v1.4+")
|
||||
.FindAll(p => p != "JoWood X-Prot v2");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "JoWood X-Prot v2"))
|
||||
else if (foundProtections.Exists(p => p == "JoWood X-Prot v2"))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "JoWood X-Prot")
|
||||
.Where(p => p != "JoWood X-Prot v1.0-v1.3")
|
||||
.Where(p => p != "JoWood X-Prot v1.4+");
|
||||
foundProtections = foundProtections.FindAll(p => p != "JoWood X-Prot")
|
||||
.FindAll(p => p != "JoWood X-Prot v1.0-v1.3")
|
||||
.FindAll(p => p != "JoWood X-Prot v1.4+");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "JoWood X-Prot v1.4+"))
|
||||
else if (foundProtections.Exists(p => p == "JoWood X-Prot v1.4+"))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "JoWood X-Prot")
|
||||
.Where(p => p != "JoWood X-Prot v1.0-v1.3");
|
||||
foundProtections = foundProtections.FindAll(p => p != "JoWood X-Prot")
|
||||
.FindAll(p => p != "JoWood X-Prot v1.0-v1.3");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "JoWood X-Prot v1.0-v1.3"))
|
||||
else if (foundProtections.Exists(p => p == "JoWood X-Prot v1.0-v1.3"))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "JoWood X-Prot");
|
||||
foundProtections = foundProtections.FindAll(p => p != "JoWood X-Prot");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +231,7 @@ namespace MPF.Frontend.Tools
|
||||
// TODO: Figure this one out
|
||||
|
||||
// Online Registration
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("Executable-Based Online Registration"));
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Executable-Based Online Registration"));
|
||||
|
||||
// ProtectDISC / VOB ProtectCD/DVD
|
||||
// TODO: Figure this one out
|
||||
@@ -283,76 +240,127 @@ namespace MPF.Frontend.Tools
|
||||
// TODO: Figure this one out
|
||||
|
||||
// Cactus Data Shield / SafeDisc
|
||||
if (foundProtections.Any(p => p == "Cactus Data Shield 300 (Confirm presence of other CDS-300 files)"))
|
||||
if (foundProtections.Exists(p => p == "Cactus Data Shield 300 (Confirm presence of other CDS-300 files)"))
|
||||
{
|
||||
foundProtections = foundProtections
|
||||
.Where(p => p != "Cactus Data Shield 300 (Confirm presence of other CDS-300 files)");
|
||||
.FindAll(p => p != "Cactus Data Shield 300 (Confirm presence of other CDS-300 files)");
|
||||
|
||||
if (foundProtections.Any(p => !p.StartsWith("SafeDisc")))
|
||||
{
|
||||
#if NET20 || NET35 || NET40 || NET452 || NET462
|
||||
var tempList = new List<string>();
|
||||
tempList.AddRange(foundProtections);
|
||||
tempList.Add("Cactus Data Shield 300");
|
||||
foundProtections = tempList;
|
||||
#else
|
||||
foundProtections = foundProtections.Append("Cactus Data Shield 300");
|
||||
#endif
|
||||
}
|
||||
if (foundProtections.Exists(p => !p.StartsWith("SafeDisc")))
|
||||
foundProtections.Add("Cactus Data Shield 300");
|
||||
}
|
||||
|
||||
// SafeDisc
|
||||
if (foundProtections.Any(p => p.StartsWith("SafeDisc")))
|
||||
if (foundProtections.Exists(p => p.StartsWith("SafeDisc")))
|
||||
{
|
||||
if (foundProtections.Any(p => Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled) && !p.StartsWith("Macrovision Protection File")))
|
||||
// Confirmed this set of checks works with Redump entries 10430, 11347, 13230, 18614, 28257, 31149, 31824, 52606, 57721, 58455, 58573, 62935, 63941, 64255, 65569, 66005, 70504, 73502, 74520, 78048, 79729, 83468, 98589, and 101261.
|
||||
|
||||
// Best case scenario for SafeDisc 2+: A full SafeDisc version is found in a line starting with "Macrovision Protected Application". All other SafeDisc detections can be safely scrubbed.
|
||||
// TODO: Scrub "Macrovision Protected Application, " from before the SafeDisc version.
|
||||
if (foundProtections.Exists(p => Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled) && p.StartsWith("Macrovision Protected Application") && !p.Contains("SRV Tool APP")))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("Macrovision Protected Application"))
|
||||
.Where(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.Where(p => !p.StartsWith("Macrovision Security Driver"))
|
||||
.Where(p => p != "SafeDisc")
|
||||
.Where(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)))
|
||||
.Where(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}/+", RegexOptions.Compiled)))
|
||||
.Where(p => p != "SafeDisc 1/Lite")
|
||||
.Where(p => p != "SafeDisc 2+");
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !p.StartsWith("Macrovision Security Driver"))
|
||||
.FindAll(p => !p.Contains("SRV Tool APP"))
|
||||
.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => !p.StartsWith("Macrovision Protected Application [Version Expunged]"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\/4\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => p != "SafeDisc 1/Lite")
|
||||
.FindAll(p => p != "SafeDisc 2+")
|
||||
.FindAll(p => p != "SafeDisc 3+ (DVD)");
|
||||
}
|
||||
else if (foundProtections.Any(p => Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled) && !p.StartsWith("Macrovision Protection File")))
|
||||
|
||||
// Next best case for SafeDisc 2+: A full SafeDisc version is found from the "SafeDisc SRV Tool APP".
|
||||
else if (foundProtections.Exists(p => Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled) && p.StartsWith("Macrovision Protected Application") && p.Contains("SRV Tool APP")))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("Macrovision Protected Application"))
|
||||
.Where(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.Where(p => !p.StartsWith("Macrovision Security Driver"))
|
||||
.Where(p => p != "SafeDisc")
|
||||
.Where(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}/+", RegexOptions.Compiled)))
|
||||
.Where(p => p != "SafeDisc 1/Lite")
|
||||
.Where(p => p != "SafeDisc 2+");
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !p.StartsWith("Macrovision Security Driver"))
|
||||
.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => !p.StartsWith("Macrovision Protected Application [Version Expunged]"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\/4\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => p != "SafeDisc 1/Lite")
|
||||
.FindAll(p => p != "SafeDisc 2+")
|
||||
.FindAll(p => p != "SafeDisc 3+ (DVD)");
|
||||
}
|
||||
else if (foundProtections.Any(p => Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}/+", RegexOptions.Compiled) && !p.StartsWith("Macrovision Protection File")))
|
||||
|
||||
// Covers specific edge cases where older drivers are erroneously placed in discs with a newer version of SafeDisc, and the specific SafeDisc version is expunged.
|
||||
else if (foundProtections.Exists(p => Regex.IsMatch(p, @"SafeDisc [1-2]\.[0-9]{2}\.[0-9]{3}-[1-2]\.[0-9]{2}\.[0-9]{3}$", RegexOptions.Compiled) || Regex.IsMatch(p, @"SafeDisc [1-2]\.[0-9]{2}\.[0-9]{3}$", RegexOptions.Compiled)) && foundProtections.Exists(p => p == "SafeDisc 3+ (DVD)"))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("Macrovision Protected Application"))
|
||||
.Where(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.Where(p => !p.StartsWith("Macrovision Security Driver"))
|
||||
.Where(p => p != "SafeDisc")
|
||||
.Where(p => p != "SafeDisc 1/Lite")
|
||||
.Where(p => p != "SafeDisc 2+");
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !p.StartsWith("Macrovision Protected Application [Version Expunged]"))
|
||||
.FindAll(p => !p.StartsWith("Macrovision Security Driver"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [1-2]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [1-2]\.[0-9]{2}\.[0-9]{3}-[1-2]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)))
|
||||
.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => p != "SafeDisc 1/Lite")
|
||||
.FindAll(p => p != "SafeDisc 2+");
|
||||
}
|
||||
else if (foundProtections.Any(p => p.StartsWith("Macrovision Security Driver")))
|
||||
|
||||
// Best case for SafeDisc 1.X: A full SafeDisc version is found that isn't part of a version range.
|
||||
else if (foundProtections.Exists(p => Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}$", RegexOptions.Compiled) && !(Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled))))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("Macrovision Protected Application"))
|
||||
.Where(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.Where(p => p != "SafeDisc")
|
||||
.Where(p => p != "SafeDisc 1/Lite")
|
||||
.Where(p => p != "SafeDisc 2+");
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !p.StartsWith("Macrovision Security Driver"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => p != "SafeDisc 1")
|
||||
.FindAll(p => p != "SafeDisc 1/Lite");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "SafeDisc 2+"))
|
||||
|
||||
// Next best case for SafeDisc 1: A SafeDisc version range is found from "SECDRV.SYS".
|
||||
// TODO: Scrub "Macrovision Security Driver {Version}" from before the SafeDisc version.
|
||||
else if (foundProtections.Exists(p => p.StartsWith("Macrovision Security Driver") && Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}-[1-2]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled) || Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}$")))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("Macrovision Protected Application"))
|
||||
.Where(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.Where(p => p != "SafeDisc");
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !p.StartsWith("Macrovision Protected Application [Version Expunged]"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)))
|
||||
.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => p != "SafeDisc 1")
|
||||
.FindAll(p => p != "SafeDisc 1/Lite");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "SafeDisc 1/Lite"))
|
||||
|
||||
// Next best case for SafeDisc 2+: A SafeDisc version range is found from "SECDRV.SYS".
|
||||
// TODO: Scrub "Macrovision Security Driver {Version}" from before the SafeDisc version.
|
||||
else if (foundProtections.Exists(p => p.StartsWith("Macrovision Security Driver")))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => !p.StartsWith("Macrovision Protected Application"))
|
||||
.Where(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.Where(p => p != "SafeDisc");
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !p.StartsWith("Macrovision Protected Application [Version Expunged]"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}-[0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)))
|
||||
.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => p != "SafeDisc 1")
|
||||
.FindAll(p => p != "SafeDisc 1/Lite")
|
||||
.FindAll(p => p != "SafeDisc 2+")
|
||||
.FindAll(p => p != "SafeDisc 3+ (DVD)");
|
||||
}
|
||||
|
||||
// Only SafeDisc Lite is found.
|
||||
else if (foundProtections.Exists(p => p == "SafeDisc Lite"))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}-1\.[0-9]{2}\.[0-9]{3}\/Lite", RegexOptions.Compiled)));
|
||||
}
|
||||
|
||||
// Only SafeDisc 3+ is found.
|
||||
else if (foundProtections.Exists(p => p == "SafeDisc 3+ (DVD)"))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => p != "SafeDisc 2+")
|
||||
.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)));
|
||||
}
|
||||
|
||||
// Only SafeDisc 2+ is found.
|
||||
else if (foundProtections.Exists(p => p == "SafeDisc 2+"))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "SafeDisc")
|
||||
.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
.FindAll(p => !(Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}\+", RegexOptions.Compiled)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,44 +371,52 @@ namespace MPF.Frontend.Tools
|
||||
// TODO: Figure this one out
|
||||
|
||||
// StarForce
|
||||
if (foundProtections.Any(p => p.StartsWith("StarForce")))
|
||||
if (foundProtections.Exists(p => p.StartsWith("StarForce")))
|
||||
{
|
||||
if (foundProtections.Any(p => Regex.IsMatch(p, @"StarForce [0-9]+\..+", RegexOptions.Compiled)))
|
||||
if (foundProtections.Exists(p => Regex.IsMatch(p, @"StarForce [0-9]+\..+", RegexOptions.Compiled)))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "StarForce")
|
||||
.Where(p => p != "StarForce 3-5")
|
||||
.Where(p => p != "StarForce 5")
|
||||
.Where(p => p != "StarForce 5 [Protected Module]");
|
||||
foundProtections = foundProtections.FindAll(p => p != "StarForce")
|
||||
.FindAll(p => p != "StarForce 3-5")
|
||||
.FindAll(p => p != "StarForce 5")
|
||||
.FindAll(p => p != "StarForce 5 [Protected Module]");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "StarForce 5 [Protected Module]"))
|
||||
else if (foundProtections.Exists(p => p == "StarForce 5 [Protected Module]"))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "StarForce")
|
||||
.Where(p => p != "StarForce 3-5")
|
||||
.Where(p => p != "StarForce 5");
|
||||
foundProtections = foundProtections.FindAll(p => p != "StarForce")
|
||||
.FindAll(p => p != "StarForce 3-5")
|
||||
.FindAll(p => p != "StarForce 5");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "StarForce 5"))
|
||||
else if (foundProtections.Exists(p => p == "StarForce 5"))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "StarForce")
|
||||
.Where(p => p != "StarForce 3-5");
|
||||
foundProtections = foundProtections.FindAll(p => p != "StarForce")
|
||||
.FindAll(p => p != "StarForce 3-5");
|
||||
}
|
||||
else if (foundProtections.Any(p => p == "StarForce 3-5"))
|
||||
else if (foundProtections.Exists(p => p == "StarForce 3-5"))
|
||||
{
|
||||
foundProtections = foundProtections.Where(p => p != "StarForce");
|
||||
foundProtections = foundProtections.FindAll(p => p != "StarForce");
|
||||
}
|
||||
}
|
||||
|
||||
// Sysiphus
|
||||
if (foundProtections.Any(p => p == "Sysiphus") && foundProtections.Any(p => p.StartsWith("Sysiphus") && p.Length > "Sysiphus".Length))
|
||||
foundProtections = foundProtections.Where(p => p != "Sysiphus");
|
||||
if (foundProtections.Exists(p => p == "Sysiphus")
|
||||
&& foundProtections.Exists(p => p.StartsWith("Sysiphus") && p.Length > "Sysiphus".Length))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "Sysiphus");
|
||||
}
|
||||
|
||||
// TAGES
|
||||
// TODO: Figure this one out
|
||||
|
||||
// XCP
|
||||
if (foundProtections.Any(p => p == "XCP") && foundProtections.Any(p => p.StartsWith("XCP") && p.Length > "XCP".Length))
|
||||
foundProtections = foundProtections.Where(p => p != "XCP");
|
||||
if (foundProtections.Exists(p => p == "XCP")
|
||||
&& foundProtections.Exists(p => p.StartsWith("XCP") && p.Length > "XCP".Length))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => p != "XCP");
|
||||
}
|
||||
|
||||
return string.Join(", ", foundProtections.ToArray());
|
||||
// Sort and return the protections
|
||||
foundProtections.Sort();
|
||||
return string.Join(", ", [.. foundProtections]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
using BinaryObjectScanner;
|
||||
using MPF.Processors;
|
||||
@@ -57,8 +59,8 @@ namespace MPF.Frontend.Tools
|
||||
string outputFilename = Path.GetFileName(outputPath);
|
||||
|
||||
// Check that all of the relevant files are there
|
||||
(bool foundFiles, List<string> missingFiles) = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (!foundFiles)
|
||||
List<string> missingFiles = processor.FoundAllFiles(outputDirectory, outputFilename);
|
||||
if (missingFiles.Count > 0)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Failure($"There were files missing from the output:\n{string.Join("\n", [.. missingFiles])}"));
|
||||
resultProgress?.Report(ResultEventArgs.Failure($"This may indicate an issue with the hardware or media, including unsupported devices.\nPlease see dumping program documentation for more details."));
|
||||
@@ -85,11 +87,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Get a list of matching IDs for each line in the DAT
|
||||
if (!string.IsNullOrEmpty(info.TracksAndWriteOffsets!.ClrMameProData) && options.HasRedumpLogin)
|
||||
#if NET40
|
||||
_ = FillFromRedump(options, info, resultProgress);
|
||||
#else
|
||||
_ = await FillFromRedump(options, info, resultProgress);
|
||||
#endif
|
||||
|
||||
// If we have both ClrMamePro and Size and Checksums data, remove the ClrMamePro
|
||||
if (!string.IsNullOrEmpty(info.SizeAndChecksums?.CRC32))
|
||||
@@ -118,11 +116,23 @@ namespace MPF.Frontend.Tools
|
||||
if (system.SupportsCopyProtectionScans())
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Success("Running copy protection scan... this might take a while!"));
|
||||
var (protectionString, fullProtections) = await ProtectionTool.GetCopyProtection(drive, options, protectionProgress);
|
||||
|
||||
info.CopyProtection!.Protection += protectionString;
|
||||
info.CopyProtection.FullProtections = fullProtections as Dictionary<string, List<string>?> ?? [];
|
||||
resultProgress?.Report(ResultEventArgs.Success("Copy protection scan complete!"));
|
||||
ProtectionDictionary? protections = null;
|
||||
try
|
||||
{
|
||||
if (options.ScanForProtection && drive?.Name != null)
|
||||
protections = await ProtectionTool.RunProtectionScanOnPath(drive.Name, options, protectionProgress);
|
||||
|
||||
var protectionString = ProtectionTool.FormatProtections(protections);
|
||||
|
||||
info.CopyProtection!.Protection += protectionString;
|
||||
info.CopyProtection.FullProtections = ReformatProtectionDictionary(protections);
|
||||
resultProgress?.Report(ResultEventArgs.Success("Copy protection scan complete!"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Failure(ex.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Set fields that may have automatic filling otherwise
|
||||
@@ -147,7 +157,9 @@ namespace MPF.Frontend.Tools
|
||||
/// <param name="options">Options object representing user-defined options</param>
|
||||
/// <param name="info">Existing SubmissionInfo object to fill</param>
|
||||
/// <param name="resultProgress">Optional result progress callback</param>
|
||||
public async static Task<bool> FillFromRedump(Frontend.Options options, SubmissionInfo info, IProgress<ResultEventArgs>? resultProgress = null)
|
||||
public async static Task<bool> FillFromRedump(Frontend.Options options,
|
||||
SubmissionInfo info,
|
||||
IProgress<ResultEventArgs>? resultProgress = null)
|
||||
{
|
||||
// If no username is provided
|
||||
if (string.IsNullOrEmpty(options.RedumpUsername) || string.IsNullOrEmpty(options.RedumpPassword))
|
||||
@@ -212,103 +224,96 @@ namespace MPF.Frontend.Tools
|
||||
continue;
|
||||
}
|
||||
|
||||
(bool singleFound, var foundIds, string? result) = await Validator.ValidateSingleTrack(wc, info, sha1);
|
||||
if (singleFound)
|
||||
resultProgress?.Report(ResultEventArgs.Success(result));
|
||||
var foundIds = await Validator.ValidateSingleTrack(wc, info, sha1);
|
||||
if (foundIds != null && foundIds.Count == 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Single match found for {sha1}"));
|
||||
else if (foundIds != null && foundIds.Count != 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for {sha1}"));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(result));
|
||||
resultProgress?.Report(ResultEventArgs.Failure($"No matches found for {sha1}"));
|
||||
|
||||
// Add the found IDs to the map
|
||||
foundIdSets.Add(foundIds?.ToArray() ?? []);
|
||||
|
||||
// Ensure that all tracks are found
|
||||
allFound &= singleFound;
|
||||
allFound &= (foundIds != null && foundIds.Count >= 1);
|
||||
}
|
||||
|
||||
// If all tracks were found, check if there are any fully-matched IDs
|
||||
List<int>? fullyMatchedIDs = null;
|
||||
HashSet<int>? fullyMatchedIdsSet = null;
|
||||
if (allFound)
|
||||
{
|
||||
fullyMatchedIDs = null;
|
||||
fullyMatchedIdsSet = null;
|
||||
foreach (var set in foundIdSets)
|
||||
{
|
||||
// First track is always all IDs
|
||||
if (fullyMatchedIDs == null)
|
||||
if (fullyMatchedIdsSet == null)
|
||||
{
|
||||
fullyMatchedIDs = [.. set];
|
||||
fullyMatchedIdsSet = [.. set];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to intersect with all known IDs
|
||||
fullyMatchedIDs = fullyMatchedIDs.Intersect(set).ToList();
|
||||
if (!fullyMatchedIDs.Any())
|
||||
fullyMatchedIdsSet.IntersectWith(set);
|
||||
if (fullyMatchedIdsSet.Count == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If we don't have any matches but we have a universal hash
|
||||
if (!info.PartiallyMatchedIDs.Any() && info.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.UniversalHash) == true)
|
||||
if (info.PartiallyMatchedIDs.Count == 0 && info.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.UniversalHash) == true)
|
||||
{
|
||||
#if NET40
|
||||
var validateTask = Validator.ValidateUniversalHash(wc, info);
|
||||
validateTask.Wait();
|
||||
(bool singleFound, var foundIds, string? result) = validateTask.Result;
|
||||
#else
|
||||
(bool singleFound, var foundIds, string? result) = await Validator.ValidateUniversalHash(wc, info);
|
||||
#endif
|
||||
if (singleFound)
|
||||
resultProgress?.Report(ResultEventArgs.Success(result));
|
||||
string sha1 = info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash];
|
||||
var foundIds = await Validator.ValidateUniversalHash(wc, info);
|
||||
if (foundIds != null && foundIds.Count == 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Single match found for universal hash {sha1}"));
|
||||
else if (foundIds != null && foundIds.Count != 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for universal hash {sha1}"));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure(result));
|
||||
resultProgress?.Report(ResultEventArgs.Failure($"No matches found for universal hash {sha1}"));
|
||||
|
||||
// Ensure that the hash is found
|
||||
allFound = singleFound;
|
||||
allFound = (foundIds != null && foundIds.Count == 1);
|
||||
|
||||
// If we found a match, then the disc is a match
|
||||
if (singleFound && foundIds != null)
|
||||
fullyMatchedIDs = foundIds;
|
||||
if (foundIds != null && foundIds.Count == 1)
|
||||
fullyMatchedIdsSet = [.. foundIds];
|
||||
else
|
||||
fullyMatchedIDs = [];
|
||||
fullyMatchedIdsSet = [];
|
||||
}
|
||||
|
||||
// Make sure we only have unique IDs
|
||||
info.PartiallyMatchedIDs = [.. info.PartiallyMatchedIDs.Distinct().OrderBy(id => id)];
|
||||
// Get a list version of the fully matched IDs
|
||||
List<int> fullyMatchedIdsList = fullyMatchedIdsSet != null ? [.. fullyMatchedIdsSet] : [];
|
||||
|
||||
resultProgress?.Report(ResultEventArgs.Success("Match finding complete! " + (fullyMatchedIDs != null && fullyMatchedIDs.Count > 0
|
||||
? "Fully Matched IDs: " + string.Join(",", fullyMatchedIDs.Select(i => i.ToString()).ToArray())
|
||||
// Make sure we only have unique IDs
|
||||
var partiallyMatchedIds = new HashSet<int>();
|
||||
partiallyMatchedIds.IntersectWith(info.PartiallyMatchedIDs);
|
||||
info.PartiallyMatchedIDs = [.. partiallyMatchedIds];
|
||||
info.PartiallyMatchedIDs.Sort();
|
||||
|
||||
resultProgress?.Report(ResultEventArgs.Success("Match finding complete! " + (fullyMatchedIdsList != null && fullyMatchedIdsList.Count > 0
|
||||
? "Fully Matched IDs: " + string.Join(",", [.. fullyMatchedIdsList.ConvertAll(i => i.ToString())])
|
||||
: "No matches found")));
|
||||
|
||||
// Exit early if one failed or there are no matched IDs
|
||||
if (!allFound || fullyMatchedIDs == null || fullyMatchedIDs.Count == 0)
|
||||
if (!allFound || fullyMatchedIdsList == null || fullyMatchedIdsList.Count == 0)
|
||||
return false;
|
||||
|
||||
// Find the first matched ID where the track count matches, we can grab a bunch of info from it
|
||||
int totalMatchedIDsCount = fullyMatchedIDs.Count;
|
||||
int totalMatchedIDsCount = fullyMatchedIdsList.Count;
|
||||
for (int i = 0; i < totalMatchedIDsCount; i++)
|
||||
{
|
||||
// Skip if the track count doesn't match
|
||||
#if NET40
|
||||
var validateTask = Validator.ValidateTrackCount(wc, fullyMatchedIDs[i], trackCount);
|
||||
validateTask.Wait();
|
||||
if (!validateTask.Result)
|
||||
#else
|
||||
if (!await Validator.ValidateTrackCount(wc, fullyMatchedIDs[i], trackCount))
|
||||
#endif
|
||||
if (!await Validator.ValidateTrackCount(wc, fullyMatchedIdsList[i], trackCount))
|
||||
continue;
|
||||
|
||||
// Fill in the fields from the existing ID
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Filling fields from existing ID {fullyMatchedIDs[i]}..."));
|
||||
#if NET40
|
||||
var fillTask = Task.Factory.StartNew(() => Builder.FillFromId(wc, info, fullyMatchedIDs[i], options.PullAllInformation));
|
||||
fillTask.Wait();
|
||||
_ = fillTask.Result;
|
||||
#else
|
||||
_ = await Builder.FillFromId(wc, info, fullyMatchedIDs[i], options.PullAllInformation);
|
||||
#endif
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Filling fields from existing ID {fullyMatchedIdsList[i]}..."));
|
||||
_ = await Builder.FillFromId(wc, info, fullyMatchedIdsList[i], options.PullAllInformation);
|
||||
resultProgress?.Report(ResultEventArgs.Success("Information filling complete!"));
|
||||
|
||||
// Set the fully matched ID to the current
|
||||
info.FullyMatchedID = fullyMatchedIDs[i];
|
||||
info.FullyMatchedID = fullyMatchedIdsList[i];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -413,7 +418,13 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
|
||||
// If only one label, don't mention fs
|
||||
#if NET20
|
||||
string[] keyArr = new string[labels.Count];
|
||||
labels.Keys.CopyTo(keyArr, 0);
|
||||
string firstLabel = keyArr[0];
|
||||
#else
|
||||
string firstLabel = labels.First().Key;
|
||||
#endif
|
||||
if (labels.Count == 1 && (firstLabel == driveLabel || driveLabel == null))
|
||||
{
|
||||
// Ignore common volume labels
|
||||
@@ -439,7 +450,7 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
|
||||
// Ensure that no labels are empty
|
||||
volLabels = volLabels.Where(l => !string.IsNullOrEmpty(l?.Trim())).ToList();
|
||||
volLabels = volLabels.FindAll(l => !string.IsNullOrEmpty(l?.Trim()));
|
||||
|
||||
// Print each label separated by a comma and a space
|
||||
if (volLabels.Count == 0)
|
||||
@@ -817,7 +828,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
SetCommentFieldIfNotExists(info, SiteCode.InternalSerialName, drive, PhysicalTool.GetPlayStation3Serial);
|
||||
SetVersionIfNotExists(info, drive, PhysicalTool.GetPlayStation3Version);
|
||||
SetCommentFieldIfNotExists(info, SiteCode.Patches, drive, FormatPlayStation3FirmwareVersion);
|
||||
SetContentFieldIfNotExists(info, SiteCode.Patches, drive, FormatPlayStation3FirmwareVersion);
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation4:
|
||||
@@ -887,6 +898,38 @@ namespace MPF.Frontend.Tools
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![key] = valueFunc(drive) ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if a content field exists based on key
|
||||
/// </summary>
|
||||
private static bool ContentFieldExists(SubmissionInfo info, SiteCode key, out string? value)
|
||||
{
|
||||
// Ensure the contents fields exist
|
||||
if (info.CommonDiscInfo!.ContentsSpecialFields == null)
|
||||
info.CommonDiscInfo.ContentsSpecialFields = [];
|
||||
|
||||
// Check if the field exists
|
||||
if (!info.CommonDiscInfo.ContentsSpecialFields.TryGetValue(key, out value))
|
||||
return false;
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return false;
|
||||
|
||||
// The value is valid
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a content field if it doesn't already have a value
|
||||
/// </summary>
|
||||
private static void SetContentFieldIfNotExists(SubmissionInfo info, SiteCode key, Drive? drive, Func<Drive?, string?> valueFunc)
|
||||
{
|
||||
// If the field has a valid value, skip
|
||||
if (ContentFieldExists(info, key, out _))
|
||||
return;
|
||||
|
||||
// Set the value
|
||||
info.CommonDiscInfo!.ContentsSpecialFields![key] = valueFunc(drive) ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the version if it doesn't already have a value
|
||||
/// </summary>
|
||||
@@ -900,6 +943,27 @@ namespace MPF.Frontend.Tools
|
||||
info.VersionAndEditions.Version = valueFunc(drive) ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reformat a protection dictionary for submission info
|
||||
/// </summary>
|
||||
/// <param name="oldDict">ProtectionDictionary to format</param>
|
||||
/// <returns>Reformatted dictionary on success, empty on error</returns>
|
||||
private static Dictionary<string, List<string>?> ReformatProtectionDictionary(ProtectionDictionary? oldDict)
|
||||
{
|
||||
// Null or empty protections return empty
|
||||
if (oldDict == null || oldDict.Count == 0)
|
||||
return [];
|
||||
|
||||
// Reformat each set into a List
|
||||
var newDict = new Dictionary<string, List<string>?>();
|
||||
foreach (string key in oldDict.Keys)
|
||||
{
|
||||
newDict[key] = [.. oldDict[key]];
|
||||
}
|
||||
|
||||
return newDict;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BinaryObjectScanner;
|
||||
using MPF.Frontend.ComboBoxItems;
|
||||
@@ -260,7 +259,7 @@ namespace MPF.Frontend.ViewModels
|
||||
CancelButtonEnabled = true;
|
||||
|
||||
MediaTypes = [];
|
||||
Systems = RedumpSystemComboBoxItem.GenerateElements().ToList();
|
||||
Systems = RedumpSystemComboBoxItem.GenerateElements();
|
||||
InternalPrograms = [];
|
||||
|
||||
PopulateMediaType();
|
||||
@@ -296,7 +295,7 @@ namespace MPF.Frontend.ViewModels
|
||||
public void ChangeSystem()
|
||||
{
|
||||
PopulateMediaType();
|
||||
this.CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -304,7 +303,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void ChangeMediaType()
|
||||
{
|
||||
this.CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -312,7 +311,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void ChangeDumpingProgram()
|
||||
{
|
||||
this.CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -320,7 +319,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void ChangeInputPath()
|
||||
{
|
||||
this.CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
CheckDumpButtonEnabled = ShouldEnableCheckDumpButton();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -368,20 +367,20 @@ namespace MPF.Frontend.ViewModels
|
||||
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
|
||||
DisableEventHandlers();
|
||||
|
||||
if (this.CurrentSystem != null)
|
||||
if (CurrentSystem != null)
|
||||
{
|
||||
var mediaTypeValues = this.CurrentSystem.MediaTypes();
|
||||
int index = mediaTypeValues.FindIndex(m => m == this.CurrentMediaType);
|
||||
var mediaTypeValues = CurrentSystem.MediaTypes();
|
||||
int index = mediaTypeValues.FindIndex(m => m == CurrentMediaType);
|
||||
|
||||
MediaTypes = mediaTypeValues.Select(m => new Element<MediaType>(m ?? MediaType.NONE)).ToList();
|
||||
this.MediaTypeComboBoxEnabled = MediaTypes.Count > 1;
|
||||
this.CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
MediaTypes = mediaTypeValues.ConvertAll(m => new Element<MediaType>(m ?? MediaType.NONE));
|
||||
MediaTypeComboBoxEnabled = MediaTypes.Count > 1;
|
||||
CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.MediaTypeComboBoxEnabled = false;
|
||||
this.MediaTypes = null;
|
||||
this.CurrentMediaType = null;
|
||||
MediaTypeComboBoxEnabled = false;
|
||||
MediaTypes = null;
|
||||
CurrentMediaType = null;
|
||||
}
|
||||
|
||||
// Reenable event handlers, if necessary
|
||||
@@ -398,15 +397,15 @@ namespace MPF.Frontend.ViewModels
|
||||
DisableEventHandlers();
|
||||
|
||||
// Get the current internal program
|
||||
InternalProgram internalProgram = this.Options.InternalProgram;
|
||||
InternalProgram internalProgram = Options.InternalProgram;
|
||||
|
||||
// Create a static list of supported Check programs, not everything
|
||||
var internalPrograms = new List<InternalProgram> { InternalProgram.Redumper, InternalProgram.Aaru, InternalProgram.DiscImageCreator, InternalProgram.CleanRip, InternalProgram.PS3CFW, InternalProgram.UmdImageCreator, InternalProgram.XboxBackupCreator };
|
||||
InternalPrograms = internalPrograms.Select(ip => new Element<InternalProgram>(ip)).ToList();
|
||||
InternalPrograms = internalPrograms.ConvertAll(ip => new Element<InternalProgram>(ip));
|
||||
|
||||
// Select the current default dumping program
|
||||
int currentIndex = InternalPrograms.FindIndex(m => m == internalProgram);
|
||||
this.CurrentProgram = (currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value);
|
||||
CurrentProgram = (currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value);
|
||||
|
||||
// Reenable event handlers, if necessary
|
||||
if (cachedCanExecuteSelectionChanged) EnableEventHandlers();
|
||||
@@ -418,7 +417,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
private bool ShouldEnableCheckDumpButton()
|
||||
{
|
||||
return this.CurrentSystem != null && this.CurrentMediaType != null && !string.IsNullOrEmpty(this.InputPath);
|
||||
return CurrentSystem != null && CurrentMediaType != null && !string.IsNullOrEmpty(InputPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -445,12 +444,12 @@ namespace MPF.Frontend.ViewModels
|
||||
/// Performs MPF.Check functionality
|
||||
/// </summary>
|
||||
/// <returns>An error message if failed, otherwise string.Empty/null</returns>
|
||||
public async Task<string?> CheckDump(Func<SubmissionInfo?, (bool?, SubmissionInfo?)> processUserInfo)
|
||||
public async Task<string?> CheckDump(ProcessUserInfoDelegate processUserInfo)
|
||||
{
|
||||
if (string.IsNullOrEmpty(InputPath))
|
||||
return "Invalid Input path";
|
||||
|
||||
if (!File.Exists(this.InputPath!.Trim('"')))
|
||||
if (!File.Exists(InputPath!.Trim('"')))
|
||||
return "Input Path is not a valid file";
|
||||
|
||||
// Disable UI while Check is running
|
||||
@@ -459,7 +458,7 @@ namespace MPF.Frontend.ViewModels
|
||||
DisableEventHandlers();
|
||||
|
||||
// Populate an environment
|
||||
var env = new DumpEnvironment(Options, Path.GetFullPath(this.InputPath.Trim('"')), null, this.CurrentSystem, this.CurrentMediaType, this.CurrentProgram, parameters: null);
|
||||
var env = new DumpEnvironment(Options, Path.GetFullPath(InputPath.Trim('"')), null, CurrentSystem, CurrentMediaType, CurrentProgram, parameters: null);
|
||||
|
||||
// Make new Progress objects
|
||||
var resultProgress = new Progress<ResultEventArgs>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MPF.Frontend.ComboBoxItems;
|
||||
using MPF.Frontend.Tools;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
@@ -27,12 +27,14 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// List of available disc categories
|
||||
/// </summary>
|
||||
public List<Element<DiscCategory>> Categories { get; private set; } = Element<DiscCategory>.GenerateElements().ToList();
|
||||
public List<Element<DiscCategory>> Categories { get; private set; }
|
||||
= Element<DiscCategory>.GenerateElements();
|
||||
|
||||
/// <summary>
|
||||
/// List of available regions
|
||||
/// </summary>
|
||||
public List<Element<Region>> Regions { get; private set; } = Element<Region>.GenerateElements().ToList();
|
||||
public List<Element<Region>> Regions { get; private set; }
|
||||
= Element<Region>.GenerateElements();
|
||||
|
||||
/// <summary>
|
||||
/// List of Redump-supported Regions
|
||||
@@ -123,7 +125,8 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// List of available languages
|
||||
/// </summary>
|
||||
public List<Element<Language>> Languages { get; private set; } = Element<Language>.GenerateElements().ToList();
|
||||
public List<Element<Language>> Languages { get; private set; }
|
||||
= Element<Language>.GenerateElements();
|
||||
|
||||
/// <summary>
|
||||
/// List of Redump-supported Languages
|
||||
@@ -183,7 +186,8 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// List of available languages
|
||||
/// </summary>
|
||||
public List<Element<LanguageSelection>> LanguageSelections { get; private set; } = Element<LanguageSelection>.GenerateElements().ToList();
|
||||
public List<Element<LanguageSelection>> LanguageSelections { get; private set; }
|
||||
= Element<LanguageSelection>.GenerateElements();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -205,9 +209,9 @@ namespace MPF.Frontend.ViewModels
|
||||
public void Load()
|
||||
{
|
||||
if (SubmissionInfo.CommonDiscInfo?.Languages != null)
|
||||
Languages.ForEach(l => l.IsChecked = SubmissionInfo.CommonDiscInfo.Languages.Contains(l));
|
||||
Languages.ForEach(l => l.IsChecked = Array.IndexOf(SubmissionInfo.CommonDiscInfo.Languages, l) > -1);
|
||||
if (SubmissionInfo.CommonDiscInfo?.LanguageSelection != null)
|
||||
LanguageSelections.ForEach(ls => ls.IsChecked = SubmissionInfo.CommonDiscInfo.LanguageSelection.Contains(ls));
|
||||
LanguageSelections.ForEach(ls => ls.IsChecked = Array.IndexOf(SubmissionInfo.CommonDiscInfo.LanguageSelection, ls) > -1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -218,10 +222,10 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
if (SubmissionInfo.CommonDiscInfo == null)
|
||||
SubmissionInfo.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
SubmissionInfo.CommonDiscInfo.Languages = Languages.Where(l => l.IsChecked).Select(l => l?.Value).ToArray();
|
||||
if (!SubmissionInfo.CommonDiscInfo.Languages.Any())
|
||||
SubmissionInfo.CommonDiscInfo.Languages = [.. Languages.FindAll(l => l.IsChecked).ConvertAll(l => l?.Value)];
|
||||
if (SubmissionInfo.CommonDiscInfo.Languages.Length == 0)
|
||||
SubmissionInfo.CommonDiscInfo.Languages = [null];
|
||||
SubmissionInfo.CommonDiscInfo.LanguageSelection = LanguageSelections.Where(ls => ls.IsChecked).Select(ls => ls?.Value).ToArray();
|
||||
SubmissionInfo.CommonDiscInfo.LanguageSelection = [.. LanguageSelections.FindAll(ls => ls.IsChecked).ConvertAll(ls => ls?.Value)];
|
||||
SubmissionInfo.CommonDiscInfo.Title = FrontendTool.NormalizeDiscTitle(SubmissionInfo.CommonDiscInfo.Title, SubmissionInfo.CommonDiscInfo.Languages);
|
||||
}
|
||||
|
||||
@@ -230,7 +234,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void SetRedumpLanguages()
|
||||
{
|
||||
this.Languages = RedumpLanguages.Select(l => new Element<Language>(l)).ToList();
|
||||
Languages = RedumpLanguages.ConvertAll(l => new Element<Language>(l));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -238,7 +242,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void SetRedumpRegions()
|
||||
{
|
||||
this.Regions = RedumpRegions.Select(r => new Element<Region>(r)).ToList();
|
||||
Regions = RedumpRegions.ConvertAll(r => new Element<Region>(r));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BinaryObjectScanner;
|
||||
using MPF.Frontend.ComboBoxItems;
|
||||
using MPF.Frontend.Tools;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.Frontend.ViewModels
|
||||
@@ -68,7 +68,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// Function to process user information
|
||||
/// </summary>
|
||||
private Func<SubmissionInfo?, (bool?, SubmissionInfo?)>? _processUserInfo;
|
||||
private ProcessUserInfoDelegate? _processUserInfo;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -556,7 +556,7 @@ namespace MPF.Frontend.ViewModels
|
||||
LogPanelExpanded = _options.OpenLogWindowAtStartup;
|
||||
|
||||
MediaTypes = [];
|
||||
Systems = RedumpSystemComboBoxItem.GenerateElements().ToList();
|
||||
Systems = RedumpSystemComboBoxItem.GenerateElements();
|
||||
InternalPrograms = [];
|
||||
}
|
||||
|
||||
@@ -566,7 +566,7 @@ namespace MPF.Frontend.ViewModels
|
||||
public void Init(
|
||||
Action<LogLevel, string> loggerAction,
|
||||
Func<string, string, int, bool, bool?> displayUserMessage,
|
||||
Func<SubmissionInfo?, (bool?, SubmissionInfo?)> processUserInfo)
|
||||
ProcessUserInfoDelegate processUserInfo)
|
||||
{
|
||||
// Set the callbacks
|
||||
_logger = loggerAction;
|
||||
@@ -612,18 +612,18 @@ namespace MPF.Frontend.ViewModels
|
||||
VerboseLogLn("Scanning for drives..");
|
||||
|
||||
// Always enable the media scan
|
||||
this.MediaScanButtonEnabled = true;
|
||||
this.UpdateVolumeLabelEnabled = true;
|
||||
MediaScanButtonEnabled = true;
|
||||
UpdateVolumeLabelEnabled = true;
|
||||
|
||||
// If we have a selected drive, keep track of it
|
||||
char? lastSelectedDrive = this.CurrentDrive?.Name?[0] ?? null;
|
||||
char? lastSelectedDrive = CurrentDrive?.Name?[0] ?? null;
|
||||
|
||||
// Populate the list of drives and add it to the combo box
|
||||
Drives = Drive.CreateListOfDrives(this.Options.IgnoreFixedDrives);
|
||||
Drives = Drive.CreateListOfDrives(Options.IgnoreFixedDrives);
|
||||
|
||||
if (Drives.Count > 0)
|
||||
{
|
||||
VerboseLogLn($"Found {Drives.Count} drives: {string.Join(", ", Drives.Select(d => d.Name).ToArray())}");
|
||||
VerboseLogLn($"Found {Drives.Count} drives: {string.Join(", ", [.. Drives.ConvertAll(d => d.Name)])}");
|
||||
|
||||
// Check for the last selected drive, if possible
|
||||
int index = -1;
|
||||
@@ -644,23 +644,23 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// Set the selected index
|
||||
CurrentDrive = (index != -1 ? Drives[index] : Drives[0]);
|
||||
this.Status = "Valid drive found! Choose your Media Type";
|
||||
this.CopyProtectScanButtonEnabled = true;
|
||||
Status = "Valid drive found! Choose your Media Type";
|
||||
CopyProtectScanButtonEnabled = true;
|
||||
|
||||
// Get the current system type
|
||||
if (index != -1)
|
||||
DetermineSystemType();
|
||||
|
||||
// Only enable the start/stop if we don't have the default selected
|
||||
this.StartStopButtonEnabled = ShouldEnableDumpingButton();
|
||||
StartStopButtonEnabled = ShouldEnableDumpingButton();
|
||||
}
|
||||
else
|
||||
{
|
||||
VerboseLogLn("Found no drives");
|
||||
this.CurrentDrive = null;
|
||||
this.Status = "No valid drive found!";
|
||||
this.StartStopButtonEnabled = false;
|
||||
this.CopyProtectScanButtonEnabled = false;
|
||||
CurrentDrive = null;
|
||||
Status = "No valid drive found!";
|
||||
StartStopButtonEnabled = false;
|
||||
CopyProtectScanButtonEnabled = false;
|
||||
}
|
||||
|
||||
// Reenable event handlers, if necessary
|
||||
@@ -676,22 +676,22 @@ namespace MPF.Frontend.ViewModels
|
||||
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
|
||||
DisableEventHandlers();
|
||||
|
||||
if (this.CurrentSystem != null)
|
||||
if (CurrentSystem != null)
|
||||
{
|
||||
var mediaTypeValues = this.CurrentSystem.MediaTypes();
|
||||
int index = mediaTypeValues.FindIndex(m => m == this.CurrentMediaType);
|
||||
if (this.CurrentMediaType != null && index == -1)
|
||||
var mediaTypeValues = CurrentSystem.MediaTypes();
|
||||
int index = mediaTypeValues.FindIndex(m => m == CurrentMediaType);
|
||||
if (CurrentMediaType != null && index == -1)
|
||||
VerboseLogLn($"Disc of type '{CurrentMediaType.LongName()}' found, but the current system does not support it!");
|
||||
|
||||
MediaTypes = mediaTypeValues.Select(m => new Element<MediaType>(m ?? MediaType.NONE)).ToList();
|
||||
this.MediaTypeComboBoxEnabled = MediaTypes.Count > 1;
|
||||
this.CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
MediaTypes = mediaTypeValues.ConvertAll(m => new Element<MediaType>(m ?? MediaType.NONE));
|
||||
MediaTypeComboBoxEnabled = MediaTypes.Count > 1;
|
||||
CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.MediaTypeComboBoxEnabled = false;
|
||||
this.MediaTypes = null;
|
||||
this.CurrentMediaType = null;
|
||||
MediaTypeComboBoxEnabled = false;
|
||||
MediaTypes = null;
|
||||
CurrentMediaType = null;
|
||||
}
|
||||
|
||||
// Reenable event handlers, if necessary
|
||||
@@ -708,21 +708,23 @@ namespace MPF.Frontend.ViewModels
|
||||
DisableEventHandlers();
|
||||
|
||||
// Create a static list of supported programs, not everything
|
||||
InternalPrograms = Enum.GetValues(typeof(InternalProgram)).Cast<InternalProgram>().Where(ip => InternalProgramExists(ip)).Select(ip => new Element<InternalProgram>(ip)).ToList();
|
||||
var ipArr = (InternalProgram[])Enum.GetValues(typeof(InternalProgram));
|
||||
ipArr = Array.FindAll(ipArr, ip => InternalProgramExists(ip));
|
||||
InternalPrograms = [.. Array.ConvertAll(ipArr, ip => new Element<InternalProgram>(ip))];
|
||||
|
||||
// Get the current internal program
|
||||
InternalProgram internalProgram = this.Options.InternalProgram;
|
||||
InternalProgram internalProgram = Options.InternalProgram;
|
||||
|
||||
// Select the current default dumping program
|
||||
if (InternalPrograms.Count == 0)
|
||||
{
|
||||
// If no programs are found, default to InternalProgram.NONE
|
||||
this.CurrentProgram = InternalProgram.NONE;
|
||||
CurrentProgram = InternalProgram.NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int currentIndex = InternalPrograms.FindIndex(m => m == internalProgram);
|
||||
this.CurrentProgram = (currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value);
|
||||
CurrentProgram = (currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value);
|
||||
}
|
||||
|
||||
// Reenable event handlers, if necessary
|
||||
@@ -738,7 +740,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void ChangeDumpingProgram()
|
||||
{
|
||||
VerboseLogLn($"Changed dumping program to: {((InternalProgram?)this.CurrentProgram).LongName()}");
|
||||
VerboseLogLn($"Changed dumping program to: {((InternalProgram?)CurrentProgram).LongName()}");
|
||||
EnsureDiscInformation();
|
||||
// New output name depends on new environment
|
||||
GetOutputNames(false);
|
||||
@@ -764,7 +766,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void ChangeSystem()
|
||||
{
|
||||
VerboseLogLn($"Changed system to: {this.CurrentSystem.LongName()}");
|
||||
VerboseLogLn($"Changed system to: {CurrentSystem.LongName()}");
|
||||
PopulateMediaType();
|
||||
GetOutputNames(false);
|
||||
EnsureDiscInformation();
|
||||
@@ -773,15 +775,13 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// Check for available updates
|
||||
/// </summary>
|
||||
public (bool, string, string?) CheckForUpdates()
|
||||
public void CheckForUpdates(out bool different, out string message, out string? url)
|
||||
{
|
||||
(bool different, string message, var url) = FrontendTool.CheckForNewVersion();
|
||||
FrontendTool.CheckForNewVersion(out different, out message, out url);
|
||||
|
||||
SecretLogLn(message);
|
||||
if (url == null)
|
||||
message = "An exception occurred while checking for versions, please try again later. See the log window for more details.";
|
||||
|
||||
return (different, message, url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -949,15 +949,15 @@ namespace MPF.Frontend.ViewModels
|
||||
public void ToggleStartStop()
|
||||
{
|
||||
// Dump or stop the dump
|
||||
if (this.StartStopButtonText as string == StartDumpingValue)
|
||||
if (StartStopButtonText as string == StartDumpingValue)
|
||||
{
|
||||
StartDumping();
|
||||
}
|
||||
else if (this.StartStopButtonText as string == StopDumpingValue)
|
||||
else if (StartStopButtonText as string == StopDumpingValue)
|
||||
{
|
||||
VerboseLogLn("Canceling dumping process...");
|
||||
_environment?.CancelDumping();
|
||||
this.CopyProtectScanButtonEnabled = true;
|
||||
CopyProtectScanButtonEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -973,7 +973,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// Ensure the first run flag is unset
|
||||
var continuingOptions = new Frontend.Options(optionsToSave) { FirstRun = false };
|
||||
this.Options = continuingOptions;
|
||||
Options = continuingOptions;
|
||||
|
||||
// If settings were changed, reinitialize the UI
|
||||
if (savedSettings)
|
||||
@@ -1046,14 +1046,14 @@ namespace MPF.Frontend.ViewModels
|
||||
public void FastUpdateLabel(bool removeEventHandlers)
|
||||
{
|
||||
// Disable the dumping button
|
||||
this.StartStopButtonEnabled = false;
|
||||
StartStopButtonEnabled = false;
|
||||
|
||||
// Safely uncheck the parameters box, just in case
|
||||
if (this.ParametersCheckBoxEnabled == true)
|
||||
if (ParametersCheckBoxEnabled == true)
|
||||
{
|
||||
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
|
||||
this.DisableEventHandlers();
|
||||
this.ParametersCheckBoxEnabled = false;
|
||||
DisableEventHandlers();
|
||||
ParametersCheckBoxEnabled = false;
|
||||
if (cachedCanExecuteSelectionChanged) EnableEventHandlers();
|
||||
}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ namespace MPF.Frontend.ViewModels
|
||||
DisableEventHandlers();
|
||||
|
||||
// Refresh the drive info
|
||||
this.CurrentDrive?.RefreshDrive();
|
||||
CurrentDrive?.RefreshDrive();
|
||||
|
||||
// Set the initial environment and UI values
|
||||
_environment = DetermineEnvironment();
|
||||
@@ -1073,7 +1073,7 @@ namespace MPF.Frontend.ViewModels
|
||||
EnableEventHandlers();
|
||||
|
||||
// Enable the dumping button, if necessary
|
||||
this.StartStopButtonEnabled = ShouldEnableDumpingButton();
|
||||
StartStopButtonEnabled = ShouldEnableDumpingButton();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1171,34 +1171,31 @@ namespace MPF.Frontend.ViewModels
|
||||
private void CacheCurrentDiscType()
|
||||
{
|
||||
// If the selected item is invalid, we just skip
|
||||
if (this.CurrentDrive == null)
|
||||
if (CurrentDrive == null)
|
||||
return;
|
||||
|
||||
// Get reasonable default values based on the current system
|
||||
MediaType? defaultMediaType = this.CurrentSystem.MediaTypes().FirstOrDefault() ?? MediaType.CDROM;
|
||||
var mediaTypes = CurrentSystem.MediaTypes();
|
||||
MediaType? defaultMediaType = mediaTypes.Count > 0 ? mediaTypes[0] : MediaType.CDROM;
|
||||
if (defaultMediaType == MediaType.NONE)
|
||||
defaultMediaType = MediaType.CDROM;
|
||||
|
||||
// If we're skipping detection, set the default value
|
||||
if (this.Options.SkipMediaTypeDetection)
|
||||
if (Options.SkipMediaTypeDetection)
|
||||
{
|
||||
VerboseLogLn($"Media type detection disabled, defaulting to {defaultMediaType.LongName()}.");
|
||||
CurrentMediaType = defaultMediaType;
|
||||
}
|
||||
// If the drive is marked active, try to read from it
|
||||
else if (this.CurrentDrive.MarkedActive)
|
||||
else if (CurrentDrive.MarkedActive)
|
||||
{
|
||||
VerboseLog($"Trying to detect media type for drive {this.CurrentDrive.Name} [{this.CurrentDrive.DriveFormat}] using size and filesystem.. ");
|
||||
(MediaType? detectedMediaType, var errorMessage) = this.CurrentDrive.GetMediaType(this.CurrentSystem);
|
||||
|
||||
// If we got an error message, post it to the log
|
||||
if (errorMessage != null)
|
||||
VerboseLogLn($"Message from detecting media type: {errorMessage}");
|
||||
VerboseLog($"Trying to detect media type for drive {CurrentDrive.Name} [{CurrentDrive.DriveFormat}] using size and filesystem.. ");
|
||||
MediaType? detectedMediaType = CurrentDrive.GetMediaType(CurrentSystem);
|
||||
|
||||
// If we got either an error or no media, default to the current System default
|
||||
if (detectedMediaType == null)
|
||||
{
|
||||
VerboseLogLn($"Unable to detect, defaulting to {defaultMediaType.LongName()}.");
|
||||
VerboseLogLn($"Could not detect media type, defaulting to {defaultMediaType.LongName()}.");
|
||||
CurrentMediaType = defaultMediaType;
|
||||
}
|
||||
else
|
||||
@@ -1220,17 +1217,17 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// Create a DumpEnvironment with all current settings
|
||||
/// </summary>
|
||||
/// <returns>Filled DumpEnvironment this.Parent</returns>
|
||||
/// <returns>Filled DumpEnvironment Parent</returns>
|
||||
private DumpEnvironment DetermineEnvironment()
|
||||
{
|
||||
return new DumpEnvironment(
|
||||
this.Options,
|
||||
EvaluateOutputPath(this.OutputPath),
|
||||
this.CurrentDrive,
|
||||
this.CurrentSystem,
|
||||
this.CurrentMediaType,
|
||||
this.CurrentProgram,
|
||||
this.Parameters);
|
||||
Options,
|
||||
EvaluateOutputPath(OutputPath),
|
||||
CurrentDrive,
|
||||
CurrentSystem,
|
||||
CurrentMediaType,
|
||||
CurrentProgram,
|
||||
Parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1238,32 +1235,32 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
private void DetermineSystemType()
|
||||
{
|
||||
if (Drives == null || Drives.Count == 0 || this.CurrentDrive == null)
|
||||
if (Drives == null || Drives.Count == 0 || CurrentDrive == null)
|
||||
{
|
||||
VerboseLogLn("Skipping system type detection because no valid drives found!");
|
||||
}
|
||||
else if (this.CurrentDrive?.MarkedActive != true)
|
||||
else if (CurrentDrive?.MarkedActive != true)
|
||||
{
|
||||
VerboseLogLn("Skipping system type detection because drive not marked as active!");
|
||||
}
|
||||
else if (!this.Options.SkipSystemDetection)
|
||||
else if (!Options.SkipSystemDetection)
|
||||
{
|
||||
VerboseLog($"Trying to detect system for drive {this.CurrentDrive.Name}.. ");
|
||||
VerboseLog($"Trying to detect system for drive {CurrentDrive.Name}.. ");
|
||||
var currentSystem = GetRedumpSystem(CurrentDrive, Options.DefaultSystem) ?? Options.DefaultSystem;
|
||||
VerboseLogLn(currentSystem == null ? "unable to detect." : ($"detected {currentSystem.LongName()}."));
|
||||
|
||||
if (currentSystem != null)
|
||||
{
|
||||
int sysIndex = Systems.FindIndex(s => s == currentSystem);
|
||||
this.CurrentSystem = Systems[sysIndex];
|
||||
CurrentSystem = Systems[sysIndex];
|
||||
}
|
||||
}
|
||||
else if (this.Options.SkipSystemDetection && this.Options.DefaultSystem != null)
|
||||
else if (Options.SkipSystemDetection && Options.DefaultSystem != null)
|
||||
{
|
||||
var currentSystem = this.Options.DefaultSystem;
|
||||
var currentSystem = Options.DefaultSystem;
|
||||
VerboseLogLn($"System detection disabled, setting to default of {currentSystem.LongName()}.");
|
||||
int sysIndex = Systems.FindIndex(s => s == currentSystem);
|
||||
this.CurrentSystem = Systems[sysIndex];
|
||||
CurrentSystem = Systems[sysIndex];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1321,23 +1318,23 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// Get the status to write out
|
||||
ResultEventArgs result = _environment.GetSupportStatus();
|
||||
if (this.CurrentProgram == InternalProgram.NONE)
|
||||
this.Status = "No dumping program found";
|
||||
if (CurrentProgram == InternalProgram.NONE)
|
||||
Status = "No dumping program found";
|
||||
else
|
||||
this.Status = result.Message;
|
||||
Status = result.Message;
|
||||
|
||||
// Enable or disable the button
|
||||
this.StartStopButtonEnabled = result && ShouldEnableDumpingButton();
|
||||
StartStopButtonEnabled = result && ShouldEnableDumpingButton();
|
||||
|
||||
// If we're in a type that doesn't support drive speeds
|
||||
this.DriveSpeedComboBoxEnabled = _environment.DoesSupportDriveSpeed();
|
||||
DriveSpeedComboBoxEnabled = _environment.DoesSupportDriveSpeed();
|
||||
|
||||
// If input params are not enabled, generate the full parameters from the environment
|
||||
if (!this.ParametersCheckBoxEnabled)
|
||||
if (!ParametersCheckBoxEnabled)
|
||||
{
|
||||
var generated = _environment.GetFullParameters(this.DriveSpeed);
|
||||
var generated = _environment.GetFullParameters(DriveSpeed);
|
||||
if (generated != null)
|
||||
this.Parameters = generated;
|
||||
Parameters = generated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1348,16 +1345,16 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <returns>String with %-delimited variables evaluated</returns>
|
||||
public string EvaluateOutputPath(string outputPath)
|
||||
{
|
||||
string systemLong = this._currentSystem.LongName() ?? "Unknown System";
|
||||
string systemLong = _currentSystem.LongName() ?? "Unknown System";
|
||||
if (string.IsNullOrEmpty(systemLong))
|
||||
systemLong = "Unknown System";
|
||||
string systemShort = this._currentSystem.ShortName() ?? "unknown";
|
||||
string systemShort = _currentSystem.ShortName() ?? "unknown";
|
||||
if (string.IsNullOrEmpty(systemShort))
|
||||
systemShort = "unknown";
|
||||
string mediaLong = this._currentMediaType.LongName() ?? "Unknown Media";
|
||||
string mediaLong = _currentMediaType.LongName() ?? "Unknown Media";
|
||||
if (string.IsNullOrEmpty(mediaLong))
|
||||
mediaLong = "Unknown Media";
|
||||
string program = this._currentProgram.ToString() ?? "Unknown Program";
|
||||
string program = _currentProgram.ToString() ?? "Unknown Program";
|
||||
if (string.IsNullOrEmpty(program))
|
||||
program = "Unknown Program";
|
||||
string programShort = program == "DiscImageCreator" ? "DIC" : program;
|
||||
@@ -1375,7 +1372,8 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
return outputPath
|
||||
.Replace("%SYSTEM%", systemLong)
|
||||
.Replace("%SYS%", systemShort)
|
||||
.Replace("%SYS%", systemShort.ToUpperInvariant())
|
||||
.Replace("%sys%", systemShort)
|
||||
.Replace("%MEDIA%", mediaLong)
|
||||
.Replace("%PROGRAM%", program)
|
||||
.Replace("%PROG%", programShort)
|
||||
@@ -1390,20 +1388,20 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <param name="driveChanged">Force an updated name if the drive letter changes</param>
|
||||
public void GetOutputNames(bool driveChanged)
|
||||
{
|
||||
if (Drives == null || Drives.Count == 0 || this.CurrentDrive == null)
|
||||
if (Drives == null || Drives.Count == 0 || CurrentDrive == null)
|
||||
{
|
||||
VerboseLogLn("Skipping output name building because no valid drives found!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the extension for the file for the next two statements
|
||||
var extension = _environment?.GetDefaultExtension(this.CurrentMediaType);
|
||||
var extension = _environment?.GetDefaultExtension(CurrentMediaType);
|
||||
|
||||
// Set the output filename, if it's not already
|
||||
if (string.IsNullOrEmpty(this.OutputPath))
|
||||
if (string.IsNullOrEmpty(OutputPath))
|
||||
{
|
||||
var label = GetFormattedVolumeLabel(CurrentDrive) ?? this.CurrentSystem.LongName();
|
||||
var directory = this.Options.DefaultOutputPath;
|
||||
var label = GetFormattedVolumeLabel(CurrentDrive) ?? CurrentSystem.LongName();
|
||||
var directory = Options.DefaultOutputPath;
|
||||
string filename = $"{label}{extension ?? ".bin"}";
|
||||
|
||||
// If the path ends with the label already
|
||||
@@ -1412,19 +1410,19 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
if (directory != null && label != null)
|
||||
#if NET20 || NET35
|
||||
this.OutputPath = Path.Combine(Path.Combine(directory, label), filename);
|
||||
OutputPath = Path.Combine(Path.Combine(directory, label), filename);
|
||||
#else
|
||||
this.OutputPath = Path.Combine(directory, label, filename);
|
||||
OutputPath = Path.Combine(directory, label, filename);
|
||||
#endif
|
||||
else
|
||||
this.OutputPath = filename;
|
||||
OutputPath = filename;
|
||||
}
|
||||
|
||||
// Set the output filename, if we changed drives
|
||||
else if (driveChanged)
|
||||
{
|
||||
var label = GetFormattedVolumeLabel(CurrentDrive) ?? this.CurrentSystem.LongName();
|
||||
string oldPath = FrontendTool.NormalizeOutputPaths(this.OutputPath, false);
|
||||
var label = GetFormattedVolumeLabel(CurrentDrive) ?? CurrentSystem.LongName();
|
||||
string oldPath = FrontendTool.NormalizeOutputPaths(OutputPath, false);
|
||||
string oldFilename = Path.GetFileNameWithoutExtension(oldPath);
|
||||
var directory = Path.GetDirectoryName(oldPath);
|
||||
string filename = $"{label}{extension ?? ".bin"}";
|
||||
@@ -1439,26 +1437,26 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
if (directory != null && label != null)
|
||||
#if NET20 || NET35
|
||||
this.OutputPath = Path.Combine(Path.Combine(directory, label), filename);
|
||||
OutputPath = Path.Combine(Path.Combine(directory, label), filename);
|
||||
#else
|
||||
this.OutputPath = Path.Combine(directory, label, filename);
|
||||
OutputPath = Path.Combine(directory, label, filename);
|
||||
#endif
|
||||
else
|
||||
this.OutputPath = filename;
|
||||
OutputPath = filename;
|
||||
}
|
||||
|
||||
// Otherwise, reset the extension of the currently set path
|
||||
else
|
||||
{
|
||||
string oldPath = FrontendTool.NormalizeOutputPaths(this.OutputPath, false);
|
||||
string oldPath = FrontendTool.NormalizeOutputPaths(OutputPath, false);
|
||||
string filename = Path.GetFileNameWithoutExtension(oldPath);
|
||||
var directory = Path.GetDirectoryName(oldPath);
|
||||
filename = $"{filename}{extension ?? ".bin"}";
|
||||
|
||||
if (directory != null)
|
||||
this.OutputPath = Path.Combine(directory, filename);
|
||||
OutputPath = Path.Combine(directory, filename);
|
||||
else
|
||||
this.OutputPath = filename;
|
||||
OutputPath = filename;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1509,14 +1507,10 @@ namespace MPF.Frontend.ViewModels
|
||||
// Bandai Playdia Quick Interactive System
|
||||
try
|
||||
{
|
||||
#if NET20 || NET35
|
||||
List<string> files = [.. Directory.GetFiles(drive.Name, "*", SearchOption.TopDirectoryOnly)];
|
||||
#else
|
||||
List<string> files = Directory.EnumerateFiles(drive.Name, "*", SearchOption.TopDirectoryOnly).ToList();
|
||||
#endif
|
||||
|
||||
if (files.Any(f => f.EndsWith(".AJS", StringComparison.OrdinalIgnoreCase))
|
||||
&& files.Any(f => f.EndsWith(".GLB", StringComparison.OrdinalIgnoreCase)))
|
||||
if (files.Exists(f => f.EndsWith(".AJS", StringComparison.OrdinalIgnoreCase))
|
||||
&& files.Exists(f => f.EndsWith(".GLB", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return RedumpSystem.BandaiPlaydiaQuickInteractiveSystem;
|
||||
}
|
||||
@@ -1562,11 +1556,7 @@ namespace MPF.Frontend.ViewModels
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(drive.Name, "$SystemUpdate"))
|
||||
#if NET20 || NET35
|
||||
&& Directory.GetFiles(Path.Combine(drive.Name, "$SystemUpdate")).Any()
|
||||
#else
|
||||
&& Directory.EnumerateFiles(Path.Combine(drive.Name, "$SystemUpdate")).Any()
|
||||
#endif
|
||||
&& IOExtensions.SafeGetFiles(Path.Combine(drive.Name, "$SystemUpdate")).Length > 0
|
||||
&& drive.TotalSize <= 500_000_000)
|
||||
{
|
||||
return RedumpSystem.MicrosoftXbox360;
|
||||
@@ -1718,21 +1708,13 @@ namespace MPF.Frontend.ViewModels
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(drive.Name, "AUDIO_TS"))
|
||||
#if NET20 || NET35
|
||||
&& Directory.GetFiles(Path.Combine(drive.Name, "AUDIO_TS")).Any())
|
||||
#else
|
||||
&& Directory.EnumerateFiles(Path.Combine(drive.Name, "AUDIO_TS")).Any())
|
||||
#endif
|
||||
&& IOExtensions.SafeGetFiles(Path.Combine(drive.Name, "AUDIO_TS")).Length > 0)
|
||||
{
|
||||
return RedumpSystem.DVDAudio;
|
||||
}
|
||||
|
||||
else if (Directory.Exists(Path.Combine(drive.Name, "VIDEO_TS"))
|
||||
#if NET20 || NET35
|
||||
&& Directory.GetFiles(Path.Combine(drive.Name, "VIDEO_TS")).Any())
|
||||
#else
|
||||
&& Directory.EnumerateFiles(Path.Combine(drive.Name, "VIDEO_TS")).Any())
|
||||
#endif
|
||||
&& IOExtensions.SafeGetFiles(Path.Combine(drive.Name, "VIDEO_TS")).Length > 0)
|
||||
{
|
||||
return RedumpSystem.DVDVideo;
|
||||
}
|
||||
@@ -1743,11 +1725,7 @@ namespace MPF.Frontend.ViewModels
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(drive.Name, "HVDVD_TS"))
|
||||
#if NET20 || NET35
|
||||
&& Directory.GetFiles(Path.Combine(drive.Name, "HVDVD_TS")).Any())
|
||||
#else
|
||||
&& Directory.EnumerateFiles(Path.Combine(drive.Name, "HVDVD_TS")).Any())
|
||||
#endif
|
||||
&& IOExtensions.SafeGetFiles(Path.Combine(drive.Name, "HVDVD_TS")).Length > 0)
|
||||
{
|
||||
return RedumpSystem.HDDVDVideo;
|
||||
}
|
||||
@@ -1758,11 +1736,7 @@ namespace MPF.Frontend.ViewModels
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(drive.Name, "PHOTO_CD"))
|
||||
#if NET20 || NET35
|
||||
&& Directory.GetFiles(Path.Combine(drive.Name, "PHOTO_CD")).Any())
|
||||
#else
|
||||
&& Directory.EnumerateFiles(Path.Combine(drive.Name, "PHOTO_CD")).Any())
|
||||
#endif
|
||||
&& IOExtensions.SafeGetFiles(Path.Combine(drive.Name, "PHOTO_CD")).Length > 0)
|
||||
{
|
||||
return RedumpSystem.PhotoCD;
|
||||
}
|
||||
@@ -1773,11 +1747,7 @@ namespace MPF.Frontend.ViewModels
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(drive.Name, "VCD"))
|
||||
#if NET20 || NET35
|
||||
&& Directory.GetFiles(Path.Combine(drive.Name, "drive.VCD")).Any())
|
||||
#else
|
||||
&& Directory.EnumerateFiles(Path.Combine(drive.Name, "VCD")).Any())
|
||||
#endif
|
||||
&& IOExtensions.SafeGetFiles(Path.Combine(drive.Name, "VCD")).Length > 0)
|
||||
{
|
||||
return RedumpSystem.VideoCD;
|
||||
}
|
||||
@@ -1796,7 +1766,7 @@ namespace MPF.Frontend.ViewModels
|
||||
public void ProcessCustomParameters()
|
||||
{
|
||||
// Set the execution context and processor
|
||||
if (_environment?.SetExecutionContext(this.Parameters) != true)
|
||||
if (_environment?.SetExecutionContext(Parameters) != true)
|
||||
return;
|
||||
if (_environment?.SetProcessor() != true)
|
||||
return;
|
||||
@@ -1804,21 +1774,22 @@ namespace MPF.Frontend.ViewModels
|
||||
// Catch this in case there's an input path issue
|
||||
try
|
||||
{
|
||||
int driveIndex = Drives.Select(d => d.Name?[0] ?? '\0').ToList().IndexOf(_environment.ContextInputPath?[0] ?? default);
|
||||
this.CurrentDrive = (driveIndex != -1 ? Drives[driveIndex] : Drives[0]);
|
||||
int driveIndex = Drives.ConvertAll(d => d.Name?[0] ?? '\0')
|
||||
.IndexOf(_environment.ContextInputPath?[0] ?? default);
|
||||
CurrentDrive = (driveIndex != -1 ? Drives[driveIndex] : Drives[0]);
|
||||
}
|
||||
catch { }
|
||||
|
||||
int driveSpeed = _environment.Speed ?? -1;
|
||||
if (driveSpeed > 0)
|
||||
this.DriveSpeed = driveSpeed;
|
||||
DriveSpeed = driveSpeed;
|
||||
else
|
||||
_environment.Speed = this.DriveSpeed;
|
||||
_environment.Speed = DriveSpeed;
|
||||
|
||||
// Disable change handling
|
||||
DisableEventHandlers();
|
||||
|
||||
this.OutputPath = FrontendTool.NormalizeOutputPaths(_environment.ContextOutputPath, false);
|
||||
OutputPath = FrontendTool.NormalizeOutputPaths(_environment.ContextOutputPath, false);
|
||||
|
||||
if (MediaTypes != null)
|
||||
{
|
||||
@@ -1826,7 +1797,7 @@ namespace MPF.Frontend.ViewModels
|
||||
if (mediaType != null)
|
||||
{
|
||||
int mediaTypeIndex = MediaTypes.FindIndex(m => m == mediaType);
|
||||
this.CurrentMediaType = (mediaTypeIndex > -1 ? MediaTypes[mediaTypeIndex] : MediaTypes[0]);
|
||||
CurrentMediaType = (mediaTypeIndex > -1 ? MediaTypes[mediaTypeIndex] : MediaTypes[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1837,59 +1808,49 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// Scan and show copy protection for the current disc
|
||||
/// </summary>
|
||||
#if NET40
|
||||
public (string?, string?) ScanAndShowProtection()
|
||||
#else
|
||||
public async Task<(string?, string?)> ScanAndShowProtection()
|
||||
#endif
|
||||
public async Task<string?> ScanAndShowProtection()
|
||||
{
|
||||
// Determine current environment, just in case
|
||||
_environment ??= DetermineEnvironment();
|
||||
|
||||
// If we don't have a valid drive
|
||||
if (this.CurrentDrive?.Name == null)
|
||||
return (null, "No valid drive found!");
|
||||
if (CurrentDrive?.Name == null)
|
||||
{
|
||||
ErrorLogLn("No valid drive found!");
|
||||
return null;
|
||||
}
|
||||
|
||||
VerboseLogLn($"Scanning for copy protection in {this.CurrentDrive.Name}");
|
||||
VerboseLogLn($"Scanning for copy protection in {CurrentDrive.Name}");
|
||||
|
||||
var tempContent = this.Status;
|
||||
this.Status = "Scanning for copy protection... this might take a while!";
|
||||
this.StartStopButtonEnabled = false;
|
||||
this.MediaScanButtonEnabled = false;
|
||||
this.UpdateVolumeLabelEnabled = false;
|
||||
this.CopyProtectScanButtonEnabled = false;
|
||||
var tempContent = Status;
|
||||
Status = "Scanning for copy protection... this might take a while!";
|
||||
StartStopButtonEnabled = false;
|
||||
MediaScanButtonEnabled = false;
|
||||
UpdateVolumeLabelEnabled = false;
|
||||
CopyProtectScanButtonEnabled = false;
|
||||
|
||||
var progress = new Progress<ProtectionProgress>();
|
||||
progress.ProgressChanged += ProgressUpdated;
|
||||
#if NET40
|
||||
var protectionTask = ProtectionTool.RunProtectionScanOnPath(this.CurrentDrive.Name, this.Options, progress);
|
||||
protectionTask.Wait();
|
||||
var (protections, error) = protectionTask.Result;
|
||||
#else
|
||||
var (protections, error) = await ProtectionTool.RunProtectionScanOnPath(this.CurrentDrive.Name, this.Options, progress);
|
||||
#endif
|
||||
var output = ProtectionTool.FormatProtections(protections);
|
||||
|
||||
// If SmartE is detected on the current disc, remove `/sf` from the flags for DIC only -- Disabled until further notice
|
||||
//if (Env.InternalProgram == InternalProgram.DiscImageCreator && output.Contains("SmartE"))
|
||||
//{
|
||||
// ((ExecutionContexts.DiscImageCreator.ExecutionContext)Env.ExecutionContext)[ExecutionContexts.DiscImageCreator.FlagStrings.ScanFileProtect] = false;
|
||||
// if (this.Options.VerboseLogging)
|
||||
// this.Logger.VerboseLogLn($"SmartE detected, removing {ExecutionContexts.DiscImageCreator.FlagStrings.ScanFileProtect} from parameters");
|
||||
//}
|
||||
try
|
||||
{
|
||||
var protections = await ProtectionTool.RunProtectionScanOnPath(CurrentDrive.Name, Options, progress);
|
||||
var output = ProtectionTool.FormatProtections(protections);
|
||||
LogLn($"Detected the following protections in {CurrentDrive.Name}:\r\n\r\n{output}");
|
||||
|
||||
if (string.IsNullOrEmpty(error))
|
||||
LogLn($"Detected the following protections in {this.CurrentDrive.Name}:\r\n\r\n{output}");
|
||||
else
|
||||
ErrorLogLn($"Path could not be scanned! Exception information:\r\n\r\n{error}");
|
||||
Status = tempContent;
|
||||
StartStopButtonEnabled = ShouldEnableDumpingButton();
|
||||
MediaScanButtonEnabled = true;
|
||||
UpdateVolumeLabelEnabled = true;
|
||||
CopyProtectScanButtonEnabled = true;
|
||||
|
||||
this.Status = tempContent;
|
||||
this.StartStopButtonEnabled = ShouldEnableDumpingButton();
|
||||
this.MediaScanButtonEnabled = true;
|
||||
this.UpdateVolumeLabelEnabled = true;
|
||||
this.CopyProtectScanButtonEnabled = true;
|
||||
|
||||
return (output, error);
|
||||
return output;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLogLn($"Path could not be scanned! Exception information:\r\n\r\n{ex}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1959,10 +1920,10 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// Now set the selected item, if possible
|
||||
int index = MediaTypes.FindIndex(kvp => kvp.Value == CurrentMediaType);
|
||||
if (this.CurrentMediaType != null && index == -1)
|
||||
if (CurrentMediaType != null && index == -1)
|
||||
VerboseLogLn($"Disc of type '{CurrentMediaType.LongName()}' found, but the current system does not support it!");
|
||||
|
||||
this.CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1971,14 +1932,14 @@ namespace MPF.Frontend.ViewModels
|
||||
public void SetSupportedDriveSpeed()
|
||||
{
|
||||
// Set the drive speed list that's appropriate
|
||||
this.DriveSpeeds = (List<int>)InterfaceConstants.GetSpeedsForMediaType(CurrentMediaType);
|
||||
VerboseLogLn($"Supported media speeds: {string.Join(", ", this.DriveSpeeds.Select(ds => ds.ToString()).ToArray())}");
|
||||
DriveSpeeds = (List<int>)InterfaceConstants.GetSpeedsForMediaType(CurrentMediaType);
|
||||
VerboseLogLn($"Supported media speeds: {string.Join(", ", [.. DriveSpeeds.ConvertAll(ds => ds.ToString())])}");
|
||||
|
||||
// Set the selected speed
|
||||
int speed = FrontendTool.GetDefaultSpeedForMediaType(CurrentMediaType, Options);
|
||||
|
||||
VerboseLogLn($"Setting drive speed to: {speed}");
|
||||
this.DriveSpeed = speed;
|
||||
DriveSpeed = speed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1988,8 +1949,8 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
return Drives != null
|
||||
&& Drives.Count > 0
|
||||
&& this.CurrentSystem != null
|
||||
&& this.CurrentMediaType != null
|
||||
&& CurrentSystem != null
|
||||
&& CurrentMediaType != null
|
||||
&& ProgramSupportsMedia();
|
||||
}
|
||||
|
||||
@@ -2056,12 +2017,12 @@ namespace MPF.Frontend.ViewModels
|
||||
_environment.RefreshDrive();
|
||||
|
||||
// If still in custom parameter mode, check that users meant to continue or not
|
||||
if (this.ParametersCheckBoxEnabled == true && _displayUserMessage != null)
|
||||
if (ParametersCheckBoxEnabled == true && _displayUserMessage != null)
|
||||
{
|
||||
bool? result = _displayUserMessage("Custom Changes", "It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", 3, true);
|
||||
if (result == true)
|
||||
{
|
||||
this.ParametersCheckBoxEnabled = false;
|
||||
ParametersCheckBoxEnabled = false;
|
||||
ProcessCustomParameters();
|
||||
}
|
||||
else if (result == null)
|
||||
@@ -2087,7 +2048,7 @@ namespace MPF.Frontend.ViewModels
|
||||
_environment.RefreshDrive();
|
||||
|
||||
// Output to the label and log
|
||||
this.Status = "Starting dumping process... please wait!";
|
||||
Status = "Starting dumping process... please wait!";
|
||||
LogLn("Starting dumping process... please wait!");
|
||||
LogLn("Look for the separate command window for more details");
|
||||
|
||||
@@ -2105,7 +2066,7 @@ namespace MPF.Frontend.ViewModels
|
||||
if (!_environment.IsDumpingCommand())
|
||||
{
|
||||
LogLn("No dumping command was run, submission information will not be gathered.");
|
||||
this.Status = "Execution complete!";
|
||||
Status = "Execution complete!";
|
||||
|
||||
// Reset all UI elements
|
||||
EnableAllUIElements();
|
||||
@@ -2120,13 +2081,13 @@ namespace MPF.Frontend.ViewModels
|
||||
else
|
||||
{
|
||||
ErrorLogLn(result.Message);
|
||||
this.Status = "Execution failed!";
|
||||
Status = "Execution failed!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLogLn(ex.ToString());
|
||||
this.Status = "An exception occurred!";
|
||||
Status = "An exception occurred!";
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -2265,9 +2226,9 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
return program switch
|
||||
{
|
||||
InternalProgram.Redumper => File.Exists(this.Options.RedumperPath),
|
||||
InternalProgram.Aaru => File.Exists(this.Options.AaruPath),
|
||||
InternalProgram.DiscImageCreator => File.Exists(this.Options.DiscImageCreatorPath),
|
||||
InternalProgram.Redumper => File.Exists(Options.RedumperPath),
|
||||
InternalProgram.Aaru => File.Exists(Options.AaruPath),
|
||||
InternalProgram.DiscImageCreator => File.Exists(Options.DiscImageCreatorPath),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
@@ -2301,10 +2262,10 @@ namespace MPF.Frontend.ViewModels
|
||||
var message = value?.Message;
|
||||
|
||||
// Update the label with only the first line of output
|
||||
if (message != null && message.Contains('\n'))
|
||||
this.Status = value?.Message?.Split('\n')[0] + " (See log output)";
|
||||
if (message != null && message.Contains("\n"))
|
||||
Status = value?.Message?.Split('\n')[0] + " (See log output)";
|
||||
else
|
||||
this.Status = value?.Message ?? string.Empty;
|
||||
Status = value?.Message ?? string.Empty;
|
||||
|
||||
// Log based on success or failure
|
||||
if (value != null && value)
|
||||
@@ -2319,7 +2280,7 @@ namespace MPF.Frontend.ViewModels
|
||||
private void ProgressUpdated(object? sender, ProtectionProgress value)
|
||||
{
|
||||
string message = $"{value.Percentage * 100:N2}%: {value.Filename} - {value.Protection}";
|
||||
this.Status = message;
|
||||
Status = message;
|
||||
VerboseLogLn(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MPF.Frontend.ComboBoxItems;
|
||||
using SabreTools.RedumpLib.Web;
|
||||
using RedumperReadMethod = MPF.ExecutionContexts.Redumper.ReadMethod;
|
||||
using RedumperSectorOrder = MPF.ExecutionContexts.Redumper.SectorOrder;
|
||||
|
||||
@@ -65,7 +62,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <summary>
|
||||
/// Current list of supported system profiles
|
||||
/// </summary>
|
||||
public static List<RedumpSystemComboBoxItem> Systems => RedumpSystemComboBoxItem.GenerateElements().ToList();
|
||||
public static List<RedumpSystemComboBoxItem> Systems => RedumpSystemComboBoxItem.GenerateElements();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -93,7 +90,7 @@ namespace MPF.Frontend.ViewModels
|
||||
private static List<Element<InternalProgram>> PopulateInternalPrograms()
|
||||
{
|
||||
var internalPrograms = new List<InternalProgram> { InternalProgram.Redumper, InternalProgram.DiscImageCreator, InternalProgram.Aaru };
|
||||
return internalPrograms.Select(ip => new Element<InternalProgram>(ip)).ToList();
|
||||
return internalPrograms.ConvertAll(ip => new Element<InternalProgram>(ip));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,7 +99,7 @@ namespace MPF.Frontend.ViewModels
|
||||
private static List<Element<RedumperReadMethod>> PopulateRedumperReadMethods()
|
||||
{
|
||||
var readMethods = new List<RedumperReadMethod> { RedumperReadMethod.NONE, RedumperReadMethod.D8, RedumperReadMethod.BE, RedumperReadMethod.BE_CDDA };
|
||||
return readMethods.Select(rm => new Element<RedumperReadMethod>(rm)).ToList();
|
||||
return readMethods.ConvertAll(rm => new Element<RedumperReadMethod>(rm));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -111,7 +108,7 @@ namespace MPF.Frontend.ViewModels
|
||||
private static List<Element<RedumperSectorOrder>> PopulateRedumperSectorOrders()
|
||||
{
|
||||
var sectorOrders = new List<RedumperSectorOrder> { RedumperSectorOrder.NONE, RedumperSectorOrder.DATA_C2_SUB, RedumperSectorOrder.DATA_SUB_C2, RedumperSectorOrder.DATA_SUB, RedumperSectorOrder.DATA_C2 };
|
||||
return sectorOrders.Select(so => new Element<RedumperSectorOrder>(so)).ToList();
|
||||
return sectorOrders.ConvertAll(so => new Element<RedumperSectorOrder>(so));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -119,11 +116,16 @@ namespace MPF.Frontend.ViewModels
|
||||
#region UI Commands
|
||||
|
||||
/// <summary>
|
||||
/// Test Redump login credentials
|
||||
/// Get the human-readable result for a Redump login result
|
||||
/// </summary>
|
||||
public static async Task<(bool?, string?)> TestRedumpLogin(string username, string password)
|
||||
public static string GetRedumpLoginResult(bool? success)
|
||||
{
|
||||
return await RedumpClient.ValidateCredentials(username, password);
|
||||
return success switch
|
||||
{
|
||||
true => "Redump username and password accepted!",
|
||||
false => "Redump username and password denied!",
|
||||
null => "An error occurred validating your credentials!",
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
@@ -186,7 +185,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string baseFilename)
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
@@ -618,31 +617,16 @@ namespace MPF.Processors
|
||||
continue;
|
||||
|
||||
// Build each row in consecutive order
|
||||
string pvd = string.Empty;
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] pvdLine = new byte[16];
|
||||
Array.Copy(pvdData, 0, pvdLine, 0, 16);
|
||||
pvd += GenerateSectorOutputLine("0320", pvdLine);
|
||||
Array.Copy(pvdData, 16, pvdLine, 0, 16);
|
||||
pvd += GenerateSectorOutputLine("0330", pvdLine);
|
||||
Array.Copy(pvdData, 32, pvdLine, 0, 16);
|
||||
pvd += GenerateSectorOutputLine("0340", pvdLine);
|
||||
Array.Copy(pvdData, 48, pvdLine, 0, 16);
|
||||
pvd += GenerateSectorOutputLine("0350", pvdLine);
|
||||
Array.Copy(pvdData, 64, pvdLine, 0, 16);
|
||||
pvd += GenerateSectorOutputLine("0360", pvdLine);
|
||||
Array.Copy(pvdData, 80, pvdLine, 0, 16);
|
||||
pvd += GenerateSectorOutputLine("0370", pvdLine);
|
||||
#else
|
||||
pvd += GenerateSectorOutputLine("0320", new ReadOnlySpan<byte>(pvdData, 0, 16).ToArray());
|
||||
pvd += GenerateSectorOutputLine("0330", new ReadOnlySpan<byte>(pvdData, 16, 16).ToArray());
|
||||
pvd += GenerateSectorOutputLine("0340", new ReadOnlySpan<byte>(pvdData, 32, 16).ToArray());
|
||||
pvd += GenerateSectorOutputLine("0350", new ReadOnlySpan<byte>(pvdData, 48, 16).ToArray());
|
||||
pvd += GenerateSectorOutputLine("0360", new ReadOnlySpan<byte>(pvdData, 64, 16).ToArray());
|
||||
pvd += GenerateSectorOutputLine("0370", new ReadOnlySpan<byte>(pvdData, 80, 16).ToArray());
|
||||
#endif
|
||||
var pvd = new StringBuilder();
|
||||
|
||||
return pvd;
|
||||
pvd.AppendLine(GenerateSectorOutputLine("0320", pvdData, 0 * 16));
|
||||
pvd.AppendLine(GenerateSectorOutputLine("0330", pvdData, 1 * 16));
|
||||
pvd.AppendLine(GenerateSectorOutputLine("0340", pvdData, 2 * 16));
|
||||
pvd.AppendLine(GenerateSectorOutputLine("0350", pvdData, 3 * 16));
|
||||
pvd.AppendLine(GenerateSectorOutputLine("0360", pvdData, 4 * 16));
|
||||
pvd.AppendLine(GenerateSectorOutputLine("0370", pvdData, 5 * 16));
|
||||
|
||||
return pvd.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,13 +716,13 @@ namespace MPF.Processors
|
||||
|
||||
// Now generate the byte array data
|
||||
var pvdData = new List<byte>();
|
||||
pvdData.AddRange(new string(' ', 13).ToCharArray().Select(c => (byte)c));
|
||||
pvdData.AddRange(Array.ConvertAll(new string(' ', 13).ToCharArray(), c => (byte)c));
|
||||
pvdData.AddRange(GeneratePVDDateTimeBytes(creation));
|
||||
pvdData.AddRange(GeneratePVDDateTimeBytes(modification));
|
||||
pvdData.AddRange(GeneratePVDDateTimeBytes(expiration));
|
||||
pvdData.AddRange(GeneratePVDDateTimeBytes(effective));
|
||||
pvdData.Add(0x01);
|
||||
pvdData.AddRange(new string((char)0, 14).ToCharArray().Select(c => (byte)c));
|
||||
pvdData.AddRange(Array.ConvertAll(new string((char)0, 14).ToCharArray(), c => (byte)c));
|
||||
|
||||
// Return the filled array
|
||||
return [.. pvdData];
|
||||
@@ -780,7 +764,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// Get and return the byte array
|
||||
List<byte> dateTimeList = dateTimeString.ToCharArray().Select(c => (byte)c).ToList();
|
||||
List<byte> dateTimeList = [.. Array.ConvertAll(dateTimeString.ToCharArray(), c => (byte)c)];
|
||||
dateTimeList.Add(timeZoneNumber);
|
||||
return [.. dateTimeList];
|
||||
}
|
||||
@@ -790,22 +774,26 @@ namespace MPF.Processors
|
||||
/// </summary>
|
||||
/// <param name="row">Row ID for outputting</param>
|
||||
/// <param name="bytes">Bytes representing the data to write</param>
|
||||
/// <param name="offset">Offset into the byte array</param>
|
||||
/// <param name="length">Length of the byte array</param>
|
||||
/// <returns>Formatted string representing the sector line</returns>
|
||||
private static string? GenerateSectorOutputLine(string row, byte[] bytes)
|
||||
private static string? GenerateSectorOutputLine(string row, byte[] bytes, int offset)
|
||||
{
|
||||
// If the data isn't correct, return null
|
||||
if (bytes == null || bytes.Length != 16)
|
||||
if (bytes == null || offset < 0 || offset >= bytes.Length || bytes.Length - offset < 16)
|
||||
return null;
|
||||
|
||||
string pvdLine = $"{row} : ";
|
||||
pvdLine += BitConverter.ToString(bytes.Take(8).ToArray()).Replace("-", " ");
|
||||
pvdLine += " ";
|
||||
pvdLine += BitConverter.ToString(bytes.Skip(8).Take(8).ToArray()).Replace("-", " ");
|
||||
pvdLine += " ";
|
||||
pvdLine += Encoding.ASCII.GetString([.. bytes]).Replace((char)0, '.').Replace('?', '.');
|
||||
pvdLine += "\n";
|
||||
var pvdLine = new StringBuilder();
|
||||
|
||||
return pvdLine;
|
||||
pvdLine.Append($"{row} : ");
|
||||
|
||||
pvdLine.Append(BitConverter.ToString(bytes, offset + 0, 8).Replace("-", " "));
|
||||
pvdLine.Append(" ");
|
||||
pvdLine.Append(BitConverter.ToString(bytes, offset + 8, 8).Replace("-", " "));
|
||||
pvdLine.Append(" ");
|
||||
pvdLine.Append(Encoding.ASCII.GetString(bytes, offset, 16).Replace((char)0, '.').Replace('?', '.'));
|
||||
|
||||
return pvdLine.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -986,7 +974,7 @@ namespace MPF.Processors
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// If there's no hardware information, skip
|
||||
if (opticalDisc.DumpHardwareArray == null || !opticalDisc.DumpHardwareArray.Any())
|
||||
if (opticalDisc.DumpHardwareArray == null || opticalDisc.DumpHardwareArray.Length == 0)
|
||||
continue;
|
||||
|
||||
foreach (DumpHardwareType hardware in opticalDisc.DumpHardwareArray)
|
||||
|
||||
@@ -4,8 +4,10 @@ using System.IO;
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
using System.IO.Compression;
|
||||
#endif
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
#endif
|
||||
using System.Text;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.Processors
|
||||
@@ -55,9 +57,10 @@ namespace MPF.Processors
|
||||
// <summary>
|
||||
/// Generate a list of all output files generated
|
||||
/// </summary>
|
||||
/// <param name="baseFilename">Base filename to use for checking</param>
|
||||
/// <param name="baseDirectory">Base filename and path to use for checking</param>
|
||||
/// <param name="baseFilename">Base filename and path to use for checking</param>
|
||||
/// <returns>List of all output files, empty otherwise</returns>
|
||||
internal abstract List<OutputFile> GetOutputFiles(string baseFilename);
|
||||
internal abstract List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -71,10 +74,11 @@ namespace MPF.Processors
|
||||
/// <param name="outputFilename">Output filename to use as the base path</param>
|
||||
/// <param name="processor">Processor object representing how to process the outputs</param>
|
||||
/// <returns>True if the process succeeded, false otherwise</returns>
|
||||
public (bool, string) CompressLogFiles(string? outputDirectory, string? filenameSuffix, string outputFilename)
|
||||
public bool CompressLogFiles(string? outputDirectory, string? filenameSuffix, string outputFilename, out string status)
|
||||
{
|
||||
#if NET20 || NET35 || NET40
|
||||
return (false, "Log compression is not available for this framework version");
|
||||
status = "Log compression is not available for this framework version";
|
||||
return false;
|
||||
#else
|
||||
// Prepare the necessary paths
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
@@ -92,8 +96,11 @@ namespace MPF.Processors
|
||||
var generatedFiles = GetGeneratedFilePaths(outputDirectory, filenameSuffix);
|
||||
|
||||
// Don't create an archive if there are no paths
|
||||
if (!zippableFiles.Any() && !generatedFiles.Any())
|
||||
return (true, "No files to compress!");
|
||||
if (zippableFiles.Count == 0 && generatedFiles.Count == 0)
|
||||
{
|
||||
status = "No files to compress!";
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the file already exists, we want to delete the old one
|
||||
try
|
||||
@@ -103,7 +110,8 @@ namespace MPF.Processors
|
||||
}
|
||||
catch
|
||||
{
|
||||
return (false, "Could not delete old archive!");
|
||||
status = "Could not delete old archive!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add the log files to the archive and delete the uncompressed file after
|
||||
@@ -115,11 +123,13 @@ namespace MPF.Processors
|
||||
_ = AddToArchive(zf, zippableFiles, outputDirectory, true);
|
||||
_ = AddToArchive(zf, generatedFiles, outputDirectory, false);
|
||||
|
||||
return (true, "Compression complete!");
|
||||
status = "Compression complete!";
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return (false, $"Compression could not complete: {ex}");
|
||||
status = $"Compression could not complete: {ex}";
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -135,7 +145,7 @@ namespace MPF.Processors
|
||||
/// <param name="outputFilename">Output filename to use as the base path</param>
|
||||
/// <param name="processor">Processor object representing how to process the outputs</param>
|
||||
/// <returns>True if the process succeeded, false otherwise</returns>
|
||||
public (bool, string) DeleteUnnecessaryFiles(string? outputDirectory, string outputFilename)
|
||||
public bool DeleteUnnecessaryFiles(string? outputDirectory, string outputFilename, out string status)
|
||||
{
|
||||
// Prepare the necessary paths
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
@@ -148,8 +158,11 @@ namespace MPF.Processors
|
||||
// Get the list of deleteable files from the parameters object
|
||||
var files = GetDeleteableFilePaths(combinedBase);
|
||||
|
||||
if (!files.Any())
|
||||
return (true, "No files to delete!");
|
||||
if (files.Count == 0)
|
||||
{
|
||||
status = "No files to delete!";
|
||||
return true;
|
||||
}
|
||||
|
||||
// Attempt to delete all of the files
|
||||
foreach (string file in files)
|
||||
@@ -161,7 +174,8 @@ namespace MPF.Processors
|
||||
catch { }
|
||||
}
|
||||
|
||||
return (true, "Deletion complete!");
|
||||
status = "Deletion complete!";
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -170,10 +184,10 @@ namespace MPF.Processors
|
||||
/// <param name="outputDirectory">Output folder to write to</param>
|
||||
/// <param name="outputFilename">Output filename to use as the base path</param>
|
||||
/// <param name="processor">Processor object representing how to process the outputs</param>
|
||||
/// <returns>Tuple of true if all required files exist, false otherwise and a list representing missing files</returns>
|
||||
public (bool, List<string>) FoundAllFiles(string? outputDirectory, string outputFilename)
|
||||
/// <returns>A list representing missing files, empty if none</returns>
|
||||
public List<string> FoundAllFiles(string? outputDirectory, string outputFilename)
|
||||
{
|
||||
// First, sanitized the output filename to strip off any potential extension
|
||||
// Sanitize the output filename to strip off any potential extension
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
|
||||
// Then get the base path for all checking
|
||||
@@ -194,12 +208,12 @@ namespace MPF.Processors
|
||||
/// <returns>Dictiionary of artifact keys to Base64-encoded values, if possible</param>
|
||||
public Dictionary<string, string> GenerateArtifacts(string basePath)
|
||||
{
|
||||
// Get the base filename and directory from the base path
|
||||
string baseFilename = Path.GetFileName(basePath);
|
||||
// Split the base path for matching
|
||||
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
|
||||
string baseFilename = Path.GetFileNameWithoutExtension(basePath);
|
||||
|
||||
// Get the list of output files
|
||||
var outputFiles = GetOutputFiles(baseFilename);
|
||||
var outputFiles = GetOutputFiles(baseDirectory, baseFilename);
|
||||
if (outputFiles.Count == 0)
|
||||
return [];
|
||||
|
||||
@@ -216,20 +230,20 @@ namespace MPF.Processors
|
||||
// Skip non-existent files
|
||||
foreach (string filename in outputFile.Filenames)
|
||||
{
|
||||
string outputFilePath = Path.Combine(baseDirectory, filename);
|
||||
if (!File.Exists(outputFilePath))
|
||||
string possibleFile = Path.Combine(baseDirectory, filename);
|
||||
if (!File.Exists(possibleFile))
|
||||
continue;
|
||||
|
||||
// Get binary artifacts as a byte array
|
||||
if (outputFile.IsBinaryArtifact)
|
||||
{
|
||||
byte[] data = File.ReadAllBytes(filename);
|
||||
byte[] data = File.ReadAllBytes(possibleFile);
|
||||
string str = Convert.ToBase64String(data);
|
||||
artifacts.Add(outputFile.ArtifactKey, str);
|
||||
}
|
||||
else
|
||||
{
|
||||
string? data = ProcessingTool.GetFullFile(filename);
|
||||
string? data = ProcessingTool.GetFullFile(possibleFile);
|
||||
string str = ProcessingTool.GetBase64(data) ?? string.Empty;
|
||||
artifacts.Add(outputFile.ArtifactKey, str);
|
||||
}
|
||||
@@ -316,17 +330,17 @@ namespace MPF.Processors
|
||||
/// Validate if all required output files exist
|
||||
/// </summary>
|
||||
/// <param name="basePath">Base filename and path to use for checking</param>
|
||||
/// <returns>Tuple of true if all required files exist, false otherwise and a list representing missing files</returns>
|
||||
private (bool, List<string>) CheckRequiredFiles(string basePath)
|
||||
/// <returns>A list representing missing files, empty if none</returns>
|
||||
private List<string> CheckRequiredFiles(string basePath)
|
||||
{
|
||||
// Get the base filename and directory from the base path
|
||||
string baseFilename = Path.GetFileName(basePath);
|
||||
// Split the base path for matching
|
||||
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
|
||||
string baseFilename = Path.GetFileNameWithoutExtension(basePath);
|
||||
|
||||
// Get the list of output files
|
||||
var outputFiles = GetOutputFiles(baseFilename);
|
||||
var outputFiles = GetOutputFiles(baseDirectory, baseFilename);
|
||||
if (outputFiles.Count == 0)
|
||||
return (false, ["Media and system combination not supported"]);
|
||||
return ["Media and system combination not supported"];
|
||||
|
||||
// Check for the log file
|
||||
bool logArchiveExists = false;
|
||||
@@ -381,24 +395,38 @@ namespace MPF.Processors
|
||||
#endif
|
||||
}
|
||||
|
||||
return (!missingFiles.Any(), missingFiles);
|
||||
return missingFiles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a list of all deleteable filenames
|
||||
/// </summary>
|
||||
/// <param name="baseFilename">Base filename to use for generation</param>
|
||||
/// <param name="basePath">Base filename and path to use for checking</param>
|
||||
/// <returns>List of all deleteable filenames, empty otherwise</returns>
|
||||
private List<string> GetDeleteableFilenames(string baseFilename)
|
||||
private List<string> GetDeleteableFilenames(string basePath)
|
||||
{
|
||||
// Split the base path for matching
|
||||
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
|
||||
string baseFilename = Path.GetFileNameWithoutExtension(basePath);
|
||||
|
||||
// Get the list of output files
|
||||
var outputFiles = GetOutputFiles(baseFilename);
|
||||
var outputFiles = GetOutputFiles(baseDirectory, baseFilename);
|
||||
if (outputFiles.Count == 0)
|
||||
return [];
|
||||
|
||||
// Filter down to deleteable files
|
||||
var deleteableFiles = outputFiles.Where(of => of.IsDeleteable);
|
||||
var deleteableFiles = outputFiles.FindAll(of => of.IsDeleteable);
|
||||
#if NET20
|
||||
var deleteableFilenames = new List<string>();
|
||||
foreach (var deleteableFile in deleteableFiles)
|
||||
{
|
||||
deleteableFilenames.AddRange(deleteableFile.Filenames);
|
||||
}
|
||||
|
||||
return deleteableFilenames;
|
||||
#else
|
||||
return deleteableFiles.SelectMany(of => of.Filenames).ToList();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -408,12 +436,11 @@ namespace MPF.Processors
|
||||
/// <returns>List of all deleteable file paths, empty otherwise</returns>
|
||||
private List<string> GetDeleteableFilePaths(string basePath)
|
||||
{
|
||||
// Get the base filename and directory from the base path
|
||||
string baseFilename = Path.GetFileName(basePath);
|
||||
// Split the base path for matching
|
||||
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
|
||||
|
||||
// Get the list of deleteable files
|
||||
var deleteableFilenames = GetDeleteableFilenames(baseFilename);
|
||||
var deleteableFilenames = GetDeleteableFilenames(basePath);
|
||||
if (deleteableFilenames.Count == 0)
|
||||
return [];
|
||||
|
||||
@@ -422,11 +449,11 @@ namespace MPF.Processors
|
||||
foreach (var filename in deleteableFilenames)
|
||||
{
|
||||
// Skip non-existent files
|
||||
string outputFilePath = Path.Combine(baseDirectory, filename);
|
||||
if (!File.Exists(outputFilePath))
|
||||
string possiblePath = Path.Combine(baseDirectory, filename);
|
||||
if (!File.Exists(possiblePath))
|
||||
continue;
|
||||
|
||||
deleteableFiles.Add(outputFilePath);
|
||||
deleteableFiles.Add(possiblePath);
|
||||
}
|
||||
|
||||
return deleteableFiles;
|
||||
@@ -458,10 +485,10 @@ namespace MPF.Processors
|
||||
/// <summary>
|
||||
/// Generate a list of all MPF-specific log files generated
|
||||
/// </summary>
|
||||
/// <param name="outputDirectory">Output folder to write to</param>
|
||||
/// <param name="basePath">Base directory to use for checking</param>
|
||||
/// <param name="filenameSuffix">Optional suffix to append to the filename</param>
|
||||
/// <returns>List of all log file paths, empty otherwise</returns>
|
||||
private static List<string> GetGeneratedFilePaths(string? outputDirectory, string? filenameSuffix)
|
||||
private static List<string> GetGeneratedFilePaths(string? baseDirectory, string? filenameSuffix)
|
||||
{
|
||||
// Get the list of generated files
|
||||
var generatedFilenames = GetGeneratedFilenames(filenameSuffix);
|
||||
@@ -469,18 +496,18 @@ namespace MPF.Processors
|
||||
return [];
|
||||
|
||||
// Ensure the output directory
|
||||
outputDirectory ??= string.Empty;
|
||||
baseDirectory ??= string.Empty;
|
||||
|
||||
// Return only files that exist
|
||||
var generatedFiles = new List<string>();
|
||||
foreach (var filename in generatedFilenames)
|
||||
{
|
||||
// Skip non-existent files
|
||||
string outputFilePath = Path.Combine(outputDirectory, filename);
|
||||
if (!File.Exists(outputFilePath))
|
||||
string possiblePath = Path.Combine(baseDirectory, filename);
|
||||
if (!File.Exists(possiblePath))
|
||||
continue;
|
||||
|
||||
generatedFiles.Add(outputFilePath);
|
||||
generatedFiles.Add(possiblePath);
|
||||
}
|
||||
|
||||
return generatedFiles;
|
||||
@@ -489,18 +516,32 @@ namespace MPF.Processors
|
||||
/// <summary>
|
||||
/// Generate a list of all zippable filenames
|
||||
/// </summary>
|
||||
/// <param name="baseFilename">Base filename to use for generation</param>
|
||||
/// <param name="basePath">Base filename and path to use for checking</param>
|
||||
/// <returns>List of all zippable filenames, empty otherwise</returns>
|
||||
private List<string> GetZippableFilenames(string baseFilename)
|
||||
private List<string> GetZippableFilenames(string basePath)
|
||||
{
|
||||
// Split the base path for matching
|
||||
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
|
||||
string baseFilename = Path.GetFileNameWithoutExtension(basePath);
|
||||
|
||||
// Get the list of output files
|
||||
var outputFiles = GetOutputFiles(baseFilename);
|
||||
var outputFiles = GetOutputFiles(baseDirectory, baseFilename);
|
||||
if (outputFiles.Count == 0)
|
||||
return [];
|
||||
|
||||
// Filter down to deleteable files
|
||||
var deleteableFiles = outputFiles.Where(of => of.IsZippable);
|
||||
return deleteableFiles.SelectMany(of => of.Filenames).ToList();
|
||||
// Filter down to zippable files
|
||||
var zippableFiles = outputFiles.FindAll(of => of.IsZippable);
|
||||
#if NET20
|
||||
var zippableFilenames = new List<string>();
|
||||
foreach (var zippableFile in zippableFiles)
|
||||
{
|
||||
zippableFilenames.AddRange(zippableFile.Filenames);
|
||||
}
|
||||
|
||||
return zippableFilenames;
|
||||
#else
|
||||
return zippableFiles.SelectMany(of => of.Filenames).ToList();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -510,12 +551,11 @@ namespace MPF.Processors
|
||||
/// <returns>List of all zippable file paths, empty otherwise</returns>
|
||||
private List<string> GetZippableFilePaths(string basePath)
|
||||
{
|
||||
// Get the base filename and directory from the base path
|
||||
string baseFilename = Path.GetFileName(basePath);
|
||||
// Split the base path for matching
|
||||
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
|
||||
|
||||
// Get the list of zippable files
|
||||
var zippableFilenames = GetZippableFilenames(baseFilename);
|
||||
var zippableFilenames = GetZippableFilenames(basePath);
|
||||
if (zippableFilenames.Count == 0)
|
||||
return [];
|
||||
|
||||
@@ -524,11 +564,11 @@ namespace MPF.Processors
|
||||
foreach (var filename in zippableFilenames)
|
||||
{
|
||||
// Skip non-existent files
|
||||
string outputFilePath = Path.Combine(baseDirectory, filename);
|
||||
if (!File.Exists(outputFilePath))
|
||||
string possiblePath = Path.Combine(baseDirectory, filename);
|
||||
if (!File.Exists(possiblePath))
|
||||
continue;
|
||||
|
||||
zippableFiles.Add(outputFilePath);
|
||||
zippableFiles.Add(possiblePath);
|
||||
}
|
||||
|
||||
return zippableFiles;
|
||||
@@ -561,8 +601,7 @@ namespace MPF.Processors
|
||||
hex = hex.Substring(0, trimLength);
|
||||
|
||||
// TODO: Check for non-zero values in discarded PIC
|
||||
|
||||
return Regex.Replace(hex, ".{32}", "$0\n", RegexOptions.Compiled);
|
||||
return SplitString(hex, 32);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -625,6 +664,32 @@ namespace MPF.Processors
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Split a string with newlines every <paramref name="count"/> characters
|
||||
/// </summary>
|
||||
protected static string SplitString(string? str, int count, bool trim = false)
|
||||
{
|
||||
// Ignore invalid inputs
|
||||
if (str == null)
|
||||
return string.Empty;
|
||||
if (count < 1)
|
||||
return str;
|
||||
|
||||
// Build the output string
|
||||
var sb = new StringBuilder();
|
||||
for (int i = 0; i < str.Length; i += count)
|
||||
{
|
||||
string line = str.Substring(i, count);
|
||||
if (trim)
|
||||
line = line.Trim();
|
||||
|
||||
sb.Append(line);
|
||||
sb.Append('\n');
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.Models.Logiqx;
|
||||
using SabreTools.RedumpLib;
|
||||
@@ -67,7 +66,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string baseFilename)
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
@@ -174,7 +173,18 @@ namespace MPF.Processors
|
||||
if (hex == null)
|
||||
return null;
|
||||
|
||||
return Regex.Replace(hex, ".{32}", "$0\n");
|
||||
// Separate into blocks of 4 hex digits and newlines
|
||||
var bca = new StringBuilder();
|
||||
for (int i = 0; i < hex.Length; i++)
|
||||
{
|
||||
bca.Append(hex[i]);
|
||||
if ((i + 1) % 32 == 0)
|
||||
bca.AppendLine();
|
||||
else if ((i + 1) % 4 == 0)
|
||||
bca.Append(' ');
|
||||
}
|
||||
|
||||
return bca.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -52,18 +52,13 @@ namespace MPF.Processors
|
||||
_existsFunc = existsFunc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if an output file exists in a base directory
|
||||
/// </summary>
|
||||
/// <param name="baseDirectory">Base directory to check in</param>
|
||||
/// <inheritdoc/>
|
||||
public override bool Exists(string baseDirectory)
|
||||
{
|
||||
// If the base directory is invalid
|
||||
if (string.IsNullOrEmpty(baseDirectory))
|
||||
return false;
|
||||
// Ensure the directory exists
|
||||
if (!Directory.Exists(baseDirectory))
|
||||
return false;
|
||||
|
||||
|
||||
foreach (string filename in Filenames)
|
||||
{
|
||||
// Check for invalid filenames
|
||||
@@ -72,8 +67,8 @@ namespace MPF.Processors
|
||||
|
||||
try
|
||||
{
|
||||
string possiblePath = Path.Combine(baseDirectory, filename);
|
||||
if (_existsFunc(possiblePath))
|
||||
string possibleFile = Path.Combine(baseDirectory, filename);
|
||||
if (_existsFunc(possibleFile))
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Text.RegularExpressions;
|
||||
using psxt001z;
|
||||
using SabreTools.Models.Logiqx;
|
||||
@@ -75,7 +77,7 @@ namespace MPF.Processors
|
||||
info = Builder.EnsureAllSections(info);
|
||||
|
||||
// Get the dumping program and version
|
||||
var (dicCmd, dicVersion) = GetCommandFilePathAndVersion(basePath);
|
||||
var dicVersion = GetCommandFilePathAndVersion(basePath, out var dicCmd);
|
||||
info.DumpingInfo!.DumpingProgram ??= string.Empty;
|
||||
info.DumpingInfo.DumpingProgram += $" {dicVersion ?? "Unknown Version"}";
|
||||
info.DumpingInfo.DumpingDate = ProcessingTool.GetFileModifiedDate(dicCmd)?.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -255,20 +257,22 @@ namespace MPF.Processors
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash ?? string.Empty;
|
||||
}
|
||||
|
||||
if (GetXGDAuxSSInfo($"{basePath}_disc.txt", out var xgd1SS, out var xgd1SSVer))
|
||||
if (GetXGDAuxSSInfo($"{basePath}_disc.txt", out var xgd1SS, out _))
|
||||
{
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.SSVersion] = xgd1SSVer ?? string.Empty;
|
||||
// We no longer care about SS Version from DIC
|
||||
//info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.SSVersion] = xgd1SSVer ?? string.Empty;
|
||||
info.Extras!.SecuritySectorRanges = xgd1SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd1DMIHash, out var xgd1PFIHash, out var xgd1SSHash, out var xgd1SS, out var xgd1SSVer))
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd1DMIHash, out var xgd1PFIHash, out var xgd1SSHash, out var xgd1SS, out _))
|
||||
{
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = xgd1DMIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd1PFIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer ?? string.Empty;
|
||||
// We no longer care about SS Version from DIC
|
||||
//info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer ?? string.Empty;
|
||||
info.Extras!.SecuritySectorRanges = xgd1SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -299,20 +303,22 @@ namespace MPF.Processors
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash ?? string.Empty;
|
||||
}
|
||||
|
||||
if (GetXGDAuxSSInfo($"{basePath}_disc.txt", out var xgd23SS, out var xgd23SSVer))
|
||||
if (GetXGDAuxSSInfo($"{basePath}_disc.txt", out var xgd23SS, out _))
|
||||
{
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.SSVersion] = xgd23SSVer ?? string.Empty;
|
||||
// We no longer care about SS Version from DIC
|
||||
//info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.SSVersion] = xgd23SSVer ?? string.Empty;
|
||||
info.Extras!.SecuritySectorRanges = xgd23SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd23DMIHash, out var xgd23PFIHash, out var xgd23SSHash, out var xgd23SS, out var xgd23SSVer))
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd23DMIHash, out var xgd23PFIHash, out var xgd23SSHash, out var xgd23SS, out _))
|
||||
{
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = xgd23DMIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd23PFIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer ?? string.Empty;
|
||||
// We no longer care about SS Version from DIC
|
||||
//info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer ?? string.Empty;
|
||||
info.Extras!.SecuritySectorRanges = xgd23SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -326,14 +332,17 @@ namespace MPF.Processors
|
||||
|
||||
// Take only the first 16 lines for GD-ROM
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n').Take(16).ToArray());
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n'), 0, 16);
|
||||
|
||||
if (GetGDROMBuildInfo(info.Extras.Header, out var gdSerial, out var gdVersion, out var gdDate))
|
||||
if (GetGDROMBuildInfo(info.Extras.Header,
|
||||
out var serial,
|
||||
out var version,
|
||||
out var date))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = gdSerial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = gdVersion ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = gdDate ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = serial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = version ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = date ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +353,7 @@ namespace MPF.Processors
|
||||
|
||||
// Take only the last 16 lines for Sega CD
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n').Skip(16).ToArray());
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n'), 0, 16);
|
||||
|
||||
if (GetSegaCDBuildInfo(info.Extras.Header, out var scdSerial, out var fixedDate))
|
||||
{
|
||||
@@ -362,14 +371,17 @@ namespace MPF.Processors
|
||||
|
||||
// Take only the first 16 lines for GD-ROM
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n').Take(16).ToArray());
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n'), 0, 16);
|
||||
|
||||
if (GetGDROMBuildInfo(info.Extras.Header, out var gdSerial, out var gdVersion, out var gdDate))
|
||||
if (GetGDROMBuildInfo(info.Extras.Header,
|
||||
out var serial,
|
||||
out var version,
|
||||
out var date))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = gdSerial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = gdVersion ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = gdDate ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = serial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = version ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = date ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,14 +394,17 @@ namespace MPF.Processors
|
||||
|
||||
// Take only the first 16 lines for GD-ROM
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n').Take(16).ToArray());
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n'), 0, 16);
|
||||
|
||||
if (GetGDROMBuildInfo(info.Extras.Header, out var gdSerial, out var gdVersion, out var gdDate))
|
||||
if (GetGDROMBuildInfo(info.Extras.Header,
|
||||
out var serial,
|
||||
out var version,
|
||||
out var date))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = gdSerial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = gdVersion ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = gdDate ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = serial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = version ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = date ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,14 +417,17 @@ namespace MPF.Processors
|
||||
|
||||
// Take only the first 16 lines for GD-ROM
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n').Take(16).ToArray());
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n'), 0, 16);
|
||||
|
||||
if (GetGDROMBuildInfo(info.Extras.Header, out var gdSerial, out var gdVersion, out var gdDate))
|
||||
if (GetGDROMBuildInfo(info.Extras.Header,
|
||||
out var serial,
|
||||
out var version,
|
||||
out var date))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = gdSerial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = gdVersion ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = gdDate ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = serial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = version ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = date ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,14 +440,17 @@ namespace MPF.Processors
|
||||
|
||||
// Take only the first 16 lines for GD-ROM
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n').Take(16).ToArray());
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n'), 0, 16);
|
||||
|
||||
if (GetGDROMBuildInfo(info.Extras.Header, out var gdSerial, out var gdVersion, out var gdDate))
|
||||
if (GetGDROMBuildInfo(info.Extras.Header,
|
||||
out var serial,
|
||||
out var version,
|
||||
out var date))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = gdSerial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = gdVersion ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = gdDate ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = serial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = version ?? string.Empty;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = date ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +461,7 @@ namespace MPF.Processors
|
||||
|
||||
// Take only the first 16 lines for Saturn
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n').Take(16).ToArray());
|
||||
info.Extras.Header = string.Join("\n", info.Extras.Header.Split('\n'), 0, 16);
|
||||
|
||||
if (GetSaturnBuildInfo(info.Extras.Header, out var saturnSerial, out var saturnVersion, out var buildDate))
|
||||
{
|
||||
@@ -480,7 +501,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string baseFilename)
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
@@ -572,7 +593,7 @@ namespace MPF.Processors
|
||||
new([$"{baseFilename} (Track 1)(-LBA).sub", $"{baseFilename} (Track 01)(-LBA).sub"], OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"track1_lba_sub"),
|
||||
new($"{baseFilename} (Track AA).sub", OutputFileFlags.Binary
|
||||
new([$"{baseFilename} (Track AA).sub", $"{baseFilename} (Lead-out)(Track AA).sub"], OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"track_aa_sub"),
|
||||
];
|
||||
@@ -713,12 +734,13 @@ namespace MPF.Processors
|
||||
/// Get the command file path and extract the version from it
|
||||
/// </summary>
|
||||
/// <param name="basePath">Base filename and path to use for checking</param>
|
||||
/// <returns>Tuple of file path and version as strings, both null on error</returns>
|
||||
private static (string?, string?) GetCommandFilePathAndVersion(string basePath)
|
||||
/// <returns>The version as a string, both null on error</returns>
|
||||
private static string? GetCommandFilePathAndVersion(string basePath, out string? commandPath)
|
||||
{
|
||||
// If we have an invalid base path, we can do nothing
|
||||
commandPath = null;
|
||||
if (string.IsNullOrEmpty(basePath))
|
||||
return (null, null);
|
||||
return null;
|
||||
|
||||
// Generate the matching regex based on the base path
|
||||
string baseFilename = Path.GetFileName(basePath);
|
||||
@@ -727,17 +749,16 @@ namespace MPF.Processors
|
||||
// Find the first match for the command file
|
||||
var parentDirectory = Path.GetDirectoryName(basePath);
|
||||
if (string.IsNullOrEmpty(parentDirectory))
|
||||
return (null, null);
|
||||
return null;
|
||||
|
||||
var currentFiles = Directory.GetFiles(parentDirectory);
|
||||
var commandPath = currentFiles.FirstOrDefault(f => cmdFilenameRegex.IsMatch(f));
|
||||
if (string.IsNullOrEmpty(commandPath))
|
||||
return (null, null);
|
||||
commandPath = Array.Find(currentFiles, f => cmdFilenameRegex.IsMatch(f));
|
||||
if (string.IsNullOrEmpty(value: commandPath))
|
||||
return null;
|
||||
|
||||
// Extract the version string
|
||||
var match = cmdFilenameRegex.Match(commandPath);
|
||||
string version = match.Groups[1].Value;
|
||||
return (commandPath, version);
|
||||
return match.Groups[1].Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -867,8 +888,8 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// Create the output string
|
||||
if (discTypeOrBookTypeSet.Any())
|
||||
discTypeOrBookType = string.Join(", ", [.. discTypeOrBookTypeSet.OrderBy(s => s)]);
|
||||
if (discTypeOrBookTypeSet.Count > 0)
|
||||
discTypeOrBookType = string.Join(", ", [.. discTypeOrBookTypeSet]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1166,7 +1187,7 @@ namespace MPF.Processors
|
||||
else if (xgd && line.StartsWith("LayerBreak"))
|
||||
{
|
||||
// LayerBreak: <size> (L0 Video: <size>, L0 Middle: <size>, L0 Game: <size>)
|
||||
string[] split = line.Split(' ').Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
string[] split = Array.FindAll(line.Split(' '), s => !string.IsNullOrEmpty(s));
|
||||
return split[1];
|
||||
}
|
||||
|
||||
@@ -1174,7 +1195,7 @@ namespace MPF.Processors
|
||||
else if (!xgd && line.StartsWith("LayerZeroSector"))
|
||||
{
|
||||
// LayerZeroSector: <size> (<hex>)
|
||||
string[] split = line.Split(' ').Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
string[] split = Array.FindAll(line.Split(' '), s => !string.IsNullOrEmpty(s));
|
||||
return split[1];
|
||||
}
|
||||
|
||||
@@ -1287,6 +1308,7 @@ namespace MPF.Processors
|
||||
var trackSessionRegex = new Regex(@"^\s*Session\s*([0-9]{1,2}),.*?,\s*Track\s*([0-9]{1,2}).*?$", RegexOptions.Compiled);
|
||||
|
||||
// Read in the track session data
|
||||
bool allFirstSession = true;
|
||||
var trackSessionMapping = new Dictionary<string, string>();
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== OpCode") == false)
|
||||
{
|
||||
@@ -1297,11 +1319,15 @@ namespace MPF.Processors
|
||||
if (!match.Success)
|
||||
continue;
|
||||
|
||||
// Flag if there are additional sections
|
||||
if (match.Groups[1].Value != "1")
|
||||
allFirstSession = false;
|
||||
|
||||
trackSessionMapping[match.Groups[2].Value] = match.Groups[1].Value;
|
||||
}
|
||||
|
||||
// If we have all Session 1, we can just skip out
|
||||
if (trackSessionMapping.All(kvp => kvp.Value == "1"))
|
||||
if (allFirstSession)
|
||||
return null;
|
||||
|
||||
// Seek to the multisession data
|
||||
@@ -1887,15 +1913,50 @@ namespace MPF.Processors
|
||||
|
||||
try
|
||||
{
|
||||
// Fast forward to the offsets
|
||||
// Get a list for all found offsets
|
||||
var offsets = new List<string>();
|
||||
|
||||
// Loop over all possible offsets
|
||||
using var sr = File.OpenText(disc);
|
||||
while (sr.ReadLine()?.Trim()?.StartsWith("========== Offset") == false) ;
|
||||
sr.ReadLine(); // Combined Offset
|
||||
sr.ReadLine(); // Drive Offset
|
||||
sr.ReadLine(); // Separator line
|
||||
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
// Fast forward to the offsets
|
||||
while (sr.ReadLine()?.Trim()?.StartsWith("========== Offset") == false) ;
|
||||
if (sr.EndOfStream)
|
||||
break;
|
||||
|
||||
sr.ReadLine(); // Combined Offset
|
||||
sr.ReadLine(); // Drive Offset
|
||||
sr.ReadLine(); // Separator line
|
||||
|
||||
// Now that we're at the offsets, attempt to get the sample offset
|
||||
var offsetLine = sr.ReadLine()?.Split(' ');
|
||||
string offset = offsetLine != null ? offsetLine[offsetLine.Length - 1] : string.Empty;
|
||||
offsets.Add(offset);
|
||||
}
|
||||
|
||||
// Deduplicate the offsets
|
||||
#if NET20
|
||||
var temp = new List<string>();
|
||||
foreach (var offset in offsets)
|
||||
{
|
||||
if (offset == null || offset.Length == 0)
|
||||
continue;
|
||||
if (!temp.Contains(offset))
|
||||
temp.Add(offset);
|
||||
}
|
||||
|
||||
offsets = temp;
|
||||
#else
|
||||
offsets = offsets
|
||||
.FindAll(s => !string.IsNullOrEmpty(s))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
#endif
|
||||
|
||||
// Now that we're at the offsets, attempt to get the sample offset
|
||||
return sr.ReadLine()?.Split(' ')?.LastOrDefault();
|
||||
return string.Join("; ", [.. offsets]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -1927,9 +1988,9 @@ namespace MPF.Processors
|
||||
if (roms == null || roms.Length == 0)
|
||||
return false;
|
||||
|
||||
dmihash = roms.FirstOrDefault(r => r.Name?.EndsWith("DMI.bin") == true)?.CRC?.ToUpperInvariant();
|
||||
pfihash = roms.FirstOrDefault(r => r.Name?.EndsWith("PFI.bin") == true)?.CRC?.ToUpperInvariant();
|
||||
sshash = roms.FirstOrDefault(r => r.Name?.EndsWith("SS.bin") == true)?.CRC?.ToUpperInvariant();
|
||||
dmihash = Array.Find(roms, r => r.Name?.EndsWith("DMI.bin") == true)?.CRC?.ToUpperInvariant();
|
||||
pfihash = Array.Find(roms, r => r.Name?.EndsWith("PFI.bin") == true)?.CRC?.ToUpperInvariant();
|
||||
sshash = Array.Find(roms, r => r.Name?.EndsWith("SS.bin") == true)?.CRC?.ToUpperInvariant();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
254
MPF.Processors/Generic.cs
Normal file
254
MPF.Processors/Generic.cs
Normal file
@@ -0,0 +1,254 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.Models.Logiqx;
|
||||
using SabreTools.RedumpLib;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.Processors
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents processing generic outputs
|
||||
/// </summary>
|
||||
public sealed class Generic : BaseProcessor
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Generic(RedumpSystem? system, MediaType? type) : base(system, type) { }
|
||||
|
||||
#region BaseProcessor Implementations
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void GenerateSubmissionInfo(SubmissionInfo info, string basePath, bool redumpCompat)
|
||||
{
|
||||
// Ensure that required sections exist
|
||||
info = Builder.EnsureAllSections(info);
|
||||
|
||||
// Get the dumping program and version
|
||||
info.DumpingInfo!.DumpingProgram = "UNKNOWN PROGRAM";
|
||||
info.DumpingInfo.DumpingDate = GetDumpingDate(basePath);
|
||||
|
||||
// Get the Datafile information
|
||||
var datafile = GetDatafile(basePath);
|
||||
if (datafile != null)
|
||||
info.TracksAndWriteOffsets!.ClrMameProData = ProcessingTool.GenerateDatfile(datafile);
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
switch (Type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
info.TracksAndWriteOffsets!.Cuesheet = ProcessingTool.GetFullFile($"{basePath}.cue") ?? string.Empty;
|
||||
break;
|
||||
|
||||
case MediaType.DVD:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
case MediaType.UMD:
|
||||
var firstRom = datafile?.Game?[0]?.Rom?[0];
|
||||
if (firstRom != null)
|
||||
{
|
||||
info.SizeAndChecksums!.Size = long.Parse(firstRom.Size ?? "0");
|
||||
info.SizeAndChecksums.CRC32 = firstRom.CRC;
|
||||
info.SizeAndChecksums.MD5 = firstRom.MD5;
|
||||
info.SizeAndChecksums.SHA1 = firstRom.SHA1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Information Extraction Methods
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to get the dumping date from a base path
|
||||
/// </summary>
|
||||
private static string? GetDumpingDate(string basePath)
|
||||
{
|
||||
DateTime? fileModifiedDate;
|
||||
if (File.Exists($"{basePath}.iso"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.iso");
|
||||
else if (File.Exists($"{basePath}.cue"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.cue");
|
||||
else if (File.Exists($"{basePath}.bin"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.bin");
|
||||
else if (File.Exists($"{basePath} (Track 1).bin"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath} (Track 1).bin");
|
||||
else if (File.Exists($"{basePath} (Track 01).bin"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath} (Track 01).bin");
|
||||
else if (File.Exists($"{basePath}.ccd"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.ccd");
|
||||
else if (File.Exists($"{basePath}.img"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.img");
|
||||
else if (File.Exists($"{basePath}.mds"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.mds");
|
||||
else if (File.Exists($"{basePath}.mdf"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.mdf");
|
||||
else if (File.Exists($"{basePath}.ima"))
|
||||
fileModifiedDate = ProcessingTool.GetFileModifiedDate($"{basePath}.ima");
|
||||
else
|
||||
return null;
|
||||
|
||||
return fileModifiedDate?.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to generate a datafile from a base path
|
||||
/// </summary>
|
||||
private static Datafile? GetDatafile(string basePath)
|
||||
{
|
||||
// Single-file outputs
|
||||
if (File.Exists($"{basePath}.bin"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.bin");
|
||||
if (rom != null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.ima"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.ima");
|
||||
if (rom != null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.img"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.img");
|
||||
if (rom != null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.iso"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.iso");
|
||||
if (rom != null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.mdf"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.mdf");
|
||||
if (rom != null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
|
||||
// Multi-file outputs
|
||||
else if (File.Exists($"{basePath} (Track 1).bin"))
|
||||
{
|
||||
var roms = new List<Rom>();
|
||||
|
||||
// Try Track 0
|
||||
var track0rom = GetRom($"{basePath} (Track 0).bin");
|
||||
if (track0rom != null)
|
||||
roms.Add(track0rom);
|
||||
|
||||
// Hash all found tracks
|
||||
for (int i = 1; i < 10; i++)
|
||||
{
|
||||
// Get the rom for the track
|
||||
var rom = GetRom($"{basePath} (Track {i}).bin");
|
||||
if (rom == null)
|
||||
break;
|
||||
|
||||
// Add the track to the output
|
||||
roms.Add(rom);
|
||||
}
|
||||
|
||||
// Try Track A
|
||||
var trackArom = GetRom($"{basePath} (Track A).bin");
|
||||
if (trackArom != null)
|
||||
roms.Add(trackArom);
|
||||
|
||||
// Create and return if there are any tracks
|
||||
if (roms.Count > 0)
|
||||
return GetDatafile(basePath, roms);
|
||||
}
|
||||
else if (File.Exists($"{basePath} (Track 01).bin"))
|
||||
{
|
||||
var roms = new List<Rom>();
|
||||
|
||||
// Try Track 00
|
||||
var track00rom = GetRom($"{basePath} (Track 00).bin");
|
||||
if (track00rom != null)
|
||||
roms.Add(track00rom);
|
||||
|
||||
// Hash all found tracks
|
||||
for (int i = 1; i < 100; i++)
|
||||
{
|
||||
// Get the rom for the track
|
||||
var rom = GetRom($"{basePath} (Track {i:D2}).bin");
|
||||
if (rom == null)
|
||||
break;
|
||||
|
||||
// Add the track to the output
|
||||
roms.Add(rom);
|
||||
}
|
||||
|
||||
// Try Track AA
|
||||
var trackAArom = GetRom($"{basePath} (Track AA).bin");
|
||||
if (trackAArom != null)
|
||||
roms.Add(trackAArom);
|
||||
|
||||
// Create and return if there are any tracks
|
||||
if (roms.Count > 0)
|
||||
return GetDatafile(basePath, roms);
|
||||
}
|
||||
|
||||
// Unrecognized file input
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a Datafile from a base path and a Rom
|
||||
/// </summary>
|
||||
private static Datafile? GetDatafile(string basePath, Rom rom)
|
||||
=> GetDatafile(basePath, [rom]);
|
||||
|
||||
/// <summary>
|
||||
/// Generate a Datafile from a base path and a list of Roms
|
||||
/// </summary>
|
||||
private static Datafile? GetDatafile(string basePath, List<Rom> roms)
|
||||
{
|
||||
// Return null if no Roms exist
|
||||
if (roms.Count == 0)
|
||||
return null;
|
||||
|
||||
// Format the new Datafile
|
||||
return new Datafile
|
||||
{
|
||||
Game =
|
||||
[
|
||||
new Game
|
||||
{
|
||||
Name = Path.GetFileName(basePath),
|
||||
Rom = [.. roms]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a Rom object for a single file
|
||||
/// </summary>
|
||||
private static Rom? GetRom(string file)
|
||||
{
|
||||
// Skip missing or invalid files
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
if (!HashTool.GetStandardHashes(file, out long filesize, out var crc32, out var md5, out var sha1))
|
||||
return null;
|
||||
|
||||
// Format the data into a rom object
|
||||
return new Rom { Name = Path.GetFileName(file), Size = filesize.ToString(), CRC = crc32, MD5 = md5, SHA1 = sha1 };
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>NU1902;NU1903</NoWarn>
|
||||
<Nullable>enable</Nullable>
|
||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<VersionPrefix>3.2.2</VersionPrefix>
|
||||
<VersionPrefix>3.2.4</VersionPrefix>
|
||||
<WarningsNotAsErrors>NU5104</WarningsNotAsErrors>
|
||||
|
||||
<!-- Package Properties -->
|
||||
@@ -25,43 +26,20 @@
|
||||
<InternalsVisibleTo Include="MPF.Test" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Support All Frameworks -->
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net4`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Support for old .NET versions -->
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="MinAsyncBridge" Version="0.12.4" />
|
||||
<PackageReference Include="MinTasksExtensionsBridge" Version="0.3.4" />
|
||||
<PackageReference Include="MinThreadingBridge" Version="0.11.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`)) AND !$(TargetFramework.StartsWith(`net40`))">
|
||||
<PackageReference Include="IndexRange" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))">
|
||||
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="psxt001z.Library" Version="0.21.0-rc1" />
|
||||
<PackageReference Include="SabreTools.Hashing" Version="1.2.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.4.8" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.4.1" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.6.5" />
|
||||
<PackageReference Include="psxt001z.Library" Version="0.21.0-rc2" />
|
||||
<PackageReference Include="SabreTools.Hashing" Version="1.4.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.5.3" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.7.6" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -195,12 +195,10 @@ namespace MPF.Processors
|
||||
/// <param name="baseDirectory">Base directory to check in</param>
|
||||
public virtual bool Exists(string baseDirectory)
|
||||
{
|
||||
// If the base directory is invalid
|
||||
if (string.IsNullOrEmpty(baseDirectory))
|
||||
return false;
|
||||
// Ensure the directory exists
|
||||
if (!Directory.Exists(baseDirectory))
|
||||
return false;
|
||||
|
||||
|
||||
foreach (string filename in Filenames)
|
||||
{
|
||||
// Check for invalid filenames
|
||||
@@ -209,8 +207,8 @@ namespace MPF.Processors
|
||||
|
||||
try
|
||||
{
|
||||
string possiblePath = Path.Combine(baseDirectory, filename);
|
||||
if (File.Exists(possiblePath))
|
||||
string possibleFile = Path.Combine(baseDirectory, filename);
|
||||
if (File.Exists(possibleFile))
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.Models.Logiqx;
|
||||
using SabreTools.RedumpLib;
|
||||
@@ -68,15 +67,12 @@ namespace MPF.Processors
|
||||
if (id != null)
|
||||
info.Extras!.DiscID = id.ToUpperInvariant().Substring(0, 24) + "XXXXXXXX";
|
||||
if (string.IsNullOrEmpty(info.Extras!.PIC) && !string.IsNullOrEmpty(pic))
|
||||
{
|
||||
pic = Regex.Replace(pic, ".{32}", "$0\n");
|
||||
info.Extras.PIC = pic;
|
||||
}
|
||||
info.Extras.PIC = SplitString(pic, 32);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string baseFilename)
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.Models.Logiqx;
|
||||
using SabreTools.Models.PIC;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
@@ -31,14 +34,18 @@ namespace MPF.Processors
|
||||
return null;
|
||||
|
||||
// Convert ASCII to byte via lookup table
|
||||
int[] hexLookup = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F];
|
||||
int[] hexLookup =
|
||||
[
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
|
||||
];
|
||||
byte[] byteArray = new byte[hexString.Length / 2];
|
||||
for (int i = 0; i < hexString.Length; i += 2)
|
||||
{
|
||||
// Convert next two chars to ASCII value relative to '0'
|
||||
int a = Char.ToUpper(hexString[i]) - '0';
|
||||
int b = Char.ToUpper(hexString[i + 1]) - '0';
|
||||
int a = Char.ToUpperInvariant(hexString[i]) - '0';
|
||||
int b = Char.ToUpperInvariant(hexString[i + 1]) - '0';
|
||||
|
||||
// Ensure hex string only has '0' through '9' and 'A' through 'F' (case insensitive)
|
||||
if ((a < 0 || b < 0 || a > 22 || b > 22) || (a > 10 && a < 17) || (b > 10 && b < 17))
|
||||
@@ -270,20 +277,13 @@ namespace MPF.Processors
|
||||
if (di?.Units == null || di.Units.Length <= 1)
|
||||
return false;
|
||||
|
||||
// Wrap big-endian reading
|
||||
static int ReadFromArrayBigEndian(byte[]? bytes, int offset)
|
||||
{
|
||||
if (bytes == null)
|
||||
return default;
|
||||
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] rev = new byte[0x04];
|
||||
Array.Copy(bytes, offset, rev, 0, 0x04);
|
||||
#else
|
||||
var span = new ReadOnlySpan<byte>(bytes, offset, 0x04);
|
||||
byte[] rev = span.ToArray();
|
||||
#endif
|
||||
Array.Reverse(rev);
|
||||
return BitConverter.ToInt32(rev, 0);
|
||||
return bytes.ReadInt32BigEndian(ref offset);
|
||||
}
|
||||
|
||||
// Layerbreak 1 (2+ layers)
|
||||
@@ -745,7 +745,7 @@ namespace MPF.Processors
|
||||
if (string.IsNullOrEmpty(inputPIC))
|
||||
return null;
|
||||
|
||||
string cleanPIC = inputPIC!.Trim().Replace("\n", string.Empty);
|
||||
string cleanPIC = inputPIC!.Trim().Replace("\n", string.Empty).Replace("\r", string.Empty);
|
||||
|
||||
if (cleanPIC.Length < 230)
|
||||
return null;
|
||||
@@ -921,7 +921,13 @@ namespace MPF.Processors
|
||||
if (!GetXGDType(ss, out int xgdType))
|
||||
return false;
|
||||
|
||||
if (xgdType == 3 && ss.Skip(32).Take(72).All(x => x == 0))
|
||||
#if NET20
|
||||
var checkArr = new byte[72];
|
||||
Array.Copy(ss, 32, checkArr, 0, 72);
|
||||
if (xgdType == 3 && Array.Exists(checkArr, x => x != 0))
|
||||
#else
|
||||
if (xgdType == 3 && ss.Skip(32).Take(72).Any(x => x != 0))
|
||||
#endif
|
||||
{
|
||||
// Check for a cleaned SSv2
|
||||
|
||||
@@ -1073,7 +1079,13 @@ namespace MPF.Processors
|
||||
|
||||
case 3:
|
||||
// Determine if XGD3 SS.bin is SSv1 (Kreon) or SSv2 (0800)
|
||||
#if NET20
|
||||
var checkArr = new byte[72];
|
||||
Array.Copy(ss, 32, checkArr, 0, 72);
|
||||
bool ssv2 = Array.Exists(checkArr, x => x != 0);
|
||||
#else
|
||||
bool ssv2 = ss.Skip(32).Take(72).Any(x => x != 0);
|
||||
#endif
|
||||
|
||||
if (ssv2)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.Models.CueSheets;
|
||||
@@ -173,7 +172,15 @@ namespace MPF.Processors
|
||||
break;
|
||||
|
||||
case RedumpSystem.MicrosoftXbox:
|
||||
string xmidString = ProcessingTool.GetXMID($"{basePath}.manufacturer");
|
||||
// If .dmi / .pfi / .ss don't already exist, create them
|
||||
if (!File.Exists($"{basePath}.dmi"))
|
||||
RemoveHeader($"{basePath}.manufacturer", $"{basePath}.dmi");
|
||||
if (!File.Exists($"{basePath}.pfi"))
|
||||
RemoveHeader($"{basePath}.physical", $"{basePath}.pfi");
|
||||
if (!File.Exists($"{basePath}.ss"))
|
||||
ProcessingTool.CleanSS($"{basePath}.security", $"{basePath}.ss");
|
||||
|
||||
string xmidString = ProcessingTool.GetXMID($"{basePath}.dmi");
|
||||
var xmid = SabreTools.Serialization.Wrappers.XMID.Create(xmidString);
|
||||
if (xmid != null)
|
||||
{
|
||||
@@ -185,16 +192,32 @@ namespace MPF.Processors
|
||||
info.CommonDiscInfo.Region = ProcessingTool.GetXGDRegion(xmid.Model.RegionIdentifier);
|
||||
}
|
||||
|
||||
if (HashTool.GetStandardHashes($"{basePath}.manufacturer", out _, out string? dmi1Crc, out _, out _))
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = dmi1Crc ?? string.Empty;
|
||||
if (HashTool.GetStandardHashes($"{basePath}.physical", out _, out string? pfi1Crc, out _, out _))
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.PFIHash] = pfi1Crc ?? string.Empty;
|
||||
string? dmi1Crc = HashTool.GetFileHash($"{basePath}.dmi", HashType.CRC32);
|
||||
if (dmi1Crc != null)
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = dmi1Crc.ToUpperInvariant();
|
||||
string? pfi1Crc = HashTool.GetFileHash($"{basePath}.pfi", HashType.CRC32);
|
||||
if (pfi1Crc != null)
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.PFIHash] = pfi1Crc.ToUpperInvariant();
|
||||
string? ss1Crc = HashTool.GetFileHash($"{basePath}.ss", HashType.CRC32);
|
||||
if (ss1Crc != null)
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.SSHash] = ss1Crc.ToUpperInvariant();
|
||||
|
||||
string? ranges1 = ProcessingTool.GetSSRanges($"{basePath}.ss");
|
||||
if (!string.IsNullOrEmpty(ranges1))
|
||||
info.Extras!.SecuritySectorRanges = ranges1;
|
||||
|
||||
// TODO: Support SS information when generated
|
||||
break;
|
||||
|
||||
case RedumpSystem.MicrosoftXbox360:
|
||||
string xemidString = ProcessingTool.GetXeMID($"{basePath}.manufacturer");
|
||||
// If .dmi / .pfi / .ss don't already exist, create them
|
||||
if (!File.Exists($"{basePath}.dmi"))
|
||||
RemoveHeader($"{basePath}.manufacturer", $"{basePath}.dmi");
|
||||
if (!File.Exists($"{basePath}.pfi"))
|
||||
RemoveHeader($"{basePath}.physical", $"{basePath}.pfi");
|
||||
if (!File.Exists($"{basePath}.ss"))
|
||||
ProcessingTool.CleanSS($"{basePath}.security", $"{basePath}.ss");
|
||||
|
||||
string xemidString = ProcessingTool.GetXeMID($"{basePath}.dmi");
|
||||
var xemid = SabreTools.Serialization.Wrappers.XeMID.Create(xemidString);
|
||||
if (xemid != null)
|
||||
{
|
||||
@@ -206,12 +229,20 @@ namespace MPF.Processors
|
||||
info.CommonDiscInfo.Region = ProcessingTool.GetXGDRegion(xemid.Model.RegionIdentifier);
|
||||
}
|
||||
|
||||
if (HashTool.GetStandardHashes($"{basePath}.manufacturer", out _, out string? dmi23Crc, out _, out _))
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = dmi23Crc ?? string.Empty;
|
||||
if (HashTool.GetStandardHashes($"{basePath}.physical", out _, out string? pfi23Crc, out _, out _))
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.PFIHash] = pfi23Crc ?? string.Empty;
|
||||
string? dmi23Crc = HashTool.GetFileHash($"{basePath}.dmi", HashType.CRC32);
|
||||
if (dmi23Crc != null)
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = dmi23Crc.ToUpperInvariant();
|
||||
string? pfi23Crc = HashTool.GetFileHash($"{basePath}.pfi", HashType.CRC32);
|
||||
if (pfi23Crc != null)
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.PFIHash] = pfi23Crc.ToUpperInvariant();
|
||||
string? ss23Crc = HashTool.GetFileHash($"{basePath}.ss", HashType.CRC32);
|
||||
if (ss23Crc != null)
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.SSHash] = ss23Crc.ToUpperInvariant();
|
||||
|
||||
string? ranges23 = ProcessingTool.GetSSRanges($"{basePath}.ss");
|
||||
if (!string.IsNullOrEmpty(ranges23))
|
||||
info.Extras!.SecuritySectorRanges = ranges23;
|
||||
|
||||
// TODO: Support SS information when generated
|
||||
break;
|
||||
|
||||
case RedumpSystem.NamcoSegaNintendoTriforce:
|
||||
@@ -361,7 +392,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string baseFilename)
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
@@ -385,7 +416,7 @@ namespace MPF.Processors
|
||||
| OutputFileFlags.Artifact
|
||||
| OutputFileFlags.Zippable,
|
||||
"log"),
|
||||
new CustomOutputFile($"{baseFilename}.log", OutputFileFlags.Required,
|
||||
new CustomOutputFile([$"{baseFilename}.dat", $"{baseFilename}.log"], OutputFileFlags.Required,
|
||||
DatfileExists),
|
||||
new($"{baseFilename}.pma", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
@@ -406,8 +437,15 @@ namespace MPF.Processors
|
||||
"toc"),
|
||||
];
|
||||
|
||||
// Get the base path for cuesheet reading
|
||||
string basePath;
|
||||
if (string.IsNullOrEmpty(baseDirectory))
|
||||
basePath = baseFilename;
|
||||
else
|
||||
basePath = Path.Combine(baseDirectory, baseFilename);
|
||||
|
||||
// Include .hash and .skeleton for all files in cuesheet
|
||||
var cueSheet = SabreTools.Serialization.Deserializers.CueSheet.DeserializeFile($"{baseFilename}.cue");
|
||||
var cueSheet = SabreTools.Serialization.Deserializers.CueSheet.DeserializeFile($"{basePath}.cue");
|
||||
if (cueSheet?.Files != null)
|
||||
{
|
||||
int trackId = 1;
|
||||
@@ -443,6 +481,9 @@ namespace MPF.Processors
|
||||
new($"{baseFilename}.asus", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"asus"),
|
||||
new($"{baseFilename}.dmi", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"dmi"),
|
||||
new($"{baseFilename}.hash", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"hash"),
|
||||
@@ -450,7 +491,7 @@ namespace MPF.Processors
|
||||
| OutputFileFlags.Artifact
|
||||
| OutputFileFlags.Zippable,
|
||||
"log"),
|
||||
new CustomOutputFile($"{baseFilename}.log", OutputFileFlags.Required,
|
||||
new CustomOutputFile([$"{baseFilename}.dat", $"{baseFilename}.log"], OutputFileFlags.Required,
|
||||
DatfileExists),
|
||||
new([$"{baseFilename}.manufacturer", $"{baseFilename}.0.manufacturer"], OutputFileFlags.Required
|
||||
| OutputFileFlags.Binary
|
||||
@@ -459,6 +500,9 @@ namespace MPF.Processors
|
||||
new($"{baseFilename}.1.manufacturer", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"manufacturer_1"),
|
||||
new($"{baseFilename}.pfi", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"pfi"),
|
||||
new([$"{baseFilename}.physical", $"{baseFilename}.0.physical"], OutputFileFlags.Required
|
||||
| OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
@@ -501,7 +545,7 @@ namespace MPF.Processors
|
||||
| OutputFileFlags.Artifact
|
||||
| OutputFileFlags.Zippable,
|
||||
"log"),
|
||||
new CustomOutputFile($"{baseFilename}.log", OutputFileFlags.Required,
|
||||
new CustomOutputFile([$"{baseFilename}.dat", $"{baseFilename}.log"], OutputFileFlags.Required,
|
||||
DatfileExists),
|
||||
new([$"{baseFilename}.physical", $"{baseFilename}.0.physical"], OutputFileFlags.Required
|
||||
| OutputFileFlags.Binary
|
||||
@@ -540,6 +584,52 @@ namespace MPF.Processors
|
||||
private static bool DatfileExists(string log)
|
||||
=> GetDatfile(log) != null;
|
||||
|
||||
/// <summary>
|
||||
/// Copies a file with the header removed
|
||||
/// </summary>
|
||||
/// <param name="inputFilename">Filename of file to copy from</param>
|
||||
/// <param name="outputFilename">Filename of file to copy to</param>
|
||||
/// <param name="headerLength">Length of header to remove</param>
|
||||
private static bool RemoveHeader(string inputFilename, string outputFilename, int headerLength = 4)
|
||||
{
|
||||
// If the file doesn't exist, we can't copy
|
||||
if (!File.Exists(inputFilename))
|
||||
return false;
|
||||
|
||||
// If the output file already exists, don't overwrite
|
||||
if (File.Exists(outputFilename))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
using var inputStream = new FileStream(inputFilename, FileMode.Open, FileAccess.Read);
|
||||
|
||||
// If the header length is not valid, don't copy
|
||||
if (headerLength < 1 || headerLength >= inputStream.Length)
|
||||
return false;
|
||||
|
||||
using var outputStream = new FileStream(outputFilename, FileMode.Create, FileAccess.Write);
|
||||
|
||||
// Skip the header
|
||||
inputStream.Seek(headerLength, SeekOrigin.Begin);
|
||||
|
||||
// inputStream.CopyTo(outputStream);
|
||||
byte[] buffer = new byte[4096];
|
||||
int count;
|
||||
while ((count = inputStream.Read(buffer, 0, buffer.Length)) != 0)
|
||||
{
|
||||
outputStream.Write(buffer, 0, count);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Information Extraction Methods
|
||||
@@ -777,15 +867,16 @@ namespace MPF.Processors
|
||||
/// <returns>True if error counts could be retrieved, false otherwise</returns>
|
||||
private static bool GetErrorCount(string log, out long redumpErrors, out long c2Errors)
|
||||
{
|
||||
// Set the default values for error counts
|
||||
redumpErrors = -1; c2Errors = -1;
|
||||
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(log))
|
||||
{
|
||||
redumpErrors = -1; c2Errors = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
redumpErrors = 0; c2Errors = 0;
|
||||
using var sr = File.OpenText(log);
|
||||
|
||||
// Find the error counts
|
||||
@@ -799,7 +890,9 @@ namespace MPF.Processors
|
||||
if (line.StartsWith("C2:"))
|
||||
{
|
||||
string[] parts = line.Split(' ');
|
||||
if (!long.TryParse(parts[1], out c2Errors))
|
||||
if (long.TryParse(parts[1], out long c2TrackErrors))
|
||||
c2Errors += c2TrackErrors;
|
||||
else
|
||||
c2Errors = -1;
|
||||
}
|
||||
|
||||
@@ -807,17 +900,24 @@ namespace MPF.Processors
|
||||
else if (line.StartsWith("REDUMP.ORG errors:"))
|
||||
{
|
||||
string[] parts = line!.Split(' ');
|
||||
if (!long.TryParse(parts[2], out redumpErrors))
|
||||
if (long.TryParse(parts[2], out long redumpTrackErrors))
|
||||
redumpErrors += redumpTrackErrors;
|
||||
else
|
||||
redumpErrors = -1;
|
||||
}
|
||||
|
||||
// If either value is -1, exit the loop
|
||||
if (c2Errors == -1 || redumpErrors == -1)
|
||||
break;
|
||||
}
|
||||
|
||||
// If the Redump error count is -1, then an issue occurred
|
||||
return redumpErrors != -1;
|
||||
// If either error count is -1, then an issue occurred
|
||||
return c2Errors != -1 && redumpErrors != -1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
redumpErrors = -1; c2Errors = -1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -855,6 +955,10 @@ namespace MPF.Processors
|
||||
{
|
||||
buildDate = line.Substring("build date: ".Length).Trim();
|
||||
}
|
||||
else if (line.StartsWith("version:"))
|
||||
{
|
||||
version = line.Substring("version: ".Length).Trim();
|
||||
}
|
||||
else if (line.StartsWith("serial:"))
|
||||
{
|
||||
serial = line.Substring("serial: ".Length).Trim();
|
||||
@@ -867,17 +971,13 @@ namespace MPF.Processors
|
||||
{
|
||||
region = line.Substring("regions: ".Length).Trim();
|
||||
}
|
||||
else if (line.StartsWith("version:"))
|
||||
{
|
||||
version = line.Substring("version: ".Length).Trim();
|
||||
}
|
||||
else if (line.StartsWith("header:"))
|
||||
{
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
while (line?.StartsWith("00") == true)
|
||||
{
|
||||
headerString += line + "\n";
|
||||
line = sr.ReadLine()?.Trim();
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -979,7 +1079,7 @@ namespace MPF.Processors
|
||||
else if (line.StartsWith("data "))
|
||||
{
|
||||
// data { LBA: <startLBA> .. <endLBA>, length: <length>, hLBA: <startLBA> .. <endLBA> }
|
||||
string[] split = line.Split(' ').Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
string[] split = Array.FindAll(line.Split(' '), s => !string.IsNullOrEmpty(s));
|
||||
layerbreak1 ??= split[7].TrimEnd(',');
|
||||
}
|
||||
|
||||
@@ -1435,6 +1535,10 @@ namespace MPF.Processors
|
||||
{
|
||||
buildDate = line.Substring("build date: ".Length).Trim();
|
||||
}
|
||||
else if (line.StartsWith("version:"))
|
||||
{
|
||||
version = line.Substring("version: ".Length).Trim();
|
||||
}
|
||||
else if (line.StartsWith("serial:"))
|
||||
{
|
||||
serial = line.Substring("serial: ".Length).Trim();
|
||||
@@ -1447,17 +1551,13 @@ namespace MPF.Processors
|
||||
{
|
||||
region = line.Substring("regions: ".Length).Trim();
|
||||
}
|
||||
else if (line.StartsWith("version:"))
|
||||
{
|
||||
version = line.Substring("version: ".Length).Trim();
|
||||
}
|
||||
else if (line?.StartsWith("header:") == true)
|
||||
{
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
while (line?.StartsWith("00") == true)
|
||||
{
|
||||
headerString += line + "\n";
|
||||
line = sr.ReadLine()?.Trim();
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
using System.IO.Compression;
|
||||
#endif
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace MPF.Processors
|
||||
@@ -47,17 +48,15 @@ namespace MPF.Processors
|
||||
/// <inheritdoc/>
|
||||
public override bool Exists(string baseDirectory)
|
||||
{
|
||||
// If the base directory is invalid
|
||||
if (string.IsNullOrEmpty(baseDirectory))
|
||||
return false;
|
||||
// Ensure the directory exists
|
||||
if (!Directory.Exists(baseDirectory))
|
||||
return false;
|
||||
|
||||
|
||||
// Get list of all files in directory
|
||||
var directoryFiles = Directory.GetFiles(baseDirectory);
|
||||
foreach (string file in directoryFiles)
|
||||
{
|
||||
if (Filenames.Any(pattern => Regex.IsMatch(file, pattern)))
|
||||
if (Array.FindIndex(Filenames, pattern => Regex.IsMatch(file, pattern)) > -1)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,7 +78,7 @@ namespace MPF.Processors
|
||||
var archiveFiles = archive.Entries.Select(e => e.Name).ToList();
|
||||
foreach (string file in archiveFiles)
|
||||
{
|
||||
if (Filenames.Any(pattern => Regex.IsMatch(file, pattern)))
|
||||
if (Array.Exists(Filenames, pattern => Regex.IsMatch(file, pattern)))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.Models.Logiqx;
|
||||
using SabreTools.RedumpLib;
|
||||
@@ -78,7 +77,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string baseFilename)
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.Models.Logiqx;
|
||||
using SabreTools.RedumpLib;
|
||||
@@ -127,9 +125,6 @@ namespace MPF.Processors
|
||||
if (!string.IsNullOrEmpty(ranges))
|
||||
info.Extras!.SecuritySectorRanges = ranges;
|
||||
|
||||
// TODO: Determine SS version?
|
||||
//info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.SSVersion] =
|
||||
|
||||
// Recreate RawSS.bin
|
||||
RecreateSS(logPath!, ssPath, Path.Combine(baseDirectory, "RawSS.bin"));
|
||||
|
||||
@@ -150,7 +145,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override List<OutputFile> GetOutputFiles(string baseFilename)
|
||||
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MPF.Frontend;
|
||||
using Xunit;
|
||||
|
||||
@@ -47,7 +46,7 @@ namespace MPF.Test.Frontend
|
||||
var testData = new List<object?[]>() { new object?[] { null, true } };
|
||||
foreach (DriveType driveType in Enum.GetValues(typeof(DriveType)))
|
||||
{
|
||||
if (_mappableDriveTypes.Contains(driveType))
|
||||
if (Array.IndexOf(_mappableDriveTypes, driveType) > -1)
|
||||
testData.Add([driveType, false]);
|
||||
else
|
||||
testData.Add([driveType, true]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -15,22 +15,22 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="17.10.0-release-24177-07" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0-release-24177-07" />
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="17.12.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.4.1" />
|
||||
<PackageReference Include="xunit" Version="2.8.0" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
||||
<PackageReference Include="xunit.analyzers" Version="1.13.0" />
|
||||
<PackageReference Include="xunit.assert" Version="2.8.0" />
|
||||
<PackageReference Include="xunit.core" Version="2.8.0" />
|
||||
<PackageReference Include="xunit.extensibility.core" Version="2.8.0" />
|
||||
<PackageReference Include="xunit.extensibility.execution" Version="2.8.0" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.8.0">
|
||||
<PackageReference Include="xunit.analyzers" Version="1.17.0" />
|
||||
<PackageReference Include="xunit.assert" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.core" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.extensibility.core" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.extensibility.execution" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.9.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using static MPF.Frontend.InterfaceConstants;
|
||||
|
||||
@@ -34,7 +33,7 @@ namespace MPF.UI
|
||||
/// <summary>
|
||||
/// Create a DoubleCollection out of a list of integer values
|
||||
/// </summary>
|
||||
private static DoubleCollection GetDoubleCollectionFromIntList(IList<int> list)
|
||||
=> new(list.Select(i => Convert.ToDouble(i)).ToList());
|
||||
private static DoubleCollection GetDoubleCollectionFromIntList(List<int> list)
|
||||
=> [.. list.ConvertAll(i => Convert.ToDouble(i))];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,19 +32,11 @@ namespace WPFCustomMessageBox
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NET35
|
||||
return _TextBlock_Message!.Text;
|
||||
#else
|
||||
return TextBlock_Message.Text;
|
||||
#endif
|
||||
return TextBlock_Message!.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
#if NET35
|
||||
_TextBlock_Message!.Text = value;
|
||||
#else
|
||||
TextBlock_Message.Text = value;
|
||||
#endif
|
||||
TextBlock_Message!.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,19 +44,11 @@ namespace WPFCustomMessageBox
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NET35
|
||||
return _Label_Ok!.Content.ToString();
|
||||
#else
|
||||
return Label_Ok.Content.ToString();
|
||||
#endif
|
||||
return Label_Ok!.Content.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
#if NET35
|
||||
_Label_Ok!.Content = value.TryAddKeyboardAccellerator();
|
||||
#else
|
||||
Label_Ok.Content = value.TryAddKeyboardAccellerator();
|
||||
#endif
|
||||
Label_Ok!.Content = value.TryAddKeyboardAccellerator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,19 +56,11 @@ namespace WPFCustomMessageBox
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NET35
|
||||
return _Label_Cancel!.Content.ToString();
|
||||
#else
|
||||
return Label_Cancel.Content.ToString();
|
||||
#endif
|
||||
return Label_Cancel!.Content.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
#if NET35
|
||||
_Label_Cancel!.Content = value.TryAddKeyboardAccellerator();
|
||||
#else
|
||||
Label_Cancel.Content = value.TryAddKeyboardAccellerator();
|
||||
#endif
|
||||
Label_Cancel!.Content = value.TryAddKeyboardAccellerator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,19 +68,11 @@ namespace WPFCustomMessageBox
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NET35
|
||||
return _Label_Yes!.Content.ToString();
|
||||
#else
|
||||
return Label_Yes.Content.ToString();
|
||||
#endif
|
||||
return Label_Yes!.Content.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
#if NET35
|
||||
_Label_Yes!.Content = value.TryAddKeyboardAccellerator();
|
||||
#else
|
||||
Label_Yes.Content = value.TryAddKeyboardAccellerator();
|
||||
#endif
|
||||
Label_Yes!.Content = value.TryAddKeyboardAccellerator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,19 +80,11 @@ namespace WPFCustomMessageBox
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NET35
|
||||
return _Label_No!.Content.ToString();
|
||||
#else
|
||||
return Label_No.Content.ToString();
|
||||
#endif
|
||||
return Label_No!.Content.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
#if NET35
|
||||
_Label_No!.Content = value.TryAddKeyboardAccellerator();
|
||||
#else
|
||||
Label_No.Content = value.TryAddKeyboardAccellerator();
|
||||
#endif
|
||||
Label_No!.Content = value.TryAddKeyboardAccellerator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,16 +92,16 @@ namespace WPFCustomMessageBox
|
||||
|
||||
#if NET35
|
||||
|
||||
private Button? _Button_Cancel => ItemHelper.FindChild<Button>(this, "Button_Cancel");
|
||||
private Button? _Button_No => ItemHelper.FindChild<Button>(this, "Button_No");
|
||||
private Button? _Button_OK => ItemHelper.FindChild<Button>(this, "Button_OK");
|
||||
private Button? _Button_Yes => ItemHelper.FindChild<Button>(this, "Button_Yes");
|
||||
private Button? Button_Cancel => ItemHelper.FindChild<Button>(this, "Button_Cancel");
|
||||
private Button? Button_No => ItemHelper.FindChild<Button>(this, "Button_No");
|
||||
private Button? Button_OK => ItemHelper.FindChild<Button>(this, "Button_OK");
|
||||
private Button? Button_Yes => ItemHelper.FindChild<Button>(this, "Button_Yes");
|
||||
private System.Windows.Controls.Image? _Image_MessageBox => ItemHelper.FindChild<System.Windows.Controls.Image>(this, "Image_MessageBox");
|
||||
private Label? _Label_Cancel => ItemHelper.FindChild<Label>(this, "Label_Cancel");
|
||||
private Label? _Label_No => ItemHelper.FindChild<Label>(this, "Label_No");
|
||||
private Label? _Label_Ok => ItemHelper.FindChild<Label>(this, "Label_Ok");
|
||||
private Label? _Label_Yes => ItemHelper.FindChild<Label>(this, "Label_Yes");
|
||||
private TextBlock? _TextBlock_Message => ItemHelper.FindChild<TextBlock>(this, "TextBlock_Message");
|
||||
private Label? Label_Cancel => ItemHelper.FindChild<Label>(this, "Label_Cancel");
|
||||
private Label? Label_No => ItemHelper.FindChild<Label>(this, "Label_No");
|
||||
private Label? Label_Ok => ItemHelper.FindChild<Label>(this, "Label_Ok");
|
||||
private Label? Label_Yes => ItemHelper.FindChild<Label>(this, "Label_Yes");
|
||||
private TextBlock? TextBlock_Message => ItemHelper.FindChild<TextBlock>(this, "TextBlock_Message");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -185,11 +145,7 @@ namespace WPFCustomMessageBox
|
||||
if (image.HasValue)
|
||||
DisplayImage(image.Value);
|
||||
else
|
||||
#if NET35
|
||||
_Image_MessageBox!.Visibility = Visibility.Collapsed;
|
||||
#else
|
||||
Image_MessageBox.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
Image_MessageBox!.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
@@ -206,75 +162,39 @@ namespace WPFCustomMessageBox
|
||||
{
|
||||
case MessageBoxButton.OKCancel:
|
||||
// Hide all but OK, Cancel
|
||||
#if NET35
|
||||
_Button_OK!.Visibility = Visibility.Visible;
|
||||
_Button_OK.Focus();
|
||||
_Button_Cancel!.Visibility = Visibility.Visible;
|
||||
|
||||
_Button_Yes!.Visibility = Visibility.Collapsed;
|
||||
_Button_No!.Visibility = Visibility.Collapsed;
|
||||
#else
|
||||
Button_OK.Visibility = Visibility.Visible;
|
||||
Button_OK!.Visibility = Visibility.Visible;
|
||||
Button_OK.Focus();
|
||||
Button_Cancel.Visibility = Visibility.Visible;
|
||||
Button_Cancel!.Visibility = Visibility.Visible;
|
||||
|
||||
Button_Yes.Visibility = Visibility.Collapsed;
|
||||
Button_No.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
Button_Yes!.Visibility = Visibility.Collapsed;
|
||||
Button_No!.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
case MessageBoxButton.YesNo:
|
||||
// Hide all but Yes, No
|
||||
#if NET35
|
||||
_Button_Yes!.Visibility = Visibility.Visible;
|
||||
_Button_Yes.Focus();
|
||||
_Button_No!.Visibility = Visibility.Visible;
|
||||
|
||||
_Button_OK!.Visibility = Visibility.Collapsed;
|
||||
_Button_Cancel!.Visibility = Visibility.Collapsed;
|
||||
#else
|
||||
Button_Yes.Visibility = Visibility.Visible;
|
||||
Button_Yes!.Visibility = Visibility.Visible;
|
||||
Button_Yes.Focus();
|
||||
Button_No.Visibility = Visibility.Visible;
|
||||
Button_No!.Visibility = Visibility.Visible;
|
||||
|
||||
Button_OK.Visibility = Visibility.Collapsed;
|
||||
Button_Cancel.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
Button_OK!.Visibility = Visibility.Collapsed;
|
||||
Button_Cancel!.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
case MessageBoxButton.YesNoCancel:
|
||||
// Hide only OK
|
||||
#if NET35
|
||||
_Button_Yes!.Visibility = Visibility.Visible;
|
||||
_Button_Yes.Focus();
|
||||
_Button_No!.Visibility = Visibility.Visible;
|
||||
_Button_Cancel!.Visibility = Visibility.Visible;
|
||||
|
||||
_Button_OK!.Visibility = Visibility.Collapsed;
|
||||
#else
|
||||
Button_Yes.Visibility = Visibility.Visible;
|
||||
Button_Yes!.Visibility = Visibility.Visible;
|
||||
Button_Yes.Focus();
|
||||
Button_No.Visibility = Visibility.Visible;
|
||||
Button_Cancel.Visibility = Visibility.Visible;
|
||||
Button_No!.Visibility = Visibility.Visible;
|
||||
Button_Cancel!.Visibility = Visibility.Visible;
|
||||
|
||||
Button_OK.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
Button_OK!.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
default:
|
||||
// Hide all but OK
|
||||
#if NET35
|
||||
_Button_OK!.Visibility = Visibility.Visible;
|
||||
_Button_OK.Focus();
|
||||
|
||||
_Button_Yes!.Visibility = Visibility.Collapsed;
|
||||
_Button_No!.Visibility = Visibility.Collapsed;
|
||||
_Button_Cancel!.Visibility = Visibility.Collapsed;
|
||||
#else
|
||||
Button_OK.Visibility = Visibility.Visible;
|
||||
Button_OK!.Visibility = Visibility.Visible;
|
||||
Button_OK.Focus();
|
||||
|
||||
Button_Yes.Visibility = Visibility.Collapsed;
|
||||
Button_No.Visibility = Visibility.Collapsed;
|
||||
Button_Cancel.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
Button_Yes!.Visibility = Visibility.Collapsed;
|
||||
Button_No!.Visibility = Visibility.Collapsed;
|
||||
Button_Cancel!.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -302,13 +222,8 @@ namespace WPFCustomMessageBox
|
||||
break;
|
||||
}
|
||||
|
||||
#if NET35
|
||||
_Image_MessageBox!.Source = icon.ToImageSource();
|
||||
_Image_MessageBox.Visibility = Visibility.Visible;
|
||||
#else
|
||||
Image_MessageBox.Source = icon.ToImageSource();
|
||||
Image_MessageBox!.Source = icon.ToImageSource();
|
||||
Image_MessageBox.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Button_OK_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net40;net452;net462;net472;net48;netcoreapp3.1;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows</TargetFrameworks>
|
||||
<TargetFrameworks>net40;net452;net462;net472;net48;netcoreapp3.1;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows;net9.0-windows</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<ApplicationIcon>Images\Icon.ico</ApplicationIcon>
|
||||
@@ -11,12 +11,13 @@
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<ImportFrameworkWinFXTargets Condition="$(TargetFramework.StartsWith(`net3`))">true</ImportFrameworkWinFXTargets>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>NU1902;NU1903</NoWarn>
|
||||
<Nullable>enable</Nullable>
|
||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWPF>true</UseWPF>
|
||||
<VersionPrefix>3.2.2</VersionPrefix>
|
||||
<VersionPrefix>3.2.4</VersionPrefix>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<AssemblyName>MPF</AssemblyName>
|
||||
@@ -37,8 +38,7 @@
|
||||
<ReferenceWpfLunaTheme>false</ReferenceWpfLunaTheme>
|
||||
<ReferenceWpfRoyaleTheme>false</ReferenceWpfRoyaleTheme>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup
|
||||
Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`)) OR $(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`))">
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`)) OR $(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`)) OR $(TargetFramework.StartsWith(`net9`))">
|
||||
<ReferenceWpfAeroTheme>false</ReferenceWpfAeroTheme>
|
||||
<ReferenceWpfAero2Theme>true</ReferenceWpfAero2Theme>
|
||||
<ReferenceWpfAeroLiteTheme>false</ReferenceWpfAeroLiteTheme>
|
||||
@@ -73,10 +73,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.1.13" GeneratePathProperty="true">
|
||||
<PackageReference Include="BinaryObjectScanner" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="3.2.3" GeneratePathProperty="true">
|
||||
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.4.1" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -205,53 +205,53 @@ namespace MPF.UI
|
||||
public void Apply()
|
||||
{
|
||||
// Handle application-wide resources
|
||||
Application.Current.Resources[SystemColors.ActiveBorderBrushKey] = this.ActiveBorderBrush;
|
||||
Application.Current.Resources[SystemColors.ControlBrushKey] = this.ControlBrush;
|
||||
Application.Current.Resources[SystemColors.ControlTextBrushKey] = this.ControlTextBrush;
|
||||
Application.Current.Resources[SystemColors.GrayTextBrushKey] = this.GrayTextBrush;
|
||||
Application.Current.Resources[SystemColors.WindowBrushKey] = this.WindowBrush;
|
||||
Application.Current.Resources[SystemColors.WindowTextBrushKey] = this.WindowTextBrush;
|
||||
Application.Current.Resources[SystemColors.ActiveBorderBrushKey] = ActiveBorderBrush;
|
||||
Application.Current.Resources[SystemColors.ControlBrushKey] = ControlBrush;
|
||||
Application.Current.Resources[SystemColors.ControlTextBrushKey] = ControlTextBrush;
|
||||
Application.Current.Resources[SystemColors.GrayTextBrushKey] = GrayTextBrush;
|
||||
Application.Current.Resources[SystemColors.WindowBrushKey] = WindowBrush;
|
||||
Application.Current.Resources[SystemColors.WindowTextBrushKey] = WindowTextBrush;
|
||||
|
||||
// Handle Button-specific resources
|
||||
Application.Current.Resources["Button.Disabled.Background"] = this.Button_Disabled_Background;
|
||||
Application.Current.Resources["Button.MouseOver.Background"] = this.Button_MouseOver_Background;
|
||||
Application.Current.Resources["Button.Pressed.Background"] = this.Button_Pressed_Background;
|
||||
Application.Current.Resources["Button.Static.Background"] = this.Button_Static_Background;
|
||||
Application.Current.Resources["Button.Disabled.Background"] = Button_Disabled_Background;
|
||||
Application.Current.Resources["Button.MouseOver.Background"] = Button_MouseOver_Background;
|
||||
Application.Current.Resources["Button.Pressed.Background"] = Button_Pressed_Background;
|
||||
Application.Current.Resources["Button.Static.Background"] = Button_Static_Background;
|
||||
|
||||
// Handle ComboBox-specific resources
|
||||
Application.Current.Resources["ComboBox.Disabled.Background"] = this.ComboBox_Disabled_Background;
|
||||
Application.Current.Resources["ComboBox.Disabled.Editable.Background"] = this.ComboBox_Disabled_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.Disabled.Editable.Button.Background"] = this.ComboBox_Disabled_Editable_Button_Background;
|
||||
Application.Current.Resources["ComboBox.MouseOver.Background"] = this.ComboBox_MouseOver_Background;
|
||||
Application.Current.Resources["ComboBox.MouseOver.Editable.Background"] = this.ComboBox_MouseOver_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.MouseOver.Editable.Button.Background"] = this.ComboBox_MouseOver_Editable_Button_Background;
|
||||
Application.Current.Resources["ComboBox.Pressed.Background"] = this.ComboBox_Pressed_Background;
|
||||
Application.Current.Resources["ComboBox.Pressed.Editable.Background"] = this.ComboBox_Pressed_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.Pressed.Editable.Button.Background"] = this.ComboBox_Pressed_Editable_Button_Background;
|
||||
Application.Current.Resources["ComboBox.Static.Background"] = this.ComboBox_Static_Background;
|
||||
Application.Current.Resources["ComboBox.Static.Editable.Background"] = this.ComboBox_Static_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.Static.Editable.Button.Background"] = this.ComboBox_Static_Editable_Button_Background;
|
||||
Application.Current.Resources["ComboBox.Disabled.Background"] = ComboBox_Disabled_Background;
|
||||
Application.Current.Resources["ComboBox.Disabled.Editable.Background"] = ComboBox_Disabled_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.Disabled.Editable.Button.Background"] = ComboBox_Disabled_Editable_Button_Background;
|
||||
Application.Current.Resources["ComboBox.MouseOver.Background"] = ComboBox_MouseOver_Background;
|
||||
Application.Current.Resources["ComboBox.MouseOver.Editable.Background"] = ComboBox_MouseOver_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.MouseOver.Editable.Button.Background"] = ComboBox_MouseOver_Editable_Button_Background;
|
||||
Application.Current.Resources["ComboBox.Pressed.Background"] = ComboBox_Pressed_Background;
|
||||
Application.Current.Resources["ComboBox.Pressed.Editable.Background"] = ComboBox_Pressed_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.Pressed.Editable.Button.Background"] = ComboBox_Pressed_Editable_Button_Background;
|
||||
Application.Current.Resources["ComboBox.Static.Background"] = ComboBox_Static_Background;
|
||||
Application.Current.Resources["ComboBox.Static.Editable.Background"] = ComboBox_Static_Editable_Background;
|
||||
Application.Current.Resources["ComboBox.Static.Editable.Button.Background"] = ComboBox_Static_Editable_Button_Background;
|
||||
|
||||
// Handle CustomMessageBox-specific resources
|
||||
Application.Current.Resources["CustomMessageBox.Static.Background"] = this.CustomMessageBox_Static_Background;
|
||||
Application.Current.Resources["CustomMessageBox.Static.Background"] = CustomMessageBox_Static_Background;
|
||||
|
||||
// Handle MenuItem-specific resources
|
||||
Application.Current.Resources["MenuItem.SubMenu.Background"] = this.MenuItem_SubMenu_Background;
|
||||
Application.Current.Resources["MenuItem.SubMenu.Border"] = this.MenuItem_SubMenu_Border;
|
||||
Application.Current.Resources["MenuItem.SubMenu.Background"] = MenuItem_SubMenu_Background;
|
||||
Application.Current.Resources["MenuItem.SubMenu.Border"] = MenuItem_SubMenu_Border;
|
||||
|
||||
// Handle ProgressBar-specific resources
|
||||
Application.Current.Resources["ProgressBar.Background"] = this.ProgressBar_Background;
|
||||
Application.Current.Resources["ProgressBar.Background"] = ProgressBar_Background;
|
||||
|
||||
// Handle ScrollViewer-specific resources
|
||||
Application.Current.Resources["ScrollViewer.ScrollBar.Background"] = this.ScrollViewer_ScrollBar_Background;
|
||||
Application.Current.Resources["ScrollViewer.ScrollBar.Background"] = ScrollViewer_ScrollBar_Background;
|
||||
|
||||
// Handle TabItem-specific resources
|
||||
Application.Current.Resources["TabItem.Selected.Background"] = this.TabItem_Selected_Background;
|
||||
Application.Current.Resources["TabItem.Static.Background"] = this.TabItem_Static_Background;
|
||||
Application.Current.Resources["TabItem.Static.Border"] = this.TabItem_Static_Border;
|
||||
Application.Current.Resources["TabItem.Selected.Background"] = TabItem_Selected_Background;
|
||||
Application.Current.Resources["TabItem.Static.Background"] = TabItem_Static_Background;
|
||||
Application.Current.Resources["TabItem.Static.Border"] = TabItem_Static_Border;
|
||||
|
||||
// Handle TextBox-specific resources
|
||||
Application.Current.Resources["TextBox.Static.Background"] = this.TextBox_Static_Background;
|
||||
Application.Current.Resources["TextBox.Static.Background"] = TextBox_Static_Background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,53 +36,53 @@ namespace MPF.UI.Themes
|
||||
var foregroundBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, foregroundR, foregroundG, foregroundB) };
|
||||
|
||||
// Handle application-wide resources
|
||||
this.ActiveBorderBrush = foregroundBrush;
|
||||
this.ControlBrush = backgroundBrush;
|
||||
this.ControlTextBrush = foregroundBrush;
|
||||
this.GrayTextBrush = foregroundBrush;
|
||||
this.WindowBrush = backgroundBrush;
|
||||
this.WindowTextBrush = foregroundBrush;
|
||||
ActiveBorderBrush = foregroundBrush;
|
||||
ControlBrush = backgroundBrush;
|
||||
ControlTextBrush = foregroundBrush;
|
||||
GrayTextBrush = foregroundBrush;
|
||||
WindowBrush = backgroundBrush;
|
||||
WindowTextBrush = foregroundBrush;
|
||||
|
||||
// Handle Button-specific resources
|
||||
this.Button_Disabled_Background = backgroundBrush;
|
||||
this.Button_MouseOver_Background = backgroundBrush;
|
||||
this.Button_Pressed_Background = backgroundBrush;
|
||||
this.Button_Static_Background = backgroundBrush;
|
||||
Button_Disabled_Background = backgroundBrush;
|
||||
Button_MouseOver_Background = backgroundBrush;
|
||||
Button_Pressed_Background = backgroundBrush;
|
||||
Button_Static_Background = backgroundBrush;
|
||||
|
||||
// Handle ComboBox-specific resources
|
||||
this.ComboBox_Disabled_Background = backgroundBrush;
|
||||
this.ComboBox_Disabled_Editable_Background = backgroundBrush;
|
||||
this.ComboBox_Disabled_Editable_Button_Background = backgroundBrush;
|
||||
this.ComboBox_MouseOver_Background = backgroundBrush;
|
||||
this.ComboBox_MouseOver_Editable_Background = backgroundBrush;
|
||||
this.ComboBox_MouseOver_Editable_Button_Background = backgroundBrush;
|
||||
this.ComboBox_Pressed_Background = backgroundBrush;
|
||||
this.ComboBox_Pressed_Editable_Background = backgroundBrush;
|
||||
this.ComboBox_Pressed_Editable_Button_Background = backgroundBrush;
|
||||
this.ComboBox_Static_Background = backgroundBrush;
|
||||
this.ComboBox_Static_Editable_Background = backgroundBrush;
|
||||
this.ComboBox_Static_Editable_Button_Background = backgroundBrush;
|
||||
ComboBox_Disabled_Background = backgroundBrush;
|
||||
ComboBox_Disabled_Editable_Background = backgroundBrush;
|
||||
ComboBox_Disabled_Editable_Button_Background = backgroundBrush;
|
||||
ComboBox_MouseOver_Background = backgroundBrush;
|
||||
ComboBox_MouseOver_Editable_Background = backgroundBrush;
|
||||
ComboBox_MouseOver_Editable_Button_Background = backgroundBrush;
|
||||
ComboBox_Pressed_Background = backgroundBrush;
|
||||
ComboBox_Pressed_Editable_Background = backgroundBrush;
|
||||
ComboBox_Pressed_Editable_Button_Background = backgroundBrush;
|
||||
ComboBox_Static_Background = backgroundBrush;
|
||||
ComboBox_Static_Editable_Background = backgroundBrush;
|
||||
ComboBox_Static_Editable_Button_Background = backgroundBrush;
|
||||
|
||||
// Handle CustomMessageBox-specific resources
|
||||
this.CustomMessageBox_Static_Background = backgroundBrush;
|
||||
CustomMessageBox_Static_Background = backgroundBrush;
|
||||
|
||||
// Handle MenuItem-specific resources
|
||||
this.MenuItem_SubMenu_Background = backgroundBrush;
|
||||
this.MenuItem_SubMenu_Border = Brushes.DarkGray;
|
||||
MenuItem_SubMenu_Background = backgroundBrush;
|
||||
MenuItem_SubMenu_Border = Brushes.DarkGray;
|
||||
|
||||
// Handle ProgressBar-specific resources
|
||||
this.ProgressBar_Background = backgroundBrush;
|
||||
ProgressBar_Background = backgroundBrush;
|
||||
|
||||
// Handle ScrollViewer-specific resources
|
||||
this.ScrollViewer_ScrollBar_Background = backgroundBrush;
|
||||
ScrollViewer_ScrollBar_Background = backgroundBrush;
|
||||
|
||||
// Handle TabItem-specific resources
|
||||
this.TabItem_Selected_Background = backgroundBrush;
|
||||
this.TabItem_Static_Background = backgroundBrush;
|
||||
this.TabItem_Static_Border = Brushes.DarkGray;
|
||||
TabItem_Selected_Background = backgroundBrush;
|
||||
TabItem_Static_Background = backgroundBrush;
|
||||
TabItem_Static_Border = Brushes.DarkGray;
|
||||
|
||||
// Handle TextBox-specific resources
|
||||
this.TextBox_Static_Background = backgroundBrush;
|
||||
TextBox_Static_Background = backgroundBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,53 +13,53 @@ namespace MPF.UI.Themes
|
||||
var darkModeBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x20, 0x20, 0x20) };
|
||||
|
||||
// Handle application-wide resources
|
||||
this.ActiveBorderBrush = Brushes.Black;
|
||||
this.ControlBrush = darkModeBrush;
|
||||
this.ControlTextBrush = Brushes.White;
|
||||
this.GrayTextBrush = Brushes.DarkGray;
|
||||
this.WindowBrush = darkModeBrush;
|
||||
this.WindowTextBrush = Brushes.White;
|
||||
ActiveBorderBrush = Brushes.Black;
|
||||
ControlBrush = darkModeBrush;
|
||||
ControlTextBrush = Brushes.White;
|
||||
GrayTextBrush = Brushes.DarkGray;
|
||||
WindowBrush = darkModeBrush;
|
||||
WindowTextBrush = Brushes.White;
|
||||
|
||||
// Handle Button-specific resources
|
||||
this.Button_Disabled_Background = darkModeBrush;
|
||||
this.Button_MouseOver_Background = darkModeBrush;
|
||||
this.Button_Pressed_Background = darkModeBrush;
|
||||
this.Button_Static_Background = darkModeBrush;
|
||||
Button_Disabled_Background = darkModeBrush;
|
||||
Button_MouseOver_Background = darkModeBrush;
|
||||
Button_Pressed_Background = darkModeBrush;
|
||||
Button_Static_Background = darkModeBrush;
|
||||
|
||||
// Handle ComboBox-specific resources
|
||||
this.ComboBox_Disabled_Background = darkModeBrush;
|
||||
this.ComboBox_Disabled_Editable_Background = darkModeBrush;
|
||||
this.ComboBox_Disabled_Editable_Button_Background = darkModeBrush;
|
||||
this.ComboBox_MouseOver_Background = darkModeBrush;
|
||||
this.ComboBox_MouseOver_Editable_Background = darkModeBrush;
|
||||
this.ComboBox_MouseOver_Editable_Button_Background = darkModeBrush;
|
||||
this.ComboBox_Pressed_Background = darkModeBrush;
|
||||
this.ComboBox_Pressed_Editable_Background = darkModeBrush;
|
||||
this.ComboBox_Pressed_Editable_Button_Background = darkModeBrush;
|
||||
this.ComboBox_Static_Background = darkModeBrush;
|
||||
this.ComboBox_Static_Editable_Background = darkModeBrush;
|
||||
this.ComboBox_Static_Editable_Button_Background = darkModeBrush;
|
||||
ComboBox_Disabled_Background = darkModeBrush;
|
||||
ComboBox_Disabled_Editable_Background = darkModeBrush;
|
||||
ComboBox_Disabled_Editable_Button_Background = darkModeBrush;
|
||||
ComboBox_MouseOver_Background = darkModeBrush;
|
||||
ComboBox_MouseOver_Editable_Background = darkModeBrush;
|
||||
ComboBox_MouseOver_Editable_Button_Background = darkModeBrush;
|
||||
ComboBox_Pressed_Background = darkModeBrush;
|
||||
ComboBox_Pressed_Editable_Background = darkModeBrush;
|
||||
ComboBox_Pressed_Editable_Button_Background = darkModeBrush;
|
||||
ComboBox_Static_Background = darkModeBrush;
|
||||
ComboBox_Static_Editable_Background = darkModeBrush;
|
||||
ComboBox_Static_Editable_Button_Background = darkModeBrush;
|
||||
|
||||
// Handle CustomMessageBox-specific resources
|
||||
this.CustomMessageBox_Static_Background = darkModeBrush;
|
||||
CustomMessageBox_Static_Background = darkModeBrush;
|
||||
|
||||
// Handle MenuItem-specific resources
|
||||
this.MenuItem_SubMenu_Background = darkModeBrush;
|
||||
this.MenuItem_SubMenu_Border = Brushes.DarkGray;
|
||||
MenuItem_SubMenu_Background = darkModeBrush;
|
||||
MenuItem_SubMenu_Border = Brushes.DarkGray;
|
||||
|
||||
// Handle ProgressBar-specific resources
|
||||
this.ProgressBar_Background = darkModeBrush;
|
||||
ProgressBar_Background = darkModeBrush;
|
||||
|
||||
// Handle ScrollViewer-specific resources
|
||||
this.ScrollViewer_ScrollBar_Background = darkModeBrush;
|
||||
ScrollViewer_ScrollBar_Background = darkModeBrush;
|
||||
|
||||
// Handle TabItem-specific resources
|
||||
this.TabItem_Selected_Background = darkModeBrush;
|
||||
this.TabItem_Static_Background = darkModeBrush;
|
||||
this.TabItem_Static_Border = Brushes.DarkGray;
|
||||
TabItem_Selected_Background = darkModeBrush;
|
||||
TabItem_Static_Background = darkModeBrush;
|
||||
TabItem_Static_Border = Brushes.DarkGray;
|
||||
|
||||
// Handle TextBox-specific resources
|
||||
this.TextBox_Static_Background = darkModeBrush;
|
||||
TextBox_Static_Background = darkModeBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,77 +11,77 @@ namespace MPF.UI.Themes
|
||||
public LightModeTheme()
|
||||
{
|
||||
// Handle application-wide resources
|
||||
this.ActiveBorderBrush = null;
|
||||
this.ControlBrush = null;
|
||||
this.ControlTextBrush = null;
|
||||
this.GrayTextBrush = null;
|
||||
this.WindowBrush = null;
|
||||
this.WindowTextBrush = null;
|
||||
ActiveBorderBrush = null;
|
||||
ControlBrush = null;
|
||||
ControlTextBrush = null;
|
||||
GrayTextBrush = null;
|
||||
WindowBrush = null;
|
||||
WindowTextBrush = null;
|
||||
|
||||
// Handle Button-specific resources
|
||||
this.Button_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0xF4, 0xF4));
|
||||
this.Button_MouseOver_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xBE, 0xE6, 0xFD));
|
||||
this.Button_Pressed_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xC4, 0xE5, 0xF6));
|
||||
this.Button_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xDD, 0xDD, 0xDD));
|
||||
Button_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0xF4, 0xF4));
|
||||
Button_MouseOver_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xBE, 0xE6, 0xFD));
|
||||
Button_Pressed_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xC4, 0xE5, 0xF6));
|
||||
Button_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xDD, 0xDD, 0xDD));
|
||||
|
||||
// Handle ComboBox-specific resources
|
||||
this.ComboBox_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0));
|
||||
this.ComboBox_Disabled_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
this.ComboBox_Disabled_Editable_Button_Background = Brushes.Transparent;
|
||||
this.ComboBox_MouseOver_Background = new LinearGradientBrush(
|
||||
ComboBox_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0));
|
||||
ComboBox_Disabled_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
ComboBox_Disabled_Editable_Button_Background = Brushes.Transparent;
|
||||
ComboBox_MouseOver_Background = new LinearGradientBrush(
|
||||
Color.FromArgb(0xFF, 0xEC, 0xF4, 0xFC),
|
||||
Color.FromArgb(0xFF, 0xDC, 0xEC, 0xFC),
|
||||
new Point(0, 0),
|
||||
new Point(0, 1));
|
||||
this.ComboBox_MouseOver_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
this.ComboBox_MouseOver_Editable_Button_Background = new LinearGradientBrush(
|
||||
ComboBox_MouseOver_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
ComboBox_MouseOver_Editable_Button_Background = new LinearGradientBrush(
|
||||
Color.FromArgb(0xFF, 0xEB, 0xF4, 0xFC),
|
||||
Color.FromArgb(0xFF, 0xDC, 0xEC, 0xFC),
|
||||
new Point(0, 0),
|
||||
new Point(0, 1));
|
||||
this.ComboBox_Pressed_Background = new LinearGradientBrush(
|
||||
ComboBox_Pressed_Background = new LinearGradientBrush(
|
||||
Color.FromArgb(0xFF, 0xDA, 0xEC, 0xFC),
|
||||
Color.FromArgb(0xFF, 0xC4, 0xE0, 0xFC),
|
||||
new Point(0, 0),
|
||||
new Point(0, 1));
|
||||
this.ComboBox_Pressed_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
this.ComboBox_Pressed_Editable_Button_Background = new LinearGradientBrush(
|
||||
ComboBox_Pressed_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
ComboBox_Pressed_Editable_Button_Background = new LinearGradientBrush(
|
||||
Color.FromArgb(0xFF, 0xDA, 0xEB, 0xFC),
|
||||
Color.FromArgb(0xFF, 0xC4, 0xE0, 0xFC),
|
||||
new Point(0, 0),
|
||||
new Point(0, 1));
|
||||
this.ComboBox_Static_Background = new LinearGradientBrush(
|
||||
ComboBox_Static_Background = new LinearGradientBrush(
|
||||
Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0),
|
||||
Color.FromArgb(0xFF, 0xE5, 0xE5, 0xE5),
|
||||
new Point(0, 0),
|
||||
new Point(0, 1));
|
||||
this.ComboBox_Static_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
this.ComboBox_Static_Editable_Button_Background = Brushes.Transparent;
|
||||
ComboBox_Static_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
ComboBox_Static_Editable_Button_Background = Brushes.Transparent;
|
||||
|
||||
// Handle CustomMessageBox-specific resources
|
||||
this.CustomMessageBox_Static_Background = null;
|
||||
CustomMessageBox_Static_Background = null;
|
||||
|
||||
// Handle MenuItem-specific resources
|
||||
this.MenuItem_SubMenu_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0));
|
||||
this.MenuItem_SubMenu_Border = Brushes.DarkGray;
|
||||
MenuItem_SubMenu_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0));
|
||||
MenuItem_SubMenu_Border = Brushes.DarkGray;
|
||||
|
||||
// Handle ProgressBar-specific resources
|
||||
this.ProgressBar_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6));
|
||||
ProgressBar_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6));
|
||||
|
||||
// Handle ScrollViewer-specific resources
|
||||
this.ScrollViewer_ScrollBar_Background = Brushes.LightGray;
|
||||
ScrollViewer_ScrollBar_Background = Brushes.LightGray;
|
||||
|
||||
// Handle TabItem-specific resources
|
||||
this.TabItem_Selected_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
this.TabItem_Static_Background = new LinearGradientBrush(
|
||||
TabItem_Selected_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
TabItem_Static_Background = new LinearGradientBrush(
|
||||
Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0),
|
||||
Color.FromArgb(0xFF, 0xE5, 0xE5, 0xE5),
|
||||
new Point(0, 0),
|
||||
new Point(0, 1));
|
||||
this.TabItem_Static_Border = Brushes.DarkGray;
|
||||
TabItem_Static_Border = Brushes.DarkGray;
|
||||
|
||||
// Handle TextBox-specific resources
|
||||
this.TextBox_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
TextBox_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace MPF.UI.UserControls
|
||||
|
||||
#if NET35
|
||||
|
||||
private Button? _ClearButton => ItemHelper.FindChild<Button>(this, "ClearButton");
|
||||
private RichTextBox? _Output => ItemHelper.FindChild<RichTextBox>(this, "Output");
|
||||
private ScrollViewer? _OutputViewer => ItemHelper.FindChild<ScrollViewer>(this, "OutputViewer");
|
||||
private Button? _SaveButton => ItemHelper.FindChild<Button>(this, "SaveButton");
|
||||
private Button? ClearButton => ItemHelper.FindChild<Button>(this, "ClearButton");
|
||||
private RichTextBox? Output => ItemHelper.FindChild<RichTextBox>(this, "Output");
|
||||
private ScrollViewer? OutputViewer => ItemHelper.FindChild<ScrollViewer>(this, "OutputViewer");
|
||||
private Button? SaveButton => ItemHelper.FindChild<Button>(this, "SaveButton");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -60,24 +60,13 @@ namespace MPF.UI.UserControls
|
||||
LogQueue = new ProcessingQueue<LogLine>(ProcessLogLine);
|
||||
|
||||
// Add handlers
|
||||
#if NET35
|
||||
_OutputViewer!.SizeChanged += OutputViewerSizeChanged;
|
||||
_Output!.TextChanged += OnTextChanged;
|
||||
_ClearButton!.Click += OnClearButton;
|
||||
_SaveButton!.Click += OnSaveButton;
|
||||
#else
|
||||
OutputViewer.SizeChanged += OutputViewerSizeChanged;
|
||||
Output.TextChanged += OnTextChanged;
|
||||
ClearButton.Click += OnClearButton;
|
||||
SaveButton.Click += OnSaveButton;
|
||||
#endif
|
||||
OutputViewer!.SizeChanged += OutputViewerSizeChanged;
|
||||
Output!.TextChanged += OnTextChanged;
|
||||
ClearButton!.Click += OnClearButton;
|
||||
SaveButton!.Click += OnSaveButton;
|
||||
|
||||
// Update the internal state
|
||||
#if NET35
|
||||
_Output.Document = Document;
|
||||
#else
|
||||
Output.Document = Document;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Logging
|
||||
@@ -107,8 +96,8 @@ namespace MPF.UI.UserControls
|
||||
|
||||
public LogLine(string text, LogLevel logLevel)
|
||||
{
|
||||
this.Text = text;
|
||||
this.LogLevel = logLevel;
|
||||
Text = text;
|
||||
LogLevel = logLevel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,7 +106,7 @@ namespace MPF.UI.UserControls
|
||||
/// <returns>Brush representing the color</returns>
|
||||
public Brush GetForegroundColor()
|
||||
{
|
||||
return this.LogLevel switch
|
||||
return LogLevel switch
|
||||
{
|
||||
LogLevel.SECRET => Brushes.Blue,
|
||||
LogLevel.ERROR => Brushes.Red,
|
||||
@@ -132,7 +121,7 @@ namespace MPF.UI.UserControls
|
||||
/// <returns>Run object based on internal values</returns>
|
||||
public Run GenerateRun()
|
||||
{
|
||||
return new Run { Text = this.Text, Foreground = GetForegroundColor() };
|
||||
return new Run { Text = Text, Foreground = GetForegroundColor() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,11 +203,7 @@ namespace MPF.UI.UserControls
|
||||
/// <summary>
|
||||
/// Scroll the current view to the bottom
|
||||
/// </summary>
|
||||
#if NET35
|
||||
public void ScrollToBottom() => _OutputViewer!.ScrollToBottom();
|
||||
#else
|
||||
public void ScrollToBottom() => OutputViewer.ScrollToBottom();
|
||||
#endif
|
||||
public void ScrollToBottom() => OutputViewer!.ScrollToBottom();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
#if NET40
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using MPF.Frontend.ViewModels;
|
||||
@@ -25,18 +28,18 @@ namespace MPF.UI.Windows
|
||||
|
||||
#region Settings
|
||||
|
||||
private ComboBox? _DumpingProgramComboBox => ItemHelper.FindChild<ComboBox>(this, "DumpingProgramComboBox");
|
||||
private Button? _InputPathBrowseButton => ItemHelper.FindChild<Button>(this, "InputPathBrowseButton");
|
||||
private TextBox? _InputPathTextBox => ItemHelper.FindChild<TextBox>(this, "InputPathTextBox");
|
||||
private ComboBox? _MediaTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "MediaTypeComboBox");
|
||||
private ComboBox? _SystemTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "SystemTypeComboBox");
|
||||
private ComboBox? DumpingProgramComboBox => ItemHelper.FindChild<ComboBox>(this, "DumpingProgramComboBox");
|
||||
private Button? InputPathBrowseButton => ItemHelper.FindChild<Button>(this, "InputPathBrowseButton");
|
||||
private TextBox? InputPathTextBox => ItemHelper.FindChild<TextBox>(this, "InputPathTextBox");
|
||||
private ComboBox? MediaTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "MediaTypeComboBox");
|
||||
private ComboBox? SystemTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "SystemTypeComboBox");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Controls
|
||||
|
||||
private System.Windows.Controls.Button? _CheckDumpButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CheckDumpButton");
|
||||
private System.Windows.Controls.Button? _CancelButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CancelButton");
|
||||
private System.Windows.Controls.Button? CheckDumpButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CheckDumpButton");
|
||||
private System.Windows.Controls.Button? CancelButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CancelButton");
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -80,38 +83,19 @@ namespace MPF.UI.Windows
|
||||
public void AddEventHandlers()
|
||||
{
|
||||
// Main buttons
|
||||
#if NET35
|
||||
_CheckDumpButton!.Click += OnCheckDumpClick;
|
||||
_CancelButton!.Click += OnCancelClick;
|
||||
#else
|
||||
CheckDumpButton.Click += OnCheckDumpClick;
|
||||
CancelButton.Click += OnCancelClick;
|
||||
#endif
|
||||
CheckDumpButton!.Click += OnCheckDumpClick;
|
||||
CancelButton!.Click += OnCancelClick;
|
||||
|
||||
// User Area Click
|
||||
#if NET35
|
||||
_InputPathBrowseButton!.Click += InputPathBrowseButtonClick;
|
||||
#else
|
||||
InputPathBrowseButton.Click += InputPathBrowseButtonClick;
|
||||
#endif
|
||||
InputPathBrowseButton!.Click += InputPathBrowseButtonClick;
|
||||
|
||||
// User Area SelectionChanged
|
||||
#if NET35
|
||||
_SystemTypeComboBox!.SelectionChanged += SystemTypeComboBoxSelectionChanged;
|
||||
_MediaTypeComboBox!.SelectionChanged += MediaTypeComboBoxSelectionChanged;
|
||||
_DumpingProgramComboBox!.SelectionChanged += DumpingProgramComboBoxSelectionChanged;
|
||||
#else
|
||||
SystemTypeComboBox.SelectionChanged += SystemTypeComboBoxSelectionChanged;
|
||||
MediaTypeComboBox.SelectionChanged += MediaTypeComboBoxSelectionChanged;
|
||||
DumpingProgramComboBox.SelectionChanged += DumpingProgramComboBoxSelectionChanged;
|
||||
#endif
|
||||
SystemTypeComboBox!.SelectionChanged += SystemTypeComboBoxSelectionChanged;
|
||||
MediaTypeComboBox!.SelectionChanged += MediaTypeComboBoxSelectionChanged;
|
||||
DumpingProgramComboBox!.SelectionChanged += DumpingProgramComboBoxSelectionChanged;
|
||||
|
||||
// User Area TextChanged
|
||||
#if NET35
|
||||
_InputPathTextBox!.TextChanged += InputPathTextBoxTextChanged;
|
||||
#else
|
||||
InputPathTextBox.TextChanged += InputPathTextBoxTextChanged;
|
||||
#endif
|
||||
InputPathTextBox!.TextChanged += InputPathTextBoxTextChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -181,7 +165,7 @@ namespace MPF.UI.Windows
|
||||
/// </summary>
|
||||
/// <param name="submissionInfo">SubmissionInfo object to display and possibly change</param>
|
||||
/// <returns>Dialog open result</returns>
|
||||
public (bool?, SubmissionInfo?) ShowDiscInformationWindow(SubmissionInfo? submissionInfo)
|
||||
public bool? ShowDiscInformationWindow(ref SubmissionInfo? submissionInfo)
|
||||
{
|
||||
var discInformationWindow = new DiscInformationWindow(CheckDumpViewModel.Options, submissionInfo)
|
||||
{
|
||||
@@ -192,14 +176,14 @@ namespace MPF.UI.Windows
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
};
|
||||
|
||||
discInformationWindow.Closed += delegate { this.Activate(); };
|
||||
discInformationWindow.Closed += delegate { Activate(); };
|
||||
bool? result = discInformationWindow.ShowDialog();
|
||||
|
||||
// Copy back the submission info changes, if necessary
|
||||
if (result == true)
|
||||
submissionInfo = (discInformationWindow.DiscInformationViewModel.SubmissionInfo.Clone() as SubmissionInfo)!;
|
||||
|
||||
return (result, submissionInfo!);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -209,17 +193,9 @@ namespace MPF.UI.Windows
|
||||
/// <summary>
|
||||
/// Handler for CheckDumpButton Click event
|
||||
/// </summary>
|
||||
#if NET40
|
||||
private void OnCheckDumpClick(object sender, EventArgs e)
|
||||
{
|
||||
var checkTask = CheckDumpViewModel.CheckDump(ShowDiscInformationWindow);
|
||||
checkTask.Wait();
|
||||
string? errorMessage = checkTask.Result;
|
||||
#else
|
||||
private async void OnCheckDumpClick(object sender, EventArgs e)
|
||||
{
|
||||
string? errorMessage = await CheckDumpViewModel.CheckDump(ShowDiscInformationWindow);
|
||||
#endif
|
||||
if (string.IsNullOrEmpty(errorMessage))
|
||||
{
|
||||
bool? checkAgain = DisplayUserMessage("Check Complete", "The dump has been processed successfully! Would you like to check another dump?", 2, false);
|
||||
|
||||
@@ -24,34 +24,34 @@ namespace MPF.UI.Windows
|
||||
|
||||
#region Settings
|
||||
|
||||
private Button? _InputPathBrowseButton => ItemHelper.FindChild<Button>(this, "InputPathBrowseButton");
|
||||
private TextBox? _InputPathTextBox => ItemHelper.FindChild<TextBox>(this, "InputPathTextBox");
|
||||
private Button? InputPathBrowseButton => ItemHelper.FindChild<Button>(this, "InputPathBrowseButton");
|
||||
private TextBox? InputPathTextBox => ItemHelper.FindChild<TextBox>(this, "InputPathTextBox");
|
||||
|
||||
private Button? _LogPathBrowseButton => ItemHelper.FindChild<Button>(this, "LogPathBrowseButton");
|
||||
private TextBox? _LogPathTextBox => ItemHelper.FindChild<TextBox>(this, "LogPathTextBox");
|
||||
private Button? _KeyPathBrowseButton => ItemHelper.FindChild<Button>(this, "KeyPathBrowseButton");
|
||||
private TextBox? _KeyPathTextBox => ItemHelper.FindChild<TextBox>(this, "KeyPathTextBox");
|
||||
private TextBox? _KeyTextBox => ItemHelper.FindChild<TextBox>(this, "KeyTextBox");
|
||||
private TextBox? _DiscIDTextBox => ItemHelper.FindChild<TextBox>(this, "DiscIDTextBox");
|
||||
private Button? _PICPathBrowseButton => ItemHelper.FindChild<Button>(this, "PICPathBrowseButton");
|
||||
private TextBox? _PICPathTextBox => ItemHelper.FindChild<TextBox>(this, "PICPathTextBox");
|
||||
private TextBox? _PICTextBox => ItemHelper.FindChild<TextBox>(this, "PICTextBox");
|
||||
private TextBox? _LayerbreakTextBox => ItemHelper.FindChild<TextBox>(this, "LayerbreakTextBox");
|
||||
private Button? LogPathBrowseButton => ItemHelper.FindChild<Button>(this, "LogPathBrowseButton");
|
||||
private TextBox? LogPathTextBox => ItemHelper.FindChild<TextBox>(this, "LogPathTextBox");
|
||||
private Button? KeyPathBrowseButton => ItemHelper.FindChild<Button>(this, "KeyPathBrowseButton");
|
||||
private TextBox? KeyPathTextBox => ItemHelper.FindChild<TextBox>(this, "KeyPathTextBox");
|
||||
private TextBox? KeyTextBox => ItemHelper.FindChild<TextBox>(this, "KeyTextBox");
|
||||
private TextBox? DiscIDTextBox => ItemHelper.FindChild<TextBox>(this, "DiscIDTextBox");
|
||||
private Button? PICPathBrowseButton => ItemHelper.FindChild<Button>(this, "PICPathBrowseButton");
|
||||
private TextBox? PICPathTextBox => ItemHelper.FindChild<TextBox>(this, "PICPathTextBox");
|
||||
private TextBox? PICTextBox => ItemHelper.FindChild<TextBox>(this, "PICTextBox");
|
||||
private TextBox? LayerbreakTextBox => ItemHelper.FindChild<TextBox>(this, "LayerbreakTextBox");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Controls
|
||||
|
||||
private System.Windows.Controls.Button? _CreateIRDButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CreateIRDButton");
|
||||
private System.Windows.Controls.Button? _CancelButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CancelButton");
|
||||
private System.Windows.Controls.Button? CreateIRDButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CreateIRDButton");
|
||||
private System.Windows.Controls.Button? CancelButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CancelButton");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Expanders
|
||||
|
||||
private Expander? _KeyExpander => ItemHelper.FindChild<Expander>(this, "KeyExpander");
|
||||
private Expander? _DiscIDExpander => ItemHelper.FindChild<Expander>(this, "DiscIDExpander");
|
||||
private Expander? _PICExpander => ItemHelper.FindChild<Expander>(this, "PICExpander");
|
||||
private Expander? KeyExpander => ItemHelper.FindChild<Expander>(this, "KeyExpander");
|
||||
private Expander? DiscIDExpander => ItemHelper.FindChild<Expander>(this, "DiscIDExpander");
|
||||
private Expander? PICExpander => ItemHelper.FindChild<Expander>(this, "PICExpander");
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -95,47 +95,24 @@ namespace MPF.UI.Windows
|
||||
public void AddEventHandlers()
|
||||
{
|
||||
// Main buttons
|
||||
#if NET35
|
||||
_CreateIRDButton!.Click += OnCreateIRDClick;
|
||||
_CancelButton!.Click += OnCancelClick;
|
||||
#else
|
||||
CreateIRDButton.Click += OnCreateIRDClick;
|
||||
CancelButton.Click += OnCancelClick;
|
||||
#endif
|
||||
CreateIRDButton!.Click += OnCreateIRDClick;
|
||||
CancelButton!.Click += OnCancelClick;
|
||||
|
||||
// User Area Click
|
||||
#if NET35
|
||||
_InputPathBrowseButton!.Click += InputPathBrowseButtonClick;
|
||||
_LogPathBrowseButton!.Click += LogPathBrowseButtonClick;
|
||||
_KeyPathBrowseButton!.Click += KeyPathBrowseButtonClick;
|
||||
_PICPathBrowseButton!.Click += PICPathBrowseButtonClick;
|
||||
#else
|
||||
InputPathBrowseButton.Click += InputPathBrowseButtonClick;
|
||||
LogPathBrowseButton.Click += LogPathBrowseButtonClick;
|
||||
KeyPathBrowseButton.Click += KeyPathBrowseButtonClick;
|
||||
PICPathBrowseButton.Click += PICPathBrowseButtonClick;
|
||||
#endif
|
||||
InputPathBrowseButton!.Click += InputPathBrowseButtonClick;
|
||||
LogPathBrowseButton!.Click += LogPathBrowseButtonClick;
|
||||
KeyPathBrowseButton!.Click += KeyPathBrowseButtonClick;
|
||||
PICPathBrowseButton!.Click += PICPathBrowseButtonClick;
|
||||
|
||||
// User Area TextChanged
|
||||
#if NET35
|
||||
_InputPathTextBox!.TextChanged += InputPathTextBoxTextChanged;
|
||||
_LogPathTextBox!.TextChanged += LogPathTextBoxTextChanged;
|
||||
_KeyPathTextBox!.TextChanged += KeyPathTextBoxTextChanged;
|
||||
_KeyTextBox!.TextChanged += KeyTextBoxTextChanged;
|
||||
_DiscIDTextBox!.TextChanged += DiscIDTextBoxTextChanged;
|
||||
_PICPathTextBox!.TextChanged += PICPathTextBoxTextChanged;
|
||||
_PICTextBox!.TextChanged += PICTextBoxTextChanged;
|
||||
_LayerbreakTextBox!.TextChanged += LayerbreakTextBoxTextChanged;
|
||||
#else
|
||||
InputPathTextBox.TextChanged += InputPathTextBoxTextChanged;
|
||||
LogPathTextBox.TextChanged += LogPathTextBoxTextChanged;
|
||||
KeyPathTextBox.TextChanged += KeyPathTextBoxTextChanged;
|
||||
KeyTextBox.TextChanged += KeyTextBoxTextChanged;
|
||||
DiscIDTextBox.TextChanged += DiscIDTextBoxTextChanged;
|
||||
PICPathTextBox.TextChanged += PICPathTextBoxTextChanged;
|
||||
PICTextBox.TextChanged += PICTextBoxTextChanged;
|
||||
LayerbreakTextBox.TextChanged += LayerbreakTextBoxTextChanged;
|
||||
#endif
|
||||
InputPathTextBox!.TextChanged += InputPathTextBoxTextChanged;
|
||||
LogPathTextBox!.TextChanged += LogPathTextBoxTextChanged;
|
||||
KeyPathTextBox!.TextChanged += KeyPathTextBoxTextChanged;
|
||||
KeyTextBox!.TextChanged += KeyTextBoxTextChanged;
|
||||
DiscIDTextBox!.TextChanged += DiscIDTextBoxTextChanged;
|
||||
PICPathTextBox!.TextChanged += PICPathTextBoxTextChanged;
|
||||
PICTextBox!.TextChanged += PICTextBoxTextChanged;
|
||||
LayerbreakTextBox!.TextChanged += LayerbreakTextBoxTextChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -330,15 +307,10 @@ namespace MPF.UI.Windows
|
||||
/// </summary>
|
||||
private void OnCreateIRDClick(object sender, EventArgs e)
|
||||
{
|
||||
#if NET35
|
||||
if (_KeyExpander != null) _KeyExpander.IsExpanded = false;
|
||||
if (_DiscIDExpander != null) _DiscIDExpander.IsExpanded = false;
|
||||
if (_PICExpander != null) _PICExpander.IsExpanded = false;
|
||||
#else
|
||||
KeyExpander.IsExpanded = false;
|
||||
DiscIDExpander.IsExpanded = false;
|
||||
PICExpander.IsExpanded = false;
|
||||
#endif
|
||||
if (KeyExpander != null) KeyExpander.IsExpanded = false;
|
||||
if (DiscIDExpander != null) DiscIDExpander.IsExpanded = false;
|
||||
if (PICExpander != null) PICExpander.IsExpanded = false;
|
||||
|
||||
string tempStatus = CreateIRDViewModel.CreateIRDStatus;
|
||||
bool[] enabledFields = CreateIRDViewModel.DisableUIFields();
|
||||
CreateIRDViewModel.CreateIRDStatus = "Creating IRD... Please Wait";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using MPF.Frontend;
|
||||
using MPF.Frontend.ViewModels;
|
||||
@@ -19,104 +18,104 @@ namespace MPF.UI.Windows
|
||||
|
||||
#region Common Info
|
||||
|
||||
private Grid? _LanguageSelectionGrid => ItemHelper.FindChild<Grid>(this, "LanguageSelectionGrid");
|
||||
private Grid? LanguageSelectionGrid => ItemHelper.FindChild<Grid>(this, "LanguageSelectionGrid");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Additional Info
|
||||
|
||||
private UserInput? _CommentsTextBox => ItemHelper.FindChild<UserInput>(this, "CommentsTextBox");
|
||||
private UserInput? _DiscIDTextBox => ItemHelper.FindChild<UserInput>(this, "DiscIDTextBox");
|
||||
private UserInput? _DiscKeyTextBox => ItemHelper.FindChild<UserInput>(this, "DiscKeyTextBox");
|
||||
private UserInput? CommentsTextBox => ItemHelper.FindChild<UserInput>(this, "CommentsTextBox");
|
||||
private UserInput? DiscIDTextBox => ItemHelper.FindChild<UserInput>(this, "DiscIDTextBox");
|
||||
private UserInput? DiscKeyTextBox => ItemHelper.FindChild<UserInput>(this, "DiscKeyTextBox");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Contents
|
||||
|
||||
private UserInput? _ExtrasTextBox => ItemHelper.FindChild<UserInput>(this, "ExtrasTextBox");
|
||||
private UserInput? _GameFootageTextBox => ItemHelper.FindChild<UserInput>(this, "GameFootageTextBox");
|
||||
private UserInput? _GamesTextBox => ItemHelper.FindChild<UserInput>(this, "GamesTextBox");
|
||||
private UserInput? _GeneralContent => ItemHelper.FindChild<UserInput>(this, "GeneralContent");
|
||||
private UserInput? _NetYarozeGamesTextBox => ItemHelper.FindChild<UserInput>(this, "NetYarozeGamesTextBox");
|
||||
private UserInput? _PatchesTextBox => ItemHelper.FindChild<UserInput>(this, "PatchesTextBox");
|
||||
private UserInput? _PlayableDemosTextBox => ItemHelper.FindChild<UserInput>(this, "PlayableDemosTextBox");
|
||||
private UserInput? _RollingDemosTextBox => ItemHelper.FindChild<UserInput>(this, "RollingDemosTextBox");
|
||||
private UserInput? _SavegamesTextBox => ItemHelper.FindChild<UserInput>(this, "SavegamesTextBox");
|
||||
private UserInput? _TechDemosTextBox => ItemHelper.FindChild<UserInput>(this, "TechDemosTextBox");
|
||||
private UserInput? _VideosTextBox => ItemHelper.FindChild<UserInput>(this, "VideosTextBox");
|
||||
private UserInput? ExtrasTextBox => ItemHelper.FindChild<UserInput>(this, "ExtrasTextBox");
|
||||
private UserInput? GameFootageTextBox => ItemHelper.FindChild<UserInput>(this, "GameFootageTextBox");
|
||||
private UserInput? GamesTextBox => ItemHelper.FindChild<UserInput>(this, "GamesTextBox");
|
||||
private UserInput? GeneralContent => ItemHelper.FindChild<UserInput>(this, "GeneralContent");
|
||||
private UserInput? NetYarozeGamesTextBox => ItemHelper.FindChild<UserInput>(this, "NetYarozeGamesTextBox");
|
||||
private UserInput? PatchesTextBox => ItemHelper.FindChild<UserInput>(this, "PatchesTextBox");
|
||||
private UserInput? PlayableDemosTextBox => ItemHelper.FindChild<UserInput>(this, "PlayableDemosTextBox");
|
||||
private UserInput? RollingDemosTextBox => ItemHelper.FindChild<UserInput>(this, "RollingDemosTextBox");
|
||||
private UserInput? SavegamesTextBox => ItemHelper.FindChild<UserInput>(this, "SavegamesTextBox");
|
||||
private UserInput? TechDemosTextBox => ItemHelper.FindChild<UserInput>(this, "TechDemosTextBox");
|
||||
private UserInput? VideosTextBox => ItemHelper.FindChild<UserInput>(this, "VideosTextBox");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ringcodes
|
||||
|
||||
private GroupBox? _L0Info => ItemHelper.FindChild<GroupBox>(this, "L0Info");
|
||||
private UserInput? _L0MasteringRing => ItemHelper.FindChild<UserInput>(this, "L0MasteringRing");
|
||||
private UserInput? _L0MasteringSID => ItemHelper.FindChild<UserInput>(this, "L0MasteringSID");
|
||||
private UserInput? _L0Toolstamp => ItemHelper.FindChild<UserInput>(this, "L0Toolstamp");
|
||||
private UserInput? _L0MouldSID => ItemHelper.FindChild<UserInput>(this, "L0MouldSID");
|
||||
private UserInput? _L0AdditionalMould => ItemHelper.FindChild<UserInput>(this, "L0AdditionalMould");
|
||||
private GroupBox? _L1Info => ItemHelper.FindChild<GroupBox>(this, "L1Info");
|
||||
private UserInput? _L1MasteringRing => ItemHelper.FindChild<UserInput>(this, "L1MasteringRing");
|
||||
private UserInput? _L1MasteringSID => ItemHelper.FindChild<UserInput>(this, "L1MasteringSID");
|
||||
private UserInput? _L1Toolstamp => ItemHelper.FindChild<UserInput>(this, "L1Toolstamp");
|
||||
private UserInput? _L1MouldSID => ItemHelper.FindChild<UserInput>(this, "L1MouldSID");
|
||||
private UserInput? _L1AdditionalMould => ItemHelper.FindChild<UserInput>(this, "L1AdditionalMould");
|
||||
private GroupBox? _L2Info => ItemHelper.FindChild<GroupBox>(this, "L2Info");
|
||||
private UserInput? _L2MasteringRing => ItemHelper.FindChild<UserInput>(this, "L2MasteringRing");
|
||||
private UserInput? _L2MasteringSID => ItemHelper.FindChild<UserInput>(this, "L2MasteringSID");
|
||||
private UserInput? _L2Toolstamp => ItemHelper.FindChild<UserInput>(this, "L2Toolstamp");
|
||||
private GroupBox? _L3Info => ItemHelper.FindChild<GroupBox>(this, "L3Info");
|
||||
private UserInput? _L3MasteringRing => ItemHelper.FindChild<UserInput>(this, "L3MasteringRing");
|
||||
private UserInput? _L3MasteringSID => ItemHelper.FindChild<UserInput>(this, "L3MasteringSID");
|
||||
private UserInput? _L3Toolstamp => ItemHelper.FindChild<UserInput>(this, "L3Toolstamp");
|
||||
private GroupBox? L0Info => ItemHelper.FindChild<GroupBox>(this, "L0Info");
|
||||
private UserInput? L0MasteringRing => ItemHelper.FindChild<UserInput>(this, "L0MasteringRing");
|
||||
private UserInput? L0MasteringSID => ItemHelper.FindChild<UserInput>(this, "L0MasteringSID");
|
||||
private UserInput? L0Toolstamp => ItemHelper.FindChild<UserInput>(this, "L0Toolstamp");
|
||||
private UserInput? L0MouldSID => ItemHelper.FindChild<UserInput>(this, "L0MouldSID");
|
||||
private UserInput? L0AdditionalMould => ItemHelper.FindChild<UserInput>(this, "L0AdditionalMould");
|
||||
private GroupBox? L1Info => ItemHelper.FindChild<GroupBox>(this, "L1Info");
|
||||
private UserInput? L1MasteringRing => ItemHelper.FindChild<UserInput>(this, "L1MasteringRing");
|
||||
private UserInput? L1MasteringSID => ItemHelper.FindChild<UserInput>(this, "L1MasteringSID");
|
||||
private UserInput? L1Toolstamp => ItemHelper.FindChild<UserInput>(this, "L1Toolstamp");
|
||||
private UserInput? L1MouldSID => ItemHelper.FindChild<UserInput>(this, "L1MouldSID");
|
||||
private UserInput? L1AdditionalMould => ItemHelper.FindChild<UserInput>(this, "L1AdditionalMould");
|
||||
private GroupBox? L2Info => ItemHelper.FindChild<GroupBox>(this, "L2Info");
|
||||
private UserInput? L2MasteringRing => ItemHelper.FindChild<UserInput>(this, "L2MasteringRing");
|
||||
private UserInput? L2MasteringSID => ItemHelper.FindChild<UserInput>(this, "L2MasteringSID");
|
||||
private UserInput? L2Toolstamp => ItemHelper.FindChild<UserInput>(this, "L2Toolstamp");
|
||||
private GroupBox? L3Info => ItemHelper.FindChild<GroupBox>(this, "L3Info");
|
||||
private UserInput? L3MasteringRing => ItemHelper.FindChild<UserInput>(this, "L3MasteringRing");
|
||||
private UserInput? L3MasteringSID => ItemHelper.FindChild<UserInput>(this, "L3MasteringSID");
|
||||
private UserInput? L3Toolstamp => ItemHelper.FindChild<UserInput>(this, "L3Toolstamp");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Read-Only Info
|
||||
|
||||
private UserInput? _FullyMatchedID => ItemHelper.FindChild<UserInput>(this, "FullyMatchedID");
|
||||
private UserInput? _PartiallyMatchedIDs => ItemHelper.FindChild<UserInput>(this, "PartiallyMatchedIDs");
|
||||
private UserInput? _HashData => ItemHelper.FindChild<UserInput>(this, "HashData");
|
||||
private UserInput? _HashDataSize => ItemHelper.FindChild<UserInput>(this, "HashDataSize");
|
||||
private UserInput? _HashDataCRC => ItemHelper.FindChild<UserInput>(this, "HashDataCRC");
|
||||
private UserInput? _HashDataMD5 => ItemHelper.FindChild<UserInput>(this, "HashDataMD5");
|
||||
private UserInput? _HashDataSHA1 => ItemHelper.FindChild<UserInput>(this, "HashDataSHA1");
|
||||
private UserInput? _HashDataLayerbreak1 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak1");
|
||||
private UserInput? _HashDataLayerbreak2 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak2");
|
||||
private UserInput? _HashDataLayerbreak3 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak3");
|
||||
private UserInput? _AntiModchip => ItemHelper.FindChild<UserInput>(this, "AntiModchip");
|
||||
private UserInput? _DiscOffset => ItemHelper.FindChild<UserInput>(this, "DiscOffset");
|
||||
private UserInput? _DMIHash => ItemHelper.FindChild<UserInput>(this, "DMIHash");
|
||||
private UserInput? _EDC => ItemHelper.FindChild<UserInput>(this, "EDC");
|
||||
private UserInput? _ErrorsCount => ItemHelper.FindChild<UserInput>(this, "ErrorsCount");
|
||||
private UserInput? _EXEDateBuildDate => ItemHelper.FindChild<UserInput>(this, "EXEDateBuildDate");
|
||||
private UserInput? _Filename => ItemHelper.FindChild<UserInput>(this, "Filename");
|
||||
private UserInput? _Header => ItemHelper.FindChild<UserInput>(this, "Header");
|
||||
private UserInput? _InternalName => ItemHelper.FindChild<UserInput>(this, "InternalName");
|
||||
private UserInput? _InternalSerialName => ItemHelper.FindChild<UserInput>(this, "InternalSerialName");
|
||||
private UserInput? _Multisession => ItemHelper.FindChild<UserInput>(this, "Multisession");
|
||||
private UserInput? _LibCrypt => ItemHelper.FindChild<UserInput>(this, "LibCrypt");
|
||||
private UserInput? _LibCryptData => ItemHelper.FindChild<UserInput>(this, "LibCryptData");
|
||||
private UserInput? _PFIHash => ItemHelper.FindChild<UserInput>(this, "PFIHash");
|
||||
private UserInput? _PIC => ItemHelper.FindChild<UserInput>(this, "PIC");
|
||||
private UserInput? _PVD => ItemHelper.FindChild<UserInput>(this, "PVD");
|
||||
private UserInput? _RingNonZeroDataStart => ItemHelper.FindChild<UserInput>(this, "RingNonZeroDataStart");
|
||||
private UserInput? _SecuROMData => ItemHelper.FindChild<UserInput>(this, "SecuROMData");
|
||||
private UserInput? _SSHash => ItemHelper.FindChild<UserInput>(this, "SSHash");
|
||||
private UserInput? _SecuritySectorRanges => ItemHelper.FindChild<UserInput>(this, "SecuritySectorRanges");
|
||||
private UserInput? _SSVersion => ItemHelper.FindChild<UserInput>(this, "SSVersion");
|
||||
private UserInput? _UniversalHash => ItemHelper.FindChild<UserInput>(this, "UniversalHash");
|
||||
private UserInput? _VolumeLabel => ItemHelper.FindChild<UserInput>(this, "VolumeLabel");
|
||||
private UserInput? _XeMID => ItemHelper.FindChild<UserInput>(this, "XeMID");
|
||||
private UserInput? _XMID => ItemHelper.FindChild<UserInput>(this, "XMID");
|
||||
private UserInput? FullyMatchedID => ItemHelper.FindChild<UserInput>(this, "FullyMatchedID");
|
||||
private UserInput? PartiallyMatchedIDs => ItemHelper.FindChild<UserInput>(this, "PartiallyMatchedIDs");
|
||||
private UserInput? HashData => ItemHelper.FindChild<UserInput>(this, "HashData");
|
||||
private UserInput? HashDataSize => ItemHelper.FindChild<UserInput>(this, "HashDataSize");
|
||||
private UserInput? HashDataCRC => ItemHelper.FindChild<UserInput>(this, "HashDataCRC");
|
||||
private UserInput? HashDataMD5 => ItemHelper.FindChild<UserInput>(this, "HashDataMD5");
|
||||
private UserInput? HashDataSHA1 => ItemHelper.FindChild<UserInput>(this, "HashDataSHA1");
|
||||
private UserInput? HashDataLayerbreak1 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak1");
|
||||
private UserInput? HashDataLayerbreak2 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak2");
|
||||
private UserInput? HashDataLayerbreak3 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak3");
|
||||
private UserInput? AntiModchip => ItemHelper.FindChild<UserInput>(this, "AntiModchip");
|
||||
private UserInput? DiscOffset => ItemHelper.FindChild<UserInput>(this, "DiscOffset");
|
||||
private UserInput? DMIHash => ItemHelper.FindChild<UserInput>(this, "DMIHash");
|
||||
private UserInput? EDC => ItemHelper.FindChild<UserInput>(this, "EDC");
|
||||
private UserInput? ErrorsCount => ItemHelper.FindChild<UserInput>(this, "ErrorsCount");
|
||||
private UserInput? EXEDateBuildDate => ItemHelper.FindChild<UserInput>(this, "EXEDateBuildDate");
|
||||
private UserInput? Filename => ItemHelper.FindChild<UserInput>(this, "Filename");
|
||||
private UserInput? Header => ItemHelper.FindChild<UserInput>(this, "Header");
|
||||
private UserInput? InternalName => ItemHelper.FindChild<UserInput>(this, "InternalName");
|
||||
private UserInput? InternalSerialName => ItemHelper.FindChild<UserInput>(this, "InternalSerialName");
|
||||
private UserInput? Multisession => ItemHelper.FindChild<UserInput>(this, "Multisession");
|
||||
private UserInput? LibCrypt => ItemHelper.FindChild<UserInput>(this, "LibCrypt");
|
||||
private UserInput? LibCryptData => ItemHelper.FindChild<UserInput>(this, "LibCryptData");
|
||||
private UserInput? PFIHash => ItemHelper.FindChild<UserInput>(this, "PFIHash");
|
||||
private UserInput? PIC => ItemHelper.FindChild<UserInput>(this, "PIC");
|
||||
private UserInput? PVD => ItemHelper.FindChild<UserInput>(this, "PVD");
|
||||
private UserInput? RingNonZeroDataStart => ItemHelper.FindChild<UserInput>(this, "RingNonZeroDataStart");
|
||||
private UserInput? SecuROMData => ItemHelper.FindChild<UserInput>(this, "SecuROMData");
|
||||
private UserInput? SSHash => ItemHelper.FindChild<UserInput>(this, "SSHash");
|
||||
private UserInput? SecuritySectorRanges => ItemHelper.FindChild<UserInput>(this, "SecuritySectorRanges");
|
||||
private UserInput? SSVersion => ItemHelper.FindChild<UserInput>(this, "SSVersion");
|
||||
private UserInput? UniversalHash => ItemHelper.FindChild<UserInput>(this, "UniversalHash");
|
||||
private UserInput? VolumeLabel => ItemHelper.FindChild<UserInput>(this, "VolumeLabel");
|
||||
private UserInput? XeMID => ItemHelper.FindChild<UserInput>(this, "XeMID");
|
||||
private UserInput? XMID => ItemHelper.FindChild<UserInput>(this, "XMID");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accept / Cancel
|
||||
|
||||
private Button? _AcceptButton => ItemHelper.FindChild<Button>(this, "AcceptButton");
|
||||
private Button? _CancelButton => ItemHelper.FindChild<Button>(this, "CancelButton");
|
||||
private Button? _RingCodeGuideButton => ItemHelper.FindChild<Button>(this, "RingCodeGuideButton");
|
||||
private Button? AcceptButton => ItemHelper.FindChild<Button>(this, "AcceptButton");
|
||||
private Button? CancelButton => ItemHelper.FindChild<Button>(this, "CancelButton");
|
||||
private Button? RingCodeGuideButton => ItemHelper.FindChild<Button>(this, "RingCodeGuideButton");
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -156,15 +155,9 @@ namespace MPF.UI.Windows
|
||||
}
|
||||
|
||||
// Add handlers
|
||||
#if NET35
|
||||
_AcceptButton!.Click += OnAcceptClick;
|
||||
_CancelButton!.Click += OnCancelClick;
|
||||
_RingCodeGuideButton!.Click += OnRingCodeGuideClick;
|
||||
#else
|
||||
AcceptButton.Click += OnAcceptClick;
|
||||
CancelButton.Click += OnCancelClick;
|
||||
RingCodeGuideButton.Click += OnRingCodeGuideClick;
|
||||
#endif
|
||||
AcceptButton!.Click += OnAcceptClick;
|
||||
CancelButton!.Click += OnCancelClick;
|
||||
RingCodeGuideButton!.Click += OnRingCodeGuideClick;
|
||||
|
||||
// Update UI with new values
|
||||
ManipulateFields(options, submissionInfo);
|
||||
@@ -198,90 +191,44 @@ namespace MPF.UI.Windows
|
||||
private void EnableTabsInInputFields()
|
||||
{
|
||||
// Additional Information
|
||||
#if NET35
|
||||
_CommentsTextBox!.Tab = true;
|
||||
#else
|
||||
CommentsTextBox.Tab = true;
|
||||
#endif
|
||||
CommentsTextBox!.Tab = true;
|
||||
|
||||
// Contents
|
||||
#if NET35
|
||||
_GeneralContent!.Tab = true;
|
||||
_GamesTextBox!.Tab = true;
|
||||
_NetYarozeGamesTextBox!.Tab = true;
|
||||
_PlayableDemosTextBox!.Tab = true;
|
||||
_RollingDemosTextBox!.Tab = true;
|
||||
_TechDemosTextBox!.Tab = true;
|
||||
_GameFootageTextBox!.Tab = true;
|
||||
_VideosTextBox!.Tab = true;
|
||||
_PatchesTextBox!.Tab = true;
|
||||
_SavegamesTextBox!.Tab = true;
|
||||
_ExtrasTextBox!.Tab = true;
|
||||
#else
|
||||
GeneralContent.Tab = true;
|
||||
GamesTextBox.Tab = true;
|
||||
NetYarozeGamesTextBox.Tab = true;
|
||||
PlayableDemosTextBox.Tab = true;
|
||||
RollingDemosTextBox.Tab = true;
|
||||
TechDemosTextBox.Tab = true;
|
||||
GameFootageTextBox.Tab = true;
|
||||
VideosTextBox.Tab = true;
|
||||
PatchesTextBox.Tab = true;
|
||||
SavegamesTextBox.Tab = true;
|
||||
ExtrasTextBox.Tab = true;
|
||||
#endif
|
||||
GeneralContent!.Tab = true;
|
||||
GamesTextBox!.Tab = true;
|
||||
NetYarozeGamesTextBox!.Tab = true;
|
||||
PlayableDemosTextBox!.Tab = true;
|
||||
RollingDemosTextBox!.Tab = true;
|
||||
TechDemosTextBox!.Tab = true;
|
||||
GameFootageTextBox!.Tab = true;
|
||||
VideosTextBox!.Tab = true;
|
||||
PatchesTextBox!.Tab = true;
|
||||
SavegamesTextBox!.Tab = true;
|
||||
ExtrasTextBox!.Tab = true;
|
||||
|
||||
// L0
|
||||
#if NET35
|
||||
_L0MasteringRing!.Tab = true;
|
||||
_L0MasteringSID!.Tab = true;
|
||||
_L0Toolstamp!.Tab = true;
|
||||
_L0MouldSID!.Tab = true;
|
||||
_L0AdditionalMould!.Tab = true;
|
||||
#else
|
||||
L0MasteringRing.Tab = true;
|
||||
L0MasteringSID.Tab = true;
|
||||
L0Toolstamp.Tab = true;
|
||||
L0MouldSID.Tab = true;
|
||||
L0AdditionalMould.Tab = true;
|
||||
#endif
|
||||
L0MasteringRing!.Tab = true;
|
||||
L0MasteringSID!.Tab = true;
|
||||
L0Toolstamp!.Tab = true;
|
||||
L0MouldSID!.Tab = true;
|
||||
L0AdditionalMould!.Tab = true;
|
||||
|
||||
// L1
|
||||
#if NET35
|
||||
_L1MasteringRing!.Tab = true;
|
||||
_L1MasteringSID!.Tab = true;
|
||||
_L1Toolstamp!.Tab = true;
|
||||
_L1MouldSID!.Tab = true;
|
||||
_L1AdditionalMould!.Tab = true;
|
||||
#else
|
||||
L1MasteringRing.Tab = true;
|
||||
L1MasteringSID.Tab = true;
|
||||
L1Toolstamp.Tab = true;
|
||||
L1MouldSID.Tab = true;
|
||||
L1AdditionalMould.Tab = true;
|
||||
#endif
|
||||
L1MasteringRing!.Tab = true;
|
||||
L1MasteringSID!.Tab = true;
|
||||
L1Toolstamp!.Tab = true;
|
||||
L1MouldSID!.Tab = true;
|
||||
L1AdditionalMould!.Tab = true;
|
||||
|
||||
// L2
|
||||
#if NET35
|
||||
_L2MasteringRing!.Tab = true;
|
||||
_L2MasteringSID!.Tab = true;
|
||||
_L2Toolstamp!.Tab = true;
|
||||
#else
|
||||
L2MasteringRing.Tab = true;
|
||||
L2MasteringSID.Tab = true;
|
||||
L2Toolstamp.Tab = true;
|
||||
#endif
|
||||
L2MasteringRing!.Tab = true;
|
||||
L2MasteringSID!.Tab = true;
|
||||
L2Toolstamp!.Tab = true;
|
||||
|
||||
// L3
|
||||
#if NET35
|
||||
_L3MasteringRing!.Tab = true;
|
||||
_L3MasteringSID!.Tab = true;
|
||||
_L3Toolstamp!.Tab = true;
|
||||
#else
|
||||
L3MasteringRing.Tab = true;
|
||||
L3MasteringSID.Tab = true;
|
||||
L3Toolstamp.Tab = true;
|
||||
#endif
|
||||
L3MasteringRing!.Tab = true;
|
||||
L3MasteringSID!.Tab = true;
|
||||
L3Toolstamp!.Tab = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -295,89 +242,15 @@ namespace MPF.UI.Windows
|
||||
if (submissionInfo == null)
|
||||
return;
|
||||
|
||||
#if NET35
|
||||
if (submissionInfo.FullyMatchedID == null)
|
||||
_FullyMatchedID!.Visibility = Visibility.Collapsed;
|
||||
FullyMatchedID!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.PartiallyMatchedIDs == null)
|
||||
_PartiallyMatchedIDs!.Visibility = Visibility.Collapsed;
|
||||
PartiallyMatchedIDs!.Visibility = Visibility.Collapsed;
|
||||
else
|
||||
_PartiallyMatchedIDs!.Text = string.Join(", ", submissionInfo.PartiallyMatchedIDs.Select(i => i.ToString()).ToArray());
|
||||
if (string.IsNullOrEmpty(submissionInfo.TracksAndWriteOffsets?.ClrMameProData))
|
||||
_HashData!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.SizeAndChecksums?.Size == null || submissionInfo.SizeAndChecksums.Size == 0)
|
||||
_HashDataSize!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.CRC32))
|
||||
_HashDataCRC!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.MD5))
|
||||
_HashDataMD5!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.SHA1))
|
||||
_HashDataSHA1!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.SizeAndChecksums?.Layerbreak == null || submissionInfo.SizeAndChecksums.Layerbreak == 0)
|
||||
_HashDataLayerbreak1!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.SizeAndChecksums?.Layerbreak2 == null || submissionInfo.SizeAndChecksums.Layerbreak2 == 0)
|
||||
_HashDataLayerbreak2!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.SizeAndChecksums?.Layerbreak3 == null || submissionInfo.SizeAndChecksums.Layerbreak3 == 0)
|
||||
_HashDataLayerbreak3!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CopyProtection?.AntiModchip == null)
|
||||
_AntiModchip!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.TracksAndWriteOffsets?.OtherWriteOffsets == null)
|
||||
_DiscOffset!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys?.Contains(SiteCode.DMIHash) != true)
|
||||
_DMIHash!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.EDC?.EDC == null)
|
||||
_EDC!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CommonDiscInfo?.ErrorsCount))
|
||||
_ErrorsCount!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CommonDiscInfo?.EXEDateBuildDate))
|
||||
_EXEDateBuildDate!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.Filename) != true)
|
||||
_Filename!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.Header))
|
||||
_Header!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.InternalName) != true)
|
||||
_InternalName!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.InternalSerialName) != true)
|
||||
_InternalSerialName!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.Multisession) != true)
|
||||
_Multisession!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CopyProtection?.LibCrypt == null)
|
||||
_LibCrypt!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CopyProtection?.LibCryptData))
|
||||
_LibCryptData!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.PFIHash) != true)
|
||||
_PFIHash!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.PIC))
|
||||
_PIC!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.PVD))
|
||||
_PVD!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.RingNonZeroDataStart) != true)
|
||||
_RingNonZeroDataStart!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CopyProtection?.SecuROMData))
|
||||
_SecuROMData!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.SSHash) != true)
|
||||
_SSHash!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.SecuritySectorRanges))
|
||||
_SecuritySectorRanges!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.SSVersion) != true)
|
||||
_SSVersion!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.UniversalHash) != true)
|
||||
_UniversalHash!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.VolumeLabel) != true)
|
||||
_VolumeLabel!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.XeMID) != true)
|
||||
_XeMID!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.XMID) != true)
|
||||
_XMID!.Visibility = Visibility.Collapsed;
|
||||
#else
|
||||
if (submissionInfo.FullyMatchedID == null)
|
||||
FullyMatchedID.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.PartiallyMatchedIDs == null)
|
||||
PartiallyMatchedIDs.Visibility = Visibility.Collapsed;
|
||||
else
|
||||
PartiallyMatchedIDs.Text = string.Join(", ", submissionInfo.PartiallyMatchedIDs.Select(i => i.ToString()).ToArray());
|
||||
PartiallyMatchedIDs!.Text = string.Join(", ", [.. submissionInfo.PartiallyMatchedIDs.ConvertAll(i => i.ToString())]);
|
||||
if (string.IsNullOrEmpty(submissionInfo.TracksAndWriteOffsets?.ClrMameProData))
|
||||
HashData!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.SizeAndChecksums?.Size == null)
|
||||
if (submissionInfo.SizeAndChecksums?.Size == null || submissionInfo.SizeAndChecksums.Size == 0)
|
||||
HashDataSize!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.CRC32))
|
||||
HashDataCRC!.Visibility = Visibility.Collapsed;
|
||||
@@ -392,56 +265,55 @@ namespace MPF.UI.Windows
|
||||
if (submissionInfo.SizeAndChecksums?.Layerbreak3 == null || submissionInfo.SizeAndChecksums.Layerbreak3 == 0)
|
||||
HashDataLayerbreak3!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CopyProtection?.AntiModchip == null)
|
||||
AntiModchip.Visibility = Visibility.Collapsed;
|
||||
AntiModchip!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.TracksAndWriteOffsets?.OtherWriteOffsets == null)
|
||||
DiscOffset.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys?.Contains(SiteCode.DMIHash) != true)
|
||||
DMIHash.Visibility = Visibility.Collapsed;
|
||||
DiscOffset!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.DMIHash) != true)
|
||||
DMIHash!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.EDC?.EDC == null)
|
||||
EDC.Visibility = Visibility.Collapsed;
|
||||
EDC!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CommonDiscInfo?.ErrorsCount))
|
||||
ErrorsCount.Visibility = Visibility.Collapsed;
|
||||
ErrorsCount!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CommonDiscInfo?.EXEDateBuildDate))
|
||||
EXEDateBuildDate.Visibility = Visibility.Collapsed;
|
||||
EXEDateBuildDate!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.Filename) != true)
|
||||
Filename.Visibility = Visibility.Collapsed;
|
||||
Filename!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.Header))
|
||||
Header.Visibility = Visibility.Collapsed;
|
||||
Header!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.InternalName) != true)
|
||||
InternalName.Visibility = Visibility.Collapsed;
|
||||
InternalName!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.InternalSerialName) != true)
|
||||
InternalSerialName.Visibility = Visibility.Collapsed;
|
||||
InternalSerialName!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.Multisession) != true)
|
||||
Multisession.Visibility = Visibility.Collapsed;
|
||||
Multisession!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CopyProtection?.LibCrypt == null)
|
||||
LibCrypt.Visibility = Visibility.Collapsed;
|
||||
LibCrypt!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CopyProtection?.LibCryptData))
|
||||
LibCryptData.Visibility = Visibility.Collapsed;
|
||||
LibCryptData!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.PFIHash) != true)
|
||||
PFIHash.Visibility = Visibility.Collapsed;
|
||||
PFIHash!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.PIC))
|
||||
PIC.Visibility = Visibility.Collapsed;
|
||||
PIC!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.PVD))
|
||||
PVD.Visibility = Visibility.Collapsed;
|
||||
PVD!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.RingNonZeroDataStart) != true)
|
||||
RingNonZeroDataStart.Visibility = Visibility.Collapsed;
|
||||
RingNonZeroDataStart!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.CopyProtection?.SecuROMData))
|
||||
SecuROMData.Visibility = Visibility.Collapsed;
|
||||
SecuROMData!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.SSHash) != true)
|
||||
SSHash.Visibility = Visibility.Collapsed;
|
||||
SSHash!.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(submissionInfo.Extras?.SecuritySectorRanges))
|
||||
SecuritySectorRanges.Visibility = Visibility.Collapsed;
|
||||
SecuritySectorRanges!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.SSVersion) != true)
|
||||
SSVersion.Visibility = Visibility.Collapsed;
|
||||
SSVersion!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.UniversalHash) != true)
|
||||
UniversalHash.Visibility = Visibility.Collapsed;
|
||||
UniversalHash!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.VolumeLabel) != true)
|
||||
VolumeLabel.Visibility = Visibility.Collapsed;
|
||||
VolumeLabel!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.XeMID) != true)
|
||||
XeMID.Visibility = Visibility.Collapsed;
|
||||
XeMID!.Visibility = Visibility.Collapsed;
|
||||
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.XMID) != true)
|
||||
XMID.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
XMID!.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -458,37 +330,19 @@ namespace MPF.UI.Windows
|
||||
{
|
||||
case DiscType.CD:
|
||||
case DiscType.GDROM:
|
||||
#if NET35
|
||||
_L0Info!.Header = "Data Side";
|
||||
_L0MasteringRing!.Label = "Mastering Ring";
|
||||
_L0MasteringSID!.Label = "Mastering SID";
|
||||
_L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L0MouldSID!.Label = "Mould SID";
|
||||
_L0AdditionalMould!.Label = "Additional Mould";
|
||||
#else
|
||||
L0Info.Header = "Data Side";
|
||||
L0MasteringRing.Label = "Mastering Ring";
|
||||
L0MasteringSID.Label = "Mastering SID";
|
||||
L0Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID.Label = "Mould SID";
|
||||
L0AdditionalMould.Label = "Additional Mould";
|
||||
#endif
|
||||
L0Info!.Header = "Data Side";
|
||||
L0MasteringRing!.Label = "Mastering Ring";
|
||||
L0MasteringSID!.Label = "Mastering SID";
|
||||
L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID!.Label = "Mould SID";
|
||||
L0AdditionalMould!.Label = "Additional Mould";
|
||||
|
||||
#if NET35
|
||||
_L1Info!.Header = "Label Side";
|
||||
_L1MasteringRing!.Label = "Mastering Ring";
|
||||
_L1MasteringSID!.Label = "Mastering SID";
|
||||
_L1Toolstamp!.Label = "Mastering SID";
|
||||
_L1MouldSID!.Label = "Mould SID";
|
||||
_L1AdditionalMould!.Label = "Additional Mould";
|
||||
#else
|
||||
L1Info.Header = "Label Side";
|
||||
L1MasteringRing.Label = "Mastering Ring";
|
||||
L1MasteringSID.Label = "Mastering SID";
|
||||
L1Toolstamp.Label = "Mastering SID";
|
||||
L1MouldSID.Label = "Mould SID";
|
||||
L1AdditionalMould.Label = "Additional Mould";
|
||||
#endif
|
||||
L1Info!.Header = "Label Side";
|
||||
L1MasteringRing!.Label = "Mastering Ring";
|
||||
L1MasteringSID!.Label = "Mastering SID";
|
||||
L1Toolstamp!.Label = "Mastering SID";
|
||||
L1MouldSID!.Label = "Mould SID";
|
||||
L1AdditionalMould!.Label = "Additional Mould";
|
||||
break;
|
||||
|
||||
case DiscType.DVD5:
|
||||
@@ -510,212 +364,103 @@ namespace MPF.UI.Windows
|
||||
// Quad-layer discs
|
||||
if (submissionInfo?.SizeAndChecksums?.Layerbreak3 != default(long))
|
||||
{
|
||||
#if NET35
|
||||
_L2Info!.Visibility = Visibility.Visible;
|
||||
_L3Info!.Visibility = Visibility.Visible;
|
||||
#else
|
||||
L2Info.Visibility = Visibility.Visible;
|
||||
L3Info.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
L2Info!.Visibility = Visibility.Visible;
|
||||
L3Info!.Visibility = Visibility.Visible;
|
||||
|
||||
#if NET35
|
||||
_L0Info!.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
_L0MasteringRing!.Label = "Mastering Ring";
|
||||
_L0MasteringSID!.Label = "Mastering SID";
|
||||
_L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L0MouldSID!.Label = "Data Side Mould SID";
|
||||
_L0AdditionalMould!.Label = "Data Side Additional Mould";
|
||||
#else
|
||||
L0Info.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
L0MasteringRing.Label = "Mastering Ring";
|
||||
L0MasteringSID.Label = "Mastering SID";
|
||||
L0Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID.Label = "Data Side Mould SID";
|
||||
L0AdditionalMould.Label = "Data Side Additional Mould";
|
||||
#endif
|
||||
L0Info!.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
L0MasteringRing!.Label = "Mastering Ring";
|
||||
L0MasteringSID!.Label = "Mastering SID";
|
||||
L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID!.Label = "Data Side Mould SID";
|
||||
L0AdditionalMould!.Label = "Data Side Additional Mould";
|
||||
|
||||
#if NET35
|
||||
_L1Info!.Header = "Layer 1";
|
||||
_L1MasteringRing!.Label = "Mastering Ring";
|
||||
_L1MasteringSID!.Label = "Mastering SID";
|
||||
_L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L1MouldSID!.Label = "Label Side Mould SID";
|
||||
_L1AdditionalMould!.Label = "Label Side Additional Mould";
|
||||
#else
|
||||
L1Info.Header = "Layer 1";
|
||||
L1MasteringRing.Label = "Mastering Ring";
|
||||
L1MasteringSID.Label = "Mastering SID";
|
||||
L1Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID.Label = "Label Side Mould SID";
|
||||
L1AdditionalMould.Label = "Label Side Additional Mould";
|
||||
#endif
|
||||
L1Info!.Header = "Layer 1";
|
||||
L1MasteringRing!.Label = "Mastering Ring";
|
||||
L1MasteringSID!.Label = "Mastering SID";
|
||||
L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID!.Label = "Label Side Mould SID";
|
||||
L1AdditionalMould!.Label = "Label Side Additional Mould";
|
||||
|
||||
#if NET35
|
||||
_L2Info!.Header = "Layer 2";
|
||||
_L2MasteringRing!.Label = "Mastering Ring";
|
||||
_L2MasteringSID!.Label = "Mastering SID";
|
||||
_L2Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
#else
|
||||
L2Info.Header = "Layer 2";
|
||||
L2MasteringRing.Label = "Mastering Ring";
|
||||
L2MasteringSID.Label = "Mastering SID";
|
||||
L2Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
#endif
|
||||
L2Info!.Header = "Layer 2";
|
||||
L2MasteringRing!.Label = "Mastering Ring";
|
||||
L2MasteringSID!.Label = "Mastering SID";
|
||||
L2Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
|
||||
#if NET35
|
||||
_L3Info!.Header = reverseOrder ? "Layer 3 (Inner)" : "Layer 3 (Outer)";
|
||||
_L3MasteringRing!.Label = "Mastering Ring";
|
||||
_L3MasteringSID!.Label = "Mastering SID";
|
||||
_L3Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
#else
|
||||
L3Info.Header = reverseOrder ? "Layer 3 (Inner)" : "Layer 3 (Outer)";
|
||||
L3MasteringRing.Label = "Mastering Ring";
|
||||
L3MasteringSID.Label = "Mastering SID";
|
||||
L3Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
#endif
|
||||
L3Info!.Header = reverseOrder ? "Layer 3 (Inner)" : "Layer 3 (Outer)";
|
||||
L3MasteringRing!.Label = "Mastering Ring";
|
||||
L3MasteringSID!.Label = "Mastering SID";
|
||||
L3Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
}
|
||||
|
||||
// Triple-layer discs
|
||||
else if (submissionInfo?.SizeAndChecksums?.Layerbreak2 != default(long))
|
||||
{
|
||||
#if NET35
|
||||
_L2Info!.Visibility = Visibility.Visible;
|
||||
#else
|
||||
L2Info.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
L2Info!.Visibility = Visibility.Visible;
|
||||
|
||||
#if NET35
|
||||
_L0Info!.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
_L0MasteringRing!.Label = "Mastering Ring";
|
||||
_L0MasteringSID!.Label = "Mastering SID";
|
||||
_L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L0MouldSID!.Label = "Data Side Mould SID";
|
||||
_L0AdditionalMould!.Label = "Data Side Additional Mould";
|
||||
#else
|
||||
L0Info.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
L0MasteringRing.Label = "Mastering Ring";
|
||||
L0MasteringSID.Label = "Mastering SID";
|
||||
L0Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID.Label = "Data Side Mould SID";
|
||||
L0AdditionalMould.Label = "Data Side Additional Mould";
|
||||
#endif
|
||||
L0Info!.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
L0MasteringRing!.Label = "Mastering Ring";
|
||||
L0MasteringSID!.Label = "Mastering SID";
|
||||
L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID!.Label = "Data Side Mould SID";
|
||||
L0AdditionalMould!.Label = "Data Side Additional Mould";
|
||||
|
||||
#if NET35
|
||||
_L1Info!.Header = "Layer 1";
|
||||
_L1MasteringRing!.Label = "Mastering Ring";
|
||||
_L1MasteringSID!.Label = "Mastering SID";
|
||||
_L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L1MouldSID!.Label = "Label Side Mould SID";
|
||||
_L1AdditionalMould!.Label = "Label Side Additional Mould";
|
||||
#else
|
||||
L1Info.Header = "Layer 1";
|
||||
L1MasteringRing.Label = "Mastering Ring";
|
||||
L1MasteringSID.Label = "Mastering SID";
|
||||
L1Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID.Label = "Label Side Mould SID";
|
||||
L1AdditionalMould.Label = "Label Side Additional Mould";
|
||||
#endif
|
||||
L1Info!.Header = "Layer 1";
|
||||
L1MasteringRing!.Label = "Mastering Ring";
|
||||
L1MasteringSID!.Label = "Mastering SID";
|
||||
L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID!.Label = "Label Side Mould SID";
|
||||
L1AdditionalMould!.Label = "Label Side Additional Mould";
|
||||
|
||||
#if NET35
|
||||
_L2Info!.Header = reverseOrder ? "Layer 2 (Inner)" : "Layer 2 (Outer)";
|
||||
_L2MasteringRing!.Label = "Mastering Ring";
|
||||
_L2MasteringSID!.Label = "Mastering SID";
|
||||
_L2Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
#else
|
||||
L2Info.Header = reverseOrder ? "Layer 2 (Inner)" : "Layer 2 (Outer)";
|
||||
L2MasteringRing.Label = "Mastering Ring";
|
||||
L2MasteringSID.Label = "Mastering SID";
|
||||
L2Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
#endif
|
||||
L2Info!.Header = reverseOrder ? "Layer 2 (Inner)" : "Layer 2 (Outer)";
|
||||
L2MasteringRing!.Label = "Mastering Ring";
|
||||
L2MasteringSID!.Label = "Mastering SID";
|
||||
L2Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
}
|
||||
|
||||
// Double-layer discs
|
||||
else if (submissionInfo?.SizeAndChecksums?.Layerbreak != default(long))
|
||||
{
|
||||
#if NET35
|
||||
_L0Info!.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
_L0MasteringRing!.Label = "Mastering Ring";
|
||||
_L0MasteringSID!.Label = "Mastering SID";
|
||||
_L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L0MouldSID!.Label = "Data Side Mould SID";
|
||||
_L0AdditionalMould!.Label = "Data Side Additional Mould";
|
||||
#else
|
||||
L0Info.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
L0MasteringRing.Label = "Mastering Ring";
|
||||
L0MasteringSID.Label = "Mastering SID";
|
||||
L0Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID.Label = "Data Side Mould SID";
|
||||
L0AdditionalMould.Label = "Data Side Additional Mould";
|
||||
#endif
|
||||
L0Info!.Header = reverseOrder ? "Layer 0 (Outer)" : "Layer 0 (Inner)";
|
||||
L0MasteringRing!.Label = "Mastering Ring";
|
||||
L0MasteringSID!.Label = "Mastering SID";
|
||||
L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID!.Label = "Data Side Mould SID";
|
||||
L0AdditionalMould!.Label = "Data Side Additional Mould";
|
||||
|
||||
#if NET35
|
||||
_L1Info!.Header = reverseOrder ? "Layer 1 (Inner)" : "Layer 1 (Outer)";
|
||||
_L1MasteringRing!.Label = "Mastering Ring";
|
||||
_L1MasteringSID!.Label = "Mastering SID";
|
||||
_L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L1MouldSID!.Label = "Label Side Mould SID";
|
||||
_L1AdditionalMould!.Label = "Label Side Additional Mould";
|
||||
#else
|
||||
L1Info.Header = reverseOrder ? "Layer 1 (Inner)" : "Layer 1 (Outer)";
|
||||
L1MasteringRing.Label = "Mastering Ring";
|
||||
L1MasteringSID.Label = "Mastering SID";
|
||||
L1Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID.Label = "Label Side Mould SID";
|
||||
L1AdditionalMould.Label = "Label Side Additional Mould";
|
||||
#endif
|
||||
L1Info!.Header = reverseOrder ? "Layer 1 (Inner)" : "Layer 1 (Outer)";
|
||||
L1MasteringRing!.Label = "Mastering Ring";
|
||||
L1MasteringSID!.Label = "Mastering SID";
|
||||
L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID!.Label = "Label Side Mould SID";
|
||||
L1AdditionalMould!.Label = "Label Side Additional Mould";
|
||||
}
|
||||
|
||||
// Single-layer discs
|
||||
else
|
||||
{
|
||||
#if NET35
|
||||
_L0Info!.Header = "Data Side";
|
||||
_L0MasteringRing!.Label = "Mastering Ring";
|
||||
_L0MasteringSID!.Label = "Mastering SID";
|
||||
_L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L0MouldSID!.Label = "Mould SID";
|
||||
_L0AdditionalMould!.Label = "Additional Mould";
|
||||
#else
|
||||
L0Info.Header = "Data Side";
|
||||
L0MasteringRing.Label = "Mastering Ring";
|
||||
L0MasteringSID.Label = "Mastering SID";
|
||||
L0Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID.Label = "Mould SID";
|
||||
L0AdditionalMould.Label = "Additional Mould";
|
||||
#endif
|
||||
L0Info!.Header = "Data Side";
|
||||
L0MasteringRing!.Label = "Mastering Ring";
|
||||
L0MasteringSID!.Label = "Mastering SID";
|
||||
L0Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L0MouldSID!.Label = "Mould SID";
|
||||
L0AdditionalMould!.Label = "Additional Mould";
|
||||
|
||||
#if NET35
|
||||
_L1Info!.Header = "Label Side";
|
||||
_L1MasteringRing!.Label = "Mastering Ring";
|
||||
_L1MasteringSID!.Label = "Mastering SID";
|
||||
_L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
_L1MouldSID!.Label = "Mould SID";
|
||||
_L1AdditionalMould!.Label = "Additional Mould";
|
||||
#else
|
||||
L1Info.Header = "Label Side";
|
||||
L1MasteringRing.Label = "Mastering Ring";
|
||||
L1MasteringSID.Label = "Mastering SID";
|
||||
L1Toolstamp.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID.Label = "Mould SID";
|
||||
L1AdditionalMould.Label = "Additional Mould";
|
||||
#endif
|
||||
L1Info!.Header = "Label Side";
|
||||
L1MasteringRing!.Label = "Mastering Ring";
|
||||
L1MasteringSID!.Label = "Mastering SID";
|
||||
L1Toolstamp!.Label = "Toolstamp/Mastering Code";
|
||||
L1MouldSID!.Label = "Mould SID";
|
||||
L1AdditionalMould!.Label = "Additional Mould";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// All other media we assume to have no rings
|
||||
default:
|
||||
#if NET35
|
||||
_L0Info!.Visibility = Visibility.Collapsed;
|
||||
_L1Info!.Visibility = Visibility.Collapsed;
|
||||
_L2Info!.Visibility = Visibility.Collapsed;
|
||||
_L3Info!.Visibility = Visibility.Collapsed;
|
||||
#else
|
||||
L0Info.Visibility = Visibility.Collapsed;
|
||||
L1Info.Visibility = Visibility.Collapsed;
|
||||
L2Info.Visibility = Visibility.Collapsed;
|
||||
L3Info.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
L0Info!.Visibility = Visibility.Collapsed;
|
||||
L1Info!.Visibility = Visibility.Collapsed;
|
||||
L2Info!.Visibility = Visibility.Collapsed;
|
||||
L3Info!.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -730,29 +475,16 @@ namespace MPF.UI.Windows
|
||||
switch (system)
|
||||
{
|
||||
case RedumpSystem.NintendoWiiU:
|
||||
#if NET35
|
||||
_DiscKeyTextBox!.Visibility = Visibility.Visible;
|
||||
#else
|
||||
DiscKeyTextBox.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
DiscKeyTextBox!.Visibility = Visibility.Visible;
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation2:
|
||||
#if NET35
|
||||
_LanguageSelectionGrid!.Visibility = Visibility.Visible;
|
||||
#else
|
||||
LanguageSelectionGrid.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
LanguageSelectionGrid!.Visibility = Visibility.Visible;
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation3:
|
||||
#if NET35
|
||||
_DiscKeyTextBox!.Visibility = Visibility.Visible;
|
||||
_DiscIDTextBox!.Visibility = Visibility.Visible;
|
||||
#else
|
||||
DiscKeyTextBox.Visibility = Visibility.Visible;
|
||||
DiscIDTextBox.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
DiscKeyTextBox!.Visibility = Visibility.Visible;
|
||||
DiscIDTextBox!.Visibility = Visibility.Visible;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
#if NET40
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using MPF.Frontend.ViewModels;
|
||||
@@ -25,41 +28,41 @@ namespace MPF.UI.Windows
|
||||
|
||||
#region Top Menu Bar
|
||||
|
||||
private MenuItem? _AboutMenuItem => ItemHelper.FindChild<MenuItem>(this, "AboutMenuItem");
|
||||
private MenuItem? _AppExitMenuItem => ItemHelper.FindChild<MenuItem>(this, "AppExitMenuItem");
|
||||
private MenuItem? _CheckForUpdatesMenuItem => ItemHelper.FindChild<MenuItem>(this, "CheckForUpdatesMenuItem");
|
||||
private MenuItem? _DebugViewMenuItem => ItemHelper.FindChild<MenuItem>(this, "DebugViewMenuItem");
|
||||
private MenuItem? _CheckDumpMenuItem => ItemHelper.FindChild<MenuItem>(this, "CheckDumpMenuItem");
|
||||
private MenuItem? _CreateIRDMenuItem => ItemHelper.FindChild<MenuItem>(this, "CreateIRDMenuItem");
|
||||
private MenuItem? _OptionsMenuItem => ItemHelper.FindChild<MenuItem>(this, "OptionsMenuItem");
|
||||
private MenuItem? AboutMenuItem => ItemHelper.FindChild<MenuItem>(this, "AboutMenuItem");
|
||||
private MenuItem? AppExitMenuItem => ItemHelper.FindChild<MenuItem>(this, "AppExitMenuItem");
|
||||
private MenuItem? CheckForUpdatesMenuItem => ItemHelper.FindChild<MenuItem>(this, "CheckForUpdatesMenuItem");
|
||||
private MenuItem? DebugViewMenuItem => ItemHelper.FindChild<MenuItem>(this, "DebugViewMenuItem");
|
||||
private MenuItem? CheckDumpMenuItem => ItemHelper.FindChild<MenuItem>(this, "CheckDumpMenuItem");
|
||||
private MenuItem? CreateIRDMenuItem => ItemHelper.FindChild<MenuItem>(this, "CreateIRDMenuItem");
|
||||
private MenuItem? OptionsMenuItem => ItemHelper.FindChild<MenuItem>(this, "OptionsMenuItem");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
|
||||
private ComboBox? _DriveLetterComboBox => ItemHelper.FindChild<ComboBox>(this, "DriveLetterComboBox");
|
||||
private ComboBox? _DriveSpeedComboBox => ItemHelper.FindChild<ComboBox>(this, "DriveSpeedComboBox");
|
||||
private ComboBox? _DumpingProgramComboBox => ItemHelper.FindChild<ComboBox>(this, "DumpingProgramComboBox");
|
||||
private CheckBox? _EnableParametersCheckBox => ItemHelper.FindChild<CheckBox>(this, "EnableParametersCheckBox");
|
||||
private ComboBox? _MediaTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "MediaTypeComboBox");
|
||||
private Button? _OutputPathBrowseButton => ItemHelper.FindChild<Button>(this, "OutputPathBrowseButton");
|
||||
private TextBox? _OutputPathTextBox => ItemHelper.FindChild<TextBox>(this, "OutputPathTextBox");
|
||||
private ComboBox? _SystemTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "SystemTypeComboBox");
|
||||
private ComboBox? DriveLetterComboBox => ItemHelper.FindChild<ComboBox>(this, "DriveLetterComboBox");
|
||||
private ComboBox? DriveSpeedComboBox => ItemHelper.FindChild<ComboBox>(this, "DriveSpeedComboBox");
|
||||
private ComboBox? DumpingProgramComboBox => ItemHelper.FindChild<ComboBox>(this, "DumpingProgramComboBox");
|
||||
private CheckBox? EnableParametersCheckBox => ItemHelper.FindChild<CheckBox>(this, "EnableParametersCheckBox");
|
||||
private ComboBox? MediaTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "MediaTypeComboBox");
|
||||
private Button? OutputPathBrowseButton => ItemHelper.FindChild<Button>(this, "OutputPathBrowseButton");
|
||||
private TextBox? OutputPathTextBox => ItemHelper.FindChild<TextBox>(this, "OutputPathTextBox");
|
||||
private ComboBox? SystemTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "SystemTypeComboBox");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Controls
|
||||
|
||||
private Button? _CopyProtectScanButton => ItemHelper.FindChild<Button>(this, "CopyProtectScanButton");
|
||||
private Button? _MediaScanButton => ItemHelper.FindChild<Button>(this, "MediaScanButton");
|
||||
private Button? _StartStopButton => ItemHelper.FindChild<Button>(this, "StartStopButton");
|
||||
private Button? _UpdateVolumeLabel => ItemHelper.FindChild<Button>(this, "UpdateVolumeLabel");
|
||||
private Button? CopyProtectScanButton => ItemHelper.FindChild<Button>(this, "CopyProtectScanButton");
|
||||
private Button? MediaScanButton => ItemHelper.FindChild<Button>(this, "MediaScanButton");
|
||||
private Button? StartStopButton => ItemHelper.FindChild<Button>(this, "StartStopButton");
|
||||
private Button? UpdateVolumeLabel => ItemHelper.FindChild<Button>(this, "UpdateVolumeLabel");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Status
|
||||
|
||||
private LogOutput? _LogOutput => ItemHelper.FindChild<LogOutput>(this, "LogOutput");
|
||||
private LogOutput? LogOutput => ItemHelper.FindChild<LogOutput>(this, "LogOutput");
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -102,17 +105,9 @@ namespace MPF.UI.Windows
|
||||
|
||||
// Display the debug option in the menu, if necessary
|
||||
if (MainViewModel.Options.ShowDebugViewMenuItem)
|
||||
#if NET35
|
||||
_DebugViewMenuItem!.Visibility = Visibility.Visible;
|
||||
#else
|
||||
DebugViewMenuItem.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
DebugViewMenuItem!.Visibility = Visibility.Visible;
|
||||
|
||||
#if NET35
|
||||
MainViewModel.Init(_LogOutput!.EnqueueLog, DisplayUserMessage, ShowDiscInformationWindow);
|
||||
#else
|
||||
MainViewModel.Init(LogOutput.EnqueueLog, DisplayUserMessage, ShowDiscInformationWindow);
|
||||
#endif
|
||||
MainViewModel.Init(LogOutput!.EnqueueLog, DisplayUserMessage, ShowDiscInformationWindow);
|
||||
|
||||
// Set the UI color scheme according to the options
|
||||
ApplyTheme();
|
||||
@@ -137,62 +132,31 @@ namespace MPF.UI.Windows
|
||||
public void AddEventHandlers()
|
||||
{
|
||||
// Menu Bar Click
|
||||
#if NET35
|
||||
_AboutMenuItem!.Click += AboutClick;
|
||||
_AppExitMenuItem!.Click += AppExitClick;
|
||||
_CheckForUpdatesMenuItem!.Click += CheckForUpdatesClick;
|
||||
_DebugViewMenuItem!.Click += DebugViewClick;
|
||||
_CheckDumpMenuItem!.Click += CheckDumpMenuItemClick;
|
||||
_CreateIRDMenuItem!.Click += CreateIRDMenuItemClick;
|
||||
_OptionsMenuItem!.Click += OptionsMenuItemClick;
|
||||
#else
|
||||
AboutMenuItem.Click += AboutClick;
|
||||
AppExitMenuItem.Click += AppExitClick;
|
||||
CheckForUpdatesMenuItem.Click += CheckForUpdatesClick;
|
||||
DebugViewMenuItem.Click += DebugViewClick;
|
||||
CheckDumpMenuItem.Click += CheckDumpMenuItemClick;
|
||||
CreateIRDMenuItem.Click += CreateIRDMenuItemClick;
|
||||
OptionsMenuItem.Click += OptionsMenuItemClick;
|
||||
#endif
|
||||
AboutMenuItem!.Click += AboutClick;
|
||||
AppExitMenuItem!.Click += AppExitClick;
|
||||
CheckForUpdatesMenuItem!.Click += CheckForUpdatesClick;
|
||||
DebugViewMenuItem!.Click += DebugViewClick;
|
||||
CheckDumpMenuItem!.Click += CheckDumpMenuItemClick;
|
||||
CreateIRDMenuItem!.Click += CreateIRDMenuItemClick;
|
||||
OptionsMenuItem!.Click += OptionsMenuItemClick;
|
||||
|
||||
// User Area Click
|
||||
#if NET35
|
||||
_CopyProtectScanButton!.Click += CopyProtectScanButtonClick;
|
||||
_EnableParametersCheckBox!.Click += EnableParametersCheckBoxClick;
|
||||
_MediaScanButton!.Click += MediaScanButtonClick;
|
||||
_UpdateVolumeLabel!.Click += UpdateVolumeLabelClick;
|
||||
_OutputPathBrowseButton!.Click += OutputPathBrowseButtonClick;
|
||||
_StartStopButton!.Click += StartStopButtonClick;
|
||||
#else
|
||||
CopyProtectScanButton.Click += CopyProtectScanButtonClick;
|
||||
EnableParametersCheckBox.Click += EnableParametersCheckBoxClick;
|
||||
MediaScanButton.Click += MediaScanButtonClick;
|
||||
UpdateVolumeLabel.Click += UpdateVolumeLabelClick;
|
||||
OutputPathBrowseButton.Click += OutputPathBrowseButtonClick;
|
||||
StartStopButton.Click += StartStopButtonClick;
|
||||
#endif
|
||||
CopyProtectScanButton!.Click += CopyProtectScanButtonClick;
|
||||
EnableParametersCheckBox!.Click += EnableParametersCheckBoxClick;
|
||||
MediaScanButton!.Click += MediaScanButtonClick;
|
||||
UpdateVolumeLabel!.Click += UpdateVolumeLabelClick;
|
||||
OutputPathBrowseButton!.Click += OutputPathBrowseButtonClick;
|
||||
StartStopButton!.Click += StartStopButtonClick;
|
||||
|
||||
// User Area SelectionChanged
|
||||
#if NET35
|
||||
_SystemTypeComboBox!.SelectionChanged += SystemTypeComboBoxSelectionChanged;
|
||||
_MediaTypeComboBox!.SelectionChanged += MediaTypeComboBoxSelectionChanged;
|
||||
_DriveLetterComboBox!.SelectionChanged += DriveLetterComboBoxSelectionChanged;
|
||||
_DriveSpeedComboBox!.SelectionChanged += DriveSpeedComboBoxSelectionChanged;
|
||||
_DumpingProgramComboBox!.SelectionChanged += DumpingProgramComboBoxSelectionChanged;
|
||||
#else
|
||||
SystemTypeComboBox.SelectionChanged += SystemTypeComboBoxSelectionChanged;
|
||||
MediaTypeComboBox.SelectionChanged += MediaTypeComboBoxSelectionChanged;
|
||||
DriveLetterComboBox.SelectionChanged += DriveLetterComboBoxSelectionChanged;
|
||||
DriveSpeedComboBox.SelectionChanged += DriveSpeedComboBoxSelectionChanged;
|
||||
DumpingProgramComboBox.SelectionChanged += DumpingProgramComboBoxSelectionChanged;
|
||||
#endif
|
||||
SystemTypeComboBox!.SelectionChanged += SystemTypeComboBoxSelectionChanged;
|
||||
MediaTypeComboBox!.SelectionChanged += MediaTypeComboBoxSelectionChanged;
|
||||
DriveLetterComboBox!.SelectionChanged += DriveLetterComboBoxSelectionChanged;
|
||||
DriveSpeedComboBox!.SelectionChanged += DriveSpeedComboBoxSelectionChanged;
|
||||
DumpingProgramComboBox!.SelectionChanged += DumpingProgramComboBoxSelectionChanged;
|
||||
|
||||
// User Area TextChanged
|
||||
#if NET35
|
||||
_OutputPathTextBox!.TextChanged += OutputPathTextBoxTextChanged;
|
||||
#else
|
||||
OutputPathTextBox.TextChanged += OutputPathTextBoxTextChanged;
|
||||
#endif
|
||||
OutputPathTextBox!.TextChanged += OutputPathTextBoxTextChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -237,7 +201,7 @@ namespace MPF.UI.Windows
|
||||
/// <param name="showIfSame">True to show the box even if it's the same, false to only show if it's different</param>
|
||||
public void CheckForUpdates(bool showIfSame)
|
||||
{
|
||||
(bool different, string message, var url) = MainViewModel.CheckForUpdates();
|
||||
MainViewModel.CheckForUpdates(out bool different, out string message, out var url);
|
||||
|
||||
// If we have a new version, put it in the clipboard
|
||||
if (different && !string.IsNullOrEmpty(url))
|
||||
@@ -287,8 +251,8 @@ namespace MPF.UI.Windows
|
||||
public void ShowDebugDiscInfoWindow()
|
||||
{
|
||||
var submissionInfo = MainViewModel.CreateDebugSubmissionInfo();
|
||||
var result = ShowDiscInformationWindow(submissionInfo);
|
||||
Formatter.ProcessSpecialFields(result.Item2);
|
||||
_ = ShowDiscInformationWindow(ref submissionInfo);
|
||||
Formatter.ProcessSpecialFields(submissionInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -296,7 +260,7 @@ namespace MPF.UI.Windows
|
||||
/// </summary>
|
||||
/// <param name="submissionInfo">SubmissionInfo object to display and possibly change</param>
|
||||
/// <returns>Dialog open result</returns>
|
||||
public (bool?, SubmissionInfo?) ShowDiscInformationWindow(SubmissionInfo? submissionInfo)
|
||||
public bool? ShowDiscInformationWindow(ref SubmissionInfo? submissionInfo)
|
||||
{
|
||||
if (MainViewModel.Options.ShowDiscEjectReminder)
|
||||
CustomMessageBox.Show(this, "It is now safe to eject the disc", "Eject", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
@@ -310,14 +274,14 @@ namespace MPF.UI.Windows
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
};
|
||||
|
||||
discInformationWindow.Closed += delegate { this.Activate(); };
|
||||
discInformationWindow.Closed += delegate { Activate(); };
|
||||
bool? result = discInformationWindow.ShowDialog();
|
||||
|
||||
// Copy back the submission info changes, if necessary
|
||||
if (result == true)
|
||||
submissionInfo = (discInformationWindow.DiscInformationViewModel.SubmissionInfo.Clone() as SubmissionInfo)!;
|
||||
|
||||
return (result, submissionInfo!);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -326,7 +290,7 @@ namespace MPF.UI.Windows
|
||||
public void ShowCheckDumpWindow()
|
||||
{
|
||||
// Hide MainWindow while Check GUI is open
|
||||
this.Hide();
|
||||
Hide();
|
||||
|
||||
var checkDumpWindow = new CheckDumpWindow(this)
|
||||
{
|
||||
@@ -337,10 +301,11 @@ namespace MPF.UI.Windows
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
};
|
||||
|
||||
checkDumpWindow.Closed += delegate {
|
||||
checkDumpWindow.Closed += delegate
|
||||
{
|
||||
// Unhide Main window after Check window has been closed
|
||||
this.Show();
|
||||
this.Activate();
|
||||
Show();
|
||||
Activate();
|
||||
};
|
||||
checkDumpWindow.Show();
|
||||
}
|
||||
@@ -351,7 +316,7 @@ namespace MPF.UI.Windows
|
||||
public void ShowCreateIRDWindow()
|
||||
{
|
||||
// Hide MainWindow while Create IRD UI is open
|
||||
this.Hide();
|
||||
Hide();
|
||||
|
||||
var createIRDWindow = new CreateIRDWindow(this)
|
||||
{
|
||||
@@ -362,10 +327,11 @@ namespace MPF.UI.Windows
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
};
|
||||
|
||||
createIRDWindow.Closed += delegate {
|
||||
createIRDWindow.Closed += delegate
|
||||
{
|
||||
// Unhide Main window after Create IRD window has been closed
|
||||
this.Show();
|
||||
this.Activate();
|
||||
Show();
|
||||
Activate();
|
||||
};
|
||||
createIRDWindow.Show();
|
||||
}
|
||||
@@ -385,7 +351,7 @@ namespace MPF.UI.Windows
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
};
|
||||
|
||||
optionsWindow.Closed += delegate { this.Activate(); };
|
||||
optionsWindow.Closed += delegate { Activate(); };
|
||||
optionsWindow.Closed += OnOptionsUpdated;
|
||||
optionsWindow.Show();
|
||||
}
|
||||
@@ -533,21 +499,13 @@ namespace MPF.UI.Windows
|
||||
/// <summary>
|
||||
/// Handler for CopyProtectScanButton Click event
|
||||
/// </summary>
|
||||
#if NET40
|
||||
public void CopyProtectScanButtonClick(object sender, RoutedEventArgs e)
|
||||
#else
|
||||
public async void CopyProtectScanButtonClick(object sender, RoutedEventArgs e)
|
||||
#endif
|
||||
{
|
||||
#if NET40
|
||||
var (output, error) = MainViewModel.ScanAndShowProtection();
|
||||
#else
|
||||
var (output, error) = await MainViewModel.ScanAndShowProtection();
|
||||
#endif
|
||||
var output = await MainViewModel.ScanAndShowProtection();
|
||||
|
||||
if (!MainViewModel.LogPanelExpanded)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(output) && string.IsNullOrEmpty(error))
|
||||
if (!string.IsNullOrEmpty(output))
|
||||
CustomMessageBox.Show(this, output, "Detected Protection(s)", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
else
|
||||
CustomMessageBox.Show(this, "An exception occurred, see the log for details", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
@@ -179,10 +179,11 @@
|
||||
ItemsSource="{Binding InternalPrograms}" SelectedItem="{Binding Options.InternalProgram, Converter={StaticResource ElementConverter}, Mode=TwoWay}"
|
||||
Style="{DynamicResource CustomComboBoxStyle}" />
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Default Output Path" />
|
||||
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Default Output Path"
|
||||
ToolTip="Variables allowed:
 %SYSTEM%	(System name, long)
 %SYS%		(System name, short)
 %MEDIA%	(Media type)
 %PROGRAM%	(Program name, long)
 %PROG%	(Program name, short)
 %LABEL%	(Volume label)
 %DATE%	(Current date)
 %DATETIME%	(Current date and time)" />
|
||||
<TextBox x:Name="DefaultOutputPathTextBox" Grid.Row="4" Grid.Column="1" Height="22" HorizontalAlignment="Stretch"
|
||||
Text="{Binding Options.DefaultOutputPath}" VerticalContentAlignment="Center"
|
||||
ToolTip="Variables allowed:
 %SYSTEM%	(System name, long)
 %SYS%		(System name, short)
 %MEDIA%	(Media type)
 %PROGRAM%	(Program name, long)
 %PROG%	(Program name, short)
 %LABEL%	(Volume label)
 %DATE%	(Current date)
 %DATETIME%	(Current date and time)"/>
|
||||
ToolTip="Variables allowed:
 %SYSTEM%	(System name, long)
 %SYS%		(System name, short)
 %MEDIA%	(Media type)
 %PROGRAM%	(Program name, long)
 %PROG%	(Program name, short)
 %LABEL%	(Volume label)
 %DATE%	(Current date)
 %DATETIME%	(Current date and time)" />
|
||||
<Button x:Name="DefaultOutputPathButton" Grid.Row="4" Grid.Column="2" Height="22" Width="22" Content="..."
|
||||
Style="{DynamicResource CustomButtonStyle}" />
|
||||
</Grid>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
#if NET40
|
||||
using System.Threading;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using MPF.Frontend;
|
||||
using MPF.Frontend.ViewModels;
|
||||
using SabreTools.RedumpLib.Web;
|
||||
using WPFCustomMessageBox;
|
||||
|
||||
#pragma warning disable IDE1006 // Naming Styles
|
||||
@@ -24,15 +28,15 @@ namespace MPF.UI.Windows
|
||||
|
||||
#if NET35
|
||||
|
||||
private System.Windows.Controls.Button? _AaruPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "AaruPathButton");
|
||||
private System.Windows.Controls.Button? _AcceptButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "AcceptButton");
|
||||
private System.Windows.Controls.Button? _CancelButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CancelButton");
|
||||
private System.Windows.Controls.Button? _DefaultOutputPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "DefaultOutputPathButton");
|
||||
private System.Windows.Controls.Button? _DiscImageCreatorPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "DiscImageCreatorPathButton");
|
||||
private System.Windows.Controls.Button? _RedumperPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "RedumperPathButton");
|
||||
private System.Windows.Controls.Button? _RedumpLoginTestButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "RedumpLoginTestButton");
|
||||
private PasswordBox? _RedumpPasswordBox => ItemHelper.FindChild<PasswordBox>(this, "RedumpPasswordBox");
|
||||
private System.Windows.Controls.TextBox? _RedumpUsernameTextBox => ItemHelper.FindChild<System.Windows.Controls.TextBox>(this, "RedumpUsernameTextBox");
|
||||
private System.Windows.Controls.Button? AaruPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "AaruPathButton");
|
||||
private System.Windows.Controls.Button? AcceptButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "AcceptButton");
|
||||
private System.Windows.Controls.Button? CancelButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "CancelButton");
|
||||
private System.Windows.Controls.Button? DefaultOutputPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "DefaultOutputPathButton");
|
||||
private System.Windows.Controls.Button? DiscImageCreatorPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "DiscImageCreatorPathButton");
|
||||
private System.Windows.Controls.Button? RedumperPathButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "RedumperPathButton");
|
||||
private System.Windows.Controls.Button? RedumpLoginTestButton => ItemHelper.FindChild<System.Windows.Controls.Button>(this, "RedumpLoginTestButton");
|
||||
private PasswordBox? RedumpPasswordBox => ItemHelper.FindChild<PasswordBox>(this, "RedumpPasswordBox");
|
||||
private System.Windows.Controls.TextBox? RedumpUsernameTextBox => ItemHelper.FindChild<System.Windows.Controls.TextBox>(this, "RedumpUsernameTextBox");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,34 +67,18 @@ namespace MPF.UI.Windows
|
||||
DataContext = new OptionsViewModel(options);
|
||||
|
||||
// Set initial value for binding
|
||||
#if NET35
|
||||
_RedumpPasswordBox!.Password = options.RedumpPassword;
|
||||
#else
|
||||
RedumpPasswordBox.Password = options.RedumpPassword;
|
||||
#endif
|
||||
RedumpPasswordBox!.Password = options.RedumpPassword;
|
||||
|
||||
// Add handlers
|
||||
#if NET35
|
||||
_AaruPathButton!.Click += BrowseForPathClick;
|
||||
_DiscImageCreatorPathButton!.Click += BrowseForPathClick;
|
||||
_RedumperPathButton!.Click += BrowseForPathClick;
|
||||
_DefaultOutputPathButton!.Click += BrowseForPathClick;
|
||||
AaruPathButton!.Click += BrowseForPathClick;
|
||||
DiscImageCreatorPathButton!.Click += BrowseForPathClick;
|
||||
RedumperPathButton!.Click += BrowseForPathClick;
|
||||
DefaultOutputPathButton!.Click += BrowseForPathClick;
|
||||
|
||||
_AcceptButton!.Click += OnAcceptClick;
|
||||
_CancelButton!.Click += OnCancelClick;
|
||||
_RedumpPasswordBox!.PasswordChanged += OnPasswordChanged;
|
||||
_RedumpLoginTestButton!.Click += OnRedumpTestClick;
|
||||
#else
|
||||
AaruPathButton.Click += BrowseForPathClick;
|
||||
DiscImageCreatorPathButton.Click += BrowseForPathClick;
|
||||
RedumperPathButton.Click += BrowseForPathClick;
|
||||
DefaultOutputPathButton.Click += BrowseForPathClick;
|
||||
|
||||
AcceptButton.Click += OnAcceptClick;
|
||||
CancelButton.Click += OnCancelClick;
|
||||
RedumpPasswordBox.PasswordChanged += OnPasswordChanged;
|
||||
RedumpLoginTestButton.Click += OnRedumpTestClick;
|
||||
#endif
|
||||
AcceptButton!.Click += OnAcceptClick;
|
||||
CancelButton!.Click += OnCancelClick;
|
||||
RedumpPasswordBox!.PasswordChanged += OnPasswordChanged;
|
||||
RedumpLoginTestButton!.Click += OnRedumpTestClick;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -101,7 +89,7 @@ namespace MPF.UI.Windows
|
||||
base.OnContentRendered(e);
|
||||
|
||||
// Set the window title
|
||||
OptionsViewModel.Title = this.Title;
|
||||
OptionsViewModel.Title = Title;
|
||||
}
|
||||
|
||||
#region UI Commands
|
||||
@@ -198,13 +186,10 @@ namespace MPF.UI.Windows
|
||||
/// <summary>
|
||||
/// Test Redump credentials for validity
|
||||
/// </summary>
|
||||
private async Task ValidateRedumpCredentials()
|
||||
private async Task<bool?> ValidateRedumpCredentials()
|
||||
{
|
||||
#if NET35
|
||||
(bool? success, string? message) = await OptionsViewModel.TestRedumpLogin(_RedumpUsernameTextBox!.Text, _RedumpPasswordBox!.Password);
|
||||
#else
|
||||
(bool? success, string? message) = await OptionsViewModel.TestRedumpLogin(RedumpUsernameTextBox.Text, RedumpPasswordBox.Password);
|
||||
#endif
|
||||
bool? success = await RedumpClient.ValidateCredentials(RedumpUsernameTextBox!.Text, RedumpPasswordBox!.Password);
|
||||
string message = OptionsViewModel.GetRedumpLoginResult(success);
|
||||
|
||||
if (success == true)
|
||||
CustomMessageBox.Show(this, message, "Success", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
@@ -212,6 +197,8 @@ namespace MPF.UI.Windows
|
||||
CustomMessageBox.Show(this, message, "Failure", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
CustomMessageBox.Show(this, message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -258,26 +245,15 @@ namespace MPF.UI.Windows
|
||||
/// </summary>
|
||||
private void OnPasswordChanged(object sender, EventArgs e)
|
||||
{
|
||||
#if NET35
|
||||
OptionsViewModel.Options.RedumpPassword = _RedumpPasswordBox!.Password;
|
||||
#else
|
||||
OptionsViewModel.Options.RedumpPassword = RedumpPasswordBox.Password;
|
||||
#endif
|
||||
OptionsViewModel.Options.RedumpPassword = RedumpPasswordBox!.Password;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test Redump credentials for validity
|
||||
/// </summary>
|
||||
#if NET40
|
||||
private void OnRedumpTestClick(object sender, EventArgs e)
|
||||
{
|
||||
var validateTask = ValidateRedumpCredentials();
|
||||
validateTask.Wait();
|
||||
}
|
||||
#else
|
||||
private async void OnRedumpTestClick(object sender, EventArgs e) => await ValidateRedumpCredentials();
|
||||
#endif
|
||||
private async void OnRedumpTestClick(object sender, EventArgs e)
|
||||
=> await ValidateRedumpCredentials();
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace MPF.UI.Windows
|
||||
{
|
||||
try
|
||||
{
|
||||
this.DialogResult = false;
|
||||
DialogResult = false;
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace MPF.UI.Windows
|
||||
/// </summary>
|
||||
public void MinimizeButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ namespace MPF.UI.Windows
|
||||
public void TitleMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
this.DragMove();
|
||||
DragMove();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
12
README.md
12
README.md
@@ -57,31 +57,31 @@ MPF.Check is a commandline-only program that allows users to generate submission
|
||||
|
||||
MPF.UI, MPF.CLI, and MPF.Check have the same system requirements for running, with the exception that MPF.UI is Windows-only.
|
||||
|
||||
- [Supported OS versions for .NET 8](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md)
|
||||
- Requires [.NET 8.0 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) if built without bundled runtime
|
||||
- [Supported OS versions for .NET 9](https://github.com/dotnet/core/blob/main/release-notes/9.0/supported-os.md)
|
||||
- Requires [.NET 9.0 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) if built without bundled runtime
|
||||
|
||||
Ensure that your operating system and runtimes are as up-to-date as possible, since some features may rely on those updates.
|
||||
|
||||
## Build Instructions
|
||||
|
||||
To build for .NET 8.0, ensure that the [.NET 8.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) (or later) is installed and included in your `PATH`. Then, run the following commands from command prompt, Powershell, Terminal, or shell:
|
||||
To build for .NET 9.0, ensure that the [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) (or later) is installed and included in your `PATH`. Then, run the following commands from command prompt, Powershell, Terminal, or shell:
|
||||
|
||||
**MPF.UI (Windows only):**
|
||||
|
||||
```bash
|
||||
dotnet build MPF/MPF.csproj --framework net8.0-windows --runtime [win-x86|win-x64]
|
||||
dotnet build MPF/MPF.csproj --framework net9.0-windows --runtime [win-x86|win-x64]
|
||||
```
|
||||
|
||||
**MPF.CLI (Windows, OSX, Linux):**
|
||||
|
||||
```bash
|
||||
dotnet build MPF.CLI/MPF.CLI.csproj --framework net8.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64]
|
||||
dotnet build MPF.CLI/MPF.CLI.csproj --framework net9.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64]
|
||||
```
|
||||
|
||||
**MPF.Check (Windows, OSX, Linux):**
|
||||
|
||||
```bash
|
||||
dotnet build MPF.Check/MPF.Check.csproj --framework net8.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64]
|
||||
dotnet build MPF.Check/MPF.Check.csproj --framework net9.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64]
|
||||
```
|
||||
|
||||
Choose one of `win-x86`, `win-x64`, `win-arm64`, `linux-x64`, `linux-arm64`, `osx-x64`, or `osx-arm64` depending on the machine you are targeting.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# version format
|
||||
version: 3.2.2-{build}
|
||||
version: 3.2.4-{build}
|
||||
|
||||
# pull request template
|
||||
pull_requests:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This batch file assumes the following:
|
||||
# - .NET 8.0 (or newer) SDK is installed and in PATH
|
||||
# - .NET 9.0 (or newer) SDK is installed and in PATH
|
||||
# - zip is installed and in PATH
|
||||
# - Git is installed and in PATH
|
||||
# - The relevant commandline programs are already downloaded
|
||||
@@ -51,21 +51,21 @@ echo " No archive (-a) $NO_ARCHIVE"
|
||||
echo " "
|
||||
|
||||
# Create the build matrix arrays
|
||||
UI_FRAMEWORKS=("net8.0-windows")
|
||||
UI_FRAMEWORKS=("net9.0-windows")
|
||||
UI_RUNTIMES=("win-x86" "win-x64")
|
||||
CHECK_FRAMEWORKS=("net8.0")
|
||||
CHECK_FRAMEWORKS=("net9.0")
|
||||
CHECK_RUNTIMES=("win-x86" "win-x64" "win-arm64" "linux-x64" "linux-arm64" "osx-x64" "osx-arm64")
|
||||
|
||||
# Use expanded framework lists, if requested
|
||||
if [ $USE_ALL = true ]; then
|
||||
UI_FRAMEWORKS=("net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0-windows" "net6.0-windows" "net7.0-windows" "net8.0-windows")
|
||||
CHECK_FRAMEWORKS=("net20" "net35" "net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0")
|
||||
UI_FRAMEWORKS=("net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0-windows" "net6.0-windows" "net7.0-windows" "net8.0-windows" "net9.0-windows")
|
||||
CHECK_FRAMEWORKS=("net20" "net35" "net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0")
|
||||
fi
|
||||
|
||||
# Create the filter arrays
|
||||
SINGLE_FILE_CAPABLE=("net5.0" "net5.0-windows" "net6.0" "net6.0-windows" "net7.0" "net7.0-windows" "net8.0" "net8.0-windows")
|
||||
VALID_APPLE_FRAMEWORKS=("net6.0" "net7.0" "net8.0")
|
||||
VALID_CROSS_PLATFORM_FRAMEWORKS=("netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0")
|
||||
SINGLE_FILE_CAPABLE=("net5.0" "net5.0-windows" "net6.0" "net6.0-windows" "net7.0" "net7.0-windows" "net8.0" "net8.0-windows" "net9.0" "net9.0-windows")
|
||||
VALID_APPLE_FRAMEWORKS=("net6.0" "net7.0" "net8.0" "net9.0")
|
||||
VALID_CROSS_PLATFORM_FRAMEWORKS=("netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0")
|
||||
VALID_CROSS_PLATFORM_RUNTIMES=("win-arm64" "linux-x64" "linux-arm64" "osx-x64" "osx-arm64")
|
||||
|
||||
# Only build if requested
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# This batch file assumes the following:
|
||||
# - .NET 8.0 (or newer) SDK is installed and in PATH
|
||||
# - .NET 9.0 (or newer) SDK is installed and in PATH
|
||||
# - 7-zip commandline (7z.exe) is installed and in PATH
|
||||
# - Git for Windows is installed and in PATH
|
||||
# - The relevant commandline programs are already downloaded
|
||||
@@ -42,21 +42,21 @@ Write-Host " No archive (-NoArchive) $NO_ARCHIVE"
|
||||
Write-Host " "
|
||||
|
||||
# Create the build matrix arrays
|
||||
$UI_FRAMEWORKS = @('net8.0-windows')
|
||||
$UI_FRAMEWORKS = @('net9.0-windows')
|
||||
$UI_RUNTIMES = @('win-x86', 'win-x64')
|
||||
$CHECK_FRAMEWORKS = @('net8.0')
|
||||
$CHECK_FRAMEWORKS = @('net9.0')
|
||||
$CHECK_RUNTIMES = @('win-x86', 'win-x64', 'win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64')
|
||||
|
||||
# Use expanded framework lists, if requested
|
||||
if ($USE_ALL.IsPresent) {
|
||||
$UI_FRAMEWORKS = @('net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0-windows', 'net6.0-windows', 'net7.0-windows', 'net8.0-windows')
|
||||
$CHECK_FRAMEWORKS = @('net20', 'net35', 'net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0')
|
||||
$UI_FRAMEWORKS = @('net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0-windows', 'net6.0-windows', 'net7.0-windows', 'net8.0-windows', 'net9.0-windows')
|
||||
$CHECK_FRAMEWORKS = @('net20', 'net35', 'net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0')
|
||||
}
|
||||
|
||||
# Create the filter arrays
|
||||
$SINGLE_FILE_CAPABLE = @('net5.0', 'net5.0-windows', 'net6.0', 'net6.0-windows', 'net7.0', 'net7.0-windows', 'net8.0', 'net8.0-windows')
|
||||
$VALID_APPLE_FRAMEWORKS = @('net6.0', 'net7.0', 'net8.0')
|
||||
$VALID_CROSS_PLATFORM_FRAMEWORKS = @('netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0')
|
||||
$SINGLE_FILE_CAPABLE = @('net5.0', 'net5.0-windows', 'net6.0', 'net6.0-windows', 'net7.0', 'net7.0-windows', 'net8.0', 'net8.0-windows', 'net9.0', 'net9.0-windows')
|
||||
$VALID_APPLE_FRAMEWORKS = @('net6.0', 'net7.0', 'net8.0', 'net9.0')
|
||||
$VALID_CROSS_PLATFORM_FRAMEWORKS = @('netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0')
|
||||
$VALID_CROSS_PLATFORM_RUNTIMES = @('win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64')
|
||||
|
||||
# Only build if requested
|
||||
@@ -66,8 +66,8 @@ if (!$NO_BUILD.IsPresent) {
|
||||
dotnet restore
|
||||
|
||||
# Create Nuget Packages
|
||||
dotnet pack MPF.ExecutionContexts/MPF.ExecutionContexts.csproj --output $BUILD_FOLDER
|
||||
dotnet pack MPF.Processors/MPF.Processors.csproj --output $BUILD_FOLDER
|
||||
dotnet pack MPF.ExecutionContexts\MPF.ExecutionContexts.csproj --output $BUILD_FOLDER
|
||||
dotnet pack MPF.Processors\MPF.Processors.csproj --output $BUILD_FOLDER
|
||||
|
||||
# Build UI
|
||||
foreach ($FRAMEWORK in $UI_FRAMEWORKS) {
|
||||
|
||||
Reference in New Issue
Block a user