Esempio n. 1
0
 // Token: 0x06000143 RID: 323 RVA: 0x000071B1 File Offset: 0x000053B1
 internal static DatabaseFailureItem[] GetEntriesFromEventLog()
 {
     return(DatabaseFailureItem.GetEntriesFromEventLog(DatabaseFailureItem.ChannelName, DatabaseFailureItem.DefaultQueryString));
 }
Esempio n. 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);
        }