Пример #1
0
 /// Send Error
 public static void Error(PeerSocket peer, string message)
 {
     XmlRequest xmlRequest = new XmlRequest();
     xmlRequest.FirstTag = "error";
     xmlRequest.BodyText = message;
     peer.Send(xmlRequest.GenerateXml());
 }
Пример #2
0
        // ============================================
        // PUBLIC Events
        // ============================================
        // ============================================
        // PUBLIC Methods
        // ============================================
        /// Send Login
        public static void Login(PeerSocket peer, UserInfo userInfo)
        {
            XmlRequest xmlRequest = new XmlRequest();
            xmlRequest.FirstTag = "login";
            xmlRequest.Attributes.Add("name", userInfo.Name);
            xmlRequest.Attributes.Add("secure", userInfo.SecureAuthentication.ToString());

            string magic = Protocol.Login.GenerateMagic(peer);
            xmlRequest.Attributes.Add("magic", magic);

            peer.Send(xmlRequest.GenerateXml());
        }
Пример #3
0
 private static void SendError(PeerSocket peer, string error)
 {
     XmlRequest xmlRequest = new XmlRequest();
     xmlRequest.FirstTag = "msg";
     xmlRequest.BodyText = error;
     xmlRequest.Attributes.Add("type", "error");
     if (peer != null) peer.Send(xmlRequest.GenerateXml());
 }
Пример #4
0
 private static void SendStatus(PeerSocket peer, string status)
 {
     XmlRequest xmlRequest = new XmlRequest();
     xmlRequest.FirstTag = "msg";
     xmlRequest.BodyText = status;
     xmlRequest.Attributes.Add("type", "status");
     if (peer != null) peer.Send(xmlRequest.GenerateXml());
 }
Пример #5
0
 private static void SendMessage(PeerSocket peer, string message)
 {
     XmlRequest xmlRequest = new XmlRequest();
     xmlRequest.FirstTag = "msg";
     xmlRequest.BodyText = message;
     if (peer != null) peer.Send(xmlRequest.GenerateXml());
 }
Пример #6
0
        public void SendImageThumb(PeerSocket peer, string filePath)
        {
            string imgThumb = GenerateImageThumb(filePath);
            if (imgThumb == null) return;

            // Generate Xml Request
            XmlRequest xmlRequest = new XmlRequest();
            xmlRequest.FirstTag = "snd";
            xmlRequest.BodyText = imgThumb;
            xmlRequest.Attributes.Add("what", "imgthumb");
            xmlRequest.Attributes.Add("path", filePath);
            peer.Send(xmlRequest.GenerateXml());
        }
 private void SendPeerList(PeerSocket peer)
 {
     XmlRequest xml = new XmlRequest();
     xml.FirstTag = "peerlist";
     xml.BodyText = GeneratePeerList();
     peer.Send(xml.GenerateXml());
 }
 // ============================================
 // PRIVATE Methods
 // ============================================
 private void RequestPeerList(PeerSocket peer)
 {
     XmlRequest xml = new XmlRequest();
     xml.FirstTag = "get";
     xml.Attributes.Add("what", "peerlist");
     peer.Send(xml.GenerateXml());
 }
Пример #9
0
 /// Request File By ID
 public static void RequestFile(PeerSocket peer, ulong id)
 {
     XmlRequest xmlRequest = new XmlRequest();
     xmlRequest.FirstTag = "get";
     xmlRequest.Attributes.Add("what", "file-id");
     xmlRequest.Attributes.Add("id", id);
     peer.Send(xmlRequest.GenerateXml());
 }
Пример #10
0
 /// Request File By Path
 public static void RequestFile(PeerSocket peer, string path)
 {
     XmlRequest xmlRequest = new XmlRequest();
     xmlRequest.FirstTag = "get";
     xmlRequest.Attributes.Add("what", "file");
     xmlRequest.Attributes.Add("path", path);
     peer.Send(xmlRequest.GenerateXml());
 }
Пример #11
0
 /// Send Folder's File List
 public static void SendFileList(PeerSocket peer, string path)
 {
     XmlRequest xmlRequest = new XmlRequest();
     xmlRequest.FirstTag = "snd";
     xmlRequest.Attributes.Add("what", "file-list");
     xmlRequest.Attributes.Add("path", path);
     xmlRequest.BodyText = FolderFileList(path);
     peer.Send(xmlRequest.GenerateXml());
 }