Migrated to .NET 6.0

- Switched to file-scoped namespaces
- Enabled Implicit Usings and Nullable

Kernal was migrated too but is unusable, at the moment. Stick with developing or testing from the terminal emulator.
This commit is contained in:
Tony Bark 2021-11-22 17:48:50 -05:00
parent 4f0863f429
commit bdbd8572ea
19 changed files with 233 additions and 264 deletions

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
dotnet: ["3.1.x", "5.0.x"]
dotnet: ["6.0.x"]
os: [windows-latest, ubuntu-latest, macOS-latest]
steps:

View file

@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tomas.Kernel", "Tomas.Kernel\Tomas.Kernel.csproj", "{AF6338C3-342A-4A12-A25C-2D53C5568DA8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tomas.Kernel", "Tomas.Kernel\Tomas.Kernel.csproj", "{AF6338C3-342A-4A12-A25C-2D53C5568DA8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tomas.Common", "Tomas.Common\Tomas.Common.csproj", "{C50F3A6F-CFF4-4725-A1A5-21C5A2BC3321}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tomas.Common", "Tomas.Common\Tomas.Common.csproj", "{C50F3A6F-CFF4-4725-A1A5-21C5A2BC3321}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{59C9B3FC-B1EE-4C23-9BD9-D33074BF1334}"
ProjectSection(SolutionItems) = preProject

View file

@ -1,15 +1,14 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
namespace Tomas.Common
namespace Tomas.Common;
public struct ComConsts
{
public struct ComConsts
{
/// <summary>
/// Name of the operating system
/// </summary>
public const string NAME = "TOMAS";
public static string Version = $"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}";
public static string VersionGit = $"{Version}-{ThisAssembly.Git.Commit}";
}
public const string Version = $"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}";
public const string VersionGit = $"{Version}-{ThisAssembly.Git.Commit}";
}

View file

@ -1,14 +1,12 @@
using System;
using Tomas.Interface;
namespace Tomas.Common.Programs
namespace Tomas.Common.Programs;
public class Clear : IProgram
{
public class Clear : IProgram
{
public bool Run(IShell shell)
{
Console.Clear();
return true;
}
}
}

View file

@ -1,10 +1,9 @@
using System;
using Tomas.Interface;
namespace Tomas.Common.Programs
namespace Tomas.Common.Programs;
public class Commands : IProgram
{
public class Commands : IProgram
{
public bool Run(IShell shell)
{
Console.WriteLine($"Commands:");
@ -13,5 +12,4 @@ namespace Tomas.Common.Programs
Console.WriteLine(commands);
return true;
}
}
}

View file

@ -1,13 +1,12 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using Tomas.Interface;
namespace Tomas.Common.Programs
namespace Tomas.Common.Programs;
public class FenSay : IProgram
{
public class FenSay : IProgram
{
/// <summary>
/// Fennec art by Todd Vargo
@ -38,5 +37,4 @@ namespace Tomas.Common.Programs
Console.WriteLine($"{phrases}{Environment.NewLine}{_fennec}");
return true;
}
}
}

View file

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
@ -9,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2">
<PackageReference Include="GitInfo" Version="2.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View file

@ -1,9 +1,9 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
namespace Tomas.Interface
namespace Tomas.Interface;
public interface IProgram
{
public interface IProgram
{
/// <summary>
/// The program's main entry point. Boolean behaves as an exit point.
/// True and False are the equivalent to C's 0 and 1, i.e. "Success" and "Failure," respectfully.
@ -11,5 +11,4 @@ namespace Tomas.Interface
/// <param name="shell">Allows the program to interact with the shell.</param>
/// <returns>Exit back to shell.</returns>
bool Run(IShell shell);
}
}

View file

@ -1,14 +1,10 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
namespace Tomas.Interface;
using System.Collections.Generic;
namespace Tomas.Interface
public interface IShell
{
public interface IShell
{
string ReadLine { get; }
Dictionary<string, IProgram> Programs { get; }
}
}

View file

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View file

@ -1,14 +1,12 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using Tomas.Common;
using Sys = Cosmos.System;
namespace Tomas.Kernel
namespace Tomas.Kernel;
public class Kernel : Sys.Kernel
{
public class Kernel : Sys.Kernel
{
protected override void BeforeRun()
{
try
@ -62,5 +60,4 @@ namespace Tomas.Kernel
{
Console.WriteLine($"{ComConsts.NAME} is shutting down.");
}
}
}

View file

@ -1,14 +1,12 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using Tomas.Common;
using Tomas.Interface;
namespace Tomas.Kernel.Programs
namespace Tomas.Kernel.Programs;
public class About : IProgram
{
public class About : IProgram
{
public bool Run(IShell shell)
{
Console.WriteLine($"{ComConsts.NAME} v{ComConsts.VersionGit}{Environment.NewLine}"
@ -19,5 +17,4 @@ namespace Tomas.Kernel.Programs
return true;
}
}
}

View file

@ -1,16 +1,14 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using Tomas.Common.Programs;
using Tomas.Interface;
using Tomas.Kernel.Programs;
using Sys = Cosmos.System;
namespace Tomas.Kernel
namespace Tomas.Kernel;
public class Shell : IShell
{
public class Shell : IShell
{
const char SYMBOL = '$';
public Dictionary<string, IProgram> Programs => new Dictionary<string, IProgram>()
@ -30,5 +28,4 @@ namespace Tomas.Kernel
return readl;
}
}
}
}

View file

@ -1,14 +1,12 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using Cosmos.System.FileSystem;
using Cosmos.System.FileSystem.VFS;
namespace Tomas.Kernel
namespace Tomas.Kernel;
class TomFS
{
class TomFS
{
public const string ROOT_DIR = "0:\\";
public static string SYSTEM_DIR = $"{ROOT_DIR}\\SYSTEM\\";
@ -47,5 +45,4 @@ namespace Tomas.Kernel
throw;
}
}
}
}

View file

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RuntimeIdentifier>cosmos</RuntimeIdentifier>
<SelfContained>True</SelfContained>
<BinFormat>ELF</BinFormat>

View file

@ -1,15 +1,9 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using Tomas.Terminal;
namespace Tomas.Terminal
while (true)
{
class Program
{
static void Main()
{
while (true)
{
var shell = new Shell();
var command = shell.ReadLine;
var programs = shell.Programs;
@ -23,6 +17,7 @@ namespace Tomas.Terminal
try
{
var start = program.Run(shell);
switch (start)
{
case true:
@ -36,7 +31,4 @@ namespace Tomas.Terminal
{
Console.WriteLine(err.Message);
}
}
}
}
}

View file

@ -4,15 +4,13 @@ using System;
using Tomas.Common;
using Tomas.Interface;
namespace Tomas.Terminal.Programs
namespace Tomas.Terminal.Programs;
public class About : IProgram
{
public class About : IProgram
{
public bool Run(IShell shell)
{
Console.WriteLine($"{ComConsts.NAME} Terminal Emulator v{ComConsts.VersionGit}{Environment.NewLine}"
+ "TOMAS (Tony's Managed Operating System) is a operating system written in C# using the COSMOS framework.");
Console.WriteLine($"{ComConsts.NAME} (Tony's Managed Operating System) Terminal Emulator v{ComConsts.VersionGit}{Environment.NewLine}");
return true;
}
}
}

View file

@ -1,23 +1,21 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using Tomas.Common.Programs;
using Tomas.Interface;
using Tomas.Terminal.Programs;
namespace Tomas.Terminal
namespace Tomas.Terminal;
public class Shell : IShell
{
public class Shell : IShell
{
const char SYMBOL = '$';
public Dictionary<string, IProgram> Programs => new Dictionary<string, IProgram>()
public Dictionary<string, IProgram> Programs => new()
{
{"about", new About()},
{"fensay", new FenSay()},
{"clear", new Clear()},
{"commands", new Commands()}
{ "about", new About() },
{ "fensay", new FenSay() },
{ "clear", new Clear() },
{ "commands", new Commands() }
};
public string ReadLine
@ -26,8 +24,7 @@ namespace Tomas.Terminal
{
Console.Write(SYMBOL);
var readl = Console.ReadLine();
return readl;
}
return readl!;
}
}
}

View file

@ -2,9 +2,9 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>8</LangVersion>
<Nullable>warnings</Nullable>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>