コード例 #1
0
        public CommonDownload(List <CloudFile> files, ProgressBar[] progressBars, Label[] progressLabels, CloudServiceType cloudServiceType, int overwriteMode = 3, NetworkCredential networkCredential = null, bool folderNewFiles = true)
        {
            progressbars   = progressBars;
            progresslabels = progressLabels;
            downloads      = new List <CommonFileDownload>();
            OverwriteMode  = overwriteMode;
            CloudService   = cloudServiceType;

            if (folderNewFiles)
            {
                downloadFolderPath = MainForm.syncFolderPath + "/New Files " + DateTime.Now.Date.ToShortDateString();
            }
            else
            {
                downloadFolderPath = MainForm.syncFolderPath;
            }

            //var logFileName = $"download-log-{DateTime.Now.ToString("MM-dd-yyyy")}.txt";
            //string log = $"{DateTime.Now}\ndownloadFolderPath:{downloadFolderPath}\nlogin: {networkCredential.UserName}\npassword: {networkCredential.Password}\n";
            //File.AppendAllText(logFileName, log);

            try
            {
                foreach (CloudFile file in files)
                {
                    CommonFileDownload fileDownload = new CommonFileDownload(this, file, downloadFolderPath + file.Path, networkCredential);
                    downloadQueue.Enqueue(fileDownload);
                    downloads.Add(fileDownload);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
 internal void InternalCreate(CloudServiceType serviceType)
 {
     throw new NotImplementedException("なにこれ");
 }
コード例 #3
0
 public CloudService(CloudServiceType serviceType)
 {
     InternalCreate(serviceType);
 }
コード例 #4
0
 internal void InternalCreate(CloudServiceType serviceType);
コード例 #5
0
 public CloudService(CloudServiceType serviceType)
 {
   this.InternalCreate(serviceType);
 }
コード例 #6
0
 internal void InternalCreate(CloudServiceType serviceType);
コード例 #7
0
        public SyncFilesForm(CloudFolder newFilesFolder, CloudServiceType cloudServiceName)
        {
            InitializeComponent();

            SendMessage(filter_textBox.Handle, 0x1501, 1, "Filter by name");

            overwriteMode_comboBox.DataSource    = new BindingSource(overwriteModes, null);
            overwriteMode_comboBox.DisplayMember = "Value";
            overwriteMode_comboBox.ValueMember   = "Key";

            nodeCheckBox2.IsVisibleValueNeeded += CheckIndex;

            cloudServiceType = cloudServiceName;
            if (cloudServiceType == CloudServiceType.Mega)
            {
                downloadMega_button.Enabled  = true;
                getJdLinks_button.Enabled    = false;
                downloadFiles_button.Enabled = false;
            }
            if (cloudServiceType == CloudServiceType.Yadisk)
            {
                if (Properties.Settings.Default.loginedYandex)
                {
                    addFilesToYadisk_button.Enabled = true;
                }

                getJdLinks_button.Enabled    = true;
                downloadFiles_button.Enabled = false;
            }

            progressBars = new List <ProgressBar> {
                progressBar1, progressBar2, progressBar3, progressBar4
            };
            progressLabels = new List <Label> {
                label1, label2, label3, label4, DownloadProgress_label
            };

            rootFolder = newFilesFolder;
            nodeCheckBox2.CheckStateChanged     += new EventHandler <TreePathEventArgs>(NodeCheckStateChanged);
            newFilesTreeViewAdv.ShowNodeToolTips = true;
            newFilesTreeViewAdv.NodeControls[2].ToolTipProvider = new ToolTipProvider();
            newFilesTreeViewAdv.NodeFilter = filter;
            //newFilesTreeViewAdv.Expanded += new EventHandler<TreeViewAdvEventArgs>(Form1.treeViewAdv_Expanded);
            //newFilesTreeViewAdv.Collapsed += new EventHandler<TreeViewAdvEventArgs>(Form1.treeViewAdv_Expanded);

            newFiles_model     = new TreeModel();
            newFilesFlat_model = new TreeModel();

            ColumnNode rootFlatNode = new ColumnNode(newFilesFolder.Name, newFilesFolder.Created, newFilesFolder.Modified, newFilesFolder.Size);

            newFilesFlat_model.Nodes.Add(rootFlatNode);
            ColumnNode rootNode = new ColumnNode(newFilesFolder.Name, newFilesFolder.Created, newFilesFolder.Modified, newFilesFolder.Size);

            //rootNode.Tag = newFilesFolder;
            newFilesTreeViewAdv.Model = new SortedTreeModel(newFiles_model);
            newFilesTreeViewAdv.BeginUpdate();
            newFiles_model.Nodes.Add(rootNode);

            foreach (CloudFile file in newFilesFolder.Files)
            {
                ColumnNode ffileNode = new ColumnNode(file.Name, file.Created, file.Modified, file.Size);
                ffileNode.Tag = file;
                rootFlatNode.Nodes.Add(ffileNode);

                string[] folders = ParsePath(file.Path);
                if (folders == null)
                {
                    ColumnNode subNode = new ColumnNode(file.Name, file.Created, file.Modified, file.Size);
                    subNode.Tag = file;
                    rootNode.Nodes.Add(subNode);
                }
                else
                {
                    ColumnNode currentNode = rootNode;
                    //creating folders nodes and file node from file path
                    string currentFolderPath = @"/"; //+ folders[0] + @"/";
                    for (int i = 0; i < folders.Length; i++)
                    {
                        if (folders[i] == "")
                        {
                        }
                        currentFolderPath += folders[i] + @"/";
                        ColumnNode subNode = new ColumnNode(folders[i], file.Created, file.Modified, 0);
                        if (currentNode.Nodes.ToList().ConvertAll(x => x.Text).Contains(folders[i]))
                        {
                            currentNode = (ColumnNode)currentNode.Nodes.ToList().Find(x => x.Text == folders[i]);
                        }
                        else
                        {
                            currentNode.Nodes.Add(subNode);
                            currentNode = subNode;
                        }
                        if (i == folders.Length - 1)
                        {
                            ColumnNode fileNode = new ColumnNode(file.Name, file.Created, file.Modified, file.Size);
                            fileNode.Tag = file;
                            currentNode.Nodes.Add(fileNode);
                        }
                    }
                }
            }
            //Form1.BuildSubfolderNodes(rootNode);
            //BuildFullFolderStructure(rootNode);
            newFilesTreeViewAdv.EndUpdate();
            newFilesTreeViewAdv.Root.Children[0].Expand();
            newFiles_model.Nodes[0].CheckState = CheckState.Checked;

            this.Show();
            //CheckAllSubnodes(newFiles_model.Nodes[0], false);
        }