/// <summary> Initializes all readonly configuration values </summary> static Configuration() { // Serializer: Binary = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); Binary.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; Binary.FilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; Binary.TypeFormat = System.Runtime.Serialization.Formatters.FormatterTypeStyle.TypesWhenNeeded; // DEFUALT FORMATTING FORMAT_DEFAULT = LogUtils.PrepareFormatString("[{ManagedThreadId:D2}] {Level,8} - {Message}");// <- this can NOT contain expressions FORMAT_METHOD = LogUtils.PrepareFormatString("{MethodType:%s.}{MethodName}{MethodArgs:(%s)}"); FORMAT_LOCATION = LogUtils.PrepareFormatString("{LogCurrent: executing %s}{Method: at %s@}{IlOffset:?}{FileLocation}"); FORMAT_FILELINE = LogUtils.PrepareFormatString("{FileName: in %s:line }{FileLine:?}"); FORMAT_FULLMESSAGE = LogUtils.PrepareFormatString("{Message}{Location}{Exception}"); FormatProvider = new EventDataFormatter(); CSharpTest.Net.Utils.ProcessInfo info = new CSharpTest.Net.Utils.ProcessInfo(); ProcessId = info.ProcessId; ProcessName = info.ProcessName; AppDomainName = info.AppDomainName; EntryAssembly = info.EntryAssembly.GetName().Name; IsDebugging = info.IsDebugging; DefaultLogFile = info.DefaultLogFile.Insert(info.DefaultLogFile.LastIndexOf('.'), "{0}"); }
/// <summary> Initializes all readonly configuration values </summary> static Configuration() { // Serializer: Binary = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); Binary.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; Binary.FilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; Binary.TypeFormat = System.Runtime.Serialization.Formatters.FormatterTypeStyle.TypesWhenNeeded; // DEFUALT FORMATTING FORMAT_DEFAULT = LogUtils.PrepareFormatString("[{ManagedThreadId:D2}] {Level,8} - {Message}"); // <- this can NOT contain expressions FORMAT_METHOD = LogUtils.PrepareFormatString("{MethodType:%s.}{MethodName}{MethodArgs:(%s)}"); FORMAT_LOCATION = LogUtils.PrepareFormatString("{LogCurrent: executing %s}{Method: at %s@}{IlOffset:?}{FileLocation}"); FORMAT_FILELINE = LogUtils.PrepareFormatString("{FileName: in %s:line }{FileLine:?}"); FORMAT_FULLMESSAGE = LogUtils.PrepareFormatString("{Message}{Location}{Exception}"); FormatProvider = new EventDataFormatter(); CSharpTest.Net.Utils.ProcessInfo info = new CSharpTest.Net.Utils.ProcessInfo(); ProcessId = info.ProcessId; ProcessName = info.ProcessName; AppDomainName = info.AppDomainName; EntryAssembly = info.EntryAssembly.GetName().Name; IsDebugging = info.IsDebugging; DefaultLogFile = info.DefaultLogFile.Insert(info.DefaultLogFile.LastIndexOf('.'), "{0}"); }
/// <summary> /// This is some ugly code, the intent is to be able to answer the above questions in /// a wide array of environments. I admit now this will fail eventually. /// </summary> static Constants() { CSharpTest.Net.Utils.ProcessInfo info = null; try { info = new CSharpTest.Net.Utils.ProcessInfo(); } catch { return; } ProcessId = info.ProcessId; ProcessName = info.ProcessName; ProcessFile = info.ProcessFile; AppDomainName = info.AppDomainName; EntryAssembly = info.EntryAssembly; ProductVersion = info.ProductVersion; ProductName = info.ProductName; CompanyName = info.CompanyName; IsDebugging = info.IsDebugging; RegistrySoftwarePath = info.RegistrySoftwarePath; ApplicationData = info.ApplicationData; LocalApplicationData = info.LocalApplicationData; DefaultLogFile = info.DefaultLogFile; IsUnitTest = (ProcessName.IndexOf("NUnit", StringComparison.OrdinalIgnoreCase) >= 0); }