void client_FileUploadRequest(Client client, EventArguments.FileUploadRequestEventArguments args)
        {
            var validClient = ConfigurationManager.AppSettings["AcceptDownLoadFrom"];

            if (validClient.Split(',').Contains(args.Request.SenderClient))
            {
                if (File.Exists(ConfigurationManager.AppSettings["DownLoadFolder"] + args.Request.FileName))
                {
                    File.Delete(ConfigurationManager.AppSettings["DownLoadFolder"] + args.Request.FileName);
                }
                args.Confirm(ConfigurationManager.AppSettings["DownLoadFolder"] + args.Request.FileName);
            }
            else
            {
                args.Refuse();
            }
        }
Exemplo n.º 2
0
 void client_FileUploadRequest(Client client, EventArguments.FileUploadRequestEventArguments args)
 {
     InvokeUI(() =>
     {
         if (MessageBox.Show(this, "File upload request, " + args.Request.FileName + ", " + args.Request.TotalBytes.ToString() + ". Confirm?", this.Text, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
         {
             SaveFileDialog dlg = new SaveFileDialog();
             dlg.Title          = this.Text + " Save files as";
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 args.Confirm(dlg.FileName);
             }
             else
             {
                 args.Refuse();
             }
         }
         else
         {
             args.Refuse();
         }
     });
 }