Ejemplo n.º 1
0
        private void fileSendToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _OpenFileDialog.Multiselect = true;
            var Ret = _OpenFileDialog.ShowDialog();

            if (Ret != DialogResult.OK)
            {
                return;
            }

            if (_OpenFileDialog.FileNames.Count() == 0)
            {
                return;
            }

            try
            {
                var Proto = new SSaFileSend();
                for (Int32 i = 0; i < _OpenFileDialog.FileNames.Count(); ++i)
                {
                    var fileinfo = new SFileInfo();
                    fileinfo.PathName = tbRemoteFileTransferDirectory.Text + _OpenFileDialog.SafeFileNames[i];
                    fileinfo.Stream.LoadFile(_OpenFileDialog.FileNames[i]);
                    Proto.Files.Add(fileinfo);
                }

                _Net.AgentFileSend(GetAgentKeys(), Proto);
            }
            catch (Exception Exception_)
            {
                MessageBox.Show(Exception_.Message);
            }
        }
Ejemplo n.º 2
0
        private void directorysendtoolStripMenuItem_Click(object sender, EventArgs e)
        {
            var Ret = _FolderBrowserDialog.ShowDialog();

            if (Ret != DialogResult.OK)
            {
                return;
            }

            if (_FolderBrowserDialog.SelectedPath.Length == 0)
            {
                return;
            }

            _Option.Data.LocalDirectory = _FolderBrowserDialog.SelectedPath;
            _Option.Save();

            try
            {
                var Proto = new SSaFileSend();
                foreach (var file in Directory.GetFiles(_FolderBrowserDialog.SelectedPath, "*", SearchOption.AllDirectories))
                {
                    var SafeName = file.Substring(_FolderBrowserDialog.SelectedPath.Length + 1);
                    var fileinfo = new SFileInfo();

                    fileinfo.PathName = Path.Combine(tbRemoteFileTransferDirectory.Text, SafeName);
                    fileinfo.Stream.LoadFile(file);
                    Proto.Files.Add(fileinfo);
                }

                _Net.AgentFileSend(GetAgentKeys(), Proto);
            }
            catch (Exception Exception_)
            {
                MessageBox.Show(Exception_.Message);
            }
        }
Ejemplo n.º 3
0
 // To Agent
 public void AgentFileSend(List <SKey> AgentKeys_, SSaFileSend Proto_)
 {
     _Net.Send(_ServerKey, new SCsHeader(ECsProto.ToAgent, AgentKeys_), new CStream().Push(new SSaHeader(ESaProto.FileSend)).Push(Proto_));
 }