Skip to content

Commit

Permalink
fixed build script and some color bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown6656 committed Sep 22, 2024
1 parent ff8e43b commit debfc5c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 23 deletions.
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
################################################################
# Auto-generated 2024-09-23 00:06:21.373 #
# Auto-generated 2024-09-23 00:18:36.902 #
# ANY CHANGES TO THIS DOCUMENT WILL BE LOST UPON RE-GENERATION #
################################################################
#
# git commit: 8312ce66bcf57074cebec0171c6a3dbeb45e781a
version: 1.0.31.8811
# git commit: f86513de8827a2546bd714eec75b92f733d615a7
version: 1.0.35.8811
image: Visual Studio 2022
configuration: Release
install:
- ps: Invoke-WebRequest "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile ".\lib\install-dotnet.ps1"
- ps: Invoke-WebRequest "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile ".\install-dotnet.ps1"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
- ps: '.\lib\install-dotnet.ps1 -Version "9.0.100-rc.1.24452.12" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath'
- ps: '.\install-dotnet.ps1 -Version "9.0.100-rc.1.24452.12" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath'
- ps: $env:Path += ";$env:DOTNET_INSTALL_DIR"
before_build:
#- cmd: nuget restore "Unknown6656.Console.sln"
Expand Down
16 changes: 8 additions & 8 deletions src/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

//////////////////////////////////////////////////////////////////////////
// Auto-generated 2024-09-23 00:06:21.373 //
// Auto-generated 2024-09-23 00:18:36.902 //
// ANY CHANGES TO THIS DOCUMENT WILL BE LOST UPON RE-GENERATION //
//////////////////////////////////////////////////////////////////////////

using System.Reflection;
using System;

[assembly: AssemblyVersion("1.0.31.8811")]
[assembly: AssemblyFileVersion("1.0.31.8811")]
[assembly: AssemblyInformationalVersion("v.1.0.31.8811, commit: 8312ce66bcf57074cebec0171c6a3dbeb45e781a")]
[assembly: AssemblyVersion("1.0.35.8811")]
[assembly: AssemblyFileVersion("1.0.35.8811")]
[assembly: AssemblyInformationalVersion("v.1.0.35.8811, commit: f86513de8827a2546bd714eec75b92f733d615a7")]
[assembly: AssemblyCompany("Unknown6656")]
[assembly: AssemblyCopyright("Copyright © 2020 - 2024, Unknown6656")]
[assembly: AssemblyProduct("Unknown6656.Console by Unknown6656")]
Expand Down Expand Up @@ -37,11 +37,11 @@ public static class __module__
/// <summary>
/// The library's current version.
/// </summary>
public static Version? LibraryVersion { get; } = Version.Parse("1.0.31.8811");
public static Version? LibraryVersion { get; } = Version.Parse("1.0.35.8811");
/// <summary>
/// The Git hash associated with the current build.
/// </summary>
public const string GitHash = "8312ce66bcf57074cebec0171c6a3dbeb45e781a";
public const string GitHash = "f86513de8827a2546bd714eec75b92f733d615a7";
/// <summary>
/// The name of the GitHub repository associated with <see cref="RepositoryURL"/>.
/// </summary>
Expand All @@ -51,7 +51,7 @@ public static class __module__
/// </summary>
public const string RepositoryURL = "https://github.com/Unknown6656-Megacorp/Unknown6656.Console";
/// <summary>
/// The date and time of the current build (2024-09-23 00:06:21.373).
/// The date and time of the current build (2024-09-23 00:18:36.902).
/// </summary>
public static DateTime DateBuilt { get; } = DateTime.FromFileTimeUtc(0x01db0d3ba8335b69L);
public static DateTime DateBuilt { get; } = DateTime.FromFileTimeUtc(0x01db0d3d5e9c3b5dL);
}
30 changes: 24 additions & 6 deletions src/ConsoleColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ public string GetVT520SGRCode(ColorMode mode)
.StringJoin(";");

#pragma warning disable CS8509 // The switch expression does not handle all possible values of its input type (it is not exhaustive).
#pragma warning disable CS8524 // The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value.
if (_color is null)
return mode switch
{
Expand All @@ -474,15 +475,31 @@ public string GetVT520SGRCode(ColorMode mode)
};
else if (_color.Is(out sysconsolecolor color))
{
int colvalue = (int)color;
(int lo, int hi) = mode switch
(string bg, string fg) = color switch
{
ColorMode.Foreground => (30, 90),
ColorMode.Background => (40, 100),
ColorMode.Underline => throw new ArgumentException($"Underline color in combination with '{typeof(sysconsolecolor)}' is not supported in VT520.", nameof(mode)),
sysconsolecolor.Black => ("40", "30"),
sysconsolecolor.DarkBlue => ("44", "34"),
sysconsolecolor.DarkGreen => ("42", "32"),
sysconsolecolor.DarkCyan => ("46", "36"),
sysconsolecolor.DarkRed => ("41", "31"),
sysconsolecolor.DarkMagenta => ("45", "35"),
sysconsolecolor.DarkYellow => ("43", "33"),
sysconsolecolor.Gray => ("47", "37"),
sysconsolecolor.DarkGray => ("100", "90"),
sysconsolecolor.Blue => ("104", "94"),
sysconsolecolor.Green => ("102", "92"),
sysconsolecolor.Cyan => ("106", "96"),
sysconsolecolor.Red => ("101", "91"),
sysconsolecolor.Magenta => ("105", "95"),
sysconsolecolor.Yellow => ("103", "93"),
sysconsolecolor.White => ("107", "97"),
};

return (colvalue + (colvalue < 8 ? lo : hi - 8)).ToString();
return mode switch
{
ColorMode.Foreground => fg,
ColorMode.Background => bg,
};
}
else if (_color.Is(out Color rgb))
return $"{mode switch
Expand All @@ -493,6 +510,7 @@ public string GetVT520SGRCode(ColorMode mode)
}};2;{rgb.R};{rgb.G};{rgb.B}";
else
throw new InvalidOperationException($"Invalid color type '{_color}'.");
#pragma warning restore CS8524
#pragma warning restore CS8509
}

Expand Down
4 changes: 2 additions & 2 deletions util/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ public static class __module__
image: Visual Studio 2022
configuration: Release
install:
- ps: Invoke-WebRequest "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile ".\lib\install-dotnet.ps1"
- ps: Invoke-WebRequest "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile ".\install-dotnet.ps1"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
- ps: '.\lib\install-dotnet.ps1 {(DOTNET_PREVIEW ? "-Channel Preview" : "")} -Version "{DOTNET_VERSION}" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath'
- ps: '.\install-dotnet.ps1 {(DOTNET_PREVIEW ? "-Channel Preview" : "")} -Version "{DOTNET_VERSION}" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath'
- ps: $env:Path += ";$env:DOTNET_INSTALL_DIR"
before_build:
#- cmd: nuget restore "{Path.GetRelativePath(dir_reporoot.FullName, path_sln.FullName).Replace('\\', '/')}"
Expand Down
4 changes: 2 additions & 2 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.0.31.8811
8312ce66bcf57074cebec0171c6a3dbeb45e781a
1.0.35.8811
f86513de8827a2546bd714eec75b92f733d615a7

0 comments on commit debfc5c

Please sign in to comment.