static void Test_FileTransfer(Host host, string file, string remoteDirectory)
        {
            XenConnect conn = new XenConnect(host, testServerId, testip);
            FileStream fs   = File.Open(file, FileMode.Open, FileAccess.Read);
            long       size = fs.Length;

            fs.Close();
            conn.transferFile(file, remoteDirectory, size);
        }
Example #2
0
        private void btn_file_transfer_send_Click(object sender, RoutedEventArgs e)
        {
            string filename = textbox_file_transfer_path.Text;

            Task.Run(
                () =>
            {
                XenConnect conn = new XenConnect(_CurrentHost, Settings.SystemIdentifier, Settings.SystemIp);
                FileStream fs   = File.Open(filename, FileMode.Open, FileAccess.Read);
                long size       = fs.Length;
                //TODO: If file length...throw up a message
                fs.Close();
                conn.transferFile(filename, XenMaster.LibvirtAPI.VirtualMachineBuilder.XEN_PATH_DEFAULT_DISK, size);
                Application.Current.Dispatcher.Invoke((Action) delegate {
                    MessageBox.Show("The file transfer has been completed", "File Transfer", MessageBoxButton.OK, MessageBoxImage.Information);
                });
            });
        }