Click here to Skip to main content
13,087,566 members (92,791 online)
Click here to Skip to main content

Stats

24.8K views
500 downloads
34 bookmarked
Posted 20 May 2010

NLog Log and Audit Advanced Target

, 26 May 2010
A way to audit your business objects using NLog.
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;

namespace App.Logger.Targets.ObjectHistoryLogger.Data.DBScripts
{
	/// <summary>
	/// Comparer to sort the script files by name & version
	/// </summary>
	internal class ScriptFileNameComparer : IComparer<string>
	{
		#region IComparer<string> Members

		public int Compare(string x, string y)
		{
			string type1 = x.Split('-')[0].ToLower();
			Version version1 = new Version(x.Split('-')[1].Trim().ToLower().Replace("v", ""));
			string type2 = y.Split('-')[0].ToLower();
			Version version2 = new Version(y.Split('-')[1].Trim().ToLower().Replace("v", ""));

			if (type1.Equals(type2))
			{
				return version1.CompareTo(version2);
			}
			else
			{
				return 0;
			}
		}

		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

AlexCode
Architect
Switzerland Switzerland
Senior IT Consultant working in Switzerland as Senior Software Engineer.

Find more at on my blog.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 26 May 2010
Article Copyright 2010 by AlexCode
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid