From c81573594f509177214bbc9b64427c8aabdc30a6 Mon Sep 17 00:00:00 2001 From: AShifter Date: Sat, 25 Nov 2017 08:59:48 -0700 Subject: Add SaveSystem, FullScreen Terminal and stuff Git had a horrible seizure and removed our repo but Alex-TIMEHACK helped us get it back. --- shiftos.main/shiftos/apps/terminal.cs | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'shiftos.main') diff --git a/shiftos.main/shiftos/apps/terminal.cs b/shiftos.main/shiftos/apps/terminal.cs index f7307cb..04bd6d2 100644 --- a/shiftos.main/shiftos/apps/terminal.cs +++ b/shiftos.main/shiftos/apps/terminal.cs @@ -5,6 +5,8 @@ using ShiftOS.Main.Terminal; using System.Linq; using System.Collections.Generic; using System.Drawing.Text; +using System.IO; +using ShiftOS.Main.Properties; namespace ShiftOS.Main.ShiftOS.Apps { @@ -19,7 +21,7 @@ namespace ShiftOS.Main.ShiftOS.Apps public string InputReturnText = ""; public Stack c = TerminalBackend.commandBuffer; private PrivateFontCollection fontCollection = new PrivateFontCollection(); - + // The below variables makes the terminal... a terminal! string OldText = ""; @@ -33,10 +35,8 @@ namespace ShiftOS.Main.ShiftOS.Apps TerminalBackend.trm.Add(this); - fontCollection.AddFontFile(SaveSystem.fontDir + "\\termFont.ttf"); - - termmain.Font = new System.Drawing.Font(fontCollection.Families[0], 12F, System.Drawing.FontStyle.Regular); + Setup(); } void Print() @@ -144,5 +144,27 @@ namespace ShiftOS.Main.ShiftOS.Apps termmain.AppendText(c.Pop()); } } - } + public void Setup() + { + if (!Directory.Exists(SaveSystem.gameDir)) Directory.CreateDirectory(SaveSystem.gameDir); + if (!Directory.Exists(SaveSystem.fontDir)) Directory.CreateDirectory(SaveSystem.fontDir); + if (!Directory.Exists(SaveSystem.dataDir)) Directory.CreateDirectory(SaveSystem.dataDir); + if (!File.Exists(SaveSystem.fontDir + "\\termFont.ttf")) File.WriteAllBytes(SaveSystem.fontDir + "\\termFont.ttf", Resources.UbuntuMono_R); + if (!File.Exists(SaveSystem.dataDir + "\\userCodePoints.whoa")) + { + using (var fobj = File.OpenWrite(SaveSystem.dataDir + "\\userCodePoints.whoa")) + { + Whoa.Whoa.SerialiseObject(fobj, SaveSystem.User.codePoints); + } + } + if (!Directory.Exists(SaveSystem.baseGameDir)) Directory.CreateDirectory(SaveSystem.baseGameDir); + if (!Directory.Exists(SaveSystem.desktopDir)) Directory.CreateDirectory(SaveSystem.desktopDir); + if (!Directory.Exists(SaveSystem.docDir)) Directory.CreateDirectory(SaveSystem.docDir); + if (!Directory.Exists(SaveSystem.downloadsDir)) Directory.CreateDirectory(SaveSystem.downloadsDir); + if (!Directory.Exists(SaveSystem.musicDir)) Directory.CreateDirectory(SaveSystem.musicDir); + if (!Directory.Exists(SaveSystem.picDir)) Directory.CreateDirectory(SaveSystem.picDir); + fontCollection.AddFontFile(SaveSystem.fontDir + "\\termFont.ttf"); + termmain.Font = new System.Drawing.Font(fontCollection.Families[0], 12F, System.Drawing.FontStyle.Regular); + } + } } -- cgit v1.2.3