public void Accept(XmlSocket Socket, System.Xml.XmlDocument FirstMessage) { Socket.WriterSettings.OmitXmlDeclaration = false; Socket.WriteStartDocument(); Socket.WriteDocType("cross-domain-policy", null, "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd", null); Socket.WriteStartElement("cross-domain-policy"); foreach (string Host in pHosts) { Socket.WriteStartElement("allow-access-from"); Socket.WriteAttributeString("domain", Host); if (pPorts != null) { Socket.WriteAttributeString("to-ports", pPorts); } Socket.WriteEndElement(); } Socket.WriteEndElement(); Socket.WriteEndDocument(); }
public bool Accept(TCPStream Stream) { XmlSocket XSocket = new XmlSocket(Stream); Stream.ReadTimeout = 5000; XmlDocument FirstMessage = XSocket.ReadDocument(); if (FirstMessage == null) { return(true); } IModule module; if (Modules.TryGetValue(FirstMessage.FirstChild.Name, out module)) { module.Accept(XSocket, FirstMessage); } else { Console.WriteLine("XMLServer.Accept: Module not found: " + FirstMessage.FirstChild.Name); } return(true); }