public void ReadXml(XmlReader reader) { int od = reader.Depth; reader.Read(); while (reader.Depth != od) { switch (reader.Name) { case "Protocol": protocol = ProtocolRegistry.GetProtocol(reader.ReadInnerXml()); break; case "Address": address = reader.ReadInnerXml(); break; case "Name": name = reader.ReadInnerXml(); break; case "Port": port = Int32.Parse(reader.ReadInnerXml()); break; default: reader.ReadInnerXml(); break; } } reader.Read(); }
public void Send() { try { NetworkStream n = client.GetStream(); BinaryWriter w = new BinaryWriter(n); while (true) { IChatProtocol temp = messageCollection.Take(); n = client.GetStream(); w = new BinaryWriter(n); w.Write(temp.ToJSON()); w.Flush(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { client.Close(); } }
public NetworkInformation(IChatProtocol protocol, int id, string address, int port, string name, bool useEncryption = false) : this() { Protocol = protocol; Address = address; Port = port; Name = name; Identifier = id; UseEncryption = useEncryption; }
public static void RegisterProtocol(IChatProtocol proto) { birchProtocols.Add(proto); }
public static void RegisterProtocol (IChatProtocol proto) { birchProtocols.Add (proto); }
public void AddToSendQueue(IChatProtocol data) { messageCollection.Add(data); }
public void ReadXml (XmlReader reader) { int od = reader.Depth; reader.Read (); while (reader.Depth != od) { switch (reader.Name) { case "Protocol": protocol = ProtocolRegistry.GetProtocol (reader.ReadInnerXml ()); break; case "Address": address = reader.ReadInnerXml (); break; case "Name": name = reader.ReadInnerXml (); break; case "Port": port = Int32.Parse (reader.ReadInnerXml ()); break; default: reader.ReadInnerXml (); break; } } reader.Read (); }
public NetworkInformation (IChatProtocol protocol, int id, string address, int port, string name, bool useEncryption = false) : this () { Protocol = protocol; Address = address; Port = port; Name = name; Identifier = id; UseEncryption = useEncryption; }
public void ReadXml (XmlReader reader) { int od = reader.Depth; reader.Read (); while (reader.Depth != od) { switch (reader.Name) { case "Protocol": protocol = ProtocolRegistry.GetProtocol (reader.ReadInnerXml ()); break; case "Address": address = reader.ReadInnerXml (); break; case "Name": name = reader.ReadInnerXml (); break; case "Port": port = Int32.Parse (reader.ReadInnerXml ()); break; case "UseEncryption": useEncryption = reader.ReadInnerXml ().ToLower () == "true"; break; case "UseGlobalInformation": useGlobalInformation = reader.ReadInnerXml ().ToLower () == "true"; break; default: reader.ReadInnerXml (); break; } } reader.Read (); }