mirror of
https://github.com/ShiftOS-Rewind/ShiftOS.git
synced 2025-01-22 03:11:47 -05:00
extremely rough savesystem
This commit is contained in:
parent
1febbbd405
commit
8fff93eb7d
15 changed files with 125 additions and 15 deletions
10
ShiftOS.Engine/Properties/Resources.Designer.cs
generated
10
ShiftOS.Engine/Properties/Resources.Designer.cs
generated
|
@ -1797,6 +1797,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>
|
||||
|
|
|
@ -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>
|
BIN
ShiftOS.Engine/Resources/UbuntuMono-R.ttf
Normal file
BIN
ShiftOS.Engine/Resources/UbuntuMono-R.ttf
Normal file
Binary file not shown.
27
ShiftOS.Engine/SaveSystem.cs
Normal file
27
ShiftOS.Engine/SaveSystem.cs
Normal file
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
13
ShiftOS.Main/Properties/Resources.Designer.cs
generated
13
ShiftOS.Main/Properties/Resources.Designer.cs
generated
|
@ -731,6 +731,7 @@ namespace ShiftOS.Main.Properties {
|
|||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?>
|
||||
///
|
||||
///<grammar version="1.0" xml:lang="en-US"
|
||||
/// xmlns="http://www.w3.org/2001/06/grammar"
|
||||
/// tag-format="semantics/1.0" root="Main">
|
||||
|
@ -747,7 +748,7 @@ namespace ShiftOS.Main.Properties {
|
|||
/// How much Code Points do I have?
|
||||
/// </item>
|
||||
/// <item>Can you run <ruleref uri="#programs" />?</item>
|
||||
/// <item>Can you mini [rest of string was truncated]";.
|
||||
/// <item>Can you minimi [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string CatalystGrammar {
|
||||
get {
|
||||
|
@ -1796,6 +1797,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>
|
||||
|
|
|
@ -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>
|
BIN
ShiftOS.Main/Resources/UbuntuMono-R.ttf
Normal file
BIN
ShiftOS.Main/Resources/UbuntuMono-R.ttf
Normal file
Binary file not shown.
|
@ -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>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
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
|
||||
{
|
||||
|
@ -16,7 +15,7 @@ namespace ShiftOS.Main.ShiftOS
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace ShiftOS.Main.Terminal.Commands
|
|||
}
|
||||
if (!solved)
|
||||
{
|
||||
WriteLine("The command \"" + args[0] + "\" could not be found.");
|
||||
WriteLine($"sbash: invalid token: {args[0]}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
24
ShiftOS.Main/Terminal/Commands/clear.cs
Normal file
24
ShiftOS.Main/Terminal/Commands/clear.cs
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue