mirror of
https://github.com/Manu098vm/Switch-Gift-Data-Manager.git
synced 2026-03-22 01:44:24 -05:00
Compare commits
No commits in common. "main" and "1.6.0" have entirely different histories.
72
.github/workflows/Linux.yml
vendored
72
.github/workflows/Linux.yml
vendored
|
|
@ -1,3 +1,41 @@
|
|||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
|
||||
# built on .NET Core.
|
||||
# To learn how to migrate your existing application to .NET Core,
|
||||
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
|
||||
#
|
||||
# To configure this workflow:
|
||||
#
|
||||
# 1. Configure environment variables
|
||||
# GitHub sets default environment variables for every workflow run.
|
||||
# Replace the variables relative to your project in the "env" section below.
|
||||
#
|
||||
# 2. Signing
|
||||
# Generate a signing certificate in the Windows Application
|
||||
# Packaging Project or add an existing signing certificate to the project.
|
||||
# Next, use PowerShell to encode the .pfx file using Base64 encoding
|
||||
# by running the following Powershell script to generate the output string:
|
||||
#
|
||||
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
|
||||
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
|
||||
#
|
||||
# Open the output file, SigningCertificate_Encoded.txt, and copy the
|
||||
# string inside. Then, add the string to the repo as a GitHub secret
|
||||
# and name it "Base64_Encoded_Pfx."
|
||||
# For more information on how to configure your signing certificate for
|
||||
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
|
||||
#
|
||||
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
|
||||
# See "Build the Windows Application Packaging project" below to see how the secret is used.
|
||||
#
|
||||
# For more information on GitHub Actions, refer to https://github.com/features/actions
|
||||
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
|
||||
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
|
||||
|
||||
name: Linux
|
||||
|
||||
on:
|
||||
|
|
@ -14,33 +52,35 @@ jobs:
|
|||
matrix:
|
||||
configuration: [Release]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-latest # For a list of available runner types, refer to
|
||||
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
|
||||
|
||||
env:
|
||||
Solution_Name: SwitchGiftDataManager.sln
|
||||
Project_Path: SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
# Install the .NET Core workload
|
||||
- name: Install .NET Core
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Clean previous build artifacts
|
||||
run: dotnet clean ${{ env.Project_Path }} --configuration ${{ matrix.configuration }}
|
||||
|
||||
- name: Install dependencies and build
|
||||
run: |
|
||||
dotnet restore ${{ env.Project_Path }}
|
||||
dotnet build ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} --no-restore
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
# Create the app package by building and packaging
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --configuration Release --no-restore
|
||||
- name: Test
|
||||
run: dotnet test SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --no-restore --verbosity normal
|
||||
|
||||
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
|
||||
- name: Upload Linux CommandLine build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Linux.CommandLine.App
|
||||
path: SwitchGiftDataManager.CommandLine/bin
|
||||
path: SwitchGiftDataManager.CommandLine/bin
|
||||
|
|
|
|||
75
.github/workflows/Mac.yml
vendored
75
.github/workflows/Mac.yml
vendored
|
|
@ -1,3 +1,41 @@
|
|||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
|
||||
# built on .NET Core.
|
||||
# To learn how to migrate your existing application to .NET Core,
|
||||
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
|
||||
#
|
||||
# To configure this workflow:
|
||||
#
|
||||
# 1. Configure environment variables
|
||||
# GitHub sets default environment variables for every workflow run.
|
||||
# Replace the variables relative to your project in the "env" section below.
|
||||
#
|
||||
# 2. Signing
|
||||
# Generate a signing certificate in the Windows Application
|
||||
# Packaging Project or add an existing signing certificate to the project.
|
||||
# Next, use PowerShell to encode the .pfx file using Base64 encoding
|
||||
# by running the following Powershell script to generate the output string:
|
||||
#
|
||||
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
|
||||
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
|
||||
#
|
||||
# Open the output file, SigningCertificate_Encoded.txt, and copy the
|
||||
# string inside. Then, add the string to the repo as a GitHub secret
|
||||
# and name it "Base64_Encoded_Pfx."
|
||||
# For more information on how to configure your signing certificate for
|
||||
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
|
||||
#
|
||||
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
|
||||
# See "Build the Windows Application Packaging project" below to see how the secret is used.
|
||||
#
|
||||
# For more information on GitHub Actions, refer to https://github.com/features/actions
|
||||
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
|
||||
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
|
||||
|
||||
name: MacOS
|
||||
|
||||
on:
|
||||
|
|
@ -14,42 +52,35 @@ jobs:
|
|||
matrix:
|
||||
configuration: [Release]
|
||||
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-latest # For a list of available runner types, refer to
|
||||
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
|
||||
|
||||
env:
|
||||
Solution_Name: SwitchGiftDataManager.sln
|
||||
Project_Path: SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
# Install the .NET Core workload
|
||||
- name: Install .NET Core
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Cache NuGet packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
# Create the app package by building and packaging
|
||||
- name: Install dependencies
|
||||
run: dotnet restore ${{ env.Project_Path }}
|
||||
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} --no-restore
|
||||
|
||||
run: dotnet build SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --configuration Release --no-restore
|
||||
- name: Test
|
||||
run: dotnet test ${{ env.Project_Path }} --no-restore --verbosity normal
|
||||
run: dotnet test SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --no-restore --verbosity normal
|
||||
|
||||
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
|
||||
- name: Upload MacOS CommandLine build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: MacOS.CommandLine.App
|
||||
path: SwitchGiftDataManager.CommandLine/bin
|
||||
path: SwitchGiftDataManager.CommandLine/bin
|
||||
|
|
|
|||
76
.github/workflows/Windows.yml
vendored
76
.github/workflows/Windows.yml
vendored
|
|
@ -1,3 +1,41 @@
|
|||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
|
||||
# built on .NET Core.
|
||||
# To learn how to migrate your existing application to .NET Core,
|
||||
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
|
||||
#
|
||||
# To configure this workflow:
|
||||
#
|
||||
# 1. Configure environment variables
|
||||
# GitHub sets default environment variables for every workflow run.
|
||||
# Replace the variables relative to your project in the "env" section below.
|
||||
#
|
||||
# 2. Signing
|
||||
# Generate a signing certificate in the Windows Application
|
||||
# Packaging Project or add an existing signing certificate to the project.
|
||||
# Next, use PowerShell to encode the .pfx file using Base64 encoding
|
||||
# by running the following Powershell script to generate the output string:
|
||||
#
|
||||
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
|
||||
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
|
||||
#
|
||||
# Open the output file, SigningCertificate_Encoded.txt, and copy the
|
||||
# string inside. Then, add the string to the repo as a GitHub secret
|
||||
# and name it "Base64_Encoded_Pfx."
|
||||
# For more information on how to configure your signing certificate for
|
||||
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
|
||||
#
|
||||
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
|
||||
# See "Build the Windows Application Packaging project" below to see how the secret is used.
|
||||
#
|
||||
# For more information on GitHub Actions, refer to https://github.com/features/actions
|
||||
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
|
||||
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
|
||||
|
||||
name: Windows
|
||||
|
||||
on:
|
||||
|
|
@ -14,42 +52,52 @@ jobs:
|
|||
matrix:
|
||||
configuration: [Release]
|
||||
|
||||
runs-on: windows-latest
|
||||
runs-on: windows-latest # For a list of available runner types, refer to
|
||||
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
|
||||
|
||||
env:
|
||||
Solution_Name: SwitchGiftDataManager.sln
|
||||
Configuration: ${{ matrix.configuration }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
# Install the .NET Core workload
|
||||
- name: Install .NET Core
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
||||
# Execute all unit tests in the solution
|
||||
- name: Execute unit tests
|
||||
run: dotnet test
|
||||
|
||||
- name: Restore and build the application
|
||||
run: |
|
||||
msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
|
||||
msbuild $env:Solution_Name /property:Configuration=$env:Configuration
|
||||
# Restore the application to populate the obj folder with RuntimeIdentifiers
|
||||
- name: Restore the application
|
||||
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
|
||||
env:
|
||||
Configuration: ${{ matrix.configuration }}
|
||||
|
||||
# Create the app package by building and packaging the Windows Application Packaging project
|
||||
- name: Create the app package
|
||||
run: msbuild $env:Solution_Name /property:Configuration=Release
|
||||
|
||||
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
|
||||
- name: Upload WinForms build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: WindowsForm.GUI.App
|
||||
path: SwitchGiftDataManager.WinForm/bin
|
||||
|
||||
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
|
||||
- name: Upload Windows CommandLine build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Windows.CommandLine.App
|
||||
path: SwitchGiftDataManager.CommandLine/bin
|
||||
path: SwitchGiftDataManager.CommandLine/bin
|
||||
|
|
|
|||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -3,8 +3,5 @@
|
|||
.vscode
|
||||
**/bin
|
||||
**/obj
|
||||
**/PublishProfiles
|
||||
**.user
|
||||
**.config
|
||||
**.pubxml
|
||||
**.pubxml.user
|
||||
**.config
|
||||
73
README.md
73
README.md
|
|
@ -2,75 +2,74 @@
|
|||

|
||||
|
||||
## About
|
||||
This tool aims to bring back past Mystery Gift event content in all Pokémon games for Nintendo Switch.
|
||||
Since these games don't allow event injection in the save file, this tool creates a forged BCAT package, which can be injected using homebrew tools like [JKSV](https://github.com/J-D-K/JKSV/releases).
|
||||
This allows wondercards to be redeemed through the in-game Mystery Gift menu. The use of this tool does not involve hacking the game ROM or modifying the game save file.
|
||||
This tool aims to make past Mystery Gift event contents back again in all the Pokémon games for Nintendo Switch.
|
||||
Since those games won't allow event injection in the SAV file, this tool creates a forged BCAT package, injectable with homebrews like [JKSV](https://github.com/J-D-K/JKSV/releases).
|
||||
This allows wondercards to be redeemed through the In-Game Mystery Gift Menu. The use of this tool does not involve hacking the game ROM nor hacking the game SAV.
|
||||
|
||||
### Compatible files
|
||||
* Let's Go Pikachu and Let's Go Eevee wondercard full files (.wb7full)
|
||||
* Sword and Shield wondercard files (.wc8)
|
||||
* Brilliant Diamond and Shining Pearl wondercard files (.wb8)
|
||||
* Legends Arceus wondercard files (.wa8)
|
||||
* Scarlet & Violet wondercard files (.wc9)
|
||||
* Legends Z-A wondercard files (.wa9)
|
||||
* BCAT wondercard files, containing either multiple or single wondercards (no file format extension)
|
||||
* Scarlet & Violet wondercard files (.wc9)
|
||||
* BCAT wondercard files, either with mutiple or single wondercards (no file format extension)
|
||||
|
||||
### Compatible games
|
||||
* Pokémon Let's Go Pikachu and Eevee
|
||||
* Pokémon Sword and Shield
|
||||
* Pokémon Brilliant Diamond and Shining Pearl
|
||||
* Pokémon Legends Arceus
|
||||
* Pokémon Scarlet and Violet
|
||||
* Pokémon Legends Z-A
|
||||
* Pokémon Scarlet and Violet
|
||||
|
||||
## Disclosure
|
||||
Neither I nor the Project Pokémon staff take any responsibility for possible adverse outcomes or bans resulting from the use of this tool. Use it at your own discretion.
|
||||
Neither I nor the Project Pokémon staff takes any responsibility for possible adverse outcomes or bans due to the use of this tool. Use at your own discretion.
|
||||
|
||||
**N.B.:** Some BCAT files contain sensitive console-specific information that you should keep secure. Do not share your BCAT with others!
|
||||
**N.B:** Some BCAT files contain sensible console-specific informations, which you should keep safe. Don't share your BCAT to others!
|
||||
|
||||
## Usage
|
||||
This section refers to the Windows Form app. The Command Line app usage is similar and should be fairly intuitive.
|
||||
* Ensure you have the required [.NET 9.0 Desktop Runtime](https://dotnet.microsoft.com/it-it/download/dotnet/9.0) installed correctly.
|
||||
* Dump your game's BCAT with [JKSV](https://github.com/J-D-K/JKSV/releases) and keep some copies in a safe place.
|
||||
* Open the tool and select your game of choice.
|
||||
* Import the wondercard files of your choice (by drag & drop or by clicking the `Open Files` button).
|
||||
* Optionally, edit the wondercard ID (WCID) if you have duplicate WCs, then click `Apply`.
|
||||
* Click the `Save as BCAT Package` button and browse to your dumped BCAT.
|
||||
* A folder called "Forged_BCAT_{Game}" should appear next to your dumped BCAT.
|
||||
* Restore the forged BCAT using JKSV.
|
||||
* To redeem the old event gifts, open your game -> Menu -> Mystery Gift -> Redeem via Internet.
|
||||
* When you're done, restore your original BCAT package with JKSV (not doing so may cause sync issues).
|
||||
This paragraph refers to the Windows Form app. The Command Line app usage is similar and should be fairly intuitive.
|
||||
* Ensure you have the required [.NET 7.0 Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) correctly installed
|
||||
* Dump your game's BCAT with [JKSV](https://github.com/J-D-K/JKSV/releases) and keep some copies somewhere safe
|
||||
* Open the tool and select your game of choice
|
||||
* Import wondercard files of your choice (by drag & drop or by clicking the `Open Files` button)
|
||||
* Eventually edit the wondercard id (WCID) if you have duplicated WCs and click `Apply`
|
||||
* Click the `Save as BCAT Package` button and browse to your dumped BCAT
|
||||
* A folder called "Forged_BCAT_{Game}" should appear next to your dumped BCAT
|
||||
* Restore the Forged Bcat with JKSV
|
||||
* To redeem the old fashion events, open your game -> Menu -> Mystery Gift -> redeem via Internet
|
||||
* When you're done, restore your original BCAT package with JKSV (not doing so may cause sync issues)
|
||||
|
||||
**N.B.:** BCAT sync usually occurs between 12:00 AM (UTC) and 01:00 AM (UTC). I recommend avoiding this procedure during that timeframe to prevent desynchronization.
|
||||
**N.B**: BCAT Sync usually occurs between 12:00 AM (UTC) and 01:00 AM (UTC). I suggest to not follow this procedure during that timeframe to avoid a desync.
|
||||
If you experience a desync, follow one of these methods to resync:
|
||||
* Open JKSV, select BCAT, hover over your game, press X to open the menu, then click `Reset Save Data`.
|
||||
* Download the latest BCAT for your game from [citrusbolt](https://github.com/citrusbolt)'s [website](http://citrusbolt.net/bcat/) and add the missing files to your dumped BCAT, then restore it with JKSV.
|
||||
* Open JKSV, select BCAT, hover over your game and press X to open the menu, then click `Reset Save Data`.
|
||||
* Download the latest BCAT for your game from my [bcat_updates](https://github.com/Manu098vm/bcat_updates) repo or from [citrusbolt](https://github.com/citrusbolt)'s [website](http://citrusbolt.net/bcat/) and add the missing files to your dumped BCAT, then restore it with JKSV.
|
||||
|
||||
## Support/Troubleshooting
|
||||
If you find any bugs or need support, please post in the [relevant topic on the Project Pokémon forums](https://projectpokemon.org/home/forums/topic/62491-switch-gift-data-manager-import-wondercards-into-switch-games-by-faking-bcat-packages/).
|
||||
Alternatively, feel free to contact me on my [Discord server](https://discord.gg/yWveAjKbKt).
|
||||
If you find any bug or you need support, please write in the [relevant topic on the Project Pokémon forums](https://projectpokemon.org/home/forums/topic/62491-switch-gift-data-manager-import-wondercards-into-switch-games-by-faking-bcat-packages/).
|
||||
Alternatively, feel free to contact me in my [Discord server](https://discord.gg/yWveAjKbKt).
|
||||
|
||||
[<img src="https://canary.discordapp.com/api/guilds/693083823197519873/widget.png?style=banner2">](https://discord.gg/yWveAjKbKt)
|
||||
|
||||
## Building
|
||||
* All Switch Gift Data Manager projects require .NET 9.0.
|
||||
* `.WinForm` is a Windows Form application and can only be built on Windows operating systems.
|
||||
* `.Core` and `.CommandLine` can be built on any platform.
|
||||
* Use the Debug build configuration when editing or developing code related to the `.WinForm` project. Build as Release only once the code is finalized.
|
||||
* To build the projects, open the `.sln` file in the root directory with an IDE such as Visual Studio 2022, then click `Build` -> `Build Solution`.
|
||||
* All the Switch Gift Data Manager projects require .NET 7.0.
|
||||
* .WinForm is a Windows Form application and can only be built in Windows Operating Systems.
|
||||
* .Core and .CommandLine can be built in any platform OS.
|
||||
* Use the Debug build configuration when editing or developing code related to the .WinForm project. Build as Release only once the code is finished.
|
||||
* To build the projects, open the .sln file in the root directory with an IDE such as Visual Studio 2022, click `Build` -> `Build Solution`.
|
||||
|
||||
The `.CommandLine` project is currently just a simple script that calls the `.Core` functionalities and can run on any popular OS. Feel free to improve it and/or submit a pull request if you'd like :-)
|
||||
The .CommandLine project is currently just a simple script that calls the .Core functionalities and can run on any popular OS. Feel free to improve it and/or submit a pull request if you'd like :-)
|
||||
|
||||
## Credits
|
||||
* [PNZeml](https://github.com/PNZeml) for the CRC-16/CCITT-FALSE with lookup table [implementation](https://gist.github.com/tijnkooijmans/10981093?permalink_comment_id=3996072#gistcomment-3996072).
|
||||
* [kwsch](https://github.com/kwsch), [sora10pls](https://github.com/sora10pls), and all the [PKHeX](https://github.com/kwsch/PKHeX) and [pkNX](https://github.com/kwsch/pkNX) developers and contributors for various offsets and resources.
|
||||
* [PP-theSLAYER](https://github.com/PP-theSLAYER) and [pasqualenardiello](https://github.com/pasqualenardiello) for their research on the Sword & Shield fashion block and the Scarlet & Violet fashion block, respectively.
|
||||
* All the Project Pokémon staff and the [Event Gallery](https://github.com/projectpokemon/EventsGallery) contributors for their archival efforts that made this project possible.
|
||||
* [PNZeml](https://github.com/PNZeml) for the CRC-16/CCITT-FALSE with lookup table [implementation](https://gist.github.com/tijnkooijmans/10981093?permalink_comment_id=3996072#gistcomment-3996072)
|
||||
* [kwsch](https://github.com/kwsch), [sora10pls](https://github.com/sora10pls) and all the [PKHeX](https://github.com/kwsch/PKHeX) and [pkNX](https://github.com/kwsch/pkNX) devs and contributors
|
||||
for a lot of offsets and resources
|
||||
* [PP-theSLAYER](https://github.com/PP-theSLAYER) and [pasqualenardiello](https://github.com/pasqualenardiello) for their researches on the Sword & Shield fashion block and on the Scarlet and Violet fashion block respectively
|
||||
* All the Project Pokémon Staff and the [Event Gallery](https://github.com/projectpokemon/EventsGallery) contributors for their archival efforts that made this possible
|
||||
|
||||
## License
|
||||

|
||||
|
||||
Copyright © 2025 Manu098vm
|
||||
Copyright © 2023 Manu098vm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@ public static class Program
|
|||
$"2 - SWSH{Environment.NewLine}" +
|
||||
$"3 - BDSP{Environment.NewLine}" +
|
||||
$"4 - PLA{Environment.NewLine}" +
|
||||
$"5 - SCVI{Environment.NewLine}" +
|
||||
$"6 - ZA";
|
||||
$"5 - SCVI";
|
||||
Log(msg);
|
||||
|
||||
Games game = (Games)int.Parse(Console.ReadLine()!);
|
||||
if (game is Games.None || game > Games.ZA)
|
||||
if (game is Games.None || game > Games.SCVI)
|
||||
{
|
||||
Log("Invalid input. Aborted.");
|
||||
Console.ReadKey();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net7.0\linux-x64\publish\linux-x64\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-08-14T11:07:02.3531810Z;True|2023-08-14T13:06:52.0751528+02:00;True|2023-06-06T22:09:41.5267582+02:00;True|2023-04-30T17:57:44.3876690+02:00;True|2023-04-10T17:40:35.1800594+02:00;True|2023-01-28T16:02:21.7075281+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-01-28T14:55:36.8109882Z;True|2023-01-28T15:48:22.9284343+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net7.0\osx-x64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-08-14T11:05:42.5425714Z;True|2023-08-14T13:05:32.4788643+02:00;True|2023-06-06T22:11:28.7924159+02:00;True|2023-04-30T17:56:58.4384691+02:00;True|2023-04-10T17:37:41.8202016+02:00;True|2023-01-28T16:02:13.7381611+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-01-28T14:58:16.5887032Z;True|2023-01-28T15:57:34.0451151+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net7.0\win-x64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<SelfContained>false</SelfContained>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-08-14T11:04:24.9139762Z;True|2023-06-06T22:12:34.4117725+02:00;True|2023-04-30T17:55:35.6583516+02:00;True|2023-04-10T17:35:59.0886698+02:00;False|2023-04-10T17:35:45.4776987+02:00;True|2023-01-28T16:02:06.8383516+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-01-28T14:45:49.3435089Z;True|2023-01-23T20:03:47.7790063+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Authors>Manu098vm</Authors>
|
||||
<Copyright>Copyright (C) 2024 Manu098vm</Copyright>
|
||||
<Copyright>Copyright (C) 2022 Manu098vm</Copyright>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageTags>pokemon; mystery gift; wondercard; reader; nintendo; bcat; event injection;</PackageTags>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace SwitchGiftDataManager.Core;
|
|||
|
||||
public class BCATManager
|
||||
{
|
||||
public const string Version = "1.9.0";
|
||||
public const string Version = "1.6.0";
|
||||
|
||||
private const int FileNameOffset = 0x00;
|
||||
private const int UnkOffset = 0x20;
|
||||
|
|
@ -35,7 +35,6 @@ public class BCATManager
|
|||
Games.BDSP => new WB8(data),
|
||||
Games.PLA => new WA8(data),
|
||||
Games.SCVI => new WC9(data),
|
||||
Games.ZA => new WA9(data),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(Game)),
|
||||
};
|
||||
}
|
||||
|
|
@ -342,12 +341,10 @@ public class BCATManager
|
|||
return Games.SWSH;
|
||||
else if (data.Length % (int)Wondercard.GetSize(Games.BDSP) == 0)
|
||||
return Games.BDSP;
|
||||
else if (data.Length % (int)Wondercard.GetSize(Games.PLA) == 0 && data[0x0F] != 0)
|
||||
else if (data.Length % (int)Wondercard.GetSize(Games.PLA) == 0 && data[Wondercard.GenOffset] != 0)
|
||||
return Games.PLA;
|
||||
else if (data.Length % (int)Wondercard.GetSize(Games.SCVI) == 0 && data[0x0F] == 0 && data[0x2C0] == 0)
|
||||
else if (data.Length % (int)Wondercard.GetSize(Games.SCVI) == 0 && data[Wondercard.GenOffset] == 0)
|
||||
return Games.SCVI;
|
||||
else if (data.Length % (int)Wondercard.GetSize(Games.ZA) == 0 && data[0x2C0] != 0)
|
||||
return Games.ZA;
|
||||
else
|
||||
return Games.None;
|
||||
}
|
||||
|
|
@ -361,7 +358,6 @@ public class BCATManager
|
|||
Games.BDSP => "99",
|
||||
Games.PLA => "normal",
|
||||
Games.SCVI => "normal",
|
||||
Games.ZA => "normal",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(game)),
|
||||
};
|
||||
}
|
||||
|
|
@ -374,7 +370,6 @@ public class BCATManager
|
|||
Games.BDSP => "99",
|
||||
Games.PLA => "distribution_internet",
|
||||
Games.SCVI => "distribution_internet",
|
||||
Games.ZA => "distribution_internet",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(game)),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Enums;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace SwitchGiftDataManager.Core;
|
||||
|
||||
|
|
@ -8,11 +7,11 @@ public class OtherGift
|
|||
public object? Type { get; set; }
|
||||
public ushort Item { get; set; }
|
||||
public uint Quantity { get; set; }
|
||||
public uint Opt { get; set; }
|
||||
public ushort Opt { get; set; }
|
||||
|
||||
public string GetItemName() => GetItemName(Item, Type!, Opt);
|
||||
|
||||
public static string GetItemName(ushort id, object type, uint opt = 0)
|
||||
public static string GetItemName(ushort id, object type, ushort opt = 0)
|
||||
{
|
||||
var str = "";
|
||||
|
||||
|
|
@ -99,25 +98,7 @@ public class OtherGift
|
|||
else
|
||||
str = ((GiftType9)type).ToString();
|
||||
}
|
||||
else if (type.GetType() == typeof(GiftType9A))
|
||||
{
|
||||
if ((GiftType9A)type is GiftType9A.Item or GiftType9A.Flag)
|
||||
str = Properties.Resources.Items.Split(new String[] { "\n" }, StringSplitOptions.None)[id];
|
||||
else if ((GiftType9A)type is GiftType9A.Clothing)
|
||||
{
|
||||
if (!Clothing9A.TryGetValue(opt, out str))
|
||||
str = "Unknown Clothing Item";
|
||||
}
|
||||
else
|
||||
{
|
||||
str = ((GiftType9A)type).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
private static Dictionary<uint, string> Clothing9A = new()
|
||||
{
|
||||
{ 0x2E1937, "Trench Coat and Pants Set (Beige)" },
|
||||
};
|
||||
}
|
||||
|
|
@ -13,20 +13,26 @@ public class PokemonGift
|
|||
|
||||
public string GetSpeciesName() => GetSpeciesName(Species);
|
||||
|
||||
public bool IsShiny() => ShinyType switch
|
||||
public bool IsShiny()
|
||||
{
|
||||
ShinyType.ShinyForced => true,
|
||||
ShinyType.ShinyPossible => (PID != 0 && TID != 0 && SID != 0) && IsShiny(PID, TID, SID),
|
||||
_ => false,
|
||||
};
|
||||
if (ShinyType is ShinyType.ShinyForced)
|
||||
return true;
|
||||
else if (ShinyType is ShinyType.ShinyPossible && PID != 0 && TID != 0 && SID != 0)
|
||||
return IsShiny(PID, TID, SID);
|
||||
|
||||
public static string GetSpeciesName(uint species) => Properties.Resources.Species.Split(["\n"], StringSplitOptions.None)[species];
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsShiny(uint pid, uint tid, uint sid) => (sid != 0 || tid != 0) && (sid ^ tid ^ (pid >> 16) ^ (pid & 0xFFFF)) < 16;
|
||||
public static string GetSpeciesName(uint species) => Properties.Resources.Species.Split(new string[] { "\n" }, StringSplitOptions.None)[species];
|
||||
|
||||
public static bool IsTIDAbusePossible(uint tid, uint sid, PIDType type) => type switch
|
||||
public static bool IsShiny(uint pid, uint tid, uint sid) => sid != 0 || tid != 0 ? (sid ^ tid ^ (pid >> 16) ^ (pid & 0xFFFF)) < 16 : false;
|
||||
|
||||
public static bool IsTIDAbusePossible(uint tid, uint sid, PIDType type)
|
||||
{
|
||||
PIDType.FixedPID => tid == 0 && sid == 0,
|
||||
_ => false,
|
||||
};
|
||||
if (type is PIDType.FixedPID)
|
||||
if (tid == 0)
|
||||
if (sid == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
using System.Buffers.Binary;
|
||||
using Enums;
|
||||
|
||||
namespace SwitchGiftDataManager.Core;
|
||||
|
||||
public class WA9 : Wondercard
|
||||
{
|
||||
private const int WondercardIDOffset = 0x08;
|
||||
private const int FlagOffset = 0x10;
|
||||
private const int GiftTypeOffset = 0x11;
|
||||
private const int ItemOffset = 0x18;
|
||||
private const int QuantityOffset = 0x1A;
|
||||
private const int TIDOffset = 0x18;
|
||||
private const int SIDOffset = 0x1A;
|
||||
private const int PIDOffset = 0x24;
|
||||
private const int FlagStringOffset = 0x28;
|
||||
private const int FlagItemOffset = 0x6C;
|
||||
private const int FlagItemQuantityOffset = 0x6E;
|
||||
private const int SpeciesOffset = 0x270;
|
||||
private const int ShinyTypeOffset = 0x278;
|
||||
private const int ChecksumOffset = 0x2C0;
|
||||
|
||||
public WA9(ReadOnlySpan<byte> data) : base(data)
|
||||
{
|
||||
WCID = BinaryPrimitives.ReadUInt16LittleEndian(data[WondercardIDOffset..]);
|
||||
IsRepeatable = (Data![FlagOffset] & 1) == 0;
|
||||
Type = (GiftType9A)Data![GiftTypeOffset];
|
||||
Content = Type switch
|
||||
{
|
||||
GiftType9A.Pokemon => GetPokemon(),
|
||||
_ => GetItems(),
|
||||
};
|
||||
}
|
||||
|
||||
private PokemonGift GetPokemon()
|
||||
{
|
||||
var species = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(SpeciesOffset));
|
||||
var pid = BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(PIDOffset));
|
||||
var tid = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(TIDOffset));
|
||||
var sid = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(SIDOffset));
|
||||
var pidtype = (ShinyType9)Data![ShinyTypeOffset] switch
|
||||
{
|
||||
ShinyType9.ShinyLocked => PIDType.RandomPID,
|
||||
ShinyType9.ShinyRandom => PIDType.RandomPID,
|
||||
ShinyType9.ShinyStar => PIDType.FixedPID,
|
||||
ShinyType9.ShinySquare => PIDType.FixedPID,
|
||||
ShinyType9.Fixed => PIDType.FixedPID,
|
||||
_ => throw new ArgumentOutOfRangeException(),
|
||||
};
|
||||
var shinytype = (ShinyType9)Data![ShinyTypeOffset] switch
|
||||
{
|
||||
ShinyType9.ShinyLocked => ShinyType.ShinyLocked,
|
||||
ShinyType9.ShinyRandom => ShinyType.ShinyPossible,
|
||||
ShinyType9.ShinyStar or ShinyType9.ShinySquare => ShinyType.ShinyForced,
|
||||
ShinyType9.Fixed => PokemonGift.IsShiny(pid, tid, sid) ? ShinyType.ShinyForced :
|
||||
PokemonGift.IsTIDAbusePossible(tid, sid, pidtype) ? ShinyType.ShinyTIDAbuse : ShinyType.ShinyLocked,
|
||||
_ => throw new ArgumentOutOfRangeException(),
|
||||
};
|
||||
|
||||
return new PokemonGift
|
||||
{
|
||||
Species = species,
|
||||
PID = pid,
|
||||
TID = tid,
|
||||
SID = sid,
|
||||
ShinyType = shinytype,
|
||||
PIDType = pidtype,
|
||||
};
|
||||
}
|
||||
|
||||
private List<OtherGift> GetItems()
|
||||
{
|
||||
List<OtherGift> items = new();
|
||||
for (int i = 0; i < MaxItemCount; i++)
|
||||
{
|
||||
ushort item = 0;
|
||||
uint quantity = 0;
|
||||
uint opt = 0;
|
||||
var type = (GiftType9A)Type!;
|
||||
|
||||
if (type is GiftType9A.Clothing)
|
||||
{
|
||||
item = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i)));
|
||||
opt = BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i)));
|
||||
}
|
||||
else
|
||||
{
|
||||
item = type is GiftType9A.Flag ? BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(FlagItemOffset + (0x04 * i))) :
|
||||
BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i)));
|
||||
quantity = type is GiftType9A.Flag ? BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(FlagItemQuantityOffset + (0x04 * i))) :
|
||||
BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(QuantityOffset + (0x04 * i)));
|
||||
}
|
||||
|
||||
var gift = new OtherGift
|
||||
{
|
||||
Type = type,
|
||||
Item = item,
|
||||
Quantity = quantity,
|
||||
Opt = opt,
|
||||
};
|
||||
|
||||
if ((type is not GiftType9A.Clothing && gift.Item != ushort.MinValue) || (type is GiftType9A.Clothing && item != ushort.MaxValue))
|
||||
items.Add(gift);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public override bool IsChecksumValid()
|
||||
{
|
||||
if (Data is not null)
|
||||
{
|
||||
var oldChecksum = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(ChecksumOffset));
|
||||
var span = Data.ToArray().AsSpan();
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(span[ChecksumOffset..], 0x0);
|
||||
var newchecksum = ChecksumCalculator.CalcCcittFalse(span);
|
||||
if (oldChecksum == newchecksum)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void UpdateChecksum()
|
||||
{
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(ChecksumOffset), 0x0);
|
||||
var checksum = ChecksumCalculator.CalcCcittFalse(Data.AsSpan());
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(ChecksumOffset), checksum);
|
||||
}
|
||||
|
||||
public override void SetID(ushort wcid)
|
||||
{
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(WondercardIDOffset), wcid);
|
||||
WCID = wcid;
|
||||
UpdateChecksum();
|
||||
}
|
||||
|
||||
public override void SetRepeatable(bool repeatable)
|
||||
{
|
||||
Data![FlagOffset] = (byte)((Data![FlagOffset] & ~1) | (repeatable ? 0 : 1));
|
||||
IsRepeatable = repeatable;
|
||||
UpdateChecksum();
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ public class WB7 : Wondercard
|
|||
private const int SIDOffset = 0x272;
|
||||
private const int SpeciesOffset = 0x28A;
|
||||
private const int ShinyTypeOffset = 0x2AB;
|
||||
private const int PIDOffset = 0x2DC;
|
||||
private const int PIDOffset = 0xD4;
|
||||
private const int ChecksumOffset = 0x202;
|
||||
|
||||
public WB7(ReadOnlySpan<byte> data) : base(data)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public class WC9 : Wondercard
|
|||
var pid = BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(PIDOffset));
|
||||
var tid = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(TIDOffset));
|
||||
var sid = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(SIDOffset));
|
||||
var test = (ShinyType9)Data![ShinyTypeOffset];
|
||||
var pidtype = (ShinyType9)Data![ShinyTypeOffset] switch
|
||||
{
|
||||
ShinyType9.ShinyLocked => PIDType.RandomPID,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace SwitchGiftDataManager.Core;
|
|||
|
||||
public abstract class Wondercard
|
||||
{
|
||||
public static int GenOffset = 0x0F;
|
||||
protected const int MaxItemCount = 6;
|
||||
|
||||
public Games Game { get; }
|
||||
|
|
@ -21,9 +22,8 @@ public abstract class Wondercard
|
|||
WondercardSize.WB7 => Games.LGPE,
|
||||
WondercardSize.WC8 => Games.SWSH,
|
||||
WondercardSize.WB8 => Games.BDSP,
|
||||
WondercardSize.WA8 when data[0x0F] != 0 => Games.PLA,
|
||||
WondercardSize.WC9 when data[0x0F] == 0 && data[0x2C0] == 0 => Games.SCVI,
|
||||
WondercardSize.WA9 when data[0x2C0] != 0 => Games.ZA,
|
||||
WondercardSize.WA8 when data[GenOffset] != 0 => Games.PLA,
|
||||
WondercardSize.WC9 when data[GenOffset] == 0 => Games.SCVI,
|
||||
_ => Games.None,
|
||||
};
|
||||
Data = data.ToArray();
|
||||
|
|
@ -67,7 +67,6 @@ public abstract class Wondercard
|
|||
Games.BDSP => WondercardSize.WB8,
|
||||
Games.PLA => WondercardSize.WA8,
|
||||
Games.SCVI => WondercardSize.WC9,
|
||||
Games.ZA => WondercardSize.WA9,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(game)),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ public enum Games : int
|
|||
BDSP = 3,
|
||||
PLA = 4,
|
||||
SCVI = 5,
|
||||
ZA = 6,
|
||||
}
|
||||
|
||||
public enum WCType
|
||||
|
|
@ -24,7 +23,6 @@ public enum WondercardSize : ushort
|
|||
WB8 = 0x2DC,
|
||||
WA8 = 0x2C8,
|
||||
WC9 = 0x2C8,
|
||||
WA9 = 0x2C8,
|
||||
}
|
||||
|
||||
public enum GiftType7 : byte
|
||||
|
|
@ -73,15 +71,6 @@ public enum GiftType9 : byte
|
|||
Clothing = 4,
|
||||
}
|
||||
|
||||
public enum GiftType9A : byte
|
||||
{
|
||||
None = 0,
|
||||
Pokemon = 1,
|
||||
Item = 2,
|
||||
Flag = 3,
|
||||
Clothing = 4,
|
||||
}
|
||||
|
||||
public enum PIDType
|
||||
{
|
||||
RandomPID,
|
||||
|
|
|
|||
|
|
@ -2230,64 +2230,64 @@ TM168
|
|||
TM169
|
||||
TM170
|
||||
TM171
|
||||
TM172
|
||||
TM173
|
||||
TM174
|
||||
TM175
|
||||
TM176
|
||||
TM177
|
||||
TM178
|
||||
TM179
|
||||
TM180
|
||||
TM181
|
||||
TM182
|
||||
TM183
|
||||
TM184
|
||||
TM185
|
||||
TM186
|
||||
TM187
|
||||
TM188
|
||||
TM189
|
||||
TM190
|
||||
TM191
|
||||
TM192
|
||||
TM193
|
||||
TM194
|
||||
TM195
|
||||
TM196
|
||||
TM197
|
||||
TM198
|
||||
TM199
|
||||
TM200
|
||||
TM201
|
||||
TM202
|
||||
TM203
|
||||
TM204
|
||||
TM205
|
||||
TM206
|
||||
TM207
|
||||
TM208
|
||||
TM209
|
||||
TM210
|
||||
TM211
|
||||
TM212
|
||||
TM213
|
||||
TM214
|
||||
TM215
|
||||
TM216
|
||||
TM217
|
||||
TM218
|
||||
TM219
|
||||
TM220
|
||||
TM221
|
||||
TM222
|
||||
TM223
|
||||
TM224
|
||||
TM225
|
||||
TM226
|
||||
TM227
|
||||
TM228
|
||||
TM229
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -2479,157 +2479,4 @@ Morpeko Snack
|
|||
Poltchageist Powder
|
||||
Fresh-Start Mochi
|
||||
Roto-Stick
|
||||
Glimmering Charm
|
||||
Metal Alloy
|
||||
Indigo Style Card
|
||||
Oddish Leaf
|
||||
Tentacool Stinger
|
||||
Doduo Down
|
||||
Seel Fur
|
||||
Exeggcute Shell
|
||||
Tyrogue Sweat
|
||||
Rhyhorn Fang
|
||||
Horsea Ink
|
||||
Elekid Fur
|
||||
Magby Hair
|
||||
Lapras Teardrop
|
||||
Porygon Fragment
|
||||
Chinchou Sparks
|
||||
Snubbull Hair
|
||||
Skarmory Feather
|
||||
Smeargle Paint
|
||||
Plusle Fur
|
||||
Minun Fur
|
||||
Trapinch Shell
|
||||
Beldum Claw
|
||||
Cranidos Spike
|
||||
Shieldon Claw
|
||||
Blitzle Mane Hair
|
||||
Drilbur Claw
|
||||
Cottonee Fluff
|
||||
Scraggy Sweat
|
||||
Minccino Fur
|
||||
Solosis Gel
|
||||
Joltik Thread
|
||||
Golett Shard
|
||||
Espurr Fur
|
||||
Inkay Ink
|
||||
Pikipek Feather
|
||||
Dewpider Thread
|
||||
Comfey Flower
|
||||
Minior Shell
|
||||
Milcery Cream
|
||||
Duraludon Tarnish
|
||||
Articuno Treat
|
||||
Zapdos Treat
|
||||
Moltres Treat
|
||||
Raikou Treat
|
||||
Entei Treat
|
||||
Suicune Treat
|
||||
Lugia Treat
|
||||
Ho-Oh Treat
|
||||
Latias Treat
|
||||
Latios Treat
|
||||
Kyogre Treat
|
||||
Groudon Treat
|
||||
Rayquaza Treat
|
||||
Cobalion Treat
|
||||
Terrakion Treat
|
||||
Virizion Treat
|
||||
Reshiram Treat
|
||||
Zekrom Treat
|
||||
Kyurem Treat
|
||||
Solgaleo Treat
|
||||
Lunala Treat
|
||||
Necrozma Treat
|
||||
Kubfu Treat
|
||||
Glastrier Treat
|
||||
Spectrier Treat
|
||||
Indigo Disk
|
||||
Fiery Pick
|
||||
Stellar Tera Shard
|
||||
Mythical Pecha Berry
|
||||
Blueberry Tablecloth
|
||||
Blueberry Chairs
|
||||
Synchro Machine
|
||||
Meteorite
|
||||
Scarlet Book
|
||||
Violet Book
|
||||
Briar’s Book
|
||||
Seed of Mastery
|
||||
Clefablite
|
||||
Victreebelite
|
||||
Starminite
|
||||
Dragoninite
|
||||
Meganiumite
|
||||
Feraligite
|
||||
Skarmorite
|
||||
Froslassite
|
||||
|
||||
|
||||
Emboarite
|
||||
Excadrite
|
||||
Scolipite
|
||||
Scraftinite
|
||||
Eelektrossite
|
||||
Chandelurite
|
||||
Chesnaughtite
|
||||
Delphoxite
|
||||
Greninjite
|
||||
Pyroarite
|
||||
Floettite
|
||||
Malamarite
|
||||
Barbaracite
|
||||
Dragalgite
|
||||
Hawluchanite
|
||||
Zygardite
|
||||
Drampanite
|
||||
|
||||
Falinksite
|
||||
Key to Room 202
|
||||
Super Lumiose Galette
|
||||
Lab Key Card A
|
||||
Lab Key Card B
|
||||
Lab Key Card C
|
||||
|
||||
|
||||
Pebble
|
||||
Cherished Ring
|
||||
Autographed Plush
|
||||
Tasty Trash
|
||||
Revitalizing Twig
|
||||
Lida’s Things
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mega Shard
|
||||
Colorful Screw
|
||||
Red Canari Plush
|
||||
Red Canari Plush
|
||||
Red Canari Plush
|
||||
Gold Canari Plush
|
||||
Gold Canari Plush
|
||||
Gold Canari Plush
|
||||
Pink Canari Plush
|
||||
Pink Canari Plush
|
||||
Pink Canari Plush
|
||||
Green Canari Plush
|
||||
Green Canari Plush
|
||||
Green Canari Plush
|
||||
Blue Canari Plush
|
||||
Blue Canari Plush
|
||||
Blue Canari Plush
|
||||
Glimmering Charm
|
||||
|
|
@ -8061,8 +8061,6 @@ Pika-Vee Case
|
|||
|
||||
|
||||
|
||||
Scarlet Case
|
||||
Violet Case
|
||||
|
||||
|
||||
|
||||
|
|
@ -8073,7 +8071,9 @@ Violet Case
|
|||
|
||||
|
||||
|
||||
Neo-Kitakami Case
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
---
|
||||
None
|
||||
Bulbasaur
|
||||
Ivysaur
|
||||
Venusaur
|
||||
|
|
@ -1011,16 +1011,8 @@ Clodsire
|
|||
Annihilape
|
||||
Ogerpon
|
||||
Dipplin
|
||||
Hydrapple
|
||||
Okidogi
|
||||
Munkidori
|
||||
Fezandipiti
|
||||
Gouging Fire
|
||||
Raging Bolt
|
||||
Iron Crown
|
||||
Iron Boulder
|
||||
Terapagos
|
||||
Pecharunt
|
||||
Archaludon
|
||||
Poltchageist
|
||||
Sinistcha
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Authors>Manu098vm</Authors>
|
||||
<Copyright>Copyright (C) 2024 Manu098vm</Copyright>
|
||||
<Copyright>Copyright (C) 2022 Manu098vm</Copyright>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageTags>pokemon; mystery gift; wondercard; reader; nintendo; bcat; event injection;</PackageTags>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
|
|
|
|||
43
SwitchGiftDataManager.WinForm/MainWindow.Designer.cs
generated
43
SwitchGiftDataManager.WinForm/MainWindow.Designer.cs
generated
|
|
@ -62,7 +62,6 @@ partial class MainWindow
|
|||
ToolsToolStripMenu = new ToolStripMenuItem();
|
||||
MenuItemMGDB = new ToolStripMenuItem();
|
||||
toolTipRedemptionMethod = new ToolTip(components);
|
||||
BtnZA = new Button();
|
||||
GrpBCAT.SuspendLayout();
|
||||
GrpContent.SuspendLayout();
|
||||
ContextMenuStripWC.SuspendLayout();
|
||||
|
|
@ -77,7 +76,7 @@ partial class MainWindow
|
|||
BtnLGPE.FlatStyle = FlatStyle.Flat;
|
||||
BtnLGPE.Location = new Point(5, 37);
|
||||
BtnLGPE.Name = "BtnLGPE";
|
||||
BtnLGPE.Size = new Size(111, 60);
|
||||
BtnLGPE.Size = new Size(136, 60);
|
||||
BtnLGPE.TabIndex = 0;
|
||||
BtnLGPE.TabStop = false;
|
||||
BtnLGPE.Text = "LGPE";
|
||||
|
|
@ -90,9 +89,9 @@ partial class MainWindow
|
|||
BtnSWSH.AccessibleName = "";
|
||||
BtnSWSH.Cursor = Cursors.Hand;
|
||||
BtnSWSH.FlatStyle = FlatStyle.Flat;
|
||||
BtnSWSH.Location = new Point(122, 37);
|
||||
BtnSWSH.Location = new Point(147, 37);
|
||||
BtnSWSH.Name = "BtnSWSH";
|
||||
BtnSWSH.Size = new Size(111, 60);
|
||||
BtnSWSH.Size = new Size(136, 60);
|
||||
BtnSWSH.TabIndex = 1;
|
||||
BtnSWSH.TabStop = false;
|
||||
BtnSWSH.Text = "SWSH";
|
||||
|
|
@ -105,9 +104,9 @@ partial class MainWindow
|
|||
BtnBDSP.AccessibleName = "";
|
||||
BtnBDSP.Cursor = Cursors.Hand;
|
||||
BtnBDSP.FlatStyle = FlatStyle.Flat;
|
||||
BtnBDSP.Location = new Point(239, 37);
|
||||
BtnBDSP.Location = new Point(289, 37);
|
||||
BtnBDSP.Name = "BtnBDSP";
|
||||
BtnBDSP.Size = new Size(111, 60);
|
||||
BtnBDSP.Size = new Size(136, 60);
|
||||
BtnBDSP.TabIndex = 2;
|
||||
BtnBDSP.TabStop = false;
|
||||
BtnBDSP.Text = "BDSP";
|
||||
|
|
@ -120,9 +119,9 @@ partial class MainWindow
|
|||
BtnSCVI.AccessibleName = "";
|
||||
BtnSCVI.Cursor = Cursors.Hand;
|
||||
BtnSCVI.FlatStyle = FlatStyle.Flat;
|
||||
BtnSCVI.Location = new Point(473, 37);
|
||||
BtnSCVI.Location = new Point(573, 37);
|
||||
BtnSCVI.Name = "BtnSCVI";
|
||||
BtnSCVI.Size = new Size(111, 60);
|
||||
BtnSCVI.Size = new Size(136, 60);
|
||||
BtnSCVI.TabIndex = 3;
|
||||
BtnSCVI.TabStop = false;
|
||||
BtnSCVI.Text = "SCVI";
|
||||
|
|
@ -135,9 +134,9 @@ partial class MainWindow
|
|||
BtnPLA.AccessibleName = "";
|
||||
BtnPLA.Cursor = Cursors.Hand;
|
||||
BtnPLA.FlatStyle = FlatStyle.Flat;
|
||||
BtnPLA.Location = new Point(356, 37);
|
||||
BtnPLA.Location = new Point(431, 37);
|
||||
BtnPLA.Name = "BtnPLA";
|
||||
BtnPLA.Size = new Size(111, 60);
|
||||
BtnPLA.Size = new Size(136, 60);
|
||||
BtnPLA.TabIndex = 4;
|
||||
BtnPLA.TabStop = false;
|
||||
BtnPLA.Text = "PLA";
|
||||
|
|
@ -149,6 +148,7 @@ partial class MainWindow
|
|||
ListBoxWC.AllowDrop = true;
|
||||
ListBoxWC.DrawMode = DrawMode.OwnerDrawFixed;
|
||||
ListBoxWC.FormattingEnabled = true;
|
||||
ListBoxWC.ItemHeight = 20;
|
||||
ListBoxWC.Location = new Point(7, 96);
|
||||
ListBoxWC.Name = "ListBoxWC";
|
||||
ListBoxWC.Size = new Size(214, 304);
|
||||
|
|
@ -196,7 +196,7 @@ partial class MainWindow
|
|||
GrpBCAT.Enabled = false;
|
||||
GrpBCAT.Location = new Point(5, 103);
|
||||
GrpBCAT.Name = "GrpBCAT";
|
||||
GrpBCAT.Size = new Size(696, 409);
|
||||
GrpBCAT.Size = new Size(704, 409);
|
||||
GrpBCAT.TabIndex = 8;
|
||||
GrpBCAT.TabStop = false;
|
||||
GrpBCAT.Text = "BCAT Manager";
|
||||
|
|
@ -404,7 +404,7 @@ partial class MainWindow
|
|||
MenuStrip.Items.AddRange(new ToolStripItem[] { ToolsToolStripMenu });
|
||||
MenuStrip.Location = new Point(0, 0);
|
||||
MenuStrip.Name = "MenuStrip";
|
||||
MenuStrip.Size = new Size(709, 28);
|
||||
MenuStrip.Size = new Size(715, 28);
|
||||
MenuStrip.TabIndex = 9;
|
||||
MenuStrip.Text = "menuStrip1";
|
||||
//
|
||||
|
|
@ -432,28 +432,12 @@ partial class MainWindow
|
|||
toolTipRedemptionMethod.ToolTipIcon = ToolTipIcon.Info;
|
||||
toolTipRedemptionMethod.ToolTipTitle = "Redemption Date";
|
||||
//
|
||||
// BtnZA
|
||||
//
|
||||
BtnZA.AccessibleDescription = "";
|
||||
BtnZA.AccessibleName = "";
|
||||
BtnZA.Cursor = Cursors.Hand;
|
||||
BtnZA.FlatStyle = FlatStyle.Flat;
|
||||
BtnZA.Location = new Point(590, 37);
|
||||
BtnZA.Name = "BtnZA";
|
||||
BtnZA.Size = new Size(111, 60);
|
||||
BtnZA.TabIndex = 10;
|
||||
BtnZA.TabStop = false;
|
||||
BtnZA.Text = "ZA";
|
||||
BtnZA.UseVisualStyleBackColor = true;
|
||||
BtnZA.Click += BtnZA_Click;
|
||||
//
|
||||
// MainWindow
|
||||
//
|
||||
AllowDrop = true;
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(709, 518);
|
||||
Controls.Add(BtnZA);
|
||||
ClientSize = new Size(715, 518);
|
||||
Controls.Add(MenuStrip);
|
||||
Controls.Add(GrpBCAT);
|
||||
Controls.Add(BtnPLA);
|
||||
|
|
@ -514,5 +498,4 @@ partial class MainWindow
|
|||
private Label lblRedemptionMethod;
|
||||
private ToolTip toolTipRedemptionMethod;
|
||||
private ComboBox cmbRedemptionMethod;
|
||||
private Button BtnZA;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
|
|
|
|||
66
SwitchGiftDataManager.WinForm/MgdbForm.Designer.cs
generated
66
SwitchGiftDataManager.WinForm/MgdbForm.Designer.cs
generated
|
|
@ -1,66 +0,0 @@
|
|||
namespace SwitchGiftDataManager.WinForm
|
||||
{
|
||||
partial class MgdbForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MgdbForm));
|
||||
lblMessage = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lblMessage
|
||||
//
|
||||
lblMessage.AutoSize = true;
|
||||
lblMessage.Location = new Point(94, 9);
|
||||
lblMessage.Name = "lblMessage";
|
||||
lblMessage.Size = new Size(190, 20);
|
||||
lblMessage.TabIndex = 0;
|
||||
lblMessage.Text = "Downloading, please wait...";
|
||||
//
|
||||
// MgdbForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(392, 37);
|
||||
ControlBox = false;
|
||||
Controls.Add(lblMessage);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
MaximizeBox = false;
|
||||
MinimizeBox = false;
|
||||
Name = "MgdbForm";
|
||||
ShowInTaskbar = false;
|
||||
StartPosition = FormStartPosition.Manual;
|
||||
Text = "Mystery Gift Database";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label lblMessage;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SwitchGiftDataManager.WinForm;
|
||||
|
||||
public partial class MgdbForm : Form
|
||||
{
|
||||
public MgdbForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Shown += (s, e) => Task.Run(async () => await DownloadRepoMGDB()).Wait();
|
||||
}
|
||||
|
||||
private async Task DownloadRepoMGDB()
|
||||
{
|
||||
var url = "https://github.com/projectpokemon/EventsGallery/archive/refs/heads/master.zip";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var path = Path.Combine(Environment.CurrentDirectory, "tmp");
|
||||
var mgdbPath = Path.Combine(Environment.CurrentDirectory, "mgdb");
|
||||
|
||||
//Delete old residual files if exist
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path, true);
|
||||
|
||||
if (Directory.Exists(mgdbPath))
|
||||
Directory.Delete(mgdbPath, true);
|
||||
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
var zipPath = Path.Combine(path, "tmp.zip");
|
||||
using (var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead))
|
||||
{
|
||||
var totalBytes = response.Content.Headers.ContentLength ?? 0;
|
||||
using (var content = await response.Content.ReadAsStreamAsync())
|
||||
using (var stream = new FileStream(zipPath, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
var buffer = new byte[8192];
|
||||
int bytesRead;
|
||||
long totalRead = 0;
|
||||
while ((bytesRead = await content.ReadAsync(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
await stream.WriteAsync(buffer, 0, bytesRead);
|
||||
totalRead += bytesRead;
|
||||
if (totalBytes > 0)
|
||||
{
|
||||
double progressPercentage = (double)totalRead / totalBytes * 100;
|
||||
lblMessage.Text = $"Download progress: {progressPercentage:F2}%";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lblMessage.Text = $"Extracting files...";
|
||||
ZipFile.ExtractToDirectory(zipPath, path);
|
||||
File.Delete(zipPath);
|
||||
|
||||
var tmpMgbdPath = Path.Combine(path, "EventsGallery-master");
|
||||
|
||||
lblMessage.Text = $"Cleaning up residual files...";
|
||||
File.Delete(Path.Combine(tmpMgbdPath, ".gitignore"));
|
||||
Directory.Delete(Path.Combine(tmpMgbdPath, "Extras"), true);
|
||||
Directory.Delete(Path.Combine(tmpMgbdPath, "Unreleased"), true);
|
||||
Directory.Delete(Path.Combine(tmpMgbdPath, "PKHeX Legality"), true);
|
||||
|
||||
var genPath = Path.Combine(tmpMgbdPath, "Released");
|
||||
Directory.Delete(Path.Combine(genPath, "Gen 1"), true);
|
||||
Directory.Delete(Path.Combine(genPath, "Gen 2"), true);
|
||||
Directory.Delete(Path.Combine(genPath, "Gen 3"), true);
|
||||
Directory.Delete(Path.Combine(genPath, "Gen 4"), true);
|
||||
Directory.Delete(Path.Combine(genPath, "Gen 5"), true);
|
||||
Directory.Delete(Path.Combine(genPath, "Gen 6"), true);
|
||||
|
||||
var gen7Path = Path.Combine(genPath, "Gen 7");
|
||||
Directory.Delete(Path.Combine(gen7Path, "3DS"), true);
|
||||
Directory.Delete(Path.Combine(Path.Combine(gen7Path, "Switch"), "Wondercard Records"), true);
|
||||
|
||||
var swshPath = Path.Combine(Path.Combine(genPath, "Gen 8"), "SwSh");
|
||||
Directory.Delete(Path.Combine(swshPath, "Wild Area Events"), true);
|
||||
|
||||
var svPath = Path.Combine(genPath, "Gen 9", "SV");
|
||||
Directory.Delete(Path.Combine(svPath, "Raid Events"), true);
|
||||
Directory.Delete(Path.Combine(svPath, "Outbreak Events"), true);
|
||||
|
||||
Directory.Move(tmpMgbdPath, mgdbPath);
|
||||
Directory.Delete(path, true);
|
||||
|
||||
this.FormClosed += (s, e) => MessageBox.Show($"The Mystery Gift Database has been downloaded in {mgdbPath}", "MGDB",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
|
||||
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net7.0-windows\publish\win-x86\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-08-14T11:01:52.2006498Z;True|2023-06-06T22:08:02.8282040+02:00;True|2023-04-30T17:53:05.5959766+02:00;False|2023-04-30T17:52:03.7561171+02:00;True|2023-04-30T17:51:26.5642099+02:00;False|2023-04-30T17:50:29.6287729+02:00;False|2023-04-30T17:49:48.8628113+02:00;False|2023-04-30T17:49:13.6423153+02:00;False|2023-04-30T17:49:07.1768896+02:00;True|2023-04-10T17:45:17.0563608+02:00;False|2023-04-10T17:45:05.3801595+02:00;True|2023-04-10T17:44:52.3050457+02:00;False|2023-04-10T17:43:42.2422643+02:00;False|2023-04-10T17:42:40.9947818+02:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net7.0-windows\win-x64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<SelfContained>false</SelfContained>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-08-14T19:28:20.2713749Z;True|2023-08-14T21:25:34.3082675+02:00;True|2023-08-14T21:25:27.1522351+02:00;True|2023-08-14T21:00:06.6523582+02:00;True|2023-08-14T20:58:07.2152740+02:00;True|2023-08-14T20:57:44.9836572+02:00;True|2023-08-14T13:02:48.6507319+02:00;True|2023-06-06T22:06:44.0906717+02:00;True|2023-04-30T17:47:33.6719153+02:00;False|2023-04-30T17:47:20.2017341+02:00;True|2023-04-10T17:33:26.3077827+02:00;False|2023-04-10T17:32:43.9169969+02:00;True|2023-01-28T16:01:40.5830936+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-01-28T14:44:59.9510590Z;True|2023-01-23T20:01:57.3824432+01:00;False|2023-01-23T20:00:42.5423966+01:00;True|2023-01-23T19:57:25.6949583+01:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
|
||||
<Authors>Manu098vm</Authors>
|
||||
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
|
||||
<Copyright>Copyright (C) 2024 Manu098vm</Copyright>
|
||||
<Copyright>Copyright (C) 2022 Manu098vm</Copyright>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageTags>pokemon; mystery gift; wondercard; reader; nintendo; bcat; event injection;</PackageTags>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user