-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from NerosoftDev/develop
Develop
- Loading branch information
Showing
25 changed files
with
3,826 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Pack | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Restore dependencies | ||
run: dotnet restore Starfish.Build.slnf | ||
- name: Build | ||
run: dotnet build Starfish.Build.slnf --no-restore --configuration Release | ||
- name: Pack | ||
run: dotnet pack Starfish.Build.slnf -c Release -o artifacts/ | ||
- name: Publish NuGet | ||
run: dotnet nuget push artifacts/*.nupkg --api-key ${{secrets.NUGET_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Globalization; | ||
|
||
namespace Nerosoft.Starfish.Common; | ||
/// <summary> | ||
/// Provides some helper methods to work with async methods. | ||
/// </summary> | ||
public static class AsyncHelper | ||
{ | ||
private static readonly TaskFactory _factory = new(CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Default); | ||
|
||
public static TResult RunSync<TResult>(Func<Task<TResult>> func) | ||
{ | ||
var cultureUi = CultureInfo.CurrentUICulture; | ||
var culture = CultureInfo.CurrentCulture; | ||
return _factory.StartNew(() => | ||
{ | ||
Thread.CurrentThread.CurrentCulture = culture; | ||
Thread.CurrentThread.CurrentUICulture = cultureUi; | ||
return func(); | ||
}).Unwrap().GetAwaiter().GetResult(); | ||
} | ||
|
||
public static void RunSync(Func<Task> func) | ||
{ | ||
var cultureUi = CultureInfo.CurrentUICulture; | ||
var culture = CultureInfo.CurrentCulture; | ||
_factory.StartNew(() => | ||
{ | ||
Thread.CurrentThread.CurrentCulture = culture; | ||
Thread.CurrentThread.CurrentUICulture = cultureUi; | ||
return func(); | ||
}).Unwrap().GetAwaiter().GetResult(); | ||
} | ||
} |
Oops, something went wrong.