mirror of
https://github.com/tonytins/tomas.git
synced 2025-03-15 04:11:24 +00:00
Renamed ComConsts to SysMeta
- With the help of ChatGPT, some of the code is now properly commented - Switched to calendar versioning due to the huge time skip and architectural changes - Screenshot!
This commit is contained in:
parent
e44f7e8f95
commit
2634cc8de4
12 changed files with 86 additions and 51 deletions
12
Changelog.md
12
Changelog.md
|
@ -1,8 +1,16 @@
|
|||
# Change Log
|
||||
|
||||
## 0.1.0
|
||||
## v23.0
|
||||
|
||||
- Calendar versioning, `YY.MINOR.MICRO`
|
||||
|
||||
- Build number based on commit hash
|
||||
|
||||
Due to the huge time skip and architectural changes, I've (retroactively) switched to calendar versioning with ``v0.1`` now known as ``v20.1`` as well.
|
||||
|
||||
## v20.1
|
||||
|
||||
- Filesystem (based on the Cosmos Wiki [guide](https://csos-guide-to-cosmos.fandom.com/wiki/Getting_Started_-_Materials_and_Setting_Up))
|
||||
- Proper versioning (thanks to Gitinfo!)
|
||||
- Semantic versioning
|
||||
- Replaced BasicApp with AboutApp
|
||||
- Removd TerminalCancelEventArgs and everything related to it
|
10
README.md
10
README.md
|
@ -1,5 +1,7 @@
|
|||
# TOMAS
|
||||
|
||||

|
||||
|
||||
TOMAS (**To**ny's **Ma**naged Operating **S**ystem) is a hobby operating system based on the [COSMOS](https://github.com/CosmosOS/Cosmos) framework that comes with a respective terminal emulator.
|
||||
|
||||
## Requirements
|
||||
|
@ -7,13 +9,11 @@ TOMAS (**To**ny's **Ma**naged Operating **S**ystem) is a hobby operating system
|
|||
### Prerequisites
|
||||
|
||||
- Operating System
|
||||
- Visual Studio 2022
|
||||
- COSMOS User Kit v2022 or later
|
||||
- VMWare Workstation Player
|
||||
- Visual Studio 2022
|
||||
- COSMOS User Kit v2022 or later
|
||||
- VMWare Workstation Player
|
||||
- .NET 6 or later
|
||||
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the BSD 3-Clause license - see the [LICENSE](LICENSE) file for details.
|
||||
|
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -1,29 +0,0 @@
|
|||
// 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;
|
||||
|
||||
public struct ComConsts
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the operating system
|
||||
/// </summary>
|
||||
public const string NAME = "TOMAS";
|
||||
public const string VERSION = $"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}";
|
||||
|
||||
[SuppressMessage("Usage", "CA2211:Non-constant fields should not be visible")]
|
||||
public static string BuildNumber = $"Build {BuildFromCommit}";
|
||||
|
||||
/// <summary>
|
||||
/// Generate the build number from the commit hash.
|
||||
/// </summary>
|
||||
static uint BuildFromCommit
|
||||
{
|
||||
get
|
||||
{
|
||||
var commit = Encoding.UTF8.GetBytes(ThisAssembly.Git.Commit);
|
||||
return BitConverter.ToUInt32(commit, 0) % 1000000;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
0.1
|
||||
23.0
|
54
src/Tomas.Common/SysMeta.cs
Normal file
54
src/Tomas.Common/SysMeta.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
// 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 SysMeta
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the operating system.
|
||||
/// </summary>
|
||||
public const string NAME = "TOMAS";
|
||||
|
||||
/// <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>
|
||||
[SuppressMessage("Usage", "CA2211:Non-constant fields should not be visible")]
|
||||
public static string BuildNumber = $"Build {BuildNumFromCommit}";
|
||||
|
||||
/// <summary>
|
||||
/// Let's the system know that the file system is activated.
|
||||
/// </summary>
|
||||
public static bool IsFSActive = false;
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
global using Tomas.Common.Programs;
|
||||
global using Tomas.Interface;
|
||||
global using Tomas.Kernel.Programs;
|
||||
global using Cosmos.System.FileSystem;
|
||||
global using Cosmos.System.FileSystem.VFS;
|
||||
global using Tomas.Common;
|
||||
global using Os = Cosmos.System;
|
|
@ -14,13 +14,6 @@ public class Kernel : Os.Kernel
|
|||
|
||||
protected override void Run()
|
||||
{
|
||||
/*
|
||||
Console.Write("$");
|
||||
var input = Console.ReadLine();
|
||||
Console.Write("Text typed: ");
|
||||
Console.WriteLine(input);
|
||||
*/
|
||||
|
||||
while (true)
|
||||
{
|
||||
var shell = new Shell();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// I license this project under the BSD 3-Clause license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using Tomas.Common;
|
||||
|
||||
namespace Tomas.Kernel.Programs;
|
||||
|
||||
|
@ -8,7 +7,7 @@ public class About : IProgram
|
|||
{
|
||||
public bool Run(IShell shell)
|
||||
{
|
||||
Console.WriteLine($"TOMAS v{ComConsts.VERSION} ({ComConsts.BuildNumber}) is a hobby operating system written in C# using the COSMOS framework.{Environment.NewLine}Commands:");
|
||||
Console.WriteLine($"TOMAS v{SysMeta.VERSION} ({SysMeta.BuildNumber}) is a hobby operating system written in C# using the COSMOS framework.{Environment.NewLine}Commands:");
|
||||
var progs = shell.Programs;
|
||||
foreach (var commands in progs.Keys)
|
||||
Console.WriteLine(commands);
|
||||
|
|
|
@ -5,8 +5,11 @@ namespace Tomas.Kernel;
|
|||
|
||||
public class Shell : IShell
|
||||
{
|
||||
// The symbol to display before the cursor when the shell is waiting for user input
|
||||
const char SYMBOL = '$';
|
||||
|
||||
// A dictionary containing the programs available to the shell, with the keys being the program names
|
||||
// and the values being the program objects
|
||||
public Dictionary<string, IProgram> Programs => new()
|
||||
{
|
||||
{"about", new About() },
|
||||
|
@ -15,13 +18,20 @@ public class Shell : IShell
|
|||
{"commands", new Commands() }
|
||||
};
|
||||
|
||||
// A property that allows the shell to read a line of input from the user
|
||||
public string ReadLine
|
||||
{
|
||||
get
|
||||
{
|
||||
// Write the SYMBOL character to the console
|
||||
Console.Write(SYMBOL);
|
||||
|
||||
// Read a line of input from the user
|
||||
var readl = Console.ReadLine();
|
||||
|
||||
// Return the line of input
|
||||
return readl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
// I license this project under the BSD 3-Clause license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using Cosmos.System.FileSystem;
|
||||
using Cosmos.System.FileSystem.VFS;
|
||||
using Tomas.Common;
|
||||
|
||||
namespace Tomas.Kernel;
|
||||
|
||||
|
@ -21,7 +18,7 @@ class TomFS
|
|||
Console.WriteLine("Creating system files.");
|
||||
fs.CreateFile($"{SYSTEM_DIR}sysinfo.txt");
|
||||
Console.WriteLine("Setting system preferences.");
|
||||
File.WriteAllText($"{SYSTEM_DIR}sysinfo.txt", $"{ComConsts.NAME}, {ComConsts.BuildNumber}");
|
||||
File.WriteAllText($"{SYSTEM_DIR}sysinfo.txt", $"{SysMeta.NAME} v{SysMeta.VERSION} ({SysMeta.BuildNumber})");
|
||||
Console.WriteLine("File system loaded sucesfully.");
|
||||
var intro = File.ReadAllText($"{SYSTEM_DIR}sysinfo.txt");
|
||||
Console.WriteLine(intro);
|
||||
|
|
|
@ -8,7 +8,7 @@ public class About : IProgram
|
|||
{
|
||||
public bool Run(IShell shell)
|
||||
{
|
||||
Console.WriteLine($"{ComConsts.NAME} Terminal Emulator v{ComConsts.BuildNumber}{Environment.NewLine}"
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue