aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/OS/Win95/Win95Apps
diff options
context:
space:
mode:
Diffstat (limited to 'TimeHACK.Main/OS/Win95/Win95Apps')
-rw-r--r--TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs8
-rw-r--r--TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTerminal.cs101
2 files changed, 80 insertions, 29 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs
index 4b0157e..e2a5a59 100644
--- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs
+++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs
@@ -93,14 +93,14 @@ namespace TimeHACK.OS.Win95.Win95Apps
if (returnYesIfProtected == true)
{
- if (toRead.Isprotected == true)
+ if (toRead.IsProtected == true)
{
return "yes";
}
}
else
{
- return toRead.label;
+ return toRead.Label;
}
return Val;
}
@@ -655,7 +655,7 @@ namespace TimeHACK.OS.Win95.Win95Apps
else
{
Directory.CreateDirectory(Path.Combine(CurrentDirectory, "New Folder"));
- SaveDirectoryInfo(Path.Combine(CurrentDirectory, "New Folder"), false, "New Folder", true);
+ SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true);
RefreshAll();
}
@@ -789,7 +789,7 @@ namespace TimeHACK.OS.Win95.Win95Apps
File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info"));
- SaveDirectoryInfo(Path.Combine(CurrentDirectory, setText), false, $"{setText}", true);
+ SaveDirectoryInfo(CurrentDirectory, setText, false, $"{setText}", true);
}
else
{
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTerminal.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTerminal.cs
index a754ed0..58fadee 100644
--- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTerminal.cs
+++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTerminal.cs
@@ -14,16 +14,19 @@ using System.Reflection;
using System.Linq.Expressions;
using System.Diagnostics;
using System.Text.RegularExpressions;
+using Newtonsoft.Json;
+using TimeHACK.Engine;
+using System.Globalization;
namespace TimeHACK.OS.Win95.Win95Apps
{
public partial class WinClassicTerminal : UserControl
{
- public Engine.WindowManager wm = new Engine.WindowManager();
+ public WindowManager wm = new WindowManager();
- public int currentLine = 0;
- public static string prefix = @"C:\>";
- public static string startupDir = $"{Engine.SaveSystem.ProfileMyComputerDirectory}";
+ public int currentLine = 4;
+ public static string prefix = @"C:\WINDOWS>";
+ public static string workingDir = $"{SaveSystem.ProfileWindowsDirectory}";
public string output = "";
public WinClassicTerminal(bool readOnly)
@@ -31,19 +34,19 @@ namespace TimeHACK.OS.Win95.Win95Apps
InitializeComponent();
// Paint the classic borders
- btnCopy.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2);
- btnFont.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2);
- btnMark.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2);
- btnNothing.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2);
- btnPaste.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2);
- btnSettings.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2);
- sizeSel.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2);
+ btnCopy.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
+ btnFont.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
+ btnMark.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
+ btnNothing.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
+ btnPaste.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
+ btnSettings.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
+ sizeSel.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
// Set the default index to "Auto"
sizeSel.SelectedIndex = 0;
// Set the font and append the prefix text
- cmdPrompt.Font = new Font(TitleScreen.pfc.Families[1], 10F, FontStyle.Regular);
+ cmdPrompt.Font = new Font(TitleScreen.pfc.Families[1], 12F, FontStyle.Regular);
cmdPrompt.BringToFront();
@@ -54,6 +57,7 @@ namespace TimeHACK.OS.Win95.Win95Apps
}
else
{
+ cmdPrompt.AppendText("\nMicrosoft<R> Windows 95\n <C>Copyright Microsoft Corp 1981-1995.\n\n");
cmdPrompt.AppendText(prefix);
}
}
@@ -108,18 +112,65 @@ namespace TimeHACK.OS.Win95.Win95Apps
{
if (e.KeyData == Keys.Return)
{
- // Temporary CMD redirect
- Process p = new Process();
-
- p.StartInfo.UseShellExecute = false;
- p.StartInfo.RedirectStandardOutput = true;
- p.StartInfo.CreateNoWindow = true;
- p.StartInfo.WorkingDirectory = startupDir;
- p.StartInfo.FileName = "cmd.exe";
- p.StartInfo.Arguments = $"/C {cmdPrompt.Lines[currentLine].Substring(prefix.Length)}";
- p.Start();
-
- output = p.StandardOutput.ReadToEnd();
+ string[] cmd = cmdPrompt.Lines[currentLine].Substring(prefix.Length).Split(' ');
+
+ switch (cmd[0])
+ {
+ case "dir":
+ FileSystemFolderInfo dirinfo = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(workingDir, "_data.info")));
+ NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
+ nfi.NumberDecimalDigits = 0;
+ output = $" Volume in drive C has no label\n Volume Serial Number is 0000-0000\n Directory of {prefix.Replace(">", "")}\n\n";
+ foreach (THDirInfo thd in dirinfo.SubDirs)
+ {
+ string dirline = new string(' ', 50);
+ dirline = dirline.Insert(0, thd.DOSName);
+ dirline = dirline.Insert(15, "<DIR>");
+ output += dirline + Environment.NewLine;
+ }
+ foreach (THFileInfo thfi in dirinfo.Files)
+ {
+ string[] dosname = thfi.DOSName.Split('.');
+ string dirline = new string(' ', 50);
+ dirline = dirline.Insert(0, dosname[0]);
+ dirline = dirline.Insert(9, dosname[1]);
+ dirline = dirline.Insert(26 - thfi.ByteSize.ToString("N", nfi).Length, thfi.ByteSize.ToString("N", nfi));
+ output += dirline + Environment.NewLine;
+ }
+ string fline = new string(' ', 50);
+ fline = fline.Insert(10 - dirinfo.Files.Count.ToString("N", nfi).Length, dirinfo.Files.Count.ToString("N", nfi));
+ fline = fline.Insert(11, "file(s)");
+ fline = fline.Insert(33 - dirinfo.ByteSize.ToString("N", nfi).Length, dirinfo.ByteSize.ToString("N", nfi));
+ fline = fline.Insert(34, "bytes");
+ output += fline + Environment.NewLine;
+
+ string dline = new string(' ', 50);
+ dline = dline.Insert(10 - dirinfo.SubDirs.Count.ToString("N", nfi).Length, dirinfo.SubDirs.Count.ToString("N", nfi));
+ dline = dline.Insert(11, "dir(s)");
+ dline = dline.Insert(33 - SaveSystem.CurrentSave.BytesLeft.ToString("N", nfi).Length, SaveSystem.CurrentSave.BytesLeft.ToString("N", nfi));
+ dline = dline.Insert(34, "bytes free");
+ output += dline;
+
+ break;
+ default:
+ // Temporary CMD redirect
+ /*
+ Process p = new Process();
+
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.RedirectStandardOutput = true;
+ p.StartInfo.CreateNoWindow = true;
+ p.StartInfo.WorkingDirectory = startupDir;
+ p.StartInfo.FileName = "cmd.exe";
+ p.StartInfo.Arguments = $"/C {cmdPrompt.Lines[currentLine].Substring(prefix.Length)}";
+ p.Start();
+
+ output = p.StandardOutput.ReadToEnd();
+ */
+ output = "Bad command or file name";
+
+ break;
+ }
cmdPrompt.Focus();
cmdPrompt.AppendText($"\n{output}"); // Append the command output
@@ -127,7 +178,7 @@ namespace TimeHACK.OS.Win95.Win95Apps
int numLines = output.Split('\n').Length; // Get the number of lines from the command output
currentLine = currentLine + 2 + numLines; // Set the current line to equals the previous line plus 2 plus the number of lines from the command
- cmdPrompt.AppendText($"\n{prefix}"); // Append the text to the RichTextBox
+ cmdPrompt.AppendText($"\n\n{prefix}"); // Append the text to the RichTextBox
}
}
}