aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFloppyDiskDrive <[email protected]>2017-11-23 11:20:53 -0600
committerFloppyDiskDrive <[email protected]>2017-11-23 11:20:53 -0600
commit8fff93eb7da1b01d101e146ca7fe5d90ca01fcde (patch)
treeebb8eafff81f5e54925ec27f1a19b5066f83a418
parent1febbbd405e6f67401313defb76cc5a41b44c912 (diff)
downloadshiftos-rewind-8fff93eb7da1b01d101e146ca7fe5d90ca01fcde.tar.gz
shiftos-rewind-8fff93eb7da1b01d101e146ca7fe5d90ca01fcde.tar.bz2
shiftos-rewind-8fff93eb7da1b01d101e146ca7fe5d90ca01fcde.zip
extremely rough savesystem
-rw-r--r--ShiftOS.Engine/Properties/Resources.Designer.cs10
-rw-r--r--ShiftOS.Engine/Properties/Resources.resx3
-rw-r--r--ShiftOS.Engine/Resources/UbuntuMono-R.ttfbin0 -> 205748 bytes
-rw-r--r--ShiftOS.Engine/SaveSystem.cs27
-rw-r--r--ShiftOS.Engine/ShiftOS.Engine.csproj2
-rw-r--r--ShiftOS.Main/Properties/Resources.Designer.cs21
-rw-r--r--ShiftOS.Main/Properties/Resources.resx3
-rw-r--r--ShiftOS.Main/Resources/UbuntuMono-R.ttfbin0 -> 205748 bytes
-rw-r--r--ShiftOS.Main/ShiftOS.Main.csproj2
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/Terminal.cs7
-rw-r--r--ShiftOS.Main/ShiftOS/Desktop.cs15
-rw-r--r--ShiftOS.Main/Terminal/Commands/Help.cs4
-rw-r--r--ShiftOS.Main/Terminal/Commands/clear.cs24
-rw-r--r--ShiftOS.Main/Terminal/Commands/tcpip.cs12
-rw-r--r--ShiftOS.Main/Terminal/TerminalCommand.cs10
15 files changed, 125 insertions, 15 deletions
diff --git a/ShiftOS.Engine/Properties/Resources.Designer.cs b/ShiftOS.Engine/Properties/Resources.Designer.cs
index ced728d..5959c79 100644
--- a/ShiftOS.Engine/Properties/Resources.Designer.cs
+++ b/ShiftOS.Engine/Properties/Resources.Designer.cs
@@ -1798,6 +1798,16 @@ namespace ShiftOS.Engine.Properties {
}
/// <summary>
+ /// Looks up a localized resource of type System.Byte[].
+ /// </summary>
+ internal static byte[] UbuntuMono_R {
+ get {
+ object obj = ResourceManager.GetObject("UbuntuMono_R", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap uparrow {
diff --git a/ShiftOS.Engine/Properties/Resources.resx b/ShiftOS.Engine/Properties/Resources.resx
index 7d95cf4..bafd273 100644
--- a/ShiftOS.Engine/Properties/Resources.resx
+++ b/ShiftOS.Engine/Properties/Resources.resx
@@ -1114,4 +1114,7 @@
<data name="_3beepvirus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\3beepvirus.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
+ <data name="UbuntuMono_R" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\UbuntuMono-R.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ShiftOS.Engine/Resources/UbuntuMono-R.ttf b/ShiftOS.Engine/Resources/UbuntuMono-R.ttf
new file mode 100644
index 0000000..fdd309d
--- /dev/null
+++ b/ShiftOS.Engine/Resources/UbuntuMono-R.ttf
Binary files differ
diff --git a/ShiftOS.Engine/SaveSystem.cs b/ShiftOS.Engine/SaveSystem.cs
new file mode 100644
index 0000000..59ddf4b
--- /dev/null
+++ b/ShiftOS.Engine/SaveSystem.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftOS.Engine
+{
+ public class SaveSystem
+ {
+ public static string gameDir
+ {
+ get
+ {
+ return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ShiftOS-Rewind");
+ }
+ }
+ public static string fontDir
+ {
+ get
+ {
+ return gameDir + "\\Fonts";
+ }
+ }
+ }
+}
diff --git a/ShiftOS.Engine/ShiftOS.Engine.csproj b/ShiftOS.Engine/ShiftOS.Engine.csproj
index db21b5a..faff407 100644
--- a/ShiftOS.Engine/ShiftOS.Engine.csproj
+++ b/ShiftOS.Engine/ShiftOS.Engine.csproj
@@ -63,6 +63,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
+ <Compile Include="SaveSystem.cs" />
<Compile Include="ShiftFS\FileGUI\FileOpener.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -626,6 +627,7 @@
<None Include="Resources\typesound.wav" />
</ItemGroup>
<ItemGroup>
+ <None Include="Resources\UbuntuMono-R.ttf" />
<None Include="Resources\uparrow.png" />
</ItemGroup>
<ItemGroup>
diff --git a/ShiftOS.Main/Properties/Resources.Designer.cs b/ShiftOS.Main/Properties/Resources.Designer.cs
index 94a198f..b3bb901 100644
--- a/ShiftOS.Main/Properties/Resources.Designer.cs
+++ b/ShiftOS.Main/Properties/Resources.Designer.cs
@@ -730,24 +730,25 @@ namespace ShiftOS.Main.Properties {
}
/// <summary>
- /// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+ /// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+ ///
///&lt;grammar version=&quot;1.0&quot; xml:lang=&quot;en-US&quot;
/// xmlns=&quot;http://www.w3.org/2001/06/grammar&quot;
/// tag-format=&quot;semantics/1.0&quot; root=&quot;Main&quot;&gt;
- ///
+ ///
/// &lt;!-- Catalyst Grammar File
///
/// This file gives Catalyst the ability to recognize
/// audio input and give a proper response.
///
/// --&gt;
- ///
+ ///
/// &lt;rule id=&quot;Main&quot;&gt;
/// &lt;item&gt;
/// How much Code Points do I have?
/// &lt;/item&gt;
- /// &lt;item&gt;Can you run &lt;ruleref uri=&quot;#programs&quot;/&gt;?&lt;/item&gt;
- /// &lt;item&gt;Can you mini [rest of string was truncated]&quot;;.
+ /// &lt;item&gt;Can you run &lt;ruleref uri=&quot;#programs&quot; /&gt;?&lt;/item&gt;
+ /// &lt;item&gt;Can you minimi [rest of string was truncated]&quot;;.
/// </summary>
internal static string CatalystGrammar {
get {
@@ -1797,6 +1798,16 @@ namespace ShiftOS.Main.Properties {
}
/// <summary>
+ /// Looks up a localized resource of type System.Byte[].
+ /// </summary>
+ internal static byte[] UbuntuMono_R {
+ get {
+ object obj = ResourceManager.GetObject("UbuntuMono_R", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap uparrow {
diff --git a/ShiftOS.Main/Properties/Resources.resx b/ShiftOS.Main/Properties/Resources.resx
index 7d95cf4..bafd273 100644
--- a/ShiftOS.Main/Properties/Resources.resx
+++ b/ShiftOS.Main/Properties/Resources.resx
@@ -1114,4 +1114,7 @@
<data name="_3beepvirus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\3beepvirus.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
+ <data name="UbuntuMono_R" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\UbuntuMono-R.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ShiftOS.Main/Resources/UbuntuMono-R.ttf b/ShiftOS.Main/Resources/UbuntuMono-R.ttf
new file mode 100644
index 0000000..fdd309d
--- /dev/null
+++ b/ShiftOS.Main/Resources/UbuntuMono-R.ttf
Binary files differ
diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj
index 2171874..59351a4 100644
--- a/ShiftOS.Main/ShiftOS.Main.csproj
+++ b/ShiftOS.Main/ShiftOS.Main.csproj
@@ -99,6 +99,7 @@
<Compile Include="ShiftOS\Desktop.Designer.cs">
<DependentUpon>Desktop.cs</DependentUpon>
</Compile>
+ <Compile Include="Terminal\Commands\clear.cs" />
<Compile Include="Terminal\Commands\Hello.cs" />
<Compile Include="Terminal\Commands\Help.cs" />
<Compile Include="Terminal\Commands\sftp.cs" />
@@ -592,6 +593,7 @@
<None Include="Resources\typesound.wav" />
</ItemGroup>
<ItemGroup>
+ <None Include="Resources\UbuntuMono-R.ttf" />
<None Include="Resources\uparrow.png" />
</ItemGroup>
<ItemGroup>
diff --git a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs
index c4bfe83..bd53ab7 100644
--- a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs
@@ -4,6 +4,7 @@ using ShiftOS.Engine;
using ShiftOS.Main.Terminal;
using System.Linq;
using System.Collections.Generic;
+using System.Drawing.Text;
namespace ShiftOS.Main.ShiftOS.Apps
{
@@ -17,6 +18,7 @@ namespace ShiftOS.Main.ShiftOS.Apps
public bool WaitingResponse = false;
public string InputReturnText = "";
public Stack<string> c = TerminalBackend.commandBuffer;
+ private PrivateFontCollection fontCollection = new PrivateFontCollection();
// The below variables makes the terminal... a terminal!
string OldText = "";
@@ -30,6 +32,11 @@ namespace ShiftOS.Main.ShiftOS.Apps
termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox!
TerminalBackend.trm.Add(this);
+
+ fontCollection.AddFontFile(SaveSystem.fontDir + "\\termFont.ttf");
+
+ termmain.Font = new System.Drawing.Font(fontCollection.Families[0], 12F, System.Drawing.FontStyle.Regular);
+
}
void Print()
diff --git a/ShiftOS.Main/ShiftOS/Desktop.cs b/ShiftOS.Main/ShiftOS/Desktop.cs
index 28e3a38..7d1a052 100644
--- a/ShiftOS.Main/ShiftOS/Desktop.cs
+++ b/ShiftOS.Main/ShiftOS/Desktop.cs
@@ -1,22 +1,21 @@
using System;
-using System.Linq;
using System.Windows.Forms;
-using ShiftOS.Engine.Misc;
using ShiftOS.Engine.WindowManager;
using ShiftOS.Main.Properties;
using ShiftOS.Main.ShiftOS.Apps;
-using System.Drawing;
+using System.IO;
+using ShiftOS.Engine;
namespace ShiftOS.Main.ShiftOS
{
// testing github because git hates me
- public partial class Desktop : Form
+ public partial class Desktop : Form
{
public Desktop()
{
InitializeComponent();
timer1.Start();
-
+ Setup();
Closed += (sender, args) => { Application.Exit(); };
}
@@ -54,5 +53,11 @@ namespace ShiftOS.Main.ShiftOS
{
lblClock.Text = DateTime.Now.ToString("hh:mm:ss");
}
+ public void Setup()
+ {
+ if (!Directory.Exists(SaveSystem.gameDir)) Directory.CreateDirectory(SaveSystem.gameDir);
+ if (!Directory.Exists(SaveSystem.fontDir)) Directory.CreateDirectory(SaveSystem.fontDir);
+ if (!File.Exists(SaveSystem.fontDir + "\\termFont.ttf")) File.WriteAllBytes(SaveSystem.fontDir + "\\termFont.ttf", Resources.UbuntuMono_R);
+ }
}
}
diff --git a/ShiftOS.Main/Terminal/Commands/Help.cs b/ShiftOS.Main/Terminal/Commands/Help.cs
index c851baf..9067551 100644
--- a/ShiftOS.Main/Terminal/Commands/Help.cs
+++ b/ShiftOS.Main/Terminal/Commands/Help.cs
@@ -25,13 +25,13 @@ namespace ShiftOS.Main.Terminal.Commands
if (t.Name == args[0])
{
solved = true;
- WriteLine($"{t.Name}: {t.Summary} \nusage: {t.Usage}");
+ WriteLine($"{t.Name}: {t.Summary} \n usage: {t.Usage}");
break;
}
}
if (!solved)
{
- WriteLine("The command \"" + args[0] + "\" could not be found.");
+ WriteLine($"sbash: invalid token: {args[0]}");
}
}
}
diff --git a/ShiftOS.Main/Terminal/Commands/clear.cs b/ShiftOS.Main/Terminal/Commands/clear.cs
new file mode 100644
index 0000000..cbabf88
--- /dev/null
+++ b/ShiftOS.Main/Terminal/Commands/clear.cs
@@ -0,0 +1,24 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftOS.Main.Terminal.Commands
+{
+ public class clear : TerminalCommand
+ {
+ public override string Name { get; } = "clear";
+ public override string Summary { get; } = "Clears all text from the terminal.";
+ public override string Usage { get; } = "clear";
+ public override bool Unlocked { get; set; } = false;
+ public static List<ShiftOS.Apps.Terminal> trm = TerminalBackend.trm;
+ public override void Run(params string[] parameters)
+ {
+ ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
+
+ trm.Clear();
+ }
+ }
+}
diff --git a/ShiftOS.Main/Terminal/Commands/tcpip.cs b/ShiftOS.Main/Terminal/Commands/tcpip.cs
index 5e0e232..815c010 100644
--- a/ShiftOS.Main/Terminal/Commands/tcpip.cs
+++ b/ShiftOS.Main/Terminal/Commands/tcpip.cs
@@ -10,8 +10,8 @@ namespace ShiftOS.Main.Terminal.Commands
public class tcpip : TerminalCommand
{
public override string Name { get; } = "tcpip";
- public override string Summary { get; } = "Shows a list of incoming or outgoing commands.";
- public override string Usage { get; } = "tcpip <incoming/outcoming>";
+ public override string Summary { get; } = "Shows a list of incoming or outgoing connections.";
+ public override string Usage { get; } = "tcpip <incoming/outgoing>";
public override bool Unlocked { get; set; } = false;
public override void Run(params string[] args)
@@ -29,10 +29,16 @@ namespace ShiftOS.Main.Terminal.Commands
WriteLine("tcpip: syntax error");
break;
case "incoming":
- WriteLine($"Incoming connections from localhost:");
+ WriteLine("Incoming connections from localhost:");
WriteLine($"IP ADDRESS v4 COMPUTER NAME");
WriteLine($"{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(255)} {gen}");
break;
+ case "outgoing":
+ WriteLine("Outgoing connections from localhost:");
+ WriteLine($"IP ADDRESS v4 COMPUTER NAME");
+ WriteLine($"{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(255)} {gen}");
+ WriteLine($"[1] outgoing connection(s) is using {r.Next(0, 16)} MiBs of bandwith.");
+ break;
}
}
public string Generate(int amountToGenerate)
diff --git a/ShiftOS.Main/Terminal/TerminalCommand.cs b/ShiftOS.Main/Terminal/TerminalCommand.cs
index 1f068ba..245f380 100644
--- a/ShiftOS.Main/Terminal/TerminalCommand.cs
+++ b/ShiftOS.Main/Terminal/TerminalCommand.cs
@@ -88,5 +88,15 @@ namespace ShiftOS.Main.Terminal
// Input.Start();
// return Input;
//}
+ /// <summary>
+ /// Clears all text from the terminal.
+ /// </summary>
+ public virtual void Clear()
+ {
+
+ ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
+
+ trm.Clear();
+ }
}
}