示例#1
0
        // Token: 0x06000120 RID: 288 RVA: 0x00006A98 File Offset: 0x00004C98
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (base.GetType() != obj.GetType())
            {
                return(false);
            }
            NotificationEventInfo notificationEventInfo = obj as NotificationEventInfo;

            if (!this.EventId.Equals(notificationEventInfo.EventId))
            {
                return(false);
            }
            if ((this.Parameters == null || notificationEventInfo.Parameters == null) && (this.Parameters != null || notificationEventInfo.Parameters != null))
            {
                return(false);
            }
            if (this.Parameters != null && notificationEventInfo.Parameters != null)
            {
                if (this.Parameters.Length != notificationEventInfo.Parameters.Length)
                {
                    return(false);
                }
                for (int i = 0; i < this.Parameters.Length; i++)
                {
                    if (!object.Equals(this.Parameters[i], notificationEventInfo.Parameters[i]))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#2
0
        // Token: 0x06000142 RID: 322 RVA: 0x00006FE4 File Offset: 0x000051E4
        internal static DatabaseFailureItem Parse(EventRecord record)
        {
            DatabaseFailureItem   databaseFailureItem = new DatabaseFailureItem();
            IList <EventProperty> properties          = record.Properties;

            if (properties == null || properties.Count == 0)
            {
                return(databaseFailureItem);
            }
            DatabaseFailureItem.PropertyContainer propertyContainer = new DatabaseFailureItem.PropertyContainer(properties);
            int num = propertyContainer.Get <int>(EventRecordParameteIndex.Version);

            if (num != DatabaseFailureItem.ApiVersion)
            {
                throw new InvalidFailureItemException("Version");
            }
            databaseFailureItem.NameSpace     = propertyContainer.GetEnum <FailureNameSpace>(EventRecordParameteIndex.Namespace);
            databaseFailureItem.Tag           = propertyContainer.GetEnum <FailureTag>(EventRecordParameteIndex.Tag);
            databaseFailureItem.Guid          = propertyContainer.Get <Guid>(EventRecordParameteIndex.Guid);
            databaseFailureItem.InstanceName  = propertyContainer.Get <string>(EventRecordParameteIndex.InstanceName);
            databaseFailureItem.ComponentName = propertyContainer.Get <string>(EventRecordParameteIndex.ComponentName);
            databaseFailureItem.CreationTime  = (record.TimeCreated ?? DateTime.MinValue);
            bool flag  = propertyContainer.Get <bool>(EventRecordParameteIndex.IsIoErrorSpecified);
            bool flag2 = propertyContainer.Get <bool>(EventRecordParameteIndex.IsNotifyEventSpecified);

            if (flag)
            {
                databaseFailureItem.IoError = new IoErrorInfo
                {
                    Category = propertyContainer.GetEnum <IoErrorCategory>(EventRecordParameteIndex.IoErrorCategory),
                    FileName = propertyContainer.Get <string>(EventRecordParameteIndex.IoErrorFileName),
                    Offset   = propertyContainer.Get <long>(EventRecordParameteIndex.IoErrorOffset),
                    Size     = propertyContainer.Get <long>(EventRecordParameteIndex.IoErrorSize)
                };
            }
            if (flag2)
            {
                NotificationEventInfo notificationEventInfo = new NotificationEventInfo();
                notificationEventInfo.EventId = propertyContainer.Get <int>(EventRecordParameteIndex.NotifyeventId);
                uint num2 = propertyContainer.Get <uint>(EventRecordParameteIndex.NotifyeventParambufferSize);
                if (num2 > 0U)
                {
                    byte[]          bytes           = propertyContainer.Get <byte[]>(EventRecordParameteIndex.NotifyeventParambuffer);
                    UnicodeEncoding unicodeEncoding = new UnicodeEncoding();
                    string          @string         = unicodeEncoding.GetString(bytes);
                    string          text            = @string;
                    char[]          separator       = new char[1];
                    string[]        array           = text.Split(separator);
                    notificationEventInfo.Parameters = new string[array.Length - 1];
                    for (int i = 0; i < array.Length - 1; i++)
                    {
                        notificationEventInfo.Parameters[i] = array[i];
                    }
                }
                databaseFailureItem.NotifyEvent = notificationEventInfo;
            }
            databaseFailureItem.Bookmark = record.Bookmark;
            if (propertyContainer.IsIndexValid(EventRecordParameteIndex.Message))
            {
                databaseFailureItem.Message = propertyContainer.Get <string>(EventRecordParameteIndex.Message);
            }
            return(databaseFailureItem);
        }