Exemplo n.º 1
0
        private string CopyToTemp()
        {
            string name = "";

            try
            {
                name           = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".sdf";
                Cursor.Current = Cursors.WaitCursor;
                RemoteFile.CopyFileFromDevice(Dev, File, name, false);
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
            return(name);
        }
Exemplo n.º 2
0
        private void btCopy_Click(object sender, EventArgs e)
        {
            //var dev = mgr.Devices.FirstConnectedDevice;
            //string path = Dev.GetFolderPath(SpecialFolder.MyDocuments);
            //string file = Path + "\\" + lvFiles.SelectedItems[0].Text;
            try
            {
                saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                saveFileDialog1.Filter           = "Archivo SDF (*.sdf)|*.sdf|All files (*.*)|*.*";
                saveFileDialog1.FileName         = "Catalogo_Activos_Etiq.sdf";

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    string name = saveFileDialog1.FileName;
                    Cursor.Current = Cursors.WaitCursor;
                    RemoteFile.CopyFileFromDevice(Dev, File, name, false);
                    Cursor.Current = Cursors.Default;
                }
            }
            catch { }
        }
Exemplo n.º 3
0
 public static void getFileFromDevice(string path, string file)
 {
     using (RemoteDeviceManager r = new RemoteDeviceManager())
     {
         using (RemoteDevice device = r.Devices.FirstConnectedDevice)
         {
             string myDocs     = device.GetFolderPath(SpecialFolder.MyDocuments);
             string deviceFile = myDocs + "\\" + file;
             string localFile  = path + "\\" + file;
             if (RemoteFile.Exists(device, deviceFile))
             {
                 RemoteFile.CopyFileFromDevice(device, deviceFile, localFile, true);
             }
             else
             {
                 Console.ForegroundColor = ConsoleColor.Red;
                 Console.Error.WriteLine("El archivo " + deviceFile + " no existe");
                 Console.ResetColor();
             }
         }
     }
 }