From 2d42b0f83a1dceb540d8f569fbc75cfe42fad15b Mon Sep 17 00:00:00 2001 From: Lannamokia Date: Fri, 8 Aug 2025 14:58:38 +0800 Subject: [PATCH] first commit --- .github/workflows/build.yml | 78 +++++++++++++ MainWindow.xaml | 78 +++++++++++++ MainWindow.xaml.cs | 210 +++++++++++++++++++++++++++++++++ Program.cs | 25 ++++ README.md | 81 +++++++++++++ StartupManager.cs | 71 ++++++++++++ VHDManager.cs | 225 ++++++++++++++++++++++++++++++++++++ VHDMounter.csproj | 14 +++ app.manifest | 11 ++ build.bat | 28 +++++ run_as_admin.bat | 34 ++++++ 11 files changed, 855 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 MainWindow.xaml create mode 100644 MainWindow.xaml.cs create mode 100644 Program.cs create mode 100644 README.md create mode 100644 StartupManager.cs create mode 100644 VHDManager.cs create mode 100644 VHDMounter.csproj create mode 100644 app.manifest create mode 100644 build.bat create mode 100644 run_as_admin.bat diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b4ce082 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,78 @@ +name: Build VHD Mounter + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + release: + types: [ published ] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal + continue-on-error: true + + - name: Publish Windows x64 + run: dotnet publish --configuration Release --runtime win-x64 --self-contained true --output ./publish/win-x64 + + - name: Publish Windows x86 + run: dotnet publish --configuration Release --runtime win-x86 --self-contained true --output ./publish/win-x86 + + - name: Upload Windows x64 artifacts + uses: actions/upload-artifact@v4 + with: + name: VHDMounter-win-x64 + path: ./publish/win-x64/ + + - name: Upload Windows x86 artifacts + uses: actions/upload-artifact@v4 + with: + name: VHDMounter-win-x86 + path: ./publish/win-x86/ + + - name: Create Release Assets + if: github.event_name == 'release' + run: | + Compress-Archive -Path ./publish/win-x64/* -DestinationPath VHDMounter-win-x64.zip + Compress-Archive -Path ./publish/win-x86/* -DestinationPath VHDMounter-win-x86.zip + + - name: Upload Release Assets + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./VHDMounter-win-x64.zip + asset_name: VHDMounter-win-x64.zip + asset_content_type: application/zip + + - name: Upload Release Assets x86 + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./VHDMounter-win-x86.zip + asset_name: VHDMounter-win-x86.zip + asset_content_type: application/zip \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..505bd77 --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +