small update

This commit is contained in:
That_One_Nerd 2023-03-16 07:34:33 -04:00
parent 6979b3d99e
commit 1286442c40
2 changed files with 18 additions and 5 deletions

View File

@ -13,5 +13,5 @@ public struct HistoryItem
public void Invoke() => action.Invoke(); public void Invoke() => action.Invoke();
public override string ToString() => $"{timestamp:MM/dd/yyyy HH:mm:ss} | {name}"; public override string ToString() => $"{timestamp:MM/dd/yyyy HH:mm:ss} {name}";
} }

View File

@ -44,7 +44,7 @@ public static class BaseModule
Stream writer = new FileStream(absDest, FileMode.CreateNew); Stream writer = new FileStream(absDest, FileMode.CreateNew);
ZipArchive archive = new(writer, ZipArchiveMode.Create); ZipArchive archive = new(writer, ZipArchiveMode.Create);
archive.CreateEntryFromFile(absSource, Path.GetFileName(absSource)); archive.CreateEntryFromFile(absSource, Path.GetFileName(absSource), level);
archive.Dispose(); archive.Dispose();
writer.Dispose(); writer.Dispose();
@ -71,7 +71,7 @@ public static class BaseModule
for (int i = 0; i < files.Count; i++) for (int i = 0; i < files.Count; i++)
{ {
archive.CreateEntryFromFile(files[i], relative[i], level); archive.CreateEntryFromFile(files[i], relative[i], level);
LoadingBarSet((i + 1) / (float)files.Count, ConsoleColor.DarkMagenta); LoadingBarSet((i + 1) / (float)files.Count, ConsoleColor.DarkGreen);
Console.CursorLeft = 0; Console.CursorLeft = 0;
string message = $"{relative[i]}"; string message = $"{relative[i]}";
int remainder = Console.BufferWidth - message.Length; int remainder = Console.BufferWidth - message.Length;
@ -214,8 +214,15 @@ public static class BaseModule
[Command("history")] [Command("history")]
public static void ShowHistory() public static void ShowHistory()
{ {
List<string> lines = new(); List<string> lines = new() { " Timestamp Description"};
for (int i = lines.Count - 1; i >= 0; i--) lines.Add(Program.Shell!.History[i].ToString()); int longestName = 0;
for (int i = lines.Count - 1; i >= 0; i--)
{
HistoryItem hist = Program.Shell!.History[i];
if (hist.name.Length > longestName) longestName = hist.name.Length;
lines.Add(hist.ToString());
}
lines.Insert(1, new string('-', 22 + longestName));
DisplayWithPages(lines); DisplayWithPages(lines);
} }
@ -227,6 +234,12 @@ public static class BaseModule
else throw new($"No file or directory exists at \"{path}\""); else throw new($"No file or directory exists at \"{path}\"");
} }
[Command("srcmod")]
public static void EasterEgg()
{
Write("That's me!", ConsoleColor.Magenta);
}
[Command("quit")] [Command("quit")]
public static void QuitShell(int code = 0) public static void QuitShell(int code = 0)
{ {