示例#1
0
        // Private members

        private static string LogHeaderKeyToString(LogHeaderKey key)
        {
            switch (key)
            {
            case LogHeaderKey.ProductVersion:
                return("Product Version");

            case LogHeaderKey.ClrVersion:
                return("CLR Version");

            case LogHeaderKey.FrameworkVersion:
                return("Framework Version");

            case LogHeaderKey.OSVersion:
                return("OS Version");

            case LogHeaderKey.Locale:
                return("Locale");

            case LogHeaderKey.Path:
                return("Path");

            case LogHeaderKey.WorkingDirectory:
                return("Working Directory");

            case LogHeaderKey.Timestamp:
                return("Timestamp");

            default:
                throw new ArgumentOutOfRangeException(nameof(key));
            }
        }
示例#2
0
        // Public members

        public static void Add(this ILogHeaderCollection headers, LogHeaderKey key, Func <string> getter)
        {
            headers.Add(LogHeaderKeyToString(key), getter);
        }
示例#3
0
 public static bool TryGetValue(this ILogHeaderCollection headers, LogHeaderKey key, out string value)
 {
     return(headers.TryGetValue(LogHeaderKeyToString(key), out value));
 }
示例#4
0
 public static bool ContainsKey(this ILogHeaderCollection headers, LogHeaderKey key)
 {
     return(headers.ContainsKey(LogHeaderKeyToString(key)));
 }
示例#5
0
 public static bool Remove(this ILogHeaderCollection headers, LogHeaderKey key)
 {
     return(headers.Remove(LogHeaderKeyToString(key)));
 }
示例#6
0
 public static void Add(this ILogHeaderCollection headers, LogHeaderKey key, string value)
 {
     headers.Add(key, () => value);
 }