コード例 #1
0
 internal string GetSizeFormated()
 {
     return(FileTransfer.FormatFileSize(this.Size));
 }
コード例 #2
0
ファイル: ChatWindow.cs プロジェクト: biddyweb/communicator
        private void InitializeFileTransfer(string toJID, string file)
        {
            if (!File.Exists(file))
            {
                return;
            }
            try
            {
                String ID = Guid.NewGuid().ToString();
                //PROCESS UPLOAD
                FileInfo     fileInfo   = new FileInfo(file);
                FileTransfer fileUpload = new FileTransfer();
                fileUpload.UploadCompleted       += new EventHandler(fileTransfer_UploadCompleted);
                fileUpload.UploadProgressChanged += new EventHandler(fileUpload_UploadProgressChanged);
                SharedFile fileUploadInfo = fileUpload.Upload(file, myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, toJID, ID);
                fileUploadInfo.Size = fileInfo.Length;
                myClientForm.FileTransferInvite(new JabberUser(fileUploadInfo.ToJID), fileUploadInfo.FileName, fileUploadInfo.ID, FileTransfer.FormatFileSize(fileUploadInfo.Size));
            }
            catch (Exception)
            {
#if (DEBUG)
                throw;
#endif
            }
        }
コード例 #3
0
ファイル: ChatWindow.cs プロジェクト: biddyweb/communicator
        void fileTransfer_UploadCompleted(object sender, EventArgs e)
        {
            SharedFile sharedFile = (SharedFile)sender;

            if (sharedFile.LocalFileName != null)
            {
                myClientForm.FileTransferProcessDone(sharedFile.ToJID, sharedFile.FileName, sharedFile.ID, FileTransfer.FormatFileSize(sharedFile.Size));
            }
        }
コード例 #4
0
        void toolStripSendFile_Click(object sender, EventArgs e)
        {
            ChatSession tmplChatSession = (ChatSession)myChatSessions[myChatSessionsTabControl.SelectedTab.Tag];

            if (tmplChatSession != null)
            {
                if (DialogResult.OK == myOpenFileDialog.ShowDialog())
                {
                    if (myOpenFileDialog.FileName != null && File.Exists(myOpenFileDialog.FileName))
                    {
                        String ID = Guid.NewGuid().ToString();
                        //PROCESS UPLOAD
                        FileInfo     fileInfo   = new FileInfo(myOpenFileDialog.FileName);
                        FileTransfer fileUpload = new FileTransfer();
                        fileUpload.UploadCompleted += new EventHandler(fileTransfer_UploadCompleted);
                        FileTransfer.SharedFile fileUploadInfo = fileUpload.Upload(myOpenFileDialog.FileName, myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, tmplChatSession.JabberUser.JID, ID);
                        fileUploadInfo.Size = fileInfo.Length;
                        myClientForm.FileTransferInvite(new JabberUser(fileUploadInfo.ToJID), fileUploadInfo.FileName, fileUploadInfo.ID, FileTransfer.FormatFileSize(fileUploadInfo.Size));
                    }
                }
            }
        }