Skip to content

Commit

Permalink
dev - Started development of 0.0.24.24 to update librari...
Browse files Browse the repository at this point in the history
...es

---

Type: dev
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Apr 27, 2024
1 parent 87c2baa commit 4fda81f
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 232 deletions.
88 changes: 0 additions & 88 deletions KSTests/Console/ConsoleColorsInfoInitializationTests.cs

This file was deleted.

25 changes: 6 additions & 19 deletions KSTests/InitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,14 @@
//

using System;

// Kernel Simulator Copyright (C) 2018-2022 Aptivi
//
// This file is part of Kernel Simulator
//
// Kernel Simulator is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Kernel Simulator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using System.IO;
using System.Reflection;
using KS.Files;
using KS.Files.Querying;
using KS.Login;
using KS.Misc.Configuration;
using NUnit.Framework;
using Terminaux.Base.Checks;

namespace KSTests
{
Expand All @@ -56,6 +40,9 @@ public class InitTest
[OneTimeSetUp]
public static void ReadyEverything()
{
var asm = Assembly.GetEntryAssembly();
if (asm is not null)
ConsoleChecker.AddToCheckWhitelist(asm);
Paths.InitPaths();
if (!Checking.FileExists(Paths.GetKernelPath(KernelPathType.Configuration)))
{
Expand Down Expand Up @@ -108,4 +95,4 @@ public static void CleanEverything()
}

}
}
}
2 changes: 1 addition & 1 deletion KSTests/KSTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<OutputPath>KSTest\</OutputPath>
<Version>0.0.24.23</Version>
<Version>0.0.24.24</Version>
<Configurations>Debug;Release;Debug-dotnet;Release-dotnet</Configurations>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
10 changes: 5 additions & 5 deletions Kernel Simulator/BootMetadata.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[
{
"OverrideTitle": "Kernel Simulator 0.0.24.23",
"OverrideTitle": "Kernel Simulator 0.0.24.24",
"Arguments": []
},
{
"OverrideTitle": "Kernel Simulator 0.0.24.23 - args",
"OverrideTitle": "Kernel Simulator 0.0.24.24 - args",
"Arguments": [ "args" ]
},
{
"OverrideTitle": "Kernel Simulator 0.0.24.23 - debug",
"OverrideTitle": "Kernel Simulator 0.0.24.24 - debug",
"Arguments": [ "debug" ]
},
{
"OverrideTitle": "Kernel Simulator 0.0.24.23 - test shell",
"OverrideTitle": "Kernel Simulator 0.0.24.24 - test shell",
"Arguments": [ "testInteractive" ]
},
{
"OverrideTitle": "Kernel Simulator 0.0.24.23 - force on small console",
"OverrideTitle": "Kernel Simulator 0.0.24.24 - force on small console",
"Arguments": [ "bypasssizedetection" ]
}
]
26 changes: 20 additions & 6 deletions Kernel Simulator/ConsoleBase/Inputs/Styles/ChoiceStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//

using System;
using System.Collections.Generic;
using Terminaux.Inputs;


// Kernel Simulator Copyright (C) 2018-2022 Aptivi
//
Expand Down Expand Up @@ -53,10 +56,8 @@ public static class ChoiceStyle
/// <param name="AnswersStr">Set of answers. They can be written like this: Y/N/C.</param>
/// <param name="OutputType">Output type of choices</param>
/// <param name="PressEnter">When enabled, allows the input to consist of multiple characters</param>
public static string PromptChoice(string Question, string AnswersStr, ChoiceOutputType OutputType = ChoiceOutputType.OneLine, bool PressEnter = false)
{
return PromptChoice(Question, AnswersStr, [], OutputType, PressEnter);
}
public static string PromptChoice(string Question, string AnswersStr, ChoiceOutputType OutputType = ChoiceOutputType.OneLine, bool PressEnter = false) =>
PromptChoice(Question, AnswersStr, [], OutputType, PressEnter);

/// <summary>
/// Prompts user for choice
Expand All @@ -68,8 +69,21 @@ public static string PromptChoice(string Question, string AnswersStr, ChoiceOutp
/// <param name="PressEnter">When enabled, allows the input to consist of multiple characters</param>
public static string PromptChoice(string Question, string AnswersStr, string[] AnswersTitles, ChoiceOutputType OutputType = ChoiceOutputType.OneLine, bool PressEnter = false)
{
return TermChoiceStyle.PromptChoice(Question, AnswersStr, AnswersTitles, OutputType, PressEnter);
// Variables
var answerSplit = AnswersStr.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
var finalChoices = new List<InputChoiceInfo>();

// Check to see if the answer titles are the same
if (answerSplit.Length > AnswersTitles.Length)
Array.Resize(ref AnswersTitles, answerSplit.Length);
if (AnswersTitles.Length > answerSplit.Length)
Array.Resize(ref answerSplit, AnswersTitles.Length);

// Now, populate choice information from the arrays
for (int i = 0; i < answerSplit.Length; i++)
finalChoices.Add(new InputChoiceInfo(answerSplit[i] ?? $"[{i + 1}]", AnswersTitles[i] ?? $"[{i + 1}]"));
return TermChoiceStyle.PromptChoice(Question, [.. finalChoices], OutputType, PressEnter);
}

}
}
}
26 changes: 20 additions & 6 deletions Kernel Simulator/ConsoleBase/Inputs/Styles/SelectionStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//

using System;
using System.Collections.Generic;
using Terminaux.Inputs;


// Kernel Simulator Copyright (C) 2018-2022 Aptivi
//
Expand Down Expand Up @@ -48,10 +51,8 @@ public static class SelectionStyle
/// </summary>
/// <param name="Question">A question</param>
/// <param name="AnswersStr">Set of answers. They can be written like this: Y/N/C.</param>
public static int PromptSelection(string Question, string AnswersStr)
{
return PromptSelection(Question, AnswersStr, []);
}
public static int PromptSelection(string Question, string AnswersStr) =>
PromptSelection(Question, AnswersStr, []);

/// <summary>
/// Prompts user for Selection
Expand All @@ -61,8 +62,21 @@ public static int PromptSelection(string Question, string AnswersStr)
/// <param name="AnswersTitles">Working titles for each answer. It must be the same amount as the answers.</param>
public static int PromptSelection(string Question, string AnswersStr, string[] AnswersTitles)
{
return TermSelectionStyle.PromptSelection(Question, AnswersStr, AnswersTitles);
// Variables
var answerSplit = AnswersStr.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
var finalChoices = new List<InputChoiceInfo>();

// Check to see if the answer titles are the same
if (answerSplit.Length > AnswersTitles.Length)
Array.Resize(ref AnswersTitles, answerSplit.Length);
if (AnswersTitles.Length > answerSplit.Length)
Array.Resize(ref answerSplit, AnswersTitles.Length);

// Now, populate choice information from the arrays
for (int i = 0; i < answerSplit.Length; i++)
finalChoices.Add(new InputChoiceInfo(answerSplit[i] ?? $"[{i + 1}]", AnswersTitles[i] ?? $"[{i + 1}]"));
return TermSelectionStyle.PromptSelection(Question, [.. finalChoices]);
}

}
}
}
21 changes: 8 additions & 13 deletions Kernel Simulator/Files/Interactive/FileManagerCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class FileManagerCli : BaseInteractiveTui<FileSystemInfo>, IInteractiveTu
/// <summary>
/// File manager bindings
/// </summary>
public override List<InteractiveTuiBinding> Bindings { get; set; } =
public override InteractiveTuiBinding[] Bindings { get; } =
[
new("Open", ConsoleKey.Enter, default, (info, _) => Open((FileSystemInfo)info)),
new("Copy", ConsoleKey.F1, default, (info, _) => CopyFileOrDir((FileSystemInfo)info)),
Expand Down Expand Up @@ -134,24 +134,21 @@ public override IEnumerable<FileSystemInfo> SecondaryDataSource
public override bool AcceptsEmptyData => true;

/// <inheritdoc/>
public override void RenderStatus(FileSystemInfo item)
public override string GetStatusFromItem(FileSystemInfo item)
{
// Check to see if we're given the file system info
if (item is null)
{
InteractiveTuiStatus.Status = Translate.DoTranslation("No info.");
return;
}
return Translate.DoTranslation("No info.");

// Now, populate the info to the status
try
{
bool infoIsDirectory = Checking.FolderExists(item.FullName);
InteractiveTuiStatus.Status = $"[{(infoIsDirectory ? "/" : "*")}] {item.Name}";
return $"[{(infoIsDirectory ? "/" : "*")}] {item.Name}";
}
catch (Exception ex)
{
InteractiveTuiStatus.Status = ex.Message;
return ex.Message;
}
}

Expand Down Expand Up @@ -190,15 +187,14 @@ private static void Open(FileSystemInfo currentFileSystemInfo)
if (InteractiveTuiStatus.CurrentPane == 2)
{
((FileManagerCli)Instance).secondPanePath = Filesystem.NeutralizePath(currentFileSystemInfo.FullName.ToString() + "/");
InteractiveTuiStatus.SecondPaneCurrentSelection = 1;
((FileManagerCli)Instance).refreshSecondPaneListing = true;
}
else
{
((FileManagerCli)Instance).firstPanePath = Filesystem.NeutralizePath(currentFileSystemInfo.FullName.ToString() + "/");
InteractiveTuiStatus.FirstPaneCurrentSelection = 1;
((FileManagerCli)Instance).refreshFirstPaneListing = true;
}
InteractiveTuiTools.SelectionMovement(Instance, 1);
}
}
catch (Exception ex)
Expand All @@ -215,15 +211,14 @@ private static void GoUp()
if (InteractiveTuiStatus.CurrentPane == 2)
{
((FileManagerCli)Instance).secondPanePath = Filesystem.NeutralizePath(((FileManagerCli)Instance).secondPanePath + "/..");
InteractiveTuiStatus.SecondPaneCurrentSelection = 1;
((FileManagerCli)Instance).refreshSecondPaneListing = true;
}
else
{
((FileManagerCli)Instance).firstPanePath = Filesystem.NeutralizePath(((FileManagerCli)Instance).firstPanePath + "/..");
InteractiveTuiStatus.FirstPaneCurrentSelection = 1;
((FileManagerCli)Instance).refreshFirstPaneListing = true;
}
InteractiveTuiTools.SelectionMovement(Instance, 1);
}

private static void PrintFileSystemInfo(FileSystemInfo currentFileSystemInfo)
Expand Down Expand Up @@ -371,7 +366,7 @@ private static void GoTo()
path = Filesystem.NeutralizePath(path, ((FileManagerCli)Instance).firstPanePath);
if (Checking.FolderExists(path))
{
InteractiveTuiStatus.FirstPaneCurrentSelection = 1;
InteractiveTuiTools.SelectionMovement(Instance, 1);
((FileManagerCli)Instance).firstPanePath = path;
((FileManagerCli)Instance).refreshFirstPaneListing = true;
}
Expand Down
10 changes: 5 additions & 5 deletions Kernel Simulator/Kernel Simulator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<ApplicationIcon>OfficialAppIcon-KernelSimulator-256.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Version>0.0.24.23</Version>
<PackageVersion>0.0.24.23</PackageVersion>
<FileVersion>2.1.24.20</FileVersion>
<Version>0.0.24.24</Version>
<PackageVersion>0.0.24.24</PackageVersion>
<FileVersion>2.1.24.24</FileVersion>
<DebugSymbols>true</DebugSymbols>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand Down Expand Up @@ -98,9 +98,9 @@
<PackageReference Include="SpecProbe" Version="1.4.2" />
<PackageReference Include="SSH.NET" Version="2023.0.1" />
<PackageReference Include="StringMath" Version="4.1.2" />
<PackageReference Include="Terminaux" Version="3.0.0" />
<PackageReference Include="Terminaux" Version="3.4.1" />
<PackageReference Include="Terminaux.ResizeListener" Version="3.0.0" />
<PackageReference Include="Textify.Offline.Data" Version="1.4.0" />
<PackageReference Include="Textify.Offline.Data.Analysis" Version="1.7.0" />
<PackageReference Include="UnitsNet" Version="5.43.0" />
</ItemGroup>
<!-- KS Dependencies Information End -->
Expand Down
Loading

0 comments on commit 4fda81f

Please sign in to comment.