Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
3,272 additions
and
4,573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Xml; | ||
using System.Collections; | ||
using System.Xml; | ||
|
||
namespace NLog.XmlLayout | ||
{ | ||
public class Serialization | ||
{ | ||
/// <summary> | ||
/// Serializes exception into XML. If exception or stream is null | ||
/// does nothing. | ||
/// </summary> | ||
/// <param name="currentException"></param> | ||
/// <param name="writer"></param> | ||
public static void SerializeException(Exception currentException, XmlTextWriter writer) | ||
{ | ||
if (currentException == null || writer == null) | ||
return; | ||
public class Serialization | ||
{ | ||
/// <summary> | ||
/// Serializes exception into XML. If exception or stream is null | ||
/// does nothing. | ||
/// </summary> | ||
/// <param name="currentException"></param> | ||
/// <param name="writer"></param> | ||
public static void SerializeException(Exception currentException, XmlTextWriter writer) | ||
{ | ||
if (currentException == null || writer == null) | ||
return; | ||
|
||
writer.WriteStartElement("Exception"); | ||
writer.WriteStartElement("Exception"); | ||
|
||
writer.WriteStartElement("Message"); | ||
writer.WriteString(currentException.Message); | ||
writer.WriteEndElement(); | ||
writer.WriteStartElement("Message"); | ||
writer.WriteString(currentException.Message); | ||
writer.WriteEndElement(); | ||
|
||
writer.WriteStartElement("Source"); | ||
writer.WriteString(currentException.Source); | ||
writer.WriteEndElement(); | ||
writer.WriteStartElement("Source"); | ||
writer.WriteString(currentException.Source); | ||
writer.WriteEndElement(); | ||
|
||
|
||
if (currentException.StackTrace != null) | ||
{ | ||
writer.WriteStartElement("Stack"); | ||
writer.WriteString(currentException.StackTrace); | ||
writer.WriteEndElement(); | ||
} | ||
if (currentException.Data.Count > 0) | ||
{ | ||
foreach (DictionaryEntry item in currentException.Data) | ||
{ | ||
writer.WriteStartElement("Data"); | ||
if (item.Key != null) | ||
XmlLayoutRenderer.WriteToAttribute(writer, "key", item.Key.ToString()); | ||
if (item.Value != null) | ||
XmlLayoutRenderer.WriteToAttribute(writer, "value", item.Value.ToString()); | ||
writer.WriteEndElement(); | ||
} | ||
} | ||
if (currentException.StackTrace != null) | ||
{ | ||
writer.WriteStartElement("Stack"); | ||
writer.WriteString(currentException.StackTrace); | ||
writer.WriteEndElement(); | ||
} | ||
if (currentException.Data.Count > 0) | ||
{ | ||
foreach (DictionaryEntry item in currentException.Data) | ||
{ | ||
writer.WriteStartElement("Data"); | ||
if (item.Key != null) | ||
XmlLayoutRenderer.WriteToAttribute(writer, "key", item.Key.ToString()); | ||
if (item.Value != null) | ||
XmlLayoutRenderer.WriteToAttribute(writer, "value", item.Value.ToString()); | ||
writer.WriteEndElement(); | ||
} | ||
} | ||
|
||
if (currentException.InnerException != null) | ||
{ | ||
SerializeException(currentException.InnerException, writer); | ||
} | ||
writer.WriteEndElement(); | ||
} | ||
} | ||
if (currentException.InnerException != null) | ||
{ | ||
SerializeException(currentException.InnerException, writer); | ||
} | ||
writer.WriteEndElement(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using dnGREP.Common; | ||
using Xunit; | ||
using dnGREP; | ||
using dnGREP.Common; | ||
|
||
namespace Tests | ||
{ | ||
public class BookmarkTest : TestBase | ||
{ | ||
[Fact] | ||
public void TestBookmarks() | ||
{ | ||
BookmarkLibrary.Instance.Bookmarks.Clear(); | ||
BookmarkLibrary.Instance.Bookmarks.Add(new Bookmark("test1", "test2", "test3", "test4")); | ||
BookmarkLibrary.Save(); | ||
BookmarkLibrary.Load(); | ||
Assert.Equal(BookmarkLibrary.Instance.Bookmarks.Count, 1); | ||
Assert.Equal(BookmarkLibrary.Instance.Bookmarks[0].Description, "test4"); | ||
} | ||
} | ||
{ | ||
public class BookmarkTest : TestBase | ||
{ | ||
[Fact] | ||
public void TestBookmarks() | ||
{ | ||
BookmarkLibrary.Instance.Bookmarks.Clear(); | ||
BookmarkLibrary.Instance.Bookmarks.Add(new Bookmark("test1", "test2", "test3", "test4")); | ||
BookmarkLibrary.Save(); | ||
BookmarkLibrary.Load(); | ||
Assert.Equal(BookmarkLibrary.Instance.Bookmarks.Count, 1); | ||
Assert.Equal(BookmarkLibrary.Instance.Bookmarks[0].Description, "test4"); | ||
} | ||
} | ||
} |
Oops, something went wrong.