private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Stream licStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TracerX.NotTheLicense.txt"); StreamReader reader = new StreamReader(licStream); string lic = reader.ReadToEnd(); reader.Close(); FullText dlg = new FullText(lic, false); dlg.ShowDialog(); }
// Returns true if any files were deleted or listed. private void Go(bool listFiles) { try { List <string> files = null; if (_server == null) { // Process local files directly. if (listFiles || DialogResult.Yes == MainForm.ShowMessageBoxBtns("Delete specified files?", MessageBoxButtons.YesNo)) { files = DeleteRelated.DeleteMany( txtFileSpec.Text, txtFolderSpec.Text, dtpFromTime.Value, dtpToTime.Value, int.Parse(txtFromSize.Text) * 1024, int.Parse(txtToSize.Text) * 1024, chkBinary.Checked, chkText.Checked, chkDeleteFolders.Checked, listFiles, Log); } } else { // Process remote files via the WCF server. using (ProxyFileEnum serviceProxy = new ProxyFileEnum()) { // Need to use host:port and credentials. serviceProxy.SetHost(_server.HostAndPort); serviceProxy.SetCredentials(_server.GetCreds()); int serverVersion = serviceProxy.ExchangeVersion(1); if (serverVersion >= 4) { // This version of the server has a method for deleting all the // matching files and parent folder(s) in one call, so display the // appropriate message and call that method. if (listFiles || DialogResult.Yes == MainForm.ShowMessageBoxBtns("Delete specified files?", MessageBoxButtons.YesNo)) { files = serviceProxy.DeleteMany( txtFileSpec.Text, txtFolderSpec.Text, dtpFromTime.Value, dtpToTime.Value, int.Parse(txtFromSize.Text) * 1024, int.Parse(txtToSize.Text) * 1024, chkBinary.Checked, chkText.Checked, chkDeleteFolders.Checked, listFiles); } } else { string msg = "Sorry, the TracerX-Service you're connected to is an old version that doesn't support this feature."; MainForm.ShowMessageBox(msg); } } } if (files != null) { Log.Info(files.Count, " files were returned by DeleteMany()."); if (files.Any()) { if (listFiles) { // Display the files. var dlg = new FullText(string.Join("\r\n", files), false, true); dlg.Height = 500; dlg.Text = "Matching Log Files (" + files.Count + ")"; dlg.ShowDialog(); } else { MainForm.ShowMessageBox(files.Count.ToString() + " files were deleted."); DidDeleteFiles = true; } } else { MainForm.ShowMessageBox("No files matched the specified criteria."); } } } catch (Exception ex) { MainForm.ShowMessageBox("An error occurred in the Clean Up Files dialog.\n\n" + ex.ToString()); } }