Ejemplo n.º 1
0
        public static void SendDirectory(FileInformation dir, string workingDir, StatusChangedHandler statusChanged)
        {
            if (FindXBox() == false)
            {
                return;
            }
            string dirname = Path.GetFileName(dir.Name);

            if (!XBox.FileExists(Path.Combine(workingDir, dirname)))
            {
                XBox.CreateDirectory(Path.Combine(workingDir, dirname));
            }
            foreach (string s in Directory.GetFiles(dir.Name, "*", SearchOption.TopDirectoryOnly))
            {
                FileInformation fi = new FileInformation();
                fi.Name = s;
                SendFile(fi, Path.Combine(workingDir, dirname), statusChanged);
            }
            foreach (string s in Directory.GetDirectories(dir.Name, "*", SearchOption.TopDirectoryOnly))
            {
                FileInformation fi = new FileInformation();
                fi.Name = s;
                SendDirectory(fi, Path.Combine(workingDir, dirname), statusChanged);
            }
        }
Ejemplo n.º 2
0
        public static void DownloadFile(FileInformation file, string workingDir, string destination, StatusChangedHandler statusChanged)
        {
            if (FindXBox() == false)
            {
                return;
            }
            string xboxFilename = Path.Combine(workingDir, file.Name);

            if (!XBox.FileExists(xboxFilename))
            {
                return;
            }
            statusChanged(string.Concat("Downloading File: ", file.Name));

            XBox.ReceiveFile(destination, xboxFilename);
        }
Ejemplo n.º 3
0
        public static void SendFile(FileInformation file, string workingDir, StatusChangedHandler statusChanged)
        {
            if (FindXBox() == false)
            {
                return;
            }
            string filename     = Path.GetFileName(file.Name);
            string xboxFilename = Path.Combine(workingDir, filename);

            if (XBox.FileExists(xboxFilename) && MessageBox.Show(filename + "\n\nWould You Like To Overwrite The Old File?", "File Already Exists.", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }
            statusChanged(string.Concat("Sending File: ", filename));

            XBox.SendFile(file.Name, xboxFilename);
        }