internal EseDatabaseFileRecord(string input) { Match match = base.Match(input); this.m_checksum = ulong.Parse(match.Groups["Checksum"].ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture); this.m_databaseId = int.Parse(match.Groups["DatabaseId"].ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture); this.m_database = match.Groups["Database"].ToString(); string text = match.Groups["Operation"].ToString(); if (string.Compare(text, "createdb", StringComparison.OrdinalIgnoreCase) == 0) { this.m_operation = DatabaseOperation.Create; } else if (string.Compare(text, "attachdb", StringComparison.OrdinalIgnoreCase) == 0) { this.m_operation = DatabaseOperation.Attach; } else if (string.Compare(text, "detachdb", StringComparison.OrdinalIgnoreCase) == 0) { this.m_operation = DatabaseOperation.Detach; } else { ExDiagnostics.FailFast(string.Format(CultureInfo.CurrentCulture, "operation field {0} failed to match {1}, {2} or {3}. input is {4}, regex is {5}", new object[] { text, "createdb", "attachdb", "detachdb", input, EseDatabaseFileRecord.regex.ToString() }), true); } base.SetLogPosAndSize(match); }
public FormattedSentence.SimpleToken Create(int endAt) { if (endAt >= this.input.Length) { ExDiagnostics.FailFast("endAt is beyond the end of input string", false); return(null); } if (endAt < this.startAt) { throw new FormatException("Empty tokens like \"{}\" are not allowed"); } if (this.input.IndexOf('\\', this.startAt, endAt - this.startAt + 1) != -1) { StringBuilder stringBuilder = new StringBuilder(endAt - this.startAt); bool flag = false; for (int i = this.startAt; i <= endAt; i++) { if (this.input[i] != '\\' || flag) { stringBuilder.Append(this.input[i]); } flag = (!flag && this.input[i] == '\\'); } return(new FormattedSentence.SimpleToken(this.flavor, stringBuilder.ToString())); } return(new FormattedSentence.SimpleToken(this.flavor, this.input.Substring(this.startAt, endAt - this.startAt + 1))); }
internal StoreObjectIdCollectionProperty(NativeStorePropertyDefinition propertyDefinition, PropertyFlags propertyFlags, string displayName) : base(displayName, typeof(StoreObjectId[]), propertyFlags, PropertyDefinitionConstraint.None, new PropertyDependency[] { new PropertyDependency(propertyDefinition, PropertyDependencyType.NeedForRead) }) { this.enclosedPropertyDefinition = propertyDefinition; if (propertyDefinition.Type != typeof(byte[][])) { ExDiagnostics.FailFast("Can't create StoreObjectIdCollectionProperty on non byte[][] typed properties", false); } }
// Token: 0x060009A7 RID: 2471 RVA: 0x0002DA30 File Offset: 0x0002BC30 public static EseLogRecord Parse(string input) { Match match = EseLogRecord.regex.Match(input); if (!match.Success) { EseLogRecord.ThrowParseError(input, EseLogRecord.regex); } string text = match.Groups["Identifier"].ToString(); if (text == EseLogHeaderRecord.Identifier) { return(new EseLogHeaderRecord(input)); } if (text == EseAttachInfoRecord.Identifier) { return(new EseAttachInfoRecord(input)); } if (text == EseDatabaseFileRecord.Identifier) { return(new EseDatabaseFileRecord(input)); } if (text == EseChecksumRecord.Identifier) { return(new EseChecksumRecord(input)); } if (text == EsePageRecord.Identifier) { return(new EsePageRecord(input)); } if (text == EseMiscRecord.Identifier) { return(new EseMiscRecord(input)); } if (text == EseEofRecord.Identifier) { return(new EseEofRecord(input)); } if (text == EseDatabaseResizeRecord.Identifier) { return(new EseDatabaseResizeRecord(input)); } if (text == EseDatabaseTrimRecord.Identifier) { return(new EseDatabaseTrimRecord(input)); } ExDiagnostics.FailFast(string.Format(CultureInfo.CurrentCulture, "identifier field {0} failed to match. input is {1}, regex is {2}", new object[] { text, input, EseLogRecord.regex.ToString() }), true); return(null); }
// Token: 0x060009B2 RID: 2482 RVA: 0x0002DC70 File Offset: 0x0002BE70 internal EseLogHeaderRecord(string input) { Match match = base.Match(input); this.m_signature = match.Groups["Signature"].ToString(); this.m_generation = long.Parse(match.Groups["Generation"].ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture); this.m_logFormatVersion = match.Groups["LogFormatVersion"].ToString(); this.m_creationTime = DateTime.ParseExact(match.Groups["CreationTime"].ToString(), "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); if ("00/00/1900 00:00:00" == match.Groups["PreviousGenerationCreationTime"].ToString()) { DiagCore.RetailAssert(1L == this.m_generation, "Generation {0} has a blank PrevGenCreationTime ({1}). input is {2}, regex is {3}", new object[] { this.m_generation, match.Groups["PreviousGenerationCreationTime"].ToString(), input, EseLogHeaderRecord.regex.ToString() }); this.m_previousGenerationCreationTime = DateTime.MinValue; } else { this.m_previousGenerationCreationTime = DateTime.ParseExact(match.Groups["PreviousGenerationCreationTime"].ToString(), "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); } string text = match.Groups["CircularLogging"].ToString(); if ("0x1" == text) { this.m_isCircularLoggingOn = true; } else if ("0x0" == text) { this.m_isCircularLoggingOn = false; } else { ExDiagnostics.FailFast(string.Format(CultureInfo.CurrentCulture, "circular logging field {0} failed to match {1} or {2}. input is {3}, regex is {4}", new object[] { text, "0x1", "0x0", input, EseLogHeaderRecord.regex.ToString() }), true); } this.SectorSize = int.Parse(match.Groups["SectorSizeGroup"].ToString()); }
internal void Exit() { lock (this.lockObject) { if (this.numberOfOwnerReferences > 0 && Environment.CurrentManagedThreadId == this.owningThreadId) { this.numberOfOwnerReferences--; if (this.numberOfOwnerReferences == 0) { this.owningThreadId = -1; } } else { string arg = (this.numberOfOwnerReferences == 0) ? "the calling thread doesn't own this tracker" : "no threads have entered this tracker"; string message = string.Format("Attempting to Exit() while in an invalid state - {0}. This cannot be recovered from and is fatal.", arg); ExDiagnostics.FailFast(message, true); } } }
internal static LocalizedString EnumerateDaysOfWeek(DaysOfWeek daysOfWeek) { List <IFormattable> list = new List <IFormattable>(); int num = 0; for (DaysOfWeek daysOfWeek2 = DaysOfWeek.Sunday; daysOfWeek2 <= DaysOfWeek.Saturday; daysOfWeek2 <<= 1) { if ((daysOfWeek & daysOfWeek2) == daysOfWeek2) { list.Add(new LocalizedDayOfWeek((DayOfWeek)num)); } num++; } switch (list.Count) { case 1: return(ClientStrings.WhenOneDayOfWeek(list[0])); case 2: return(ClientStrings.WhenTwoDaysOfWeek(list[0], list[1])); case 3: return(ClientStrings.WhenThreeDaysOfWeek(list[0], list[1], list[2])); case 4: return(ClientStrings.WhenFourDaysOfWeek(list[0], list[1], list[2], list[3])); case 5: return(ClientStrings.WhenFiveDaysOfWeek(list[0], list[1], list[2], list[3], list[4])); case 6: return(ClientStrings.WhenSixDaysOfWeek(list[0], list[1], list[2], list[3], list[4], list[5])); case 7: return(ClientStrings.WhenSevenDaysOfWeek(list[0], list[1], list[2], list[3], list[4], list[5], list[6])); default: ExDiagnostics.FailFast("Wrong daysofweek", true); return(default(LocalizedString)); } }
internal static LocalizedString OrderAsString(RecurrenceOrderType order) { switch (order) { case RecurrenceOrderType.Last: return(ClientStrings.WhenLast); case RecurrenceOrderType.First: return(ClientStrings.WhenFirst); case RecurrenceOrderType.Second: return(ClientStrings.WhenSecond); case RecurrenceOrderType.Third: return(ClientStrings.WhenThird); case RecurrenceOrderType.Fourth: return(ClientStrings.WhenFourth); } ExDiagnostics.FailFast("Invalid value for Order", false); throw new ArgumentOutOfRangeException("Order"); }
private static object[][] LookupInAD(Func <IRecipientSession> adRecipientSessionFactory, List <string> legacyDNs, params PropertyDefinition[] properties) { object[][] result; try { Result <ADRawEntry>[] array = adRecipientSessionFactory().FindByLegacyExchangeDNs(legacyDNs.ToArray(), properties); if (array.Length != legacyDNs.Count) { ExDiagnostics.FailFast(string.Format(CultureInfo.InvariantCulture, "Number of results in IRecipientSession.FindByLegacyExchangeDNs() is unexpected: {0} instead of {1}", new object[] { array.Length, legacyDNs.Count }), false); } result = Array.ConvertAll <Result <ADRawEntry>, object[]>(array, delegate(Result <ADRawEntry> entry) { if (entry.Data == null) { return(null); } return(entry.Data.GetProperties(properties)); }); } catch (DataSourceOperationException ex) { throw StorageGlobals.TranslateDirectoryException(ServerStrings.ADException, ex, null, "DistributionList.LookupInAD. Failed due to directory exception {0}.", new object[] { ex }); } catch (DataSourceTransientException ex2) { throw StorageGlobals.TranslateDirectoryException(ServerStrings.ADException, ex2, null, "DistributionList.LookupInAD. Failed due to directory exception {0}.", new object[] { ex2 }); } return(result); }
protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyStore) { StoreObjectId storeObjectId = null; ICoreObject coreObject = propertyStore.Context.CoreObject; if (coreObject != null) { storeObjectId = coreObject.InternalStoreObjectId; } if (storeObjectId == null) { byte[] array = propertyStore.GetValue(InternalSchema.EntryId) as byte[]; if (array != null) { storeObjectId = StoreObjectId.FromProviderSpecificId(array, this.GetStoreObjectType(propertyStore)); } else { QueryResultPropertyBag queryResultPropertyBag = ((PropertyBag)propertyStore) as QueryResultPropertyBag; if (queryResultPropertyBag != null && (!((IDirectPropertyBag)queryResultPropertyBag).IsLoaded(InternalSchema.RowType) || object.Equals(queryResultPropertyBag.TryGetProperty(InternalSchema.RowType), 1))) { ExDiagnostics.FailFast(string.Format("EntryId: \"{0}\" in view", queryResultPropertyBag.TryGetProperty(InternalSchema.EntryId)), false); } } } if (storeObjectId == null) { return(new PropertyError(this, PropertyErrorCode.NotFound)); } VersionedId versionedId = new VersionedId(storeObjectId, this.GetChangeKey(propertyStore)); if (!this.IsCompatibleId(versionedId, coreObject)) { return(new PropertyError(this, PropertyErrorCode.NotSupported)); } return(versionedId); }
internal void InternalDispose(bool disposing) { if (this.mapiProp != null && this.mapiProp.DisposeTracker != null) { this.mapiProp.DisposeTracker.AddExtraDataWithStackTrace(string.Format(CultureInfo.InvariantCulture, "MapiPropertyBag.InternalDispose({0}) called with stack", new object[] { disposing })); } if (disposing) { if (this.mapiProp != null) { try { StoreSession storeSession = null; bool flag = false; try { if (storeSession != null) { storeSession.BeginMapiCall(); storeSession.BeginServerHealthCall(); flag = true; } if (StorageGlobals.MapiTestHookBeforeCall != null) { StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod()); } this.mapiProp.Dispose(); } catch (MapiPermanentException ex) { throw StorageGlobals.TranslateMapiException(ServerStrings.StoreOperationFailed, ex, storeSession, this, "{0}. MapiException = {1}.", new object[] { string.Format("We cannot recover from an exception thrown from a Dispose call.", new object[0]), ex }); } catch (MapiRetryableException ex2) { throw StorageGlobals.TranslateMapiException(ServerStrings.StoreOperationFailed, ex2, storeSession, this, "{0}. MapiException = {1}.", new object[] { string.Format("We cannot recover from an exception thrown from a Dispose call.", new object[0]), ex2 }); } finally { try { if (storeSession != null) { storeSession.EndMapiCall(); if (flag) { storeSession.EndServerHealthCall(); } } } finally { if (StorageGlobals.MapiTestHookAfterCall != null) { StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod()); } } } } catch (Exception ex3) { if (this.mapiProp.DisposeTracker != null) { if (this.mapiProp.DisposeTracker.HasCollectedStackTrace) { string extraData = this.CollectExtraDataOnFailedMapiPropDisposal(ex3); this.mapiProp.DisposeTracker.AddExtraData(extraData); } } else if (this.disposeTracker.HasCollectedStackTrace) { string extraData2 = this.CollectExtraDataOnFailedMapiPropDisposal(ex3); this.disposeTracker.AddExtraData(extraData2); } ExDiagnostics.FailFast(string.Format("We cannot recover from an exception thrown from a Dispose call. Exception = {0}", ex3.ToString()), false); this.mapiProp = null; throw; } this.mapiProp = null; } if (this.disposeTracker != null) { this.disposeTracker.Dispose(); } } }