Skip to content

Commit 4fda81f

Browse files
committed
dev - Started development of 0.0.24.24 to update librari...
...es --- Type: dev Breaking: False Doc Required: False Part: 1/1
1 parent 87c2baa commit 4fda81f

File tree

16 files changed

+114
-232
lines changed

16 files changed

+114
-232
lines changed

KSTests/Console/ConsoleColorsInfoInitializationTests.cs

-88
This file was deleted.

KSTests/InitTest.cs

+6-19
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,14 @@
1818
//
1919

2020
using System;
21-
22-
// Kernel Simulator Copyright (C) 2018-2022 Aptivi
23-
//
24-
// This file is part of Kernel Simulator
25-
//
26-
// Kernel Simulator is free software: you can redistribute it and/or modify
27-
// it under the terms of the GNU General Public License as published by
28-
// the Free Software Foundation, either version 3 of the License, or
29-
// (at your option) any later version.
30-
//
31-
// Kernel Simulator is distributed in the hope that it will be useful,
32-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
33-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34-
// GNU General Public License for more details.
35-
//
36-
// You should have received a copy of the GNU General Public License
37-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
38-
3921
using System.IO;
22+
using System.Reflection;
4023
using KS.Files;
4124
using KS.Files.Querying;
4225
using KS.Login;
4326
using KS.Misc.Configuration;
4427
using NUnit.Framework;
28+
using Terminaux.Base.Checks;
4529

4630
namespace KSTests
4731
{
@@ -56,6 +40,9 @@ public class InitTest
5640
[OneTimeSetUp]
5741
public static void ReadyEverything()
5842
{
43+
var asm = Assembly.GetEntryAssembly();
44+
if (asm is not null)
45+
ConsoleChecker.AddToCheckWhitelist(asm);
5946
Paths.InitPaths();
6047
if (!Checking.FileExists(Paths.GetKernelPath(KernelPathType.Configuration)))
6148
{
@@ -108,4 +95,4 @@ public static void CleanEverything()
10895
}
10996

11097
}
111-
}
98+
}

KSTests/KSTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<IsCodedUITest>False</IsCodedUITest>
1818
<TestProjectType>UnitTest</TestProjectType>
1919
<OutputPath>KSTest\</OutputPath>
20-
<Version>0.0.24.23</Version>
20+
<Version>0.0.24.24</Version>
2121
<Configurations>Debug;Release;Debug-dotnet;Release-dotnet</Configurations>
2222
</PropertyGroup>
2323
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Kernel Simulator/BootMetadata.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
[
22
{
3-
"OverrideTitle": "Kernel Simulator 0.0.24.23",
3+
"OverrideTitle": "Kernel Simulator 0.0.24.24",
44
"Arguments": []
55
},
66
{
7-
"OverrideTitle": "Kernel Simulator 0.0.24.23 - args",
7+
"OverrideTitle": "Kernel Simulator 0.0.24.24 - args",
88
"Arguments": [ "args" ]
99
},
1010
{
11-
"OverrideTitle": "Kernel Simulator 0.0.24.23 - debug",
11+
"OverrideTitle": "Kernel Simulator 0.0.24.24 - debug",
1212
"Arguments": [ "debug" ]
1313
},
1414
{
15-
"OverrideTitle": "Kernel Simulator 0.0.24.23 - test shell",
15+
"OverrideTitle": "Kernel Simulator 0.0.24.24 - test shell",
1616
"Arguments": [ "testInteractive" ]
1717
},
1818
{
19-
"OverrideTitle": "Kernel Simulator 0.0.24.23 - force on small console",
19+
"OverrideTitle": "Kernel Simulator 0.0.24.24 - force on small console",
2020
"Arguments": [ "bypasssizedetection" ]
2121
}
2222
]

Kernel Simulator/ConsoleBase/Inputs/Styles/ChoiceStyle.cs

+20-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
//
1919

2020
using System;
21+
using System.Collections.Generic;
22+
using Terminaux.Inputs;
23+
2124

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

6162
/// <summary>
6263
/// Prompts user for choice
@@ -68,8 +69,21 @@ public static string PromptChoice(string Question, string AnswersStr, ChoiceOutp
6869
/// <param name="PressEnter">When enabled, allows the input to consist of multiple characters</param>
6970
public static string PromptChoice(string Question, string AnswersStr, string[] AnswersTitles, ChoiceOutputType OutputType = ChoiceOutputType.OneLine, bool PressEnter = false)
7071
{
71-
return TermChoiceStyle.PromptChoice(Question, AnswersStr, AnswersTitles, OutputType, PressEnter);
72+
// Variables
73+
var answerSplit = AnswersStr.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
74+
var finalChoices = new List<InputChoiceInfo>();
75+
76+
// Check to see if the answer titles are the same
77+
if (answerSplit.Length > AnswersTitles.Length)
78+
Array.Resize(ref AnswersTitles, answerSplit.Length);
79+
if (AnswersTitles.Length > answerSplit.Length)
80+
Array.Resize(ref answerSplit, AnswersTitles.Length);
81+
82+
// Now, populate choice information from the arrays
83+
for (int i = 0; i < answerSplit.Length; i++)
84+
finalChoices.Add(new InputChoiceInfo(answerSplit[i] ?? $"[{i + 1}]", AnswersTitles[i] ?? $"[{i + 1}]"));
85+
return TermChoiceStyle.PromptChoice(Question, [.. finalChoices], OutputType, PressEnter);
7286
}
7387

7488
}
75-
}
89+
}

Kernel Simulator/ConsoleBase/Inputs/Styles/SelectionStyle.cs

+20-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
//
1919

2020
using System;
21+
using System.Collections.Generic;
22+
using Terminaux.Inputs;
23+
2124

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

5657
/// <summary>
5758
/// Prompts user for Selection
@@ -61,8 +62,21 @@ public static int PromptSelection(string Question, string AnswersStr)
6162
/// <param name="AnswersTitles">Working titles for each answer. It must be the same amount as the answers.</param>
6263
public static int PromptSelection(string Question, string AnswersStr, string[] AnswersTitles)
6364
{
64-
return TermSelectionStyle.PromptSelection(Question, AnswersStr, AnswersTitles);
65+
// Variables
66+
var answerSplit = AnswersStr.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
67+
var finalChoices = new List<InputChoiceInfo>();
68+
69+
// Check to see if the answer titles are the same
70+
if (answerSplit.Length > AnswersTitles.Length)
71+
Array.Resize(ref AnswersTitles, answerSplit.Length);
72+
if (AnswersTitles.Length > answerSplit.Length)
73+
Array.Resize(ref answerSplit, AnswersTitles.Length);
74+
75+
// Now, populate choice information from the arrays
76+
for (int i = 0; i < answerSplit.Length; i++)
77+
finalChoices.Add(new InputChoiceInfo(answerSplit[i] ?? $"[{i + 1}]", AnswersTitles[i] ?? $"[{i + 1}]"));
78+
return TermSelectionStyle.PromptSelection(Question, [.. finalChoices]);
6579
}
6680

6781
}
68-
}
82+
}

Kernel Simulator/Files/Interactive/FileManagerCli.cs

+8-13
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class FileManagerCli : BaseInteractiveTui<FileSystemInfo>, IInteractiveTu
6464
/// <summary>
6565
/// File manager bindings
6666
/// </summary>
67-
public override List<InteractiveTuiBinding> Bindings { get; set; } =
67+
public override InteractiveTuiBinding[] Bindings { get; } =
6868
[
6969
new("Open", ConsoleKey.Enter, default, (info, _) => Open((FileSystemInfo)info)),
7070
new("Copy", ConsoleKey.F1, default, (info, _) => CopyFileOrDir((FileSystemInfo)info)),
@@ -134,24 +134,21 @@ public override IEnumerable<FileSystemInfo> SecondaryDataSource
134134
public override bool AcceptsEmptyData => true;
135135

136136
/// <inheritdoc/>
137-
public override void RenderStatus(FileSystemInfo item)
137+
public override string GetStatusFromItem(FileSystemInfo item)
138138
{
139139
// Check to see if we're given the file system info
140140
if (item is null)
141-
{
142-
InteractiveTuiStatus.Status = Translate.DoTranslation("No info.");
143-
return;
144-
}
141+
return Translate.DoTranslation("No info.");
145142

146143
// Now, populate the info to the status
147144
try
148145
{
149146
bool infoIsDirectory = Checking.FolderExists(item.FullName);
150-
InteractiveTuiStatus.Status = $"[{(infoIsDirectory ? "/" : "*")}] {item.Name}";
147+
return $"[{(infoIsDirectory ? "/" : "*")}] {item.Name}";
151148
}
152149
catch (Exception ex)
153150
{
154-
InteractiveTuiStatus.Status = ex.Message;
151+
return ex.Message;
155152
}
156153
}
157154

@@ -190,15 +187,14 @@ private static void Open(FileSystemInfo currentFileSystemInfo)
190187
if (InteractiveTuiStatus.CurrentPane == 2)
191188
{
192189
((FileManagerCli)Instance).secondPanePath = Filesystem.NeutralizePath(currentFileSystemInfo.FullName.ToString() + "/");
193-
InteractiveTuiStatus.SecondPaneCurrentSelection = 1;
194190
((FileManagerCli)Instance).refreshSecondPaneListing = true;
195191
}
196192
else
197193
{
198194
((FileManagerCli)Instance).firstPanePath = Filesystem.NeutralizePath(currentFileSystemInfo.FullName.ToString() + "/");
199-
InteractiveTuiStatus.FirstPaneCurrentSelection = 1;
200195
((FileManagerCli)Instance).refreshFirstPaneListing = true;
201196
}
197+
InteractiveTuiTools.SelectionMovement(Instance, 1);
202198
}
203199
}
204200
catch (Exception ex)
@@ -215,15 +211,14 @@ private static void GoUp()
215211
if (InteractiveTuiStatus.CurrentPane == 2)
216212
{
217213
((FileManagerCli)Instance).secondPanePath = Filesystem.NeutralizePath(((FileManagerCli)Instance).secondPanePath + "/..");
218-
InteractiveTuiStatus.SecondPaneCurrentSelection = 1;
219214
((FileManagerCli)Instance).refreshSecondPaneListing = true;
220215
}
221216
else
222217
{
223218
((FileManagerCli)Instance).firstPanePath = Filesystem.NeutralizePath(((FileManagerCli)Instance).firstPanePath + "/..");
224-
InteractiveTuiStatus.FirstPaneCurrentSelection = 1;
225219
((FileManagerCli)Instance).refreshFirstPaneListing = true;
226220
}
221+
InteractiveTuiTools.SelectionMovement(Instance, 1);
227222
}
228223

229224
private static void PrintFileSystemInfo(FileSystemInfo currentFileSystemInfo)
@@ -371,7 +366,7 @@ private static void GoTo()
371366
path = Filesystem.NeutralizePath(path, ((FileManagerCli)Instance).firstPanePath);
372367
if (Checking.FolderExists(path))
373368
{
374-
InteractiveTuiStatus.FirstPaneCurrentSelection = 1;
369+
InteractiveTuiTools.SelectionMovement(Instance, 1);
375370
((FileManagerCli)Instance).firstPanePath = path;
376371
((FileManagerCli)Instance).refreshFirstPaneListing = true;
377372
}

Kernel Simulator/Kernel Simulator.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
<ApplicationIcon>OfficialAppIcon-KernelSimulator-256.ico</ApplicationIcon>
4545
<ApplicationManifest>app.manifest</ApplicationManifest>
4646
<GenerateDocumentationFile>True</GenerateDocumentationFile>
47-
<Version>0.0.24.23</Version>
48-
<PackageVersion>0.0.24.23</PackageVersion>
49-
<FileVersion>2.1.24.20</FileVersion>
47+
<Version>0.0.24.24</Version>
48+
<PackageVersion>0.0.24.24</PackageVersion>
49+
<FileVersion>2.1.24.24</FileVersion>
5050
<DebugSymbols>true</DebugSymbols>
5151
<PlatformTarget>AnyCPU</PlatformTarget>
5252
</PropertyGroup>
@@ -98,9 +98,9 @@
9898
<PackageReference Include="SpecProbe" Version="1.4.2" />
9999
<PackageReference Include="SSH.NET" Version="2023.0.1" />
100100
<PackageReference Include="StringMath" Version="4.1.2" />
101-
<PackageReference Include="Terminaux" Version="3.0.0" />
101+
<PackageReference Include="Terminaux" Version="3.4.1" />
102102
<PackageReference Include="Terminaux.ResizeListener" Version="3.0.0" />
103-
<PackageReference Include="Textify.Offline.Data" Version="1.4.0" />
103+
<PackageReference Include="Textify.Offline.Data.Analysis" Version="1.7.0" />
104104
<PackageReference Include="UnitsNet" Version="5.43.0" />
105105
</ItemGroup>
106106
<!-- KS Dependencies Information End -->

0 commit comments

Comments
 (0)