private void btnSend_Click(object sender, EventArgs e)
        {
            LocalFiles.Clear();
            RemoteFiles.Clear();

            string sel_card_folder = lbCards.SelectedItem.ToString();
            string[] all_files = Globals.GetFiles(sel_card_folder);
            string root = Globals.GetExecutablePath();

            LocalFiles.AddRange(all_files);

            string remote_file = "";
            for (int i = 0; i < all_files.Length; i++)
            {
                remote_file = all_files[i].Replace(root, "/");
                remote_file = remote_file.Replace("\\", "/");
                RemoteFiles.Add(remote_file);
            }


            file_indx = 0;
            lblCount.Text = string.Format("{0} of {1}", file_indx + 1, LocalFiles.Count);

            try
            {
                //txtLog.AppendText(string.Format("Copy: '{0}' to '{1}'\r\n", LocalFiles[file_indx], RemoteFiles[file_indx]));
                com.FileCopyTo(LocalFiles[file_indx], RemoteFiles[file_indx]);
            }
            catch (Exception ex)
            {
                txtLog.AppendText(ex.Message + "\r\n");
            }
        }
예제 #2
0
        private void btnSendToPhone_Click(object sender, EventArgs e)
        {
            if (dgvCards.SelectedRows.Count == 0) return;

            LocalFiles.Clear();
            RemoteFiles.Clear();

            List<string> pc_side_cards = new List<string>();
            for (int i = 0; i < dgvCards.SelectedRows.Count; i++)
            {
                pc_side_cards.Add((string)dgvCards.SelectedRows[i].Cells[clmnCardPathPc.Index].Value);
            }

            foreach (string card in pc_side_cards)
            {
                string[] all_files = Globals.GetFiles(card);
                if (all_files == null) continue;
                string root = Globals.GetExecutablePath();
                LocalFiles.AddRange(all_files);
                
                string remote_file = "";
                for (int i = 0; i < all_files.Length; i++)
                {
                    remote_file = all_files[i].Replace(root, "/");
                    remote_file = remote_file.Replace("\\", "/");
                    RemoteFiles.Add(remote_file);
                }
            }

            file_indx = 0;
            lblCount.Text = string.Format("{0} of {1}", file_indx + 1, LocalFiles.Count);
            pbProgress.Maximum = LocalFiles.Count;
            pbProgress.Value = file_indx + 1;
            try
            {
                //txtLog.AppendText(string.Format("Copy: '{0}' to '{1}'\r\n", LocalFiles[file_indx], RemoteFiles[file_indx]));
                com.FileCopyTo(LocalFiles[file_indx], RemoteFiles[file_indx]);
            }
            catch (Exception ex)
            {
                // txtLog.AppendText(ex.Message + "\r\n");
            }
        }