Skip to content

Commit

Permalink
Merge pull request #176 from PhantomGamers/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomGamers authored Nov 20, 2023
2 parents 7abf79f + b6d437b commit e40799d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
dotnet-version: 7.x
cache: true
cache-dependency-path: '**/packages.lock.json'
- run: dotnet restore --locked-mode
- name: Set OS_ARG environment variable
run: |
if ("${{ runner.os }}" -eq "Windows") {
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
dotnet-version: 7.x
cache: true
cache-dependency-path: '**/packages.lock.json'
- run: dotnet restore --locked-mode
- name: Set OS_ARG environment variable
run: |
if ("${{ runner.os }}" -eq "Windows") {
Expand Down
19 changes: 17 additions & 2 deletions SFP/Models/Utils.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#region

using System.Diagnostics;
using System.Drawing;

#endregion

Expand Down Expand Up @@ -63,12 +64,26 @@ public static List<string> GetCommandLine(Process? process)
return new List<string>();
}

// ReSharper disable once InconsistentNaming
public static string ConvertARGBtoRGBA(string argb)
{
if (argb.Length != 9 || !argb.StartsWith("#"))
if (!argb.StartsWith("#"))
{
throw new ArgumentException("Invalid ARGB format");
var color = Color.FromName(argb);
if (color is { A: 0, R: 0, G: 0, B: 0 })
{
Log.Logger.Warn("Could not get color from {ColorName}", argb);
return argb;
}
argb = $"#{color.ToArgb():x8}";
}

if (argb.Length is not 9)
{
Log.Logger.Warn("Could not convert {ColorName} to RGBA, unexpected format", argb);
return argb;
}

var alpha = argb.Substring(1, 2);
var rgb = argb[3..];
return "#" + rgb + alpha;
Expand Down

0 comments on commit e40799d

Please sign in to comment.