public Arhitect() { my_Write = new ConsoleWriter(); my_tree = new List <Root>(); map_in_my_tree = new List <string>(); Root root = new Room("Приемная", 10, my_Write); root.Add(new Statistic("Должна быть выполнена в теплых тонах", 10, my_Write), new string[] { "1" }); Root Table_1 = new Table("Журнальный столик", 10, new ConsoleWriter()); Table_1.Add(new Statistic("10-20 журналов типа «компьютерный мир» ", 10, my_Write), new string[] { "1" }); root.Add(Table_1, new string[] { "1" }); root.Add(new Statistic("Мягкий диван ", 10, my_Write), new string[] { "1" }); Root Table_2 = new Table("Стол секретаря ", 10, my_Write); Root PC_1 = new PC("Компьютер", 10, new ConsoleWriter()); PC_1.Add(new Statistic("Важно наличие большого объема жесткого диска", 10, my_Write), new string[] { "1" }); Table_2.Add(PC_1, new string[] { "1" }); Table_2.Add(new Statistic("Офисный инструментарий ", 10, my_Write), new string[] { "1" }); root.Add(Table_2, new string[] { "1" }); root.Add(new Statistic("Кулер с теплой и холодной водой", 10, my_Write), new string[] { "1" }); my_tree.Add(root); }
public frmMain() { InitializeComponent(); this.root = new RootMessages(); this.allMessage = AllMessage.getObject(); //log nesnemizi oluşturduk. this.log = LogManager.GetCurrentClassLogger(); }
//принимает 1 сообщение от пользователя public string GetMessage(MyTCPChatUser user) { //MyTCPClient client = listener.AcceptTCPClient(); //var client = listener.AcceptTcpClient(); NetworkStream stream = user.stream; StreamReader reader = new StreamReader(stream); string message = reader.ReadLine(); IMessage Msg = MsgPareser.Parse(message); if (Msg is AllMessage A) { A = (AllMessage)Msg; SendToAll(A); return(A.ToOutString()); } else if (Msg is PersonalMessage P) { P = (PersonalMessage)Msg; SendTo(P); return(P.ToOutString()); } else if (Msg is HelloMessage H) { H = (HelloMessage)Msg; //отсылаем всем что новый пользователь подключился AllMessage all = new AllMessage() { Name = H.Name, Content = H.Content }; SendToAll(all); //добавляем клиента и отсылаем обратно ID AddConnection(user, H); //Рассылаем всем новый лист клиентов SendList(); return(H.ToOutString()); } else if (Msg is GoodbyMessage G) { G = (GoodbyMessage)Msg; //удаляем пользователя RemoveConnection(user, G); //рассылаем всем что пользователь вышел AllMessage all = new AllMessage() { Name = G.Name, Content = G.Content }; SendToAll(all); //Рассылаем всем новый лист клиентов SendList(); return(G.ToOutString()); } else { throw new Exception("Recieve message has an invalid type"); } }
public void SendToAll(AllMessage message) { StreamWriter writer; foreach (var o in usersList) { writer = new StreamWriter(o.stream); writer.Write(message.ToFullString()); writer.WriteLine(); writer.Flush(); } }
public void AllMessage(string content) { StreamWriter writer = new StreamWriter(stream); AllMessage msg = new AllMessage { Content = content, Name = Name }; writer.Write(msg.ToFullString()); writer.WriteLine(); writer.Flush(); }
public Underworld(AllMessage writer, Allread read) { this.writer = writer; this.read = read; }
public void AllMessageManager(AllMessage message) { AllMessages.Add(message); }
public PC(AllMessage elem) { message_ = elem; }
// Constructor public Room(string name, int price, AllMessage elem) : base(name, price, elem) { }
// Constructor public Root(string name, int price, AllMessage elem) { this.price = price; this.name = name; my_write = elem; }
public Statistic(string name, int price, AllMessage elem) : base(name, price, elem) { }
public Game(AllMessage writer) { field_game = new string[] { " | | ", "- - -", " | | ", "- - -", " | | " }; this.writer = writer; }