diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index 14eb023..48b40de 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -50,10 +50,17 @@ namespace ShiftOS.WinForms.Applications { this.Invoke(new Action(() => { - - var cmsg = JsonConvert.DeserializeObject(msg.Contents); - if(id == cmsg.Channel) - rtbchat.AppendText($"[{cmsg.Username}@{cmsg.SystemName}] {cmsg.Message}{Environment.NewLine}"); + try + { + var args = JsonConvert.DeserializeObject>(msg.Contents); + var cmsg = new ShiftOS.Objects.ChatMessage(args["Username"] as string, args["SystemName"] as string, args["Message"] as string, args["Channel"] as string); + if (id == cmsg.Channel) + rtbchat.AppendText($"[{cmsg.Username}@{cmsg.SystemName}] {cmsg.Message}{Environment.NewLine}"); + } + catch (Exception ex) + { + rtbchat.AppendText($"[system@multiuserdomain] Exception thrown by client: {ex}"); + } })); } catch { } @@ -63,6 +70,8 @@ namespace ShiftOS.WinForms.Applications public void SendMessage(string msg) { + rtbchat.AppendText($"[{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}] {msg}{Environment.NewLine}"); + ServerManager.SendMessage("chat_send", JsonConvert.SerializeObject(new ShiftOS.Objects.ChatMessage(SaveSystem.CurrentSave.Username, SaveSystem.CurrentSave.SystemName, msg, id))); } diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index 8350dc3..b91e421 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -136,7 +136,14 @@ namespace ShiftOS.Engine { if (!SaveSystem.CurrentSave.Upgrades.ContainsKey(itm.ID)) { - SaveSystem.CurrentSave.Upgrades.Add(itm.ID, false); + try + { + SaveSystem.CurrentSave.Upgrades.Add(itm.ID, false); + } + catch + { + + } } } }