private void btnDeleteEmptyRootFolderDest_Click(object sender, EventArgs e) { string Folder = txtRootFolderDest.Text.Trim(); string Msg = string.Format("Do you want to empty following foler(s) that has no file(s)?\n\n{0}", Folder); DialogResult dret = MessageBox.Show(Msg, "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dret != System.Windows.Forms.DialogResult.OK) { return; } string[] aRootFolderDest = txtRootFolderDest.Text.Trim().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string RootFolderDest in aRootFolderDest) { CFile.EmptyFolderHasNoFile(RootFolderDest); } MessageBox.Show(this, "Empty succeeded.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnSyncNow_Click(object sender, EventArgs e) { using (new CWaitCursor(this, btnSyncNow)) { SInfo InfoIs; string ErrMsgIs; if (!IsValid(out InfoIs, out ErrMsgIs)) { MessageBox.Show(ErrMsgIs, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); return; } CSyncFile SyncFile = null; if (InfoIs.FtpInfo == null) { SyncFile = new CSyncFile(InfoIs.RootFolderSrc, InfoIs.aRootFolderDest, InfoIs.SyncType, InfoIs.MinifyJs, InfoIs.aFullPathReferencingJs, InfoIs.aJsFullPathRefered, InfoIs.DateTimeAfter, InfoIs.LogFolder); } else { SyncFile = new CSyncFile(InfoIs.RootFolderSrc, new CFtpInfoSync[] { InfoIs.FtpInfo }, InfoIs.SyncType, InfoIs.MinifyJs, InfoIs.aFullPathReferencingJs, InfoIs.aJsFullPathRefered, InfoIs.DateTimeAfter, InfoIs.LogFolder); } if (radDisallowedExt.Checked) { SyncFile.DisallowedExt = InfoIs.DisallowedExt.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { SyncFile.AllowedOnlyExt = InfoIs.AllowedOnlyExt.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } if (radDisallowedFolder.Checked) { SyncFile.DisallowedFolder = InfoIs.DisallowedFolder.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { SyncFile.AllowedOnlyFolder = InfoIs.AllowedOnlyFolder.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } SyncFile.CopyAll(); if (InfoIs.EmptyFolderHasNoFile) { foreach (string RootFolderDest in InfoIs.aRootFolderDest) { CFile.EmptyFolderHasNoFile(RootFolderDest); } } if (SyncFile.CountFailed > 0) { MessageBox.Show(string.Format("{0} count of file failed.", SyncFile.CountFailed), "Information", MessageBoxButtons.OK); return; } if (InfoIs.SyncType == SyncTypes.AfterSrcTime) { //다음번에 이 시간을 기준할 수 있게 함. DataTable dt = GetTable(); DataGridViewCell dgv = grvList.SelectedCells[0]; dt.Rows[dgv.OwningRow.Index]["DateTimeAfter"] = DateTime.Now; tlsbtnSave.PerformClick(); } sttlblMsg.Text = "Synchronization completed at " + DateTime.Now.ToString(); } }