From 9914c18456a0c08019e778479ce727ac937b1e57 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 28 May 2017 14:40:42 -0400 Subject: [PATCH] Fuck --- ShiftOS.WinForms/Applications/Terminal.cs | 1 + ShiftOS.WinForms/Controls/TerminalBox.cs | 6 ++ ShiftOS.WinForms/Tools/ControlManager.cs | 6 +- ShiftOS_TheReturn/SaveSystem.cs | 70 +++++++++++------------ ShiftOS_TheReturn/ServerManager.cs | 17 ------ ShiftOS_TheReturn/ShiftOS.Engine.csproj | 4 -- 6 files changed, 45 insertions(+), 59 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 3d17d35..de4888b 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -232,6 +232,7 @@ namespace ShiftOS.WinForms.Applications var text = txt.Lines.ToArray(); var text2 = text[text.Length - 1]; var text3 = ""; + Console.WriteLine(); var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); if (IsInRemoteSystem == true) diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index 25f7144..c188321 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -64,6 +64,9 @@ namespace ShiftOS.WinForms.Controls public void Write(string text) { this.HideSelection = true; + this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); + this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); + this.SelectionFont = ConstructFont(); this.AppendText(Localization.Parse(text)); this.HideSelection = false; } @@ -85,6 +88,9 @@ namespace ShiftOS.WinForms.Controls { Engine.AudioManager.PlayStream(Properties.Resources.writesound); this.HideSelection = true; + this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); + this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); + this.SelectionFont = ConstructFont(); this.Select(this.TextLength, 0); this.AppendText(Localization.Parse(text) + Environment.NewLine); this.HideSelection = false; diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index fe77884..92482fa 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -207,19 +207,19 @@ namespace ShiftOS.WinForms.Tools if (ctrl is Button) { Button b = ctrl as Button; - if (!b.Tag.ToString().ToLower().Contains("keepbg")) + if (!tag.Contains("keepbg")) { b.BackColor = SkinEngine.LoadedSkin.ButtonBackgroundColor; b.BackgroundImage = SkinEngine.GetImage("buttonidle"); b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonidle"); } b.FlatAppearance.BorderSize = SkinEngine.LoadedSkin.ButtonBorderWidth; - if (!b.Tag.ToString().ToLower().Contains("keepfg")) + if (!tag.Contains("keepfg")) { b.FlatAppearance.BorderColor = SkinEngine.LoadedSkin.ButtonForegroundColor; b.ForeColor = SkinEngine.LoadedSkin.ButtonForegroundColor; } - if (!b.Tag.ToString().ToLower().Contains("keepfont")) + if (!tag.Contains("keepfont")) b.Font = SkinEngine.LoadedSkin.ButtonTextFont; Color orig_bg = b.BackColor; diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 489b718..55f5cd5 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -153,50 +153,50 @@ namespace ShiftOS.Engine } } - if (defaultConf.ConnectToMud == true) + + + bool guidReceived = false; + ServerManager.GUIDReceived += (str) => { - bool guidReceived = false; - ServerManager.GUIDReceived += (str) => - { //Connection successful! Stop waiting! guidReceived = true; - Console.WriteLine("[inetd] Connection successful."); - }; + Console.WriteLine("[inetd] Connection successful."); + }; - try - { - - ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); - //This haults the client until the connection is successful. - while (ServerManager.thisGuid == new Guid()) - { - Thread.Sleep(10); - } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); - } - catch (Exception ex) - { - //No errors, this never gets called. - Console.WriteLine("[inetd] SEVERE: " + ex.Message); - Thread.Sleep(3000); - ServerManager.StartLANServer(); - while (ServerManager.thisGuid == new Guid()) - { - Thread.Sleep(10); - } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); - } - } - else + try { - ServerManager.StartLANServer(); + + ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); + //This haults the client until the connection is successful. + while (ServerManager.thisGuid == new Guid()) + { + Thread.Sleep(10); + } + Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + FinishBootstrap(); + } + catch (Exception ex) + { + //No errors, this never gets called. + Console.WriteLine("[inetd] SEVERE: " + ex.Message); + Thread.Sleep(3000); + Console.WriteLine("[sys] SEVERE: Cannot connect to server. Shutting down in 5..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 4..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 3..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 2..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] 1..."); + Thread.Sleep(1000); + Console.WriteLine("[sys] Bye bye."); + System.Diagnostics.Process.GetCurrentProcess().Kill(); } //Nothing happens past this point - but the client IS connected! It shouldn't be stuck in that while loop above. - + })); thread.IsBackground = true; thread.Start(); diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 217b9ee..f0acaa2 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -316,23 +316,6 @@ Ping: {ServerManager.DigitalSocietyPing} ms private static bool singleplayer = false; public static bool IsSingleplayer { get { return singleplayer; } } - public static void StartLANServer() - { - singleplayer = true; - ShiftOS.Server.Program.ServerStarted += (address) => - { - Console.WriteLine($"Connecting to {address}..."); - Initiate(address, 13370); - }; - Disconnected += () => - { - ShiftOS.Server.Program.Stop(); - }; - ShiftOS.Server.Program.Main(new[] { "" }); - - - } - /// /// Occurs when the server sends a message to this client. /// diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj index 9d7d696..4cbce72 100644 --- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj +++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj @@ -162,10 +162,6 @@ {A069089A-8962-4607-B2B2-4CF4A371066E} ShiftOS.Objects - - {226C63B4-E60D-4949-B4E7-7A2DDBB96776} - ShiftOS.Server -