A simple game patcher/launcher built with C# to manage updates and installations for a game. This tool ensures that the game is always up-to-date by checking for version changes and downloading the latest game files when needed.
- Automatic Update Check: Compares local and online versions of the game to determine if an update is required.
- Game Download & Installation: Downloads the game files (ZIP format) and extracts them automatically.
- Dynamic Version Handling: Handles versioning with a simple
major.minor.subminor
format. - Play Button: Launches the game executable once it is installed or updated.
- Retry on Failure: Provides an option to retry the update process if it fails.
- The launcher downloads a version file from a specified URL.
- Compares the downloaded version with the local version stored on the user's machine.
- If the versions differ, it triggers an update.
- Downloads the latest game files (ZIP archive).
- Extracts the ZIP file to a specified folder.
- Locates the game executable (
.exe
) file dynamically. - Updates the local version file after a successful installation.
- Allows the user to launch the game if the installation or update process is successful.
Ensure you have the required .NET version installed to run the application. The version should match the target framework specified in the project's csproj
file (e.g., .NET 6.0
).
To use the patcher, you need to host two files:
- A
Version.txt
file in the formatmajor.minor.subminor
(e.g.,1.0.0
). - A ZIP archive containing the game files.
Both the Version.txt
and the ZIP file must be hosted online with direct download links. Here is an example if you are using Dropbox:
-
Upload Files to Dropbox
- Upload
Version.txt
and your game ZIP file to your Dropbox account.
- Upload
-
Copy the Sharing Link
- On the web app:
Hover over the file you want to share and click the Copy link button.
Alternatively, right-click the file and select Copy link. - In the Dropbox Finder/File Explorer app:
Right-click the file and select Copy Dropbox link.
- On the web app:
-
Modify the Sharing Link
- Paste the copied link into a text editor or browser tab.
For example:https://www.dropbox.com/scl/fi/svmal51kp1qbf0rhnhhq6/Version.txt?rlkey=ubr8jiwyu90w1gzcfowxvx8a3&dl=0
- Replace the
dl=0
at the end of the link withdl=1
to create a direct download link:https://www.dropbox.com/scl/fi/svmal51kp1qbf0rhnhhq6/Version.txt?rlkey=ubr8jiwyu90w1gzcfowxvx8a3&dl=1
- Paste the copied link into a text editor or browser tab.
-
Use the Modified Link in Your Code
private string versionFileURL = "https://www.dropbox.com/scl/fi/svmal51kp1qbf0rhnhhq6/Version.txt?rlkey=ubr8jiwyu90w1gzcfowxvx8a3&dl=1"; private string gameZipURL = "https://www.dropbox.com/scl/fi/svmal51kp1qbf0rhnhhq6/GameFiles.zip?rlkey=ubr8jiwyu90w1gzcfowxvx8a3&dl=1";
- Open the solution in Visual Studio.
- Update the URLs in
MainWindow.xaml.cs
to match your hosted files:private string versionFileURL = "YOUR_VERSION_FILE_URL"; private string gameZipURL = "YOUR_GAME_ZIP_URL";
- Build and run the application.
- After building the solution, the compiled
.exe
file will be located in the following directory:GamePatcher/bin/Debug/net6.0-windows/GamePatcher.exe