Renamed Tomas.Common to Tomas.Core

- Imported CSTNet parser to kernal under Globalization namespace
- Added System.Diagnostics to global usings
- Split version systems between kernal and terminal emulator (see changelog)
This commit is contained in:
Tony Bark 2023-01-07 11:22:38 -05:00
parent 7b56b93edd
commit dc2176b26d
20 changed files with 300 additions and 28 deletions

View file

@ -0,0 +1 @@
0.1

View file

@ -1,2 +1,4 @@
global using System.Diagnostics.CodeAnalysis;
global using System.Diagnostics;
global using Tomas.Common.Programs;
global using Tomas.Interface;

View file

@ -6,10 +6,9 @@ namespace Tomas.Terminal.Programs;
public class About : IProgram
{
public bool Run(IShell shell)
{
Console.WriteLine($"{SysMeta.NAME} Terminal Emulator v{SysMeta.BuildNumber}{Environment.NewLine}"
+ "TOMAS (Tony's Managed Operating System) is a operating system written in C# using the COSMOS framework.");
return true;
}
public bool Run(IShell shell)
{
Console.WriteLine($"{TermMeta.NAME} Terminal Emulator v{TermMeta.VERSION}");
return true;
}
}

View file

@ -0,0 +1,48 @@
// I license this project under the BSD 3-Clause license.
// See the LICENSE file in the project root for more information.
using System.Text;
namespace Tomas.Common;
/// <summary>
/// System metdata, such as name, version and build number.
/// </summary>
public struct TermMeta
{
/// <summary>
/// The name of the operating system.
/// </summary>
public const string NAME = "TOMAS Emulator";
/// <summary>
/// The version of the operating system, in the Calendar Versioning format: "yy.minor.patch".
/// The year, minor, and patch version numbers are automatically extracted from the Git repository
/// using the ThisAssembly.Git.SemVer object.
/// </summary>
public const string VERSION = $"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}";
/// <summary>
/// The build number of the operating system, generated from the commit hash.
/// The build number is a 6-digit number, with the first 3 digits being the first 3 digits of the commit hash
/// converted to a uint, and the last 3 digits being the last 3 digits of the commit hash converted to a uint.
/// </summary>
public static string BuildNumber = $"Build {BuildNumFromCommit}";
/// <summary>
/// Generates the build number from the commit hash.
/// </summary>
/// <returns>The build number as a uint.</returns>
static uint BuildNumFromCommit
{
get
{
// Get the bytes of the commit hash as a UTF-8 encoded string
var commit = Encoding.UTF8.GetBytes(ThisAssembly.Git.Commit);
// Convert the first 4 bytes of the commit hash to a uint and return it modulo 1000000
// (this will give us a 6-digit number with the first 3 digits being the first 3 digits of the commit hash
// and the last 3 digits being the last 3 digits of the commit hash)
return BitConverter.ToUInt32(commit, 0) % 1000000;
}
}
}

View file

@ -8,7 +8,15 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Tomas.Common\Tomas.Common.csproj" />
<PackageReference Include="GitInfo" Version="2.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NLua" Version="1.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tomas.Core\Tomas.Core.csproj" />
<ProjectReference Include="..\Tomas.Interface\Tomas.Interface.csproj" />
</ItemGroup>