";
+ exception + "";
var redmineRequestXml = new XElement("issue", new XElement("project_id", this.ProjectId));
@@ -194,7 +192,7 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
{
redmineRequestXml.Add(new XElement("author_id", this.AuthorId));
}
-
+
var bytes = Encoding.UTF8.GetBytes(redmineRequestXml.ToString());
request.ContentLength = bytes.Length;
@@ -214,4 +212,4 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
return true;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Submission/Tracker/Trac.cs b/NBug/Core/Submission/Tracker/Trac.cs
index 2008aa1..1c9868e 100644
--- a/NBug/Core/Submission/Tracker/Trac.cs
+++ b/NBug/Core/Submission/Tracker/Trac.cs
@@ -35,4 +35,4 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
return true;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Submission/Web/Ftp.cs b/NBug/Core/Submission/Web/Ftp.cs
index efb2122..d50a3b2 100644
--- a/NBug/Core/Submission/Web/Ftp.cs
+++ b/NBug/Core/Submission/Web/Ftp.cs
@@ -9,12 +9,10 @@
namespace NBug.Core.Submission.Web
{
+ using NBug.Core.Util.Logging;
using System;
using System.IO;
using System.Net;
- using System.Text;
-
- using NBug.Core.Util.Logging;
internal class FtpFactory : IProtocolFactory
{
@@ -62,7 +60,7 @@ public Ftp()
public override bool Send(string fileName, Stream file, Report report, SerializableException exception)
{
- var request = (FtpWebRequest) WebRequest.Create(new Uri(this.Url + fileName));
+ var request = (FtpWebRequest)WebRequest.Create(new Uri(this.Url + fileName));
if (!string.IsNullOrEmpty(this.Usessl))
{
@@ -99,4 +97,4 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
return true;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Submission/Web/Http.cs b/NBug/Core/Submission/Web/Http.cs
index 392bc34..d4201c9 100644
--- a/NBug/Core/Submission/Web/Http.cs
+++ b/NBug/Core/Submission/Web/Http.cs
@@ -9,11 +9,9 @@
namespace NBug.Core.Submission.Web
{
- using System.IO;
- using System.Net;
-
using NBug.Core.Util.Logging;
using NBug.Core.Util.Web;
+ using System.IO;
public class HttpFactory : IProtocolFactory
{
@@ -58,20 +56,20 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
// http://netomatix.com/HttpPostData.aspx
/* upload.php file my look like the one below (note that uploaded files are not statically named in this case script may need modification)
- *
+ *
*
// --------------------------------------------------------------------------------------------------------------------
-using System.Xml.Linq;
-using System.Xml.Serialization;
using NBug.Core.Reporting.Info;
using NBug.Core.Util.Serialization;
namespace NBug.Core.Submission.Web
{
+ using NBug.Core.Util.Logging;
using System;
using System.IO;
using System.Net;
using System.Net.Mail;
- using NBug.Core.Util.Logging;
- using NBug.Core.Util.Storage;
-
public class MailFactory : IProtocolFactory
{
public IProtocol FromConnectionString(string connectionString)
@@ -41,6 +37,7 @@ public Mail(string connectionString)
public Mail()
{
+ Port = 25;
}
// Connection string format (single line)
@@ -81,7 +78,7 @@ public Mail()
public string ReplyTo { get; set; }
- public string UseAttachment { get; set; }
+ public bool UseAttachment { get; set; }
public string CustomSubject { get; set; }
@@ -89,13 +86,13 @@ public Mail()
public string SmtpServer { get; set; }
- public string UseSsl { get; set; }
+ public bool UseSsl { get; set; }
- public string Port { get; set; }
+ public int Port { get; set; }
- public string Priority { get; set; }
+ public MailPriority Priority { get; set; }
- public string UseAuthentication { get; set; }
+ public bool UseAuthentication { get; set; }
public string Username { get; set; }
@@ -103,7 +100,6 @@ public Mail()
public override bool Send(string fileName, Stream file, Report report, SerializableException exception)
{
-
if (string.IsNullOrEmpty(this.From) || string.IsNullOrEmpty(this.To))
{
return false;
@@ -114,29 +110,20 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
this.ReplyTo = this.From;
}
- if (string.IsNullOrEmpty(this.UseSsl))
+ if (this.Port <= 0)
{
- this.UseSsl = "false";
+ this.Port = this.UseSsl ? 465 : 25;
}
- if (string.IsNullOrEmpty(this.Port))
+ if (!this.UseAttachment)
{
- this.Port = this.UseSsl == "true" ? "465" : "25";
- }
-
- if (string.IsNullOrEmpty(this.UseAttachment))
- {
- this.UseAttachment = "false";
+ this.UseAttachment = false;
}
// Make sure that we can use authentication even with emtpy username and password
if (!string.IsNullOrEmpty(this.Username))
{
- this.UseAuthentication = "true";
- }
- else if (string.IsNullOrEmpty(this.UseAuthentication))
- {
- this.UseAuthentication = "false";
+ this.UseAuthentication = true;
}
using (var smtpClient = new SmtpClient())
@@ -147,20 +134,14 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
smtpClient.Host = this.SmtpServer;
}
- if (!string.IsNullOrEmpty(this.Port))
- {
- smtpClient.Port = Convert.ToInt32(this.Port);
- }
+ smtpClient.Port = this.Port;
- if (this.UseAuthentication.ToLower() == "true")
+ if (this.UseAuthentication)
{
smtpClient.Credentials = new NetworkCredential(this.Username, this.Password);
}
- if (this.UseSsl == "true")
- {
- smtpClient.EnableSsl = true;
- }
+ smtpClient.EnableSsl = this.UseSsl;
if (!string.IsNullOrEmpty(this.Cc))
{
@@ -172,27 +153,13 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
message.Bcc.Add(this.Bcc);
}
- if (!string.IsNullOrEmpty(this.Priority))
- {
- switch (this.Priority.ToLower())
- {
- case "high":
- message.Priority = MailPriority.High;
- break;
- case "normal":
- message.Priority = MailPriority.Normal;
- break;
- case "low":
- message.Priority = MailPriority.Low;
- break;
- }
- }
+ message.Priority = this.Priority;
message.To.Add(this.To);
message.ReplyToList.Add(this.ReplyTo);
message.From = !string.IsNullOrEmpty(this.FromName) ? new MailAddress(this.From, this.FromName) : new MailAddress(this.From);
- if (this.UseAttachment.ToLower() == "true")
+ if (this.UseAttachment)
{
// ToDo: Report file name should be attached to the report file object itself, file shouldn't be accessed directly!
file.Position = 0;
@@ -214,11 +181,11 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
if (!string.IsNullOrEmpty(this.CustomBody))
{
message.Body = this.CustomBody + Environment.NewLine + Environment.NewLine + report +
- Environment.NewLine + Environment.NewLine + exception;
+ Environment.NewLine + Environment.NewLine + exception;
}
else
{
- message.Body = report + Environment.NewLine + Environment.NewLine + exception;
+ message.Body = report + Environment.NewLine + Environment.NewLine + exception;
}
smtpClient.Send(message);
@@ -228,4 +195,4 @@ public override bool Send(string fileName, Stream file, Report report, Serializa
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/Console/ConsoleUI.cs b/NBug/Core/UI/Console/ConsoleUI.cs
index 382440f..2a20bac 100644
--- a/NBug/Core/UI/Console/ConsoleUI.cs
+++ b/NBug/Core/UI/Console/ConsoleUI.cs
@@ -6,12 +6,11 @@
namespace NBug.Core.UI.Console
{
- using System;
-
using NBug.Core.Reporting.Info;
using NBug.Core.Util.Exceptions;
using NBug.Core.Util.Serialization;
using NBug.Enums;
+ using System;
internal static class ConsoleUI
{
@@ -41,4 +40,4 @@ internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException e
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/Custom/CustomUI.cs b/NBug/Core/UI/Custom/CustomUI.cs
index d8b03c0..f7174ef 100644
--- a/NBug/Core/UI/Custom/CustomUI.cs
+++ b/NBug/Core/UI/Custom/CustomUI.cs
@@ -6,7 +6,6 @@
namespace NBug.Core.UI.WPF
{
- using System.ComponentModel;
using NBug.Core.Reporting.Info;
using NBug.Core.Util.Exceptions;
using NBug.Core.Util.Serialization;
@@ -20,16 +19,16 @@ internal static class CustomUI
{
internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException exception, Report report)
{
- if (Settings.CustomUIHandle != null)
+ if (Settings.CustomUIHandle != null)
{
- var e = new CustomUIEventArgs(uiMode, exception, report);
- Settings.CustomUIHandle.DynamicInvoke(null, e);
- return e.Result;
- }
+ var e = new CustomUIEventArgs(uiMode, exception, report);
+ Settings.CustomUIHandle.DynamicInvoke(null, e);
+ return e.Result;
+ }
else
{
throw NBugConfigurationException.Create(() => Settings.UIMode, "Parameter supplied for settings property is invalid.");
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/Developer/InternalExceptionViewer.cs b/NBug/Core/UI/Developer/InternalExceptionViewer.cs
index 726e011..97cbb21 100644
--- a/NBug/Core/UI/Developer/InternalExceptionViewer.cs
+++ b/NBug/Core/UI/Developer/InternalExceptionViewer.cs
@@ -6,15 +6,14 @@
namespace NBug.Core.UI.Developer
{
+ using NBug.Core.Util.Exceptions;
+ using NBug.Core.Util.Serialization;
+ using NBug.Properties;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
- using NBug.Core.Util.Exceptions;
- using NBug.Core.Util.Serialization;
- using NBug.Properties;
-
internal partial class InternalExceptionViewer : Form
{
internal InternalExceptionViewer()
@@ -41,7 +40,7 @@ internal void ShowDialog(Exception exception)
this.DisplayExceptionDetails(exception);
}
}
-
+
internal void ShowDialog(NBugConfigurationException configurationException)
{
this.messageLabel.Text = "An internal configuration exception has occurred. Please correct the invalid configuration regarding the information below. You may also use discussion forum to get help or read the online documentation's configuration section.";
@@ -65,9 +64,9 @@ private void BugReportButton_Click(object sender, EventArgs e)
new Dispatcher(false);
MessageBox.Show("Successfully sent bug report to NBug developer community.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);*/
MessageBox.Show(
- "Internal bug reporting feature is not implemented yet but you can still manually submit a bug report using the bug tracker.",
- "Information",
- MessageBoxButtons.OK,
+ "Internal bug reporting feature is not implemented yet but you can still manually submit a bug report using the bug tracker.",
+ "Information",
+ MessageBoxButtons.OK,
MessageBoxIcon.Information);
this.bugReportButton.Enabled = false;
}
@@ -116,4 +115,4 @@ private void TrackerToolStripLabel_Click(object sender, EventArgs e)
Process.Start(this.trackerToolStripLabel.Tag.ToString());
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/Developer/InternalLogViewer.cs b/NBug/Core/UI/Developer/InternalLogViewer.cs
index 47976c4..d7259b6 100644
--- a/NBug/Core/UI/Developer/InternalLogViewer.cs
+++ b/NBug/Core/UI/Developer/InternalLogViewer.cs
@@ -6,14 +6,13 @@
namespace NBug.Core.UI.Developer
{
+ using NBug.Enums;
+ using NBug.Properties;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
- using NBug.Enums;
- using NBug.Properties;
-
internal partial class InternalLogViewer : Form
{
private static bool initialized;
diff --git a/NBug/Core/UI/UIDialogResult.cs b/NBug/Core/UI/UIDialogResult.cs
index bf95db7..17e3670 100644
--- a/NBug/Core/UI/UIDialogResult.cs
+++ b/NBug/Core/UI/UIDialogResult.cs
@@ -8,7 +8,7 @@ namespace NBug.Core.UI
{
public enum SendReport
{
- Send,
+ Send,
DoNotSend
}
@@ -17,12 +17,12 @@ public enum ExecutionFlow
///
/// This will handle all unhandled exceptions to be able to continue execution.
///
- ContinueExecution,
+ ContinueExecution,
///
/// This will handle all unhandled exceptions and exit the application.
///
- BreakExecution,
+ BreakExecution,
}
public struct UIDialogResult
@@ -36,4 +36,4 @@ public UIDialogResult(ExecutionFlow execution, SendReport report)
this.Report = report;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/UISelector.cs b/NBug/Core/UI/UISelector.cs
index d1fb8b4..537f8f5 100644
--- a/NBug/Core/UI/UISelector.cs
+++ b/NBug/Core/UI/UISelector.cs
@@ -6,8 +6,6 @@
namespace NBug.Core.UI
{
- using System;
-
using NBug.Core.Reporting.Info;
using NBug.Core.UI.Console;
using NBug.Core.UI.WinForms;
@@ -16,6 +14,7 @@ namespace NBug.Core.UI
using NBug.Core.Util.Exceptions;
using NBug.Core.Util.Serialization;
using NBug.Enums;
+ using System;
///
/// Initializes a new instance of the UISelector class which displays the user an appropriate user interface in the event of unhandled exceptions.
@@ -48,19 +47,23 @@ internal static UIDialogResult DisplayBugReportUI(ExceptionThread exceptionThrea
{
case UIProvider.WinForms:
return WinFormsUI.ShowDialog(UIMode.Minimal, serializableException, report);
+
case UIProvider.WPF:
return WPFUI.ShowDialog(UIMode.Minimal, serializableException, report);
+
case UIProvider.Console:
return ConsoleUI.ShowDialog(UIMode.Minimal, serializableException, report);
- case UIProvider.Custom:
- return CustomUI.ShowDialog(UIMode.Minimal, serializableException, report);
+
+ case UIProvider.Custom:
+ return CustomUI.ShowDialog(UIMode.Minimal, serializableException, report);
+
default:
throw new NBugRuntimeException("UISelector.DiscoverUI() returned an invalid UI type.");
}
}
else
{
- throw new NBugRuntimeException(String.Format("Parameter supplied for '{0}' is not valid.", typeof(ExceptionThread).Name));
+ throw new NBugRuntimeException(String.Format("Parameter supplied for '{0}' is not valid.", typeof(ExceptionThread).Name));
}
}
else if (Settings.UIMode == UIMode.None)
@@ -87,10 +90,10 @@ internal static UIDialogResult DisplayBugReportUI(ExceptionThread exceptionThrea
{
return WPFUI.ShowDialog(Settings.UIMode, serializableException, report);
}
- else if (Settings.UIProvider == UIProvider.Custom)
- {
- return CustomUI.ShowDialog(UIMode.Minimal, serializableException, report);
- }
+ else if (Settings.UIProvider == UIProvider.Custom)
+ {
+ return CustomUI.ShowDialog(UIMode.Minimal, serializableException, report);
+ }
else if (Settings.UIProvider == UIProvider.Auto)
{
// In this case, UIProvider = Auto & UIMode != Auto so just discover the UI provider and use the selected UI mode
@@ -98,12 +101,16 @@ internal static UIDialogResult DisplayBugReportUI(ExceptionThread exceptionThrea
{
case UIProvider.WinForms:
return WinFormsUI.ShowDialog(Settings.UIMode, serializableException, report);
+
case UIProvider.WPF:
return WPFUI.ShowDialog(Settings.UIMode, serializableException, report);
+
case UIProvider.Console:
return ConsoleUI.ShowDialog(Settings.UIMode, serializableException, report);
- case UIProvider.Custom:
- return CustomUI.ShowDialog(UIMode.Minimal, serializableException, report);
+
+ case UIProvider.Custom:
+ return CustomUI.ShowDialog(UIMode.Minimal, serializableException, report);
+
default:
throw new NBugRuntimeException("UISelector.DiscoverUI() returned an invalid UI type.");
}
@@ -127,6 +134,7 @@ private static UIProvider DiscoverUI()
{
case "System.Windows.Forms":
return UIProvider.WinForms;
+
case "PresentationFramework":
return UIProvider.WPF;
}
@@ -139,6 +147,7 @@ private static UIProvider DiscoverUI()
{
case "System.Windows.Forms":
return UIProvider.WinForms;
+
case "PresentationFramework":
return UIProvider.WPF;
}
@@ -148,4 +157,4 @@ private static UIProvider DiscoverUI()
return UIProvider.Console;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WPF/WPFUI.cs b/NBug/Core/UI/WPF/WPFUI.cs
index b274d02..c30aad1 100644
--- a/NBug/Core/UI/WPF/WPFUI.cs
+++ b/NBug/Core/UI/WPF/WPFUI.cs
@@ -47,4 +47,4 @@ internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException e
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WinForms/Feedback.cs b/NBug/Core/UI/WinForms/Feedback.cs
index 138d497..5396f86 100644
--- a/NBug/Core/UI/WinForms/Feedback.cs
+++ b/NBug/Core/UI/WinForms/Feedback.cs
@@ -10,4 +10,4 @@ public Feedback()
this.Icon = Properties.Resources.NBug_icon_16;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WinForms/Full.cs b/NBug/Core/UI/WinForms/Full.cs
index 1276be4..1d73ee5 100644
--- a/NBug/Core/UI/WinForms/Full.cs
+++ b/NBug/Core/UI/WinForms/Full.cs
@@ -6,13 +6,12 @@
namespace NBug.Core.UI.WinForms
{
+ using NBug.Core.Reporting.Info;
+ using NBug.Core.Util.Serialization;
using System;
using System.Drawing;
using System.Windows.Forms;
- using NBug.Core.Reporting.Info;
- using NBug.Core.Util.Serialization;
-
internal partial class Full : Form
{
private UIDialogResult uiDialogResult;
@@ -36,7 +35,7 @@ internal Full()
internal UIDialogResult ShowDialog(SerializableException exception, Report report)
{
this.Text = string.Format("{0} {1}", report.GeneralInfo.HostApplication, Settings.Resources.UI_Dialog_Full_Title);
-
+
// Fill in the 'General' tab
warningPictureBox.Image = SystemIcons.Warning.ToBitmap();
this.exceptionTextBox.Text = exception.Type;
@@ -46,10 +45,10 @@ internal UIDialogResult ShowDialog(SerializableException exception, Report repor
this.nbugTextBox.Text = report.GeneralInfo.NBugVersion;
this.dateTimeTextBox.Text = report.GeneralInfo.DateTime;
this.clrTextBox.Text = report.GeneralInfo.CLRVersion;
-
+
// Fill in the 'Exception' tab
this.exceptionDetails.Initialize(exception);
-
+
// ToDo: Fill in the 'Report Contents' tab);
this.ShowDialog();
@@ -89,4 +88,4 @@ private void ReportContentsTabPage_Enter(object sender, EventArgs e)
}*/
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WinForms/Minimal.cs b/NBug/Core/UI/WinForms/Minimal.cs
index abfd837..8afb018 100644
--- a/NBug/Core/UI/WinForms/Minimal.cs
+++ b/NBug/Core/UI/WinForms/Minimal.cs
@@ -6,10 +6,9 @@
namespace NBug.Core.UI.WinForms
{
+ using NBug.Core.Reporting.Info;
using System.Windows.Forms;
- using NBug.Core.Reporting.Info;
-
internal class Minimal
{
internal UIDialogResult ShowDialog(Report report)
@@ -24,4 +23,4 @@ internal UIDialogResult ShowDialog(Report report)
return new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send);
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WinForms/Normal.cs b/NBug/Core/UI/WinForms/Normal.cs
index bde102a..f6eeb72 100644
--- a/NBug/Core/UI/WinForms/Normal.cs
+++ b/NBug/Core/UI/WinForms/Normal.cs
@@ -6,12 +6,11 @@
namespace NBug.Core.UI.WinForms
{
+ using NBug.Core.Reporting.Info;
using System;
using System.Drawing;
using System.Windows.Forms;
- using NBug.Core.Reporting.Info;
-
internal partial class Normal : Form
{
private UIDialogResult uiDialogResult;
@@ -48,4 +47,4 @@ private void QuitButton_Click(object sender, EventArgs e)
this.Close();
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WinForms/Panels/ExceptionDetailView.cs b/NBug/Core/UI/WinForms/Panels/ExceptionDetailView.cs
index c7af360..42766a3 100644
--- a/NBug/Core/UI/WinForms/Panels/ExceptionDetailView.cs
+++ b/NBug/Core/UI/WinForms/Panels/ExceptionDetailView.cs
@@ -28,4 +28,4 @@ private void CloseButton_Click(object sender, EventArgs e)
this.Close();
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WinForms/Panels/ExceptionDetails.cs b/NBug/Core/UI/WinForms/Panels/ExceptionDetails.cs
index 1e86a60..4ef4ea6 100644
--- a/NBug/Core/UI/WinForms/Panels/ExceptionDetails.cs
+++ b/NBug/Core/UI/WinForms/Panels/ExceptionDetails.cs
@@ -6,13 +6,12 @@
namespace NBug.Core.UI.WinForms.Panels
{
+ using NBug.Core.Util.Serialization;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
- using NBug.Core.Util.Serialization;
-
internal partial class ExceptionDetails : UserControl
{
private readonly Dictionary exceptionDetailsList = new Dictionary();
@@ -82,7 +81,7 @@ private void DisplayExceptionDetails(TreeNode node)
if (exception.Source != null) this.exceptionDetailsListView.Items.Add("Source").SubItems.Add(exception.Source);
if (exception.HelpLink != null) this.exceptionDetailsListView.Items.Add("Help Link").SubItems.Add(exception.HelpLink);
if (exception.StackTrace != null) this.exceptionDetailsListView.Items.Add("Stack Trace").SubItems.Add(exception.StackTrace);
-
+
if (exception.Data != null)
{
foreach (var pair in exception.Data)
@@ -110,7 +109,7 @@ private void ExceptionDetailsListView_DoubleClick(object sender, EventArgs e)
using (var detailView = new ExceptionDetailView())
{
detailView.ShowDialog(
- this.exceptionDetailsListView.SelectedItems[0].Text,
+ this.exceptionDetailsListView.SelectedItems[0].Text,
this.exceptionDetailsListView.SelectedItems[0].SubItems[1].Text);
}
}
@@ -136,4 +135,4 @@ private void FillInnerExceptionTree(SerializableException innerException, TreeNo
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/UI/WinForms/WinFormsUI.cs b/NBug/Core/UI/WinForms/WinFormsUI.cs
index d03e6ac..977b65d 100644
--- a/NBug/Core/UI/WinForms/WinFormsUI.cs
+++ b/NBug/Core/UI/WinForms/WinFormsUI.cs
@@ -43,4 +43,4 @@ internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException e
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/ConnectionStringParser.cs b/NBug/Core/Util/ConnectionStringParser.cs
index a8f70fa..81f21d4 100644
--- a/NBug/Core/Util/ConnectionStringParser.cs
+++ b/NBug/Core/Util/ConnectionStringParser.cs
@@ -1,7 +1,7 @@
+using NBug.Core.Util.Exceptions;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
-using NBug.Core.Util.Exceptions;
namespace NBug.Core.Util
{
diff --git a/NBug/Core/Util/ExceptionThread.cs b/NBug/Core/Util/ExceptionThread.cs
index 30f6360..2b5ed89 100644
--- a/NBug/Core/Util/ExceptionThread.cs
+++ b/NBug/Core/Util/ExceptionThread.cs
@@ -7,4 +7,4 @@ internal enum ExceptionThread
UI_WPF,
Task
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Exceptions/NBugConfigurationException.cs b/NBug/Core/Util/Exceptions/NBugConfigurationException.cs
index b79b94a..5726fc6 100644
--- a/NBug/Core/Util/Exceptions/NBugConfigurationException.cs
+++ b/NBug/Core/Util/Exceptions/NBugConfigurationException.cs
@@ -12,12 +12,14 @@ namespace NBug.Core.Util.Exceptions
[Serializable]
public class NBugConfigurationException : NBugException
{
- public NBugConfigurationException(string message, Exception inner) : base(message, inner)
+ public NBugConfigurationException(string message, Exception inner)
+ : base(message, inner)
{
this.MisconfiguredProperty = string.Empty;
}
- private NBugConfigurationException(string propertyName, string message) : base(message)
+ private NBugConfigurationException(string propertyName, string message)
+ : base(message)
{
this.MisconfiguredProperty = propertyName;
}
@@ -29,4 +31,4 @@ public static NBugConfigurationException Create(Expression> propertyE
return new NBugConfigurationException(((MemberExpression)propertyExpression.Body).Member.Name, message);
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Exceptions/NBugException.cs b/NBug/Core/Util/Exceptions/NBugException.cs
index bf783c6..2f71d20 100644
--- a/NBug/Core/Util/Exceptions/NBugException.cs
+++ b/NBug/Core/Util/Exceptions/NBugException.cs
@@ -16,16 +16,19 @@ public NBugException()
{
}
- public NBugException(string message) : base(message)
+ public NBugException(string message)
+ : base(message)
{
}
- public NBugException(string message, Exception inner) : base(message, inner)
+ public NBugException(string message, Exception inner)
+ : base(message, inner)
{
}
- protected NBugException(SerializationInfo info, StreamingContext context) : base(info, context)
+ protected NBugException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Exceptions/NBugRuntimeException.cs b/NBug/Core/Util/Exceptions/NBugRuntimeException.cs
index 7977787..55eda2e 100644
--- a/NBug/Core/Util/Exceptions/NBugRuntimeException.cs
+++ b/NBug/Core/Util/Exceptions/NBugRuntimeException.cs
@@ -11,12 +11,14 @@ namespace NBug.Core.Util.Exceptions
[Serializable]
public class NBugRuntimeException : NBugException
{
- public NBugRuntimeException(string message, Exception inner) : base(message, inner)
+ public NBugRuntimeException(string message, Exception inner)
+ : base(message, inner)
{
}
- public NBugRuntimeException(string message) : base(message)
+ public NBugRuntimeException(string message)
+ : base(message)
{
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Logging/Logger.cs b/NBug/Core/Util/Logging/Logger.cs
index 2fdec0f..bb213fc 100644
--- a/NBug/Core/Util/Logging/Logger.cs
+++ b/NBug/Core/Util/Logging/Logger.cs
@@ -6,13 +6,12 @@
namespace NBug.Core.Util.Logging
{
- using System;
- using System.IO;
- using System.Linq.Expressions;
-
using NBug.Core.UI.Developer;
using NBug.Core.Util.Exceptions;
using NBug.Enums;
+ using System;
+ using System.IO;
+ using System.Linq.Expressions;
///
/// Uses method to log important messages. Also provides a
@@ -49,12 +48,12 @@ static Logger()
/// First parameters is message string, second one is the category.
///
internal static event Action LogWritten;
-
+
internal static void Trace(string message)
{
Write(message, LoggerCategory.NBugTrace);
}
-
+
internal static void Info(string message)
{
Write(message, LoggerCategory.NBugInfo);
@@ -135,4 +134,4 @@ private static void Write(string message, LoggerCategory category)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/ProtectedConfiguration.cs b/NBug/Core/Util/ProtectedConfiguration.cs
index c0d6dc9..137fb1b 100644
--- a/NBug/Core/Util/ProtectedConfiguration.cs
+++ b/NBug/Core/Util/ProtectedConfiguration.cs
@@ -86,4 +86,4 @@ internal static void UnProtectConfiguration()
}
}*/
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/PublicResources.cs b/NBug/Core/Util/PublicResources.cs
index aea60fd..0dca883 100644
--- a/NBug/Core/Util/PublicResources.cs
+++ b/NBug/Core/Util/PublicResources.cs
@@ -11,6 +11,7 @@ namespace NBug.Core.Util
public class PublicResources
{
private string ui_Console_Full_Message;
+
public string UI_Console_Full_Message
{
get
@@ -25,6 +26,7 @@ public string UI_Console_Full_Message
}
private string ui_Console_Minimal_Message;
+
public string UI_Console_Minimal_Message
{
get
@@ -39,6 +41,7 @@ public string UI_Console_Minimal_Message
}
private string ui_Console_Normal_Message;
+
public string UI_Console_Normal_Message
{
get
@@ -51,8 +54,9 @@ public string UI_Console_Normal_Message
this.ui_Console_Normal_Message = value;
}
}
-
+
private string ui_Dialog_Minimal_Message;
+
public string UI_Dialog_Minimal_Message
{
get
@@ -67,6 +71,7 @@ public string UI_Dialog_Minimal_Message
}
private string ui_Dialog_Normal_Message;
+
public string UI_Dialog_Normal_Message
{
get
@@ -81,6 +86,7 @@ public string UI_Dialog_Normal_Message
}
private string ui_Dialog_Normal_Title;
+
public string UI_Dialog_Normal_Title
{
get
@@ -95,6 +101,7 @@ public string UI_Dialog_Normal_Title
}
private string ui_Dialog_Normal_Continue_Button;
+
public string UI_Dialog_Normal_Continue_Button
{
get
@@ -109,6 +116,7 @@ public string UI_Dialog_Normal_Continue_Button
}
private string ui_Dialog_Normal_Quit_Button;
+
public string UI_Dialog_Normal_Quit_Button
{
get
@@ -123,6 +131,7 @@ public string UI_Dialog_Normal_Quit_Button
}
private string ui_Dialog_Full_Message;
+
public string UI_Dialog_Full_Message
{
get
@@ -137,6 +146,7 @@ public string UI_Dialog_Full_Message
}
private string ui_Dialog_Full_Title;
+
public string UI_Dialog_Full_Title
{
get
@@ -151,6 +161,7 @@ public string UI_Dialog_Full_Title
}
private string ui_Dialog_Full_General_Tab;
+
public string UI_Dialog_Full_General_Tab
{
get
@@ -165,6 +176,7 @@ public string UI_Dialog_Full_General_Tab
}
private string ui_Dialog_Full_Exception_Tab;
+
public string UI_Dialog_Full_Exception_Tab
{
get
@@ -179,6 +191,7 @@ public string UI_Dialog_Full_Exception_Tab
}
private string ui_Dialog_Full_Report_Contents_Tab;
+
public string UI_Dialog_Full_Report_Contents_Tab
{
get
@@ -193,6 +206,7 @@ public string UI_Dialog_Full_Report_Contents_Tab
}
private string ui_Dialog_Full_How_to_Reproduce_the_Error_Notification;
+
public string UI_Dialog_Full_How_to_Reproduce_the_Error_Notification
{
get
@@ -207,6 +221,7 @@ public string UI_Dialog_Full_How_to_Reproduce_the_Error_Notification
}
private string ui_Dialog_Full_Quit_Button;
+
public string UI_Dialog_Full_Quit_Button
{
get
@@ -221,6 +236,7 @@ public string UI_Dialog_Full_Quit_Button
}
private string ui_Dialog_Full_Send_and_Quit_Button;
+
public string UI_Dialog_Full_Send_and_Quit_Button
{
get
@@ -234,4 +250,4 @@ public string UI_Dialog_Full_Send_and_Quit_Button
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Serialization/SerializableDictionary.cs b/NBug/Core/Util/Serialization/SerializableDictionary.cs
index cc0c10a..5b0a77d 100644
--- a/NBug/Core/Util/Serialization/SerializableDictionary.cs
+++ b/NBug/Core/Util/Serialization/SerializableDictionary.cs
@@ -76,4 +76,4 @@ public void WriteXml(XmlWriter writer)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Serialization/SerializableException.cs b/NBug/Core/Util/Serialization/SerializableException.cs
index 0f8cdf2..a4837d7 100644
--- a/NBug/Core/Util/Serialization/SerializableException.cs
+++ b/NBug/Core/Util/Serialization/SerializableException.cs
@@ -7,7 +7,6 @@
using System.IO;
using System.Xml.Linq;
using System.Xml.Serialization;
-using NBug.Core.Reporting.Info;
namespace NBug.Core.Util.Serialization
{
@@ -20,7 +19,7 @@ namespace NBug.Core.Util.Serialization
public class SerializableException
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
/// Default constructor provided for XML serialization and de-serialization.
///
public SerializableException()
@@ -89,7 +88,7 @@ public SerializableException(Exception exception)
if (exception.TargetSite != null)
{
- this.TargetSite = String.Format("{0} @ {1}", exception.TargetSite, exception.TargetSite.DeclaringType);
+ this.TargetSite = String.Format("{0} @ {1}", exception.TargetSite, exception.TargetSite.DeclaringType);
}
this.ExtendedInformation = this.GetExtendedInformation(exception);
@@ -104,7 +103,7 @@ public SerializableException(Exception exception)
public SerializableException InnerException { get; set; }
public List InnerExceptions { get; set; }
-
+
public string Message { get; set; }
public string Source { get; set; }
@@ -113,18 +112,18 @@ public SerializableException(Exception exception)
// This will make TargetSite property XML serializable but RuntimeMethodInfo class does not have a parameterless
// constructor thus the serializer throws an exception if full info is used
- public string TargetSite { get; set; }
+ public string TargetSite { get; set; }
public string Type { get; set; }
private SerializableDictionary GetExtendedInformation(Exception exception)
{
var extendedProperties = from property in exception.GetType().GetProperties()
- where
+ where
property.Name != "Data" && property.Name != "InnerExceptions" && property.Name != "InnerException" &&
- property.Name != "Message" && property.Name != "Source" && property.Name != "StackTrace" &&
+ property.Name != "Message" && property.Name != "Source" && property.Name != "StackTrace" &&
property.Name != "TargetSite" && property.Name != "HelpLink" && property.CanRead
- select property;
+ select property;
if (extendedProperties.Count() != 0)
{
@@ -148,9 +147,9 @@ public override string ToString()
var serializer = new XmlSerializer(typeof(SerializableException));
using (var stream = new MemoryStream())
{
- stream.SetLength(0);
+ stream.SetLength(0);
serializer.Serialize(stream, this);
- stream.Position = 0;
+ stream.Position = 0;
var doc = XDocument.Load(stream);
return doc.Root.ToString();
}
diff --git a/NBug/Core/Util/Storage/StoragePath.cs b/NBug/Core/Util/Storage/StoragePath.cs
index 7200df7..8e6fee0 100644
--- a/NBug/Core/Util/Storage/StoragePath.cs
+++ b/NBug/Core/Util/Storage/StoragePath.cs
@@ -28,7 +28,7 @@ internal StoragePath(string storagePath)
storagePathString = storagePath;
storagePathEnum = Enums.StoragePath.Custom;
}
-
+
public static implicit operator StoragePath(Enums.StoragePath path)
{
return new StoragePath(path);
@@ -57,4 +57,4 @@ public static implicit operator string(StoragePath path)
return storagePathString;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Storage/Storer.cs b/NBug/Core/Util/Storage/Storer.cs
index 38bac06..0474561 100644
--- a/NBug/Core/Util/Storage/Storer.cs
+++ b/NBug/Core/Util/Storage/Storer.cs
@@ -6,14 +6,13 @@
namespace NBug.Core.Util.Storage
{
+ using NBug.Core.Util.Exceptions;
+ using NBug.Core.Util.Logging;
using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Linq;
- using NBug.Core.Util.Exceptions;
- using NBug.Core.Util.Logging;
-
///
/// Initializes a new instance of the Storage class. This class implements interface
/// so it is better used with a using {...} statement.
@@ -117,7 +116,7 @@ internal static void TruncateReportFiles(int maxQueuedReports)
{
Logger.Trace("Truncating extra " + extraCount + " report files from the isolates storage.");
}
-
+
foreach (var file in isoFile.GetFileNames("Exception_*.zip"))
{
extraCount--;
@@ -193,7 +192,7 @@ internal Stream CreateReportFile(string reportFileName)
internal void DeleteCurrentReportFile()
{
this.stream.Close();
-
+
if (this.stream is IsolatedStorageFileStream)
{
Logger.Trace("Deleting report file from isolated storage: " + this.FileName);
@@ -270,7 +269,7 @@ internal Stream GetFirstReportFile()
else if (Settings.StoragePath == Enums.StoragePath.IsolatedStorage)
{
this.isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain, null, null);
-
+
if (this.isoStore.GetFileNames("Exception_*.zip").Count() > 0)
{
try
@@ -381,4 +380,4 @@ private void Dispose(bool disposing)
this.disposed = true;
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Core/Util/Storage/ZipStorer.cs b/NBug/Core/Util/Storage/ZipStorer.cs
index 13ca9e2..46038cc 100644
--- a/NBug/Core/Util/Storage/ZipStorer.cs
+++ b/NBug/Core/Util/Storage/ZipStorer.cs
@@ -78,11 +78,12 @@ internal class ZipStorer : IDisposable
///
private Stream ZipFileStream;
- #endregion
+ #endregion Constants and Fields
// File access for Open method
// Static constructor. Just invoked once in order to create the CRC32 lookup table.
+
#region Constructors and Destructors
///
@@ -111,7 +112,7 @@ static ZipStorer()
}
}
- #endregion
+ #endregion Constructors and Destructors
#region Enums
@@ -123,7 +124,7 @@ public enum Compression : ushort
///
/// Uncompressed storage
///
- Store = 0,
+ Store = 0,
///
/// Deflate compression method
@@ -131,7 +132,7 @@ public enum Compression : ushort
Deflate = 8
}
- #endregion
+ #endregion Enums
#region Public Methods
@@ -563,7 +564,7 @@ public List ReadCentralDir()
var result = new List();
- for (int pointer = 0; pointer < this.CentralDirImage.Length;)
+ for (int pointer = 0; pointer < this.CentralDirImage.Length; )
{
uint signature = BitConverter.ToUInt32(this.CentralDirImage, pointer);
if (signature != 0x02014b50)
@@ -607,7 +608,7 @@ public List ReadCentralDir()
return result;
}
- #endregion
+ #endregion Public Methods
#region Implemented Interfaces
@@ -621,20 +622,21 @@ public void Dispose()
this.Close();
}
- #endregion
+ #endregion IDisposable
- #endregion
+ #endregion Implemented Interfaces
/* DOS Date and time:
- MS-DOS date. The date is a packed value with the following format. Bits Description
- 0-4 Day of the month (1–31)
- 5-8 Month (1 = January, 2 = February, and so on)
- 9-15 Year offset from 1980 (add 1980 to get actual year)
- MS-DOS time. The time is a packed value with the following format. Bits Description
- 0-4 Second divided by 2
- 5-10 Minute (0–59)
- 11-15 Hour (0–23 on a 24-hour clock)
+ MS-DOS date. The date is a packed value with the following format. Bits Description
+ 0-4 Day of the month (1–31)
+ 5-8 Month (1 = January, 2 = February, and so on)
+ 9-15 Year offset from 1980 (add 1980 to get actual year)
+ MS-DOS time. The time is a packed value with the following format. Bits Description
+ 0-4 Second divided by 2
+ 5-10 Minute (0–59)
+ 11-15 Hour (0–23 on a 24-hour clock)
*/
+
#region Methods
///
@@ -665,11 +667,11 @@ private uint DateTimeToDosTime(DateTime _dt)
private DateTime DosTimeToDateTime(uint _dt)
{
return new DateTime(
- (int)(_dt >> 25) + 1980,
- (int)(_dt >> 21) & 15,
- (int)(_dt >> 16) & 31,
- (int)(_dt >> 11) & 31,
- (int)(_dt >> 5) & 63,
+ (int)(_dt >> 25) + 1980,
+ (int)(_dt >> 21) & 15,
+ (int)(_dt >> 16) & 31,
+ (int)(_dt >> 11) & 31,
+ (int)(_dt >> 5) & 63,
(int)(_dt & 31) * 2);
}
@@ -696,7 +698,7 @@ private uint GetFileOffset(uint _headerOffset)
}
/* CRC32 algorithm
- The 'magic number' for the CRC is 0xdebb20e3.
+ The 'magic number' for the CRC is 0xdebb20e3.
The proper CRC pre and post conditioning
is used, meaning that the CRC register is
pre-conditioned with all ones (a starting value
@@ -846,7 +848,7 @@ private void Store(ref ZipFileEntry _zfe, Stream _source)
// Verify for real compression
if (_zfe.Method == Compression.Deflate && !this.ForceDeflating && _source.CanSeek &&
- _zfe.CompressedSize > _zfe.FileSize)
+ _zfe.CompressedSize > _zfe.FileSize)
{
// Start operation again with Store algorithm
_zfe.Method = Compression.Store;
@@ -893,7 +895,7 @@ private void WriteCentralDirRecord(ZipFileEntry _zfe)
this.ZipFileStream.Write(new byte[] { 80, 75, 1, 2, 23, 0xB, 20, 0 }, 0, 8);
this.ZipFileStream.Write(BitConverter.GetBytes((ushort)(_zfe.EncodeUTF8 ? 0x0800 : 0)), 0, 2);
- // filename and comment encoding
+ // filename and comment encoding
this.ZipFileStream.Write(BitConverter.GetBytes((ushort)_zfe.Method), 0, 2); // zipping method
this.ZipFileStream.Write(BitConverter.GetBytes(this.DateTimeToDosTime(_zfe.ModifyTime)), 0, 4);
@@ -970,7 +972,7 @@ private void WriteLocalHeader(ref ZipFileEntry _zfe)
this.ZipFileStream.Write(new byte[] { 80, 75, 3, 4, 20, 0 }, 0, 6); // No extra header
this.ZipFileStream.Write(BitConverter.GetBytes((ushort)(_zfe.EncodeUTF8 ? 0x0800 : 0)), 0, 2);
- // filename and comment encoding
+ // filename and comment encoding
this.ZipFileStream.Write(BitConverter.GetBytes((ushort)_zfe.Method), 0, 2); // zipping method
this.ZipFileStream.Write(BitConverter.GetBytes(this.DateTimeToDosTime(_zfe.ModifyTime)), 0, 4);
@@ -985,7 +987,7 @@ private void WriteLocalHeader(ref ZipFileEntry _zfe)
_zfe.HeaderSize = (uint)(this.ZipFileStream.Position - pos);
}
- #endregion
+ #endregion Methods
///
/// Represents an entry in Zip file directory
@@ -1049,7 +1051,7 @@ public struct ZipFileEntry
///
public DateTime ModifyTime;
- #endregion
+ #endregion Constants and Fields
#region Public Methods
@@ -1064,7 +1066,7 @@ public override string ToString()
return this.FilenameInZip;
}
- #endregion
+ #endregion Public Methods
}
}
}
\ No newline at end of file
diff --git a/NBug/Core/Util/Web/StreamUpload.cs b/NBug/Core/Util/Web/StreamUpload.cs
index 2793a5a..150e5d7 100644
--- a/NBug/Core/Util/Web/StreamUpload.cs
+++ b/NBug/Core/Util/Web/StreamUpload.cs
@@ -6,13 +6,11 @@
// --------------------------------------------------------------------------------------------------------------------
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
using System.Collections.Specialized;
-using System.Net;
using System.Globalization;
+using System.IO;
+using System.Net;
+using System.Text;
namespace NBug.Core.Util.Web
{
@@ -45,14 +43,13 @@ public StreamUpload Upload(string url)
request.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);
request.Method = "POST";
- if(credentials != null)
+ if (credentials != null)
{
var user = credentials.GetCredential(request.RequestUri, "Basic");
string auth = string.Format("{0}:{1}", user.UserName, user.Password);
request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(auth)));
}
-
WriteToHttpStream(request, outputStream);
response = request.GetResponse();
return this;
@@ -68,10 +65,10 @@ public StreamUpload Add(string name, string value)
public StreamUpload AddNameValues(NameValueCollection nameValues)
{
- foreach(string name in nameValues.Keys)
+ foreach (string name in nameValues.Keys)
{
Add(name, nameValues[name]);
- }
+ }
return this;
}
@@ -91,7 +88,7 @@ public StreamUpload Add(Stream inputStream, string formName, string fileName, st
byte[] buffer = new byte[inputStream.Length];
int bytesRead = 0;
- while((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) != 0)
+ while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) != 0)
{
outputStream.Write(buffer, 0, bytesRead);
}
@@ -122,7 +119,7 @@ private void WriteBoundaryToStream(MemoryStream stream, string endDeliminator)
private void WriteNameValuesToStream(MemoryStream stream, NameValueCollection nameValues)
{
- foreach(string name in nameValues.Keys)
+ foreach (string name in nameValues.Keys)
{
WriteBoundaryToStream(stream, Environment.NewLine);
@@ -135,7 +132,7 @@ private void WriteToHttpStream(HttpWebRequest request, MemoryStream outputStream
{
request.ContentLength = outputStream.Length;
- using(Stream requestStream = request.GetRequestStream())
+ using (Stream requestStream = request.GetRequestStream())
{
outputStream.Position = 0;
diff --git a/NBug/Enums/LoggerCategory.cs b/NBug/Enums/LoggerCategory.cs
index 4627298..d2ba245 100644
--- a/NBug/Enums/LoggerCategory.cs
+++ b/NBug/Enums/LoggerCategory.cs
@@ -15,7 +15,7 @@ public enum LoggerCategory
NBugTrace,
///
- /// This category outputs results of substantial events like the server response after submitting a bug report to the a server.
+ /// This category outputs results of substantial events like the server response after submitting a bug report to the a server.
///
NBugInfo,
diff --git a/NBug/Enums/UIProvider.cs b/NBug/Enums/UIProvider.cs
index 6705840..5d871c1 100644
--- a/NBug/Enums/UIProvider.cs
+++ b/NBug/Enums/UIProvider.cs
@@ -28,9 +28,9 @@ public enum UIProvider
///
WPF,
- ///
- /// Custom UIProvider.
- ///
- Custom
+ ///
+ /// Custom UIProvider.
+ ///
+ Custom
}
}
\ No newline at end of file
diff --git a/NBug/Events/CustomSubmissionEventArgs.cs b/NBug/Events/CustomSubmissionEventArgs.cs
new file mode 100644
index 0000000..7a0be10
--- /dev/null
+++ b/NBug/Events/CustomSubmissionEventArgs.cs
@@ -0,0 +1,29 @@
+namespace NBug
+{
+ using NBug.Core.Reporting.Info;
+ using NBug.Core.Util.Serialization;
+ using System;
+ using System.IO;
+
+ public class CustomSubmissionEventArgs : EventArgs
+ {
+ internal CustomSubmissionEventArgs(string fileName, Stream file, Report report, SerializableException exception)
+ {
+ FileName = fileName;
+ File = file;
+ Report = report;
+ Exception = exception;
+ Result = false;
+ }
+
+ public string FileName { get; private set; }
+
+ public Stream File { get; private set; }
+
+ public Report Report { get; private set; }
+
+ public SerializableException Exception { get; private set; }
+
+ public bool Result { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/NBug/Events/CustomUIEventArgs.cs b/NBug/Events/CustomUIEventArgs.cs
index bab1a09..20f1b75 100644
--- a/NBug/Events/CustomUIEventArgs.cs
+++ b/NBug/Events/CustomUIEventArgs.cs
@@ -1,26 +1,27 @@
namespace NBug
{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using NBug.Core.Reporting.Info;
- using NBug.Core.Util.Serialization;
- using NBug.Core.UI;
- using NBug.Enums;
+ using NBug.Core.Reporting.Info;
+ using NBug.Core.UI;
+ using NBug.Core.Util.Serialization;
+ using NBug.Enums;
+ using System;
- public class CustomUIEventArgs : EventArgs
- {
- internal CustomUIEventArgs(UIMode uiMode, SerializableException exception, Report report)
- {
- UIMode = uiMode;
- Report = report;
- Exception = exception;
- Result = new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.DoNotSend);
- }
+ public class CustomUIEventArgs : EventArgs
+ {
+ internal CustomUIEventArgs(UIMode uiMode, SerializableException exception, Report report)
+ {
+ UIMode = uiMode;
+ Report = report;
+ Exception = exception;
+ Result = new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.DoNotSend);
+ }
- public UIMode UIMode { get; private set; }
- public Report Report { get; private set; }
- public SerializableException Exception { get; private set; }
- public UIDialogResult Result { get; set; }
- }
-}
+ public UIMode UIMode { get; private set; }
+
+ public Report Report { get; private set; }
+
+ public SerializableException Exception { get; private set; }
+
+ public UIDialogResult Result { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/NBug/Exceptions.cs b/NBug/Exceptions.cs
index d089305..4039220 100644
--- a/NBug/Exceptions.cs
+++ b/NBug/Exceptions.cs
@@ -6,12 +6,10 @@
namespace NBug
{
- using System;
-
using NBug.Core.Reporting;
using NBug.Core.Reporting.MiniDump;
- using NBug.Core.Submission;
using NBug.Core.Util;
+ using System;
public static class Exceptions
{
@@ -19,12 +17,12 @@ public static class Exceptions
/// This function acts as an exception filter for any exception that is raised from within the action body (you can see
/// MSDN subject "Exception Filters" to get more info on the subject). As the name implies, exceptions raised from within
/// the action block is simply filtered to be sent as an error report, and never actually caught or handled. Filters all
- /// the exceptions inside the action body and queues an error report. Note that the exceptions are not actually handled,
- /// but filtered, so if the exception is left unhandled in an upper block, it will crash the application. This is very
+ /// the exceptions inside the action body and queues an error report. Note that the exceptions are not actually handled,
+ /// but filtered, so if the exception is left unhandled in an upper block, it will crash the application. This is very
/// useful for situations where you need to log exceptions inside a code block and get a good minidump of the exception.
/// Use the method to actually handle the exception and show an exception dialog to the
/// user and shut down the application gracefully (if set so). You can simply use Filter(() => { MyCodeHere(); })
- ///
+ ///
/// Body of code to be executed.
public static void Filter(Action body)
{
@@ -46,18 +44,18 @@ public static void Handle(bool continueExecution, Action body)
ExceptionFilters.Filter(
body,
ex =>
- {
- // Filtering the exception
- new BugReport().Report(ex, ExceptionThread.Main);
- return true; // Yes proceed to handling the exception
- },
+ {
+ // Filtering the exception
+ new BugReport().Report(ex, ExceptionThread.Main);
+ return true; // Yes proceed to handling the exception
+ },
ex =>
+ {
+ if (!continueExecution)
{
- if (!continueExecution)
- {
- Environment.Exit(0);
- }
- });
+ Environment.Exit(0);
+ }
+ });
}
///
@@ -71,4 +69,4 @@ public static void Report(Exception exception)
new BugReport().Report(exception, ExceptionThread.Main);
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Handler.cs b/NBug/Handler.cs
index 3488b45..ee63f18 100644
--- a/NBug/Handler.cs
+++ b/NBug/Handler.cs
@@ -6,6 +6,10 @@
namespace NBug
{
+ using NBug.Core.Reporting;
+ using NBug.Core.UI;
+ using NBug.Core.Util;
+ using NBug.Core.Util.Logging;
using System;
using System.Runtime.ExceptionServices;
using System.Threading;
@@ -13,11 +17,6 @@ namespace NBug
using System.Windows.Forms;
using System.Windows.Threading;
- using NBug.Core.Reporting;
- using NBug.Core.UI;
- using NBug.Core.Util;
- using NBug.Core.Util.Logging;
-
public static class Handler
{
static Handler()
@@ -122,7 +121,7 @@ private static void UnhandledExceptionHandler(object sender, UnhandledExceptionE
if (executionFlow == ExecutionFlow.BreakExecution)
{
Environment.Exit(0);
- }
+ }
}
}
@@ -149,7 +148,7 @@ private static void ThreadExceptionHandler(object sender, ThreadExceptionEventAr
if (executionFlow == ExecutionFlow.BreakExecution)
{
Environment.Exit(0);
- }
+ }
}
}
@@ -179,7 +178,7 @@ private static void DispatcherUnhandledExceptionHandler(object sender, Dispatche
else if (executionFlow == ExecutionFlow.ContinueExecution)
{
e.Handled = true;
- }
+ }
}
}
@@ -209,7 +208,7 @@ private static void UnobservedTaskExceptionHandler(object sender, UnobservedTask
else if (executionFlow == ExecutionFlow.ContinueExecution)
{
e.SetObserved();
- }
+ }
}
}
@@ -219,4 +218,4 @@ private static void CorruptUnobservedTaskExceptionHandler(object sender, Unobser
UnobservedTaskExceptionHandler(sender, e);
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/NBug.csproj b/NBug/NBug.csproj
index ffe6db6..c40b685 100644
--- a/NBug/NBug.csproj
+++ b/NBug/NBug.csproj
@@ -70,6 +70,7 @@
Properties\GlobalAssemblyInfo.cs
+
@@ -95,6 +96,7 @@
+
diff --git a/NBug/Properties/AssemblyInfo.cs b/NBug/Properties/AssemblyInfo.cs
index 07c6fad..0fd1807 100644
--- a/NBug/Properties/AssemblyInfo.cs
+++ b/NBug/Properties/AssemblyInfo.cs
@@ -8,15 +8,15 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NBug")]
[assembly: AssemblyDescription("NBug bug reporting library created by Teoman Soygul.")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -30,10 +30,10 @@
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
\ No newline at end of file
diff --git a/NBug/Properties/SettingsOverride.cs b/NBug/Properties/SettingsOverride.cs
index 5def70c..8f0a160 100644
--- a/NBug/Properties/SettingsOverride.cs
+++ b/NBug/Properties/SettingsOverride.cs
@@ -9,7 +9,7 @@ namespace NBug.Properties
using System.IO;
using System.Xml;
using System.Xml.Linq;
-
+
public static class SettingsOverride
{
///
@@ -69,4 +69,4 @@ public static void SaveCustomSettings(Stream settingsFile)
NBug.Settings.SaveCustomSettings(settingsFile, false);
}
}
-}
+}
\ No newline at end of file
diff --git a/NBug/Settings.cs b/NBug/Settings.cs
index 9ece3e2..5a44f70 100644
--- a/NBug/Settings.cs
+++ b/NBug/Settings.cs
@@ -6,6 +6,14 @@
namespace NBug
{
+ using NBug.Core.Reporting;
+ using NBug.Core.Reporting.Info;
+ using NBug.Core.Submission;
+ using NBug.Core.Util;
+ using NBug.Core.Util.Exceptions;
+ using NBug.Core.Util.Logging;
+ using NBug.Enums;
+ using NBug.Properties;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -21,24 +29,15 @@ namespace NBug
using System.Xml.Linq;
using System.Xml.XPath;
- using NBug.Core.Reporting;
- using NBug.Core.Reporting.Info;
- using NBug.Core.Submission;
- using NBug.Core.Util;
- using NBug.Core.Util.Exceptions;
- using NBug.Core.Util.Logging;
- using NBug.Enums;
- using NBug.Properties;
-
public static class Settings
{
///
/// Lookup for quickly finding the type to instantiate for a given connection string type.
- ///
+ ///
/// By making this lazy we don't do the lookup until we know we have to, as
/// reflection against all assemblies can be slow.
///
- private static readonly Lazy> _availableProtocols
+ private static readonly Lazy> _availableProtocols
= new Lazy>(() =>
{
// find all concrete implementations of IProtocolFactory
@@ -48,7 +47,7 @@ private static readonly Lazy> _availablePr
.Where(type.IsAssignableFrom)
.Where(t => t.IsClass)
.Where(t => !t.IsAbstract)
- .Select(t => (IProtocolFactory) Activator.CreateInstance(t))
+ .Select(t => (IProtocolFactory)Activator.CreateInstance(t))
.ToDictionary(f => f.SupportedType);
});
@@ -62,16 +61,16 @@ static Settings()
// Default to developer mode settings. Settings this now so that any exception below will be handled with correct settings
ReleaseMode = false; // ToDo: This results initial config loading always setup to ThrowExceptions = true;
-
+
// Check to see if the settings are overriden manually. If so, don't load the settings file automatically.
if (SettingsOverride.Overridden == false)
{
- /*
- * Settings file search order:
- * 1) NBug.config (inside the same folder with 'NBug.dll')
- * 2) NBug.dll.config (fool proof!) (inside the same folder with 'NBug.dll')
- * 3) app.config (i.e. MyProduct.exe.config inside the same folder with the main executable 'MyProduct.exe')
- */
+ /*
+ * Settings file search order:
+ * 1) NBug.config (inside the same folder with 'NBug.dll')
+ * 2) NBug.dll.config (fool proof!) (inside the same folder with 'NBug.dll')
+ * 3) app.config (i.e. MyProduct.exe.config inside the same folder with the main executable 'MyProduct.exe')
+ */
var path1 = Path.Combine(NBugDirectory, "NBug.config");
var path2 = Path.Combine(NBugDirectory, "NBug.dll.config");
@@ -113,6 +112,7 @@ static Settings()
}
#region Public methods
+
///
/// Adds a destination based on a connection string.
///
@@ -133,7 +133,8 @@ public static IProtocol AddDestinationFromConnectionString(string connectionStri
Destinations.Add(protocol);
return protocol;
}
- #endregion
+
+ #endregion Public methods
#region Public Settings
@@ -189,11 +190,12 @@ public static event Action ProcessingException
}
private static readonly ICollection destinations = new Collection();
+
public static ICollection Destinations
{
get { return destinations; }
}
-
+
///
/// Gets or sets the UI mode. You should only change this if you read the documentation and understood it. Otherwise leave it to auto.
/// Default value is Auto.
@@ -248,7 +250,7 @@ public static ICollection Destinations
public static MiniDumpType MiniDumpType { get; set; }
///
- /// Gets or sets a value indicating whether to write "NLog.log" file to disk. Otherwise, you can subscribe to log events through the
+ /// Gets or sets a value indicating whether to write "NLog.log" file to disk. Otherwise, you can subscribe to log events through the
/// event. All the logging is done through System.Diagnostics.Trace.Write() function so you can also get
/// the log with any trace listener. Default value is true.
///
@@ -270,7 +272,7 @@ public static ICollection Destinations
public static bool HandleProcessCorruptedStateExceptions { get; set; }
///
- /// Gets or sets a value indicating whether to use the deferred reporting feature. With this feature enabled, all bug reports are sent
+ /// Gets or sets a value indicating whether to use the deferred reporting feature. With this feature enabled, all bug reports are sent
/// after the next application start and as a background task. This helps facilitate sending of bug reports with large memory dumps
/// with them. When this feature is disabled, bug reports are sent as soon as an unhandled exception is caught. For the users, it is
/// very uncomfortable to wait for bug reports to be sent after an application crash, so it is best to leave this feature on.
@@ -331,23 +333,41 @@ public static bool ReleaseMode
///
public static List AdditionalReportFiles { get; set; }
- ///
- /// Gets or sets an event for a CustomUI.
- ///
- internal static Delegate CustomUIHandle;
- public static event EventHandler CustomUIEvent
- {
- add
- {
- CustomUIHandle = Delegate.Combine(CustomUIHandle, value);
- }
- remove
- {
- CustomUIHandle = Delegate.Remove(CustomUIHandle, value);
- }
- }
-
- #endregion
+ ///
+ /// Gets or sets an event for a CustomUI.
+ ///
+ internal static Delegate CustomUIHandle;
+
+ public static event EventHandler CustomUIEvent
+ {
+ add
+ {
+ CustomUIHandle = Delegate.Combine(CustomUIHandle, value);
+ }
+ remove
+ {
+ CustomUIHandle = Delegate.Remove(CustomUIHandle, value);
+ }
+ }
+
+ ///
+ /// Gets or sets an event for a CustomSubmission.
+ ///
+ internal static Delegate CustomSubmissionHandle;
+
+ public static event EventHandler CustomSubmissionEvent
+ {
+ add
+ {
+ CustomSubmissionHandle = Delegate.Combine(CustomSubmissionHandle, value);
+ }
+ remove
+ {
+ CustomSubmissionHandle = Delegate.Remove(CustomSubmissionHandle, value);
+ }
+ }
+
+ #endregion Public Settings
#region Internal Settings
@@ -359,7 +379,7 @@ public static event EventHandler CustomUIEvent
internal static bool? EnableNetworkTrace { get; set; }
///
- /// Gets the Cipher text used for encrypting connection strings before saving to disk. This is automatically generated when the
+ /// Gets the Cipher text used for encrypting connection strings before saving to disk. This is automatically generated when the
/// method method is called with encryption set to true.
///
internal static byte[] Cipher { get; private set; }
@@ -412,14 +432,14 @@ public static event EventHandler CustomUIEvent
internal static bool SkipDispatching { get; set; }
///
- /// Gets or sets a value indicating whether to remove all the statements from
- /// the thread executions. Some thread sleep statements are used to increase the host application performance i.e. the
+ /// Gets or sets a value indicating whether to remove all the statements from
+ /// the thread executions. Some thread sleep statements are used to increase the host application performance i.e. the
/// halts the execution of for a given number of
/// seconds to let the host application initialize properly.
///
internal static bool RemoveThreadSleep { get; set; }
- #endregion
+ #endregion Internal Settings
#region Load Save Settings Methods
@@ -445,8 +465,8 @@ internal static void LoadCustomSettings(XElement config)
if (config.XPathSelectElement("system.diagnostics") != null && config.XPathSelectElement("system.diagnostics/sharedListeners") != null)
{
var traceLog = from networkTrace in config.XPathSelectElements("system.diagnostics/sharedListeners/add")
- where networkTrace.Attribute("initializeData") != null && networkTrace.Attribute("initializeData").Value == "NBug.Network.log"
- select networkTrace;
+ where networkTrace.Attribute("initializeData") != null && networkTrace.Attribute("initializeData").Value == "NBug.Network.log"
+ select networkTrace;
if (traceLog.Count() != 0)
{
@@ -515,7 +535,7 @@ where element.Attribute("name") != null && element.Element("value") != null
}
else
{
- Logger.Error("There is a problem with the 'applicationSettings' section of the configuration file. The property read from the file '" + property + "' is undefined. This is probably a refactoring problem, or a malformed config file.");
+ Logger.Error(String.Format("There is a problem with the 'applicationSettings' section of the configuration file. The property read from the file '{0}' is undefined. This is probably a refactoring problem, or a malformed config file.", property));
}
}
@@ -587,8 +607,8 @@ internal static void SaveCustomSettings(Stream settingsFile, bool encryptConnect
else
{
var sectionGroup = from setting in config.Root.Element("configSections").Elements()
- where setting.Attribute("name") != null && setting.Attribute("name").Value == "applicationSettings"
- select setting;
+ where setting.Attribute("name") != null && setting.Attribute("name").Value == "applicationSettings"
+ select setting;
if (sectionGroup.Count() == 0)
{
@@ -597,8 +617,8 @@ where setting.Attribute("name") != null && setting.Attribute("name").Value == "a
else
{
var nbugSection = from section in sectionGroup.Elements()
- where section.Attribute("name") != null && section.Attribute("name").Value == "NBug.Properties.Settings"
- select section;
+ where section.Attribute("name") != null && section.Attribute("name").Value == "NBug.Properties.Settings"
+ select section;
if (nbugSection.Count() == 0)
{
@@ -645,9 +665,9 @@ where section.Attribute("name") != null && section.Attribute("name").Value == "N
// Replace connection strings
var prefix = "NBug.Properties.Settings.";
var connectionStrings = from connString in config.Root.Element("connectionStrings").Elements()
- where connString.Attribute("name") != null &&
- connString.Attribute("name").Value.StartsWith(prefix)
- select connString;
+ where connString.Attribute("name") != null &&
+ connString.Attribute("name").Value.StartsWith(prefix)
+ select connString;
connectionStrings.Remove();
if (encryptConnectionStrings)
@@ -674,20 +694,20 @@ where connString.Attribute("name") != null &&
// Replace application setting
// ToDo: This can be simplified using a loop and reflection to get all the Settings.PublicProperties to do remove-add cycle
var applicationSettings = from appSetting in config.Root.Element("applicationSettings").Element("NBug.Properties.Settings").Elements()
- where appSetting.Attribute("name") != null &&
- (appSetting.Attribute("name").Value == GetPropertyName(() => UIMode) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => UIProvider) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => SleepBeforeSend) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => MaxQueuedReports) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => StopReportingAfter) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => StoragePath) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => MiniDumpType) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => WriteLogToDisk) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => ExitApplicationImmediately) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => HandleProcessCorruptedStateExceptions) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => ReleaseMode) ||
- appSetting.Attribute("name").Value == GetPropertyName(() => DeferredReporting))
- select appSetting;
+ where appSetting.Attribute("name") != null &&
+ (appSetting.Attribute("name").Value == GetPropertyName(() => UIMode) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => UIProvider) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => SleepBeforeSend) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => MaxQueuedReports) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => StopReportingAfter) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => StoragePath) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => MiniDumpType) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => WriteLogToDisk) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => ExitApplicationImmediately) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => HandleProcessCorruptedStateExceptions) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => ReleaseMode) ||
+ appSetting.Attribute("name").Value == GetPropertyName(() => DeferredReporting))
+ select appSetting;
applicationSettings.Remove();
AddApplicationSetting(config, UIMode, () => UIMode);
@@ -717,9 +737,10 @@ where appSetting.Attribute("name") != null &&
settingsFile.Flush();
}
- #endregion
+ #endregion Load Save Settings Methods
#region Private Methods
+
private static void AddConnectionString(XDocument document, string content, int number)
{
if (!string.IsNullOrEmpty(content))
@@ -869,6 +890,6 @@ private static string GetPropertyName(Expression> propertyExpression)
return ((MemberExpression)propertyExpression.Body).Member.Name;
}
- #endregion
+ #endregion Private Methods
}
}
\ No newline at end of file
diff --git a/NBug/app.config b/NBug/app.config
index b06983b..c8d4922 100644
--- a/NBug/app.config
+++ b/NBug/app.config
@@ -1,52 +1,52 @@

-
-
-
-
-
-
-
-
-
- Auto
-
-
- Auto
-
-
- 10
-
-
- 5
-
-
- 30
-
-
- CurrentDirectory
-
-
- Tiny
-
-
- True
-
-
- True
-
-
- False
-
-
- False
-
-
- True
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ Auto
+
+
+ Auto
+
+
+ 10
+
+
+ 5
+
+
+ 30
+
+
+ CurrentDirectory
+
+
+ Tiny
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ True
+
+
+
+
+
+
+
\ No newline at end of file