/// <summary> /// Invoke invalidQueueHandler if failed to access the queue. /// </summary> /// <remarks> /// Notice: Only handle the case that queue is not found now. May /// add more error handlings for specific queue issues if necessary. /// </remarks> /// <param name="e">exception happens when access the queue</param> private void HandleInvalidQueue(StorageException e) { TraceUtils.TraceError( "MessageRetriever.Worker", "HandleInvalidQueue", "StorageException, worker {0}, queue {1}, error code {2}, {3}", this.workerId, this.queue.Name, BurstUtility.GetStorageErrorCode(e), e); if (BurstUtility.IsQueueNotFound(e)) { // Invoke invalidQueueHandler if the exception indicates // that the queue is not found. if (this.invalidQueueHandler != null) { this.invalidQueueHandler(e); } } }
/// <summary> /// Dispose current object. /// </summary> /// <param name="disposing">disposing flag</param> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (this.ReliableQueue != null) { try { this.ReliableQueue.Close(); } catch (Exception e) { TraceUtils.TraceVerbose("AzureStorageClient", "Dispose", "Closing ReliableQueue failed, {0}", e); } this.ReliableQueue = null; } } }
private async Task WriteCompositeObject(object obj, Type type, Stream stream) { TraceUtils.WriteLineFormatted("Writing composite object of type: {0}", type.FullName); var props = obj.GetProperties(); if (props.Any()) { foreach (var prop in props) { var value = prop.GetValue(obj); TraceUtils.WriteLineFormatted("Writing sub-object of property {0} with type: {1}", prop.Name, prop.PropertyType.FullName); await WritePlainObject(value, prop.PropertyType, stream).ConfigureAwait(false); } } else { TraceUtils.WriteLineFormatted("Composite object hasn't any read\\write properties"); } }
public WrapperObject(int x) { WrapperGuid = Guid.NewGuid(); var traceVal = TraceUtils.GetTraceData(__TEMP_REVIT_TRACE_ID); if (traceVal != null) { IDHolder idHolder = (IDHolder)traceVal; ID = idHolder.ID; } else { nextID++; ID = nextID; TraceUtils.SetTraceData(__TEMP_REVIT_TRACE_ID, new IDHolder() { ID = nextID }); } }
/// <summary> /// Note that x is a dummy var here that is intended to force replicated dispatch /// it's not actually used /// </summary> /// <param name="x"></param> public IncrementerTracedClass(int x) { var retVal = TraceUtils.GetTraceData(__TEMP_REVIT_TRACE_ID); if (retVal != null) { wasTraced = true; IDHolder idHolder = (IDHolder)retVal; ID = idHolder.ID; } else { nextID++; ID = nextID; TraceUtils.SetTraceData(__TEMP_REVIT_TRACE_ID, new IDHolder() { ID = nextID }); } }
private void SetReadFlags(byte[] messageEntryId, byte[] folderEntryId, bool isRead) { base.CheckDisposed(); using (ImapFolder folder = base.GetFolder <ImapSourceFolder>(folderEntryId)) { if (folder == null) { MrsTracer.Provider.Warning("Source folder {0} doesn't exist", new object[] { TraceUtils.DumpBytes(folderEntryId) }); throw new ImapObjectNotFoundException(TraceUtils.DumpBytes(folderEntryId)); } uint item = ImapEntryId.ParseUid(messageEntryId); List <uint> list = new List <uint>(1); list.Add(item); List <ImapMessageRec> list2 = folder.Folder.LookupMessages(base.ImapConnection, list); if (list2.Count == 0) { MrsTracer.Provider.Warning("Source message {0} doesn't exist", new object[] { TraceUtils.DumpBytes(messageEntryId) }); throw new ImapObjectNotFoundException(TraceUtils.DumpBytes(messageEntryId)); } ImapMailFlags imapMailFlags = list2[0].ImapMailFlags; ImapMailFlags imapMailFlags2 = isRead ? (imapMailFlags | ImapMailFlags.Seen) : (imapMailFlags & ~ImapMailFlags.Seen); if (imapMailFlags != imapMailFlags2) { string text = item.ToString(CultureInfo.InvariantCulture); MrsTracer.Provider.Debug("StoreMessageFlags - uid: {0}, flagsToStore: {1}, previousFlags {2}", new object[] { text, imapMailFlags2, imapMailFlags }); base.ImapConnection.StoreMessageFlags(text, imapMailFlags2, imapMailFlags); } } }
public T GetFolder <T>(byte[] folderId) where T : PstFolder, new() { MrsTracer.Provider.Function("PstMailbox.GetFolder({0})", new object[] { TraceUtils.DumpEntryId(folderId) }); uint nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.iPst.MessageStore.Guid, folderId); IFolder folder; try { folder = this.iPst.ReadFolder(nodeIdFromEntryId); } catch (PSTIOException innerException) { throw new UnableToReadPSTFolderTransientException(nodeIdFromEntryId, innerException); } catch (PSTExceptionBase innerException2) { throw new UnableToReadPSTFolderPermanentException(nodeIdFromEntryId, innerException2); } if (folder == null) { MrsTracer.Provider.Debug("Folder does not exist", new object[0]); return(default(T)); } PstFxFolder pstFxFolder = new PstFxFolder(this, folder); if (MrsTracer.Provider.IsEnabled(TraceType.DebugTrace)) { MrsTracer.Provider.Debug("Opened folder '{0}'", new object[] { (string)pstFxFolder.GetProp(PropertyTag.DisplayName).Value }); } T result = Activator.CreateInstance <T>(); result.Config(folderId, pstFxFolder); return(result); }
public void CopyMailboxProperties() { MrsTracer.Service.Function("MailboxMerger.CopyMailboxProperties", new object[0]); PropValue[] native = DataConverter <PropValueConverter, PropValue, PropValueData> .GetNative(base.SourceMailbox.GetProps(MailboxMerger.MailboxPtags)); List <PropValue> list = new List <PropValue>(); foreach (PropValue item in native) { if (!item.IsNull() && !item.IsError()) { if (item.PropTag == PropTag.SentMailEntryId) { byte[] array2 = item.Value as byte[]; if (array2 != null) { FolderMapping folderMapping = this.SourceHierarchy[array2] as FolderMapping; if (folderMapping != null && folderMapping.IsIncluded && folderMapping.TargetFolder != null) { MrsTracer.Service.Debug("Remapped SentItemsEntryId from {0} to {1}", new object[] { TraceUtils.DumpEntryId(array2), TraceUtils.DumpEntryId(folderMapping.TargetFolder.EntryId) }); list.Add(new PropValue(item.PropTag, folderMapping.TargetFolder.EntryId)); } } } else { list.Add(item); } } } if (list.Count > 0) { base.DestMailbox.SetProps(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(list.ToArray())); } }
private void RegisterUniqueTargetSecondaryKeys(MessageRec message, List <byte[]> secondaryKeys, EntryIdMap <MessageRec> messageMap, HashSet <byte[]> duplicateKeys) { foreach (byte[] array in secondaryKeys) { if (array != null && !duplicateKeys.Contains(array)) { if (!messageMap.ContainsKey(array)) { messageMap.Add(array, message); } else { MrsTracer.Service.Debug("Duplicate SecondaryKey found for target message {0}", new object[] { TraceUtils.DumpEntryId(message.EntryId) }); messageMap.Remove(array); duplicateKeys.Add(array); } } } }
public static void OverwriteNullTest() { var key = TraceUtils.TEMP_GetTraceKeys()[0]; SerializableString testStr1 = new SerializableString("{0955D962-2936-4FB2-AAB3-635C6FF6E0AD}"); TraceUtils.SetTraceData(key, testStr1); //Set complete, readback test ISerializable readback = TraceUtils.GetTraceData(key); Assert.IsTrue(readback == testStr1); TraceUtils.SetTraceData(key, null); //Set complete, readback test readback = TraceUtils.GetTraceData(key); Assert.IsTrue(readback == null); }
public void DefinitionsShouldHave_TypedModelNodes_v12() { Trace.WriteLine("Checking typed model nodes"); Trace.WriteLine(""); var passes = true; var showOnlyFalseOutput = true; TraceUtils.WithScope(trace => { foreach (var defType in AllDefinitionTypes.OrderBy(d => d.Name)) { var pureDefName = defType.Name.Replace("Definition", string.Empty); var targetModelNodeTypeName = string.Format("{0}ModelNode", pureDefName); var modelNodelType = AllModelNodeTypes.FirstOrDefault(n => n.Name == targetModelNodeTypeName); if (!showOnlyFalseOutput) { trace.WriteLine(defType.Name); } if (modelNodelType == null) { passes = false; if (showOnlyFalseOutput) { trace.WriteLine(defType.Name); } trace.WriteLine(string.Format("[FALSE] Missing model node: [{0}]", targetModelNodeTypeName)); trace.WriteLine(""); } } }); Assert.IsTrue(passes); }
protected override void ValidateHtmlPage(File file, string pageUrl, string pageContent, DefinitionBase definitionBase) { var definition = definitionBase as XsltListViewWebPartGridModePresenceDefinition; var assert = ServiceFactory.AssertService .NewAssert(definition, file) // dont' need to check that, not the pupose of the test //.ShouldBeEqual(m => m.PageFileName, o => o.GetName()) .ShouldNotBeNull(file); //if (definition.WebPartDefinitions.Any()) //{ assert.ShouldBeEqual((p, s, d) => { var srcProp = s.GetExpressionValue(m => m.WebPartDefinitions); var isValid = true; TraceUtils.WithScope(trace => { trace.WriteLine(string.Format("Checking InitGridFromView presence:[{0}]", pageUrl)); isValid = pageContent.Contains("InitGridFromView"); }); return(new PropertyValidationResult { Tag = p.Tag, Src = srcProp, //Dst = dstProp, IsValid = isValid }); }); //} //else //{ // assert.SkipProperty(m => m.WebPartDefinitions, "WebPartDefinitions.Count = 0. Skipping"); //} }
public override void DeployModel(object modelHost, DefinitionBase model) { var webModelHost = modelHost.WithAssertAndCast <WebModelHost>("modelHost", value => value.RequireNotNull()); var listModel = model.WithAssertAndCast <ListDefinition>("model", value => value.RequireNotNull()); var web = webModelHost.HostWeb; var context = web.Context; context.Load(web, w => w.ServerRelativeUrl); context.Load(web, w => w.Lists); context.ExecuteQuery(); var spObject = FindListByTitle(web.Lists, listModel.Title); context.Load(spObject, list => list.RootFolder.ServerRelativeUrl); context.ExecuteQuery(); TraceUtils.WithScope(traceScope => { var pair = new ComparePair <ListDefinition, List>(listModel, spObject); traceScope.WriteLine(string.Format("Validating model:[{0}] field:[{1}]", model, spObject)); traceScope.WithTraceIndent(trace => pair .ShouldBeEqual(trace, m => m.Title, o => o.Title) .ShouldBeEqual(trace, m => m.Description, o => o.Description) .ShouldBeEqual(trace, m => m.GetServerRelativeUrl(web), o => o.GetServerRelativeUrl()) .ShouldBeEqual(trace, m => m.ContentTypesEnabled, o => o.ContentTypesEnabled)); if (listModel.TemplateType > 0) { traceScope.WithTraceIndent(trace => pair .ShouldBeEqual(trace, m => m.TemplateType, o => (int)o.BaseTemplate)); } else { } }); }
public T GetFolder <T>(byte[] folderId) where T : ImapFolder, new() { MrsTracer.Provider.Function("ImapMailbox.GetFolder({0})", new object[] { TraceUtils.DumpEntryId(folderId) }); base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None); ImapClientFolder folder; if (!this.folderCache.TryGetValue(folderId, out folder)) { MrsTracer.Provider.Debug("Folder with entryId {0} does not exist", new object[] { folderId }); return(default(T)); } T result = Activator.CreateInstance <T>(); result.Config(folderId, folder, this); return(result); }
public static TracedHog ByPoint(double x, double y) { TracedHog tHog; HogID hid = TraceUtils.GetTraceData(REVIT_TRACE_ID) as HogID; if (hid == null) { // Trace didn't give us a hog, it's a new one. tHog = new TracedHog(x, y); } else { tHog = TracedHogManager.GetHogByID(hid.IntID); } // Set the trace data on the return to be this hog. TraceUtils.SetTraceData(REVIT_TRACE_ID, new HogID { IntID = tHog.ID }); return(tHog); }
private static Dictionary <string, string> ParseMessageEntryId(byte[] messageEntryId) { if (messageEntryId == null) { throw new ParsingMessageEntryIdFailedException(null, new ArgumentNullException("messageEntryId")); } string text = null; try { text = Encoding.UTF8.GetString(messageEntryId); } catch (Exception innerException) { throw new ParsingMessageEntryIdFailedException(TraceUtils.DumpBytes(messageEntryId), innerException); } string[] keyValuePairs = text.Split(new char[] { ';' }); return(ImapEntryId.ParseKeyValuePairs(messageEntryId, keyValuePairs)); }
protected override void DeployModelInternal(object modelHost, DefinitionBase model) { var siteModelHost = modelHost.WithAssertAndCast <SiteModelHost>("modelHost", value => value.RequireNotNull()); var fieldModel = model.WithAssertAndCast <FieldDefinition>("model", value => value.RequireNotNull()); var site = siteModelHost.HostSite; TraceUtils.WithScope(traceScope => { var spField = GetField(modelHost, fieldModel); var pair = new ComparePair <FieldDefinition, SPField>(fieldModel, spField); traceScope.WriteLine(string.Format("Validating model:[{0}] field:[{1}]", fieldModel, spField)); traceScope.WithTraceIndent(trace => pair .ShouldBeEqual(trace, m => m.Title, w => w.Title) .ShouldBeEqual(trace, m => m.Description, w => w.Description) .ShouldBeEqual(trace, m => m.Group, w => w.Group) .ShouldBeEqual(trace, m => m.InternalName, w => w.InternalName) .ShouldBeEqual(trace, m => m.Id, w => w.Id)); }); }
/// <summary> /// Send <see cref="ProcessingContext.RequestHeader" /> to server, /// copy rest of the <see cref="ProcessingContext.ClientStream" /> to <see cref="ProcessingContext.ServerStream" /> /// and read <see cref="ProcessingContext.ResponseHeader" /> from <see cref="ProcessingContext.ServerStream" />. /// Expects <see cref="ProcessingContext.ServerStream" />, <see cref="ProcessingContext.RequestHeader" /> and /// <see cref="ProcessingContext.ClientStream" /> to be defined. /// </summary> /// <param name="context">current request context</param> protected virtual void ReceiveResponse(ProcessingContext context) { Contract.Requires <ArgumentNullException>(context != null, "context"); Contract.Requires <InvalidContextException>(context.ServerStream != null, "ServerStream"); Contract.Requires <InvalidContextException>(context.RequestHeader != null, "RequestHeader"); Contract.Requires <InvalidContextException>(context.ClientStream != null, "ClientStream"); Contract.Requires <InvalidContextException>(context.ClientSocket != null, "ClientSocket"); var requestWriter = new HttpMessageWriter(context.ServerStream); var responseReader = new HttpHeaderReader(new PlainStreamReader(context.ServerStream)); try { requestWriter.Write(context.RequestHeader, context.ClientStream, context.ClientSocket.Available); context.ResponseHeader = new HttpResponseHeader(responseReader.ReadHttpMessageHeader()); if (Logger.IsDebugEnabled) { Logger.DebugFormat("Response Received: {0}", TraceUtils.GetHttpTrace(context.ResponseHeader)); } } catch (IOException ex) { var responseWriter = new HttpResponseWriter(context.ClientStream); if (ex.IsSocketException(SocketError.TimedOut)) { Logger.WarnFormat("Request to remote server has timed out. {0}", TraceUtils.GetHttpTrace(context.RequestHeader)); responseWriter.WriteGatewayTimeout(); } else { throw; } context.StopProcessing(); } }
public void DefinitionsShouldHave_ParentHostCapabilityAttribute_v12() { if (!M2RegressionRuntime.IsV12) { return; } var passed = true; // definitions must have a relationship attt var defTypesWithoutRelationships = AllDefinitionTypes.Where(d => AllDefinitionRelationships.All(r => r.DefinitionType != d)); Trace.WriteLine("Cheking ParentHostCapability attr presence for all definitions"); TraceUtils.WithScope(trace => { foreach (var def in defTypesWithoutRelationships) { Trace.WriteLine(string.Format("missing relationship for definition:[{0}]", def.Name)); } }); if (defTypesWithoutRelationships.Any()) { passed = false; } if (defTypesWithoutRelationships.Any()) { Trace.WriteLine("[FALSE] Missing definition relationships detected"); } else { Trace.WriteLine("[TRUE] Missing definition relationships detected"); } Assert.IsTrue(passed); }
internal void CopyBatch(IFxProxyPool proxyPool, List <MessageRec> batch) { StorageSourceFolder.< > c__DisplayClass9 CS$ < > 8__locals1 = new StorageSourceFolder.< > c__DisplayClass9(); CS$ < > 8__locals1.< > 4__this = this; if (batch.Count == 0) { return; } byte[][] array = new byte[batch.Count][]; for (int i = 0; i < batch.Count; i++) { array[i] = batch[i].EntryId; } CS$ < > 8__locals1.flags = CopyMessagesFlags.SendEntryId; using (IMapiFxProxy destFolderProxy = proxyPool.GetFolderProxy(base.FolderId)) { if (destFolderProxy == null) { MrsTracer.Provider.Warning("Destination folder {0} does not exist.", new object[] { TraceUtils.DumpEntryId(base.FolderId) }); } else { MapiUtils.ProcessMapiCallInBatches <byte[]>(array, delegate(byte[][] smallBatch) { using (CS$ < > 8__locals1.< > 4__this.Mailbox.RHTracker.Start()) { using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(destFolderProxy, false, new Func <IDisposable>(CS$ < > 8__locals1.< > 4__this.Mailbox.RHTracker.StartExclusive), new Action <uint>(CS$ < > 8__locals1.< > 4__this.Mailbox.RHTracker.Charge))) { CS$ < > 8__locals1.< > 4__this.MapiFolder.ExportMessages(fxProxyBudgetWrapper, CS$ < > 8__locals1.flags, smallBatch); } } }); } } }
private async Task <object> ReadObjectInternal(Type type, Stream stream) { if (type != typeof(object)) { object resultObject; var objectType = TypeUtils.DetermineObjectType(type); if (objectType == ObjectType.Class || objectType == ObjectType.Struct) { resultObject = await ReadCompositeObject(type, stream); } else { TraceUtils.WriteLineFormatted("Reading plain object of type: {0}", type.FullName); resultObject = await ReadPlainObject(type, stream); } return(resultObject); } TraceUtils.WriteLineFormatted("Unable to read object of type \"{0}\": Unsupported", type.FullName); return(null); }
public static void SetGetTest() { List <String> keys = TraceUtils.TEMP_GetTraceKeys(); SerializableString testStr1 = new SerializableString("{0955D962-2936-4FB2-AAB3-635C6FF6E0AD}"); SerializableString testStr2 = new SerializableString("{2D7FE0ED-56F3-47A4-9BAA-8DF570170D97}"); Dictionary <String, ISerializable> data = new Dictionary <string, ISerializable>(); data.Add(keys[0], testStr1); TraceUtils.SetObjectToTLS(data); //Set complete, readback test Dictionary <String, ISerializable> readback = TraceUtils.GetObjectFromTLS(); Assert.IsTrue(((SerializableString)readback[keys[0]]).Payload == testStr1.Payload); }
public void Trace_SimpleAnnotation() { string rootSpanName = CreateRootSpanName(nameof(Trace_SimpleAnnotation)); var consumer = CreateGrpcTraceConsumer(); var tracer = CreateSimpleManagedTracer(consumer); var annotation = new Dictionary <string, string> { { "annotation-key", "annotation-value" }, { "some-key", "some-value" } }; tracer.StartSpan(rootSpanName); BlockUntilClockTick(); tracer.AnnotateSpan(annotation); tracer.EndSpan(); TraceProto trace = _polling.GetTrace(rootSpanName, _startTime); Assert.NotNull(trace); Assert.Single(trace.Spans); Assert.True(TraceUtils.IsValidAnnotation(trace.Spans[0], annotation)); }
public async Task <bool> Update(IEnumerable <AppIdentity> applicationsToRemove, IEnumerable <AppInstallConfig> applicationsToDeploy) { if (!applicationsToDeploy.Any() || !applicationsToRemove.Any()) { throw new ArgumentException("An update must at least involve an application to remove and an application to deploy"); } string appId = applicationsToDeploy.First().AppIdentity.Id; bool failed = false; try { if (!await _updateSessionManager.TryStartUpdateSession(appId)) { Trace.TraceInformation("Couldn't start update session for app {0}", appId); return(false); } await UnInstallApplications(applicationsToRemove); await InstallApplications(applicationsToDeploy); } catch (AggregateException e) { failed = true; TraceUtils.TraceAllErrors("Failed to update applications", e); } catch (Exception e) { failed = true; Trace.TraceError("Failed to update applications", e); } await _updateSessionManager.EndUpdateSession(appId); return(!failed); }
private void ProcessDefinitionsPropertyUpdateValidation(DefinitionBase def) { var updatableProps = def.GetType() .GetProperties() .Where(p => p.GetCustomAttributes(typeof(ExpectUpdate), true).Count() > 0); TraceUtils.WithScope(trace => { trace.WriteLine(""); trace.WriteLine(string.Format("[INF]\tPROPERTY UPDATE VALIDATION")); trace.WriteLine(string.Format("[INF]\tModel of type: [{0}] - [{1}]", def.GetType(), def)); if (updatableProps.Count() == 0) { trace.WriteLine(string.Format("[INF]\tNo properties to be validated. Skipping.")); } else { foreach (var prop in updatableProps) { object newValue = null; var expectUpdateAttr = prop.GetCustomAttributes(typeof(ExpectUpdate), true) .FirstOrDefault() as ExpectUpdate; newValue = GetNewPropValue(expectUpdateAttr, def, prop); trace.WriteLine(string.Format("[INF]\t\tChanging property [{0}] from [{1}] to [{2}]", prop.Name, prop.GetValue(def), newValue)); prop.SetValue(def, newValue); } } trace.WriteLine(""); }); }
/// <summary> /// Invoke the invalidQueueHandler. /// </summary> /// <param name="e">exception occurred when access the queue</param> private void HandleInvalidQueue(StorageException e) { if (this.invalidQueueHandler != null) { if (Interlocked.CompareExchange(ref this.invalidQueueHandlerInvoked, 1, 0) == 0) { try { // invoke the handler in threadpool thread rather than // in IO completion thread ThreadPool.QueueUserWorkItem((s) => { this.invalidQueueHandler(e); }); } catch (Exception ex) { TraceUtils.TraceError( "MessageRetriever", "HandleInvalidQueue", "Error occurs, queue {0}, {1}", this.queueName, ex); } } } }
MessageRec IMailbox.SaveSyncState(byte[] key, string syncStateStr) { MrsTracer.Provider.Function("PstDestinationMailbox.IMailbox.SaveSyncState(key={0})", new object[] { TraceUtils.DumpBytes(key) }); if (base.IPst == null) { MrsTracer.Provider.Debug("Skipping sync state save on a previously failed pst file", new object[0]); return null; } try { this.LoadSyncStateCache(); this.syncStateCache[key] = syncStateStr; base.MessageStorePropertyBag.SetProperty(new PropertyValue(new PropertyTag((PropertyId)this.syncStatePropId, PropertyType.Unicode), this.syncStateCache.Serialize(false))); base.IPst.MessageStore.Save(); } catch (PSTExceptionBase innerException) { throw new UnableToSavePSTSyncStatePermanentException(base.IPst.FileName, innerException); } return null; }
/// <summary> /// Occurs after the action method is invoked. /// </summary> /// <param name="actionExecutedContext">The action executed context.</param> public override void OnActionExecuted(ActionExecutedContext actionExecutedContext) { //Validazione argomenti if (actionExecutedContext == null) { throw new ArgumentNullException(nameof(actionExecutedContext)); } //Leggo il content e il relativo type BodyContent body = GetResponseBody(actionExecutedContext.Result); //Inizializzo la response _Response = TraceUtils.GenerateResponse(_Request, body.Value, body.Type, body.Length, actionExecutedContext.Exception); //Traccio il response (se richiesto) if (EnableResponseTrace) { TraceResponse(_Response); } //Esecuzione delle funzioni base base.OnActionExecuted(actionExecutedContext); }
private byte[] MoveItem(byte[] messageEntryId, byte[] sourceFolderEntryId, byte[] destFolderEntryId, out bool isPermanentDeletionMove) { isPermanentDeletionMove = false; base.CheckDisposed(); Add add; if (!base.EasFolderCache.TryGetValue(sourceFolderEntryId, out add)) { MrsTracer.Provider.Warning("Source folder {0} doesn't exist", new object[] { TraceUtils.DumpBytes(sourceFolderEntryId) }); throw new EasObjectNotFoundException(EasMailbox.GetStringId(sourceFolderEntryId)); } Add add2; if (!base.EasFolderCache.TryGetValue(destFolderEntryId, out add2)) { MrsTracer.Provider.Warning("Destination folder {0} doesn't exist", new object[] { TraceUtils.DumpBytes(destFolderEntryId) }); throw new EasObjectNotFoundException(EasMailbox.GetStringId(destFolderEntryId)); } string stringId = EasMailbox.GetStringId(messageEntryId); if (add2.Type == 4 && EasFolder.IsCalendarFolder((EasFolderType)add.Type)) { this.DeleteItem(messageEntryId, sourceFolderEntryId); isPermanentDeletionMove = true; return(null); } string stringId2 = base.EasConnectionWrapper.MoveItem(stringId, add.ServerId, add2.ServerId); return(EasMailbox.GetEntryId(stringId2)); }
private void WriteWellKnownFolderReference(WellKnownFolderType wkfType, byte[] folderId) { WellKnownFolderMapping wellKnownFolderMapping = FolderHierarchyUtils.FindWKFMapping(wkfType, (int)this.Flags); PropTagFolderMapping propTagFolderMapping = wellKnownFolderMapping as PropTagFolderMapping; if (propTagFolderMapping != null) { if (propTagFolderMapping is MailboxRootFolderMapping) { IDestinationMailbox mbx = this.MbxWrapper.Mailbox as IDestinationMailbox; this.WriteEntryIdReference(propTagFolderMapping, folderId, (PropTag[] pta) => mbx.GetProps(pta), delegate(PropValueData[] pvda) { mbx.SetProps(pvda); }); return; } if (propTagFolderMapping is InboxFolderMapping) { this.WriteWellKnownFolderReferenceToFolder(WellKnownFolderType.Inbox, wkfType, propTagFolderMapping, folderId); this.WriteWellKnownFolderReferenceToFolder(WellKnownFolderType.NonIpmSubtree, wkfType, propTagFolderMapping, folderId); return; } } else { if (wellKnownFolderMapping is NamedFolderMapping) { return; } MrsTracer.Service.Warning("Unable to write WKF reference {0} -> {1}", new object[] { wkfType, TraceUtils.DumpEntryId(folderId) }); } }