private void Create(string traceSourceName) { Type callerBase = StackTraceHelper.GetMethod(StackTraceCaller.Caller) .ReflectedType; Type myBase = MethodBase.GetCurrentMethod() .ReflectedType; bool isInternalCall = callerBase != null && myBase != null && myBase.FullName.Equals(callerBase.FullName); var shouldCreateTraceSource = false; if (!isInternalCall) { TraceSource traceSource = GetTraceSource(traceSourceName); if (traceSource == null) { shouldCreateTraceSource = true; } } if (isInternalCall || shouldCreateTraceSource) { if (_traceSourceCollection == null) { _traceSourceCollection = new List <TraceSource>(); } _traceSourceCollection.Add(new TraceSource(traceSourceName)); TraceEvent(TraceEventType.Verbose, 0, string.Format(CultureInfo.InvariantCulture, Resources.Tracer_TraceDataToFile_Created, traceSourceName)); } }
private static string GetCallerAssemblySpecificInformation() { MethodBase methodBase = StackTraceHelper.GetMethod(StackTraceCaller.CallersCallersCaller); Assembly assembly = methodBase.Module.Assembly; string output = assembly.GetTitleAttribute(); return(output); }