/// <summary> /// 上传文件夹 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpLoadFolderStripButton_Click(object sender, EventArgs e) { FolderBrowserDialog upfolder = new FolderBrowserDialog(); MongoDBHelper.UpLoadFileOption opt = new MongoDBHelper.UpLoadFileOption(); if (upfolder.ShowDialog() == DialogResult.OK) { frmGFSOption frm = new frmGFSOption(); SystemManager.OpenForm(frm, false,true); opt.FileNameOpt = frm.filename; opt.AlreadyOpt = frm.option; opt.IgnoreSubFolder = frm.ignoreSubFolder; opt.DirectorySeparatorChar = frm.DirectorySeparatorChar; frm.Dispose(); DirectoryInfo uploadDir = new DirectoryInfo(upfolder.SelectedPath); int count = 0; UploadFolder(uploadDir, ref count, opt); MyMessageBox.ShowMessage("Upload", "Upload Completed! Upload Files Count: " + count.ToString()); RefreshGUI(); } }
/// <summary> /// Upload File /// </summary> private void UploadFileStripButton_Click(object sender, EventArgs e) { OpenFileDialog upfile = new OpenFileDialog(); MongoDBHelper.UpLoadFileOption opt = new MongoDBHelper.UpLoadFileOption(); if (upfile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { frmGFSOption frm = new frmGFSOption(); SystemManager.OpenForm(frm, false,true); opt.FileNameOpt = frm.filename; opt.AlreadyOpt = frm.option; opt.DirectorySeparatorChar = frm.DirectorySeparatorChar; frm.Dispose(); MongoDBHelper.UpLoadFile(upfile.FileName, opt); RefreshGUI(); } }