static void Main(string[] args) { AuxiliaryServerWorker.WriteInfo("Welcome to the AntVault 3 server."); AuxiliaryServerWorker.WriteInfo("Write /Start to get started!"); string Command = Console.ReadLine(); while (Command.ToLower() != "/exit") { if (Command.ToLower() == "/start") { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed ServerNetworking.StartServer(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Command = Console.ReadLine(); } else if (Command.ToLower() == "/stop") { ServerNetworking.StopServer(); Command = Console.ReadLine(); } else if (Command.ToLower().StartsWith("/updatestatus")) { Command = Command + ";"; string NewStatus = AuxiliaryServerWorker.GetElement(Command, " ".ToUpperInvariant(), ";"); MainServerWorker.UpdateStatus(NewStatus); Command = Console.ReadLine(); } else if (Command.ToLower().StartsWith("/aboutuser")) { Command = Command + ";"; string UserToCheck = AuxiliaryServerWorker.GetElement(Command, " ".ToUpperInvariant(), ";"); MainServerWorker.AboutUser(UserToCheck); Command = Console.ReadLine(); } else { AuxiliaryServerWorker.WriteError("Command not recognised"); Command = Console.ReadLine(); } } if (Command.ToLower() == "/exit") { AuxiliaryServerWorker.WriteInfo("Application will exit in"); AuxiliaryServerWorker.WriteInfo("5"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("4"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("3"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("2"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("1"); Thread.Sleep(1000); Environment.Exit(0); } }
internal static Paragraph AppendMessage(string MessageString) { string Sender = "Sender"; string Message = "Message"; try { Sender = AuxiliaryClientWorker.GetElement(MessageString, "-U ", " -Content"); Message = AuxiliaryClientWorker.GetElement(MessageString, "-Content ", ";"); } catch (Exception exc) { Console.WriteLine("Could not grab message information due to " + exc); } Paragraph ChatParagraph = new Paragraph(); #region Profile picture before the text System.Windows.Shapes.Ellipse ImageToShowFrame = new System.Windows.Shapes.Ellipse(); ImageToShowFrame.Height = 30; ImageToShowFrame.Width = 30; ImageToShowFrame.Stroke = Brushes.Black; ImageToShowFrame.StrokeThickness = 1.5; ImageBrush ImageToShowBrush = new ImageBrush(AuxiliaryClientWorker.GetBitmapImageFromBitmap(MainClientWorker.CurrentProfilePictures[MainClientWorker.CurrentOnlineUsers.IndexOf(Sender)])); ImageToShowFrame.Fill = ImageToShowBrush; ImageToShowFrame.MouseLeftButtonDown += Placeholder; #endregion ChatParagraph.Inlines.Add(ImageToShowFrame); #region Text to add after the profile picture Label TextToShow = new Label(); TextToShow.FontSize = 16; TextToShow.Foreground = Brushes.Black; TextToShow.Content = "[" + Sender + "]: " + Message; #endregion ChatParagraph.Inlines.Add(TextToShow); ChatParagraph.Inlines.Add(Environment.NewLine); return(ChatParagraph); }