示例#1
0
 private string GetChannelName(EventChannel channel, string eventName)
 {
     ManifestBuilder.ChannelInfo channelInfo = null;
     if (this.channelTab == null || !this.channelTab.TryGetValue(channel, out channelInfo))
     {
         throw new ArgumentException(EventSourceSR.EventSource_UndefinedChannel(channel, eventName));
     }
     return(channelInfo.Name);
 }
示例#2
0
 public void AddKeyword(string name, ulong value)
 {
     if ((value & value - (long)1) != (long)0)
     {
         throw new ArgumentException(EventSourceSR.Event_KeywordValue(value, name));
     }
     if (this.keywordTab == null)
     {
         this.keywordTab = new Dictionary <ulong, string>();
     }
     this.keywordTab[value] = name;
 }
示例#3
0
        private string GetKeywords(ulong keywords, string eventName)
        {
            string str;
            string str1 = "";

            for (ulong i = (ulong)1; i != (long)0; i = i << 1)
            {
                if ((keywords & i) != (long)0)
                {
                    if (this.keywordTab == null || !this.keywordTab.TryGetValue(i, out str))
                    {
                        throw new ArgumentException(EventSourceSR.Event_UndefinedKeyword(i, eventName));
                    }
                    if (str1.Length != 0)
                    {
                        str1 = string.Concat(str1, " ");
                    }
                    str1 = string.Concat(str1, str);
                }
            }
            return(str1);
        }
示例#4
0
        private static string GetTypeName(Type type)
        {
            if (type.IsEnum)
            {
                FieldInfo[] fields   = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                string      typeName = ManifestBuilder.GetTypeName(fields[0].FieldType);
                return(typeName.Replace("win:Int", "win:UInt"));
            }
            switch (Type.GetTypeCode(type))
            {
            case TypeCode.Object:
            {
                return("win:UnicodeString");
            }

            case TypeCode.DBNull:
            case TypeCode.Char:
            case TypeCode.Decimal:
            case TypeCode.DateTime:
            case TypeCode.Object | TypeCode.DateTime:
            {
                if (type != typeof(Guid))
                {
                    throw new ArgumentException(EventSourceSR.Event_UnsupportType(type.Name));
                }
                return("win:GUID");
            }

            case TypeCode.Boolean:
            {
                return("win:Boolean");
            }

            case TypeCode.SByte:
            {
                return("win:Int8");
            }

            case TypeCode.Byte:
            {
                return("win:Uint8");
            }

            case TypeCode.Int16:
            {
                return("win:Int16");
            }

            case TypeCode.UInt16:
            {
                return("win:UInt16");
            }

            case TypeCode.Int32:
            {
                return("win:Int32");
            }

            case TypeCode.UInt32:
            {
                return("win:UInt32");
            }

            case TypeCode.Int64:
            {
                return("win:Int64");
            }

            case TypeCode.UInt64:
            {
                return("win:UInt64");
            }

            case TypeCode.Single:
            {
                return("win:Float");
            }

            case TypeCode.Double:
            {
                return("win:Double");
            }

            case TypeCode.String:
            {
                return("win:UnicodeString");
            }

            default:
            {
                if (type != typeof(Guid))
                {
                    throw new ArgumentException(EventSourceSR.Event_UnsupportType(type.Name));
                }
                return("win:GUID");
            }
            }
        }