Skip to content

Commit

Permalink
- ClickOnce manifest stuff
Browse files Browse the repository at this point in the history
- User settings
- Bindings cleanup
  • Loading branch information
pjmagee committed Jun 23, 2024
1 parent 8e818b0 commit 343446e
Show file tree
Hide file tree
Showing 23 changed files with 533 additions and 666 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: Build (dagger)
name: build

on:
push:
branches:
- '**'
- "**"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/Checkout@v4
with:
submodules: 'true'
ref: ${{ github.ref }}
fetch-depth: 0

- name: Build Project with Dagger
uses: dagger/dagger-for-github@v5.6.0
with:
version: "latest"
verb: call
args: build --git=. stdout
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/Checkout@v4
with:
submodules: "true"
ref: ${{ github.ref }}
fetch-depth: 0
- name: Build Project with Dagger
uses: dagger/dagger-for-github@v5.6.0
with:
version: "latest"
verb: call
args: build --git=. stdout
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107 changes: 0 additions & 107 deletions .github/workflows/release-windows-v1.yaml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/release-windows-v2.yaml

This file was deleted.

85 changes: 60 additions & 25 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,68 @@
name: Release (dagger)
name: release

# Workflow with Windows & Linux
# This is so we can use dotnet mage to build the manifests

permissions:
pages: write
contents: write
id-token: write
deployments: write

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- "v[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: write
packages: write
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
release:
if: false # This condition disables the job. Change to `true` or remove to enable.
runs-on: ubuntu-latest

publish:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/Checkout@v4
with:
submodules: 'true'
ref: ${{ github.ref }}
fetch-depth: 0

- name: Release
uses: dagger/dagger-for-github@v5.6.0
with:
version: "latest"
verb: call
args: release --git=. --tag=${{ github.ref_name }} --token=env:GITHUB_TOKEN
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: "true"
fetch-depth: 0
ref: ${{ github.ref }}

- name: Setup .NET 8 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Run release script
run: .\dotnet-mage-release.ps1
continue-on-error: false

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./Heroesprofile.Uploader.Windows/bin/publish

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: published
path: .\Heroesprofile.Uploader.Windows\bin\publish
if-no-files-found: error
retention-days: 1
overwrite: true

- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "./Heroesprofile.Uploader.Windows/bin/publish/**"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
allowUpdates: true
makeLatest: true
replacesArtifacts: true
generateReleaseNotes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 8 additions & 19 deletions Heroesprofile.Uploader.Common/Analyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ public class Analyzer : IAnalyzer

private static Logger _log = LogManager.GetCurrentClassLogger();

/// <summary>
/// Analyze replay locally before uploading
/// </summary>
/// <param name="file">Replay file</param>
public Replay Analyze(ReplayFile file)
{
try {
Expand Down Expand Up @@ -89,29 +85,22 @@ public Replay Analyze(ReplayFile file)
return null;
}

/// <summary>
/// Get unique hash of replay. Compatible with HotsLogs
/// </summary>
/// <param name="replay"></param>
/// <returns></returns>
public string GetFingerprint(Replay replay)
{
var str = new StringBuilder();
replay.Players.Select(p => p.BattleNetId).OrderBy(x => x).Map(x => str.Append(x.ToString()));
str.Append(replay.RandomValue);
var md5 = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(str.ToString()));
var md5 = MD5.HashData(Encoding.UTF8.GetBytes(str.ToString()));
var result = new Guid(md5);
return result.ToString();
}

/// <summary>
/// Swaps two bytes in a byte array
/// </summary>
private void SwapBytes(byte[] buf, int i, int j)
{
byte temp = buf[i];
buf[i] = buf[j];
buf[j] = temp;
}

//private void SwapBytes(byte[] buf, int i, int j)
//{
// byte temp = buf[i];
// buf[i] = buf[j];
// buf[j] = temp;
//}
}
}
16 changes: 15 additions & 1 deletion Heroesprofile.Uploader.Windows/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="Application_Startup"
Exit="Application_Exit" />
Exit="Application_Exit">
<Application.Resources>
<!--
Note that this application does not have a StartupUri declared, so no Window is automatically loaded.
Also, the ShutdownMode was set to explicit, so we have to close the application programmatically
-->
<!-- merge NotifyIcon and related stuff into the application -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="NotifyIconResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</Application.Resources>
</Application>
Loading

0 comments on commit 343446e

Please sign in to comment.