public CreateFolder(DriveInfo drive, AllFolder folder, string parentid, NewFileOption option) { InitializeComponent(); this.drive = drive; this.folder = folder; this.parentid = parentid; this.option = option; }
private void Ok_btn_Click(object sender, EventArgs e) { foreach (RadioButton item in flowLayoutPanel1.Controls) { if (item.Checked) { drive = (AllFolder)item.Tag; } } CloseWindow(); }
public FolderUpload(System.IO.DirectoryInfo localfolder, AllFolder folder, string parentid, DriveInfo driveinfo, ListViewGroup group) { this.localfolder = localfolder; this.fileid = parentid; this.folder = folder; this.driveinfo = driveinfo; this.accesstoken = driveinfo.token.access_token; this.maxsize = 0; startsize = 0; this.group = group; this.label = new System.Windows.Forms.Label(); this.progress = new System.Windows.Forms.ProgressBar(); }
private async Task <long> UpLoadFile(AllFolder folder, string fileid, long startsize, string filename, long filemaxsize) { string uploadurl = null; string method = "PUT"; string naem = System.IO.Path.GetFileName(filename); UpLoadUrl Url = new UpLoadUrl(naem, fileid, maxsize, accesstoken); if (driveinfo.token.Drive == "Google") { uploadurl = await Url.GetGoogleUploadUrl(); } else if (driveinfo.token.Drive == "OneDrive") { uploadurl = await Url.GetOneDriveUrl(); } else if (driveinfo.token.Drive == "DropBox") { uploadurl = string.Format("https://api-content.dropbox.com/1/chunked_upload?overwrite=true&autorename=true"); } try { System.IO.Stream filestream = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, System.IO.FileShare.ReadWrite); HttpWebResponse respone = null; respone = await RequstHttp(method, uploadurl, null, accesstoken, filestream, filemaxsize, StreamBlockSize, startsize); if (driveinfo.token.Drive == "DropBox") { Dictionary <string, object> text = HttpHelper.DerealizeJson(respone.GetResponseStream()); string uploadid = text["upload_id"].ToString(); Dictionary <string, string> parameter = new Dictionary <string, string>(); parameter.Add("upload_id", uploadid); respone = await HttpHelper.RequstHttp("POST", string.Format("https://api-content.dropbox.com/1/commit_chunked_upload/auto/{0}", System.IO.Path.Combine(fileid, filename).Replace("\\", "/")), parameter, accesstoken); } Dictionary <string, object> file = HttpHelper.DerealizeJson(respone.GetResponseStream()); filestream.Close(); return(startsize); //mstream.Close(); } catch (WebException e) { throw e; } catch (Exception e) { throw e; } }
private void LoadTile(AllFolder folder) { if (folder != null) { flowLayoutPanel_filecontent.SuspendLayout(); List <CloudFiles> cl = folder.GetFiles(); List <Control> newControl = new List <Control>(); foreach (var item in cl) { newControl.Add(item.SetTile()); } foreach (var item in newControl) { item.DoubleClick += item_DoubleClick; item.MouseClick += item_MouseClick; } flowLayoutPanel_filecontent.Controls.AddRange(newControl.ToArray()); flowLayoutPanel_filecontent.ResumeLayout(); } }