Beispiel #1
0
 private void build_remote_tree(string main, TreeNodeCollection tree)
 {
     tree.Clear();
     string[] online = eye.getDirContent(main);
     foreach (string file in online)
     {
         TreeNode node = new TreeNode(file);
         if (main == eyeSync.langs.eyeSync.loading)
         {
             if (eye.isDir(file))
             {
                 node.Nodes.Add(eyeSync.langs.eyeSync.loading);
                 node.Tag = file;
                 tree.Add(node);
             }
         }
         else
         {
             if (eye.isDir(main + "/" + file))
             {
                 node.Nodes.Add(eyeSync.langs.eyeSync.loading);
                 node.Tag = main + "/" + file;
                 tree.Add(node);
             }
         }
     }
 }
Beispiel #2
0
        void RunJob_RealJob(object sender, DoWorkEventArgs e)
        {
            ((BackgroundWorker)sender).ReportProgress(0, e.Argument);
            eyeOS eye = new eyeOS();

            eye.setCurrentUserDir();
            if (Direction == 1)
            {
                string[] files = System.IO.Directory.GetFiles(Local + "\\", "*", System.IO.SearchOption.AllDirectories);
                int      num   = 0;
                foreach (string localfile in files)
                {
                    ((BackgroundWorker)sender).ReportProgress(files.Length - num, e.Argument);
                    string remotefile = remote + localfile.Replace(Local, "").Replace('\\', '/');
                    eye.uploadFile(localfile, remotefile);
                    num++;
                }
            }
            else if (Direction == -1)
            {
                string[] files = eye.getDirContent(remote);
                int      num   = 0;
                foreach (string remotefile in files)
                {
                    ((BackgroundWorker)sender).ReportProgress(files.Length - num, e.Argument);
                    string localfile = local + "\\" + remotefile;
                    eye.downloadFile(remote + "/" + remotefile, localfile);
                    num++;
                }
            }
            else if (Direction == 0)
            {
                string[] files = System.IO.Directory.GetFiles(Local + "\\", "*", System.IO.SearchOption.AllDirectories);
                int      num   = 0;
                foreach (string localfile in files)
                {
                    num++;
                    ((BackgroundWorker)sender).ReportProgress(files.Length - (num - 1), e.Argument);
                    if (new System.IO.FileInfo(localfile).Name.StartsWith(".eyeSyncInfo__"))
                    {
                        continue;
                    }
                    string remotefile = remote + localfile.Replace(Local, "").Replace('\\', '/');
                    eye.updateFile(remotefile, localfile);
                }
            }
            ((BackgroundWorker)sender).ReportProgress(-1, e.Argument);
            isActive = false;
        }