public MessageEndpoint(string tokenPath, List <IHandler> handlers, IMessageProxy proxy) { _tokenPath = tokenPath; _handlers = handlers; _proxy = proxy; initializeEngine(); addHandlers(); }
protected override void CopySingleMessage(MessageRec curMsg, IFolderProxy folderProxy, PropTag[] propsToCopyExplicitly, PropTag[] excludeProps) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiSourceMailbox.CopySingleMessage", OperationType.None), new EntryIDsDataContext(curMsg.EntryId) }).Execute(delegate { using (this.RHTracker.Start()) { using (MapiMessage mapiMessage = (MapiMessage)this.OpenMapiEntry(curMsg.FolderId, curMsg.EntryId, OpenEntryFlags.DontThrowIfEntryIsMissing)) { if (mapiMessage == null) { MrsTracer.Provider.Debug("Message {0} is missing in source, ignoring", new object[] { TraceUtils.DumpEntryId(curMsg.EntryId) }); } else { using (IMessageProxy messageProxy = folderProxy.OpenMessage(curMsg.EntryId)) { using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(messageProxy, false, new Func <IDisposable>(this.RHTracker.StartExclusive), new Action <uint>(this.RHTracker.Charge))) { mapiMessage.ExportObject(fxProxyBudgetWrapper, CopyPropertiesFlags.None, excludeProps); } if (propsToCopyExplicitly != null && propsToCopyExplicitly.Length > 0) { PropValue[] props = mapiMessage.GetProps(propsToCopyExplicitly); using (this.RHTracker.StartExclusive()) { List <PropValueData> list = new List <PropValueData>(); foreach (PropValue propValue in props) { if (!propValue.IsNull() && !propValue.IsError()) { list.Add(new PropValueData(propValue.PropTag, propValue.Value)); } } if (list.Count > 0) { messageProxy.SetProps(list.ToArray()); } } } using (this.RHTracker.StartExclusive()) { messageProxy.SaveChanges(); } } } } } }); }
void IMessageProxy.SaveChanges() { IMessageProxy messageProxy = (IMessageProxy)base.WrappedObject; if (this.dataToSetOnSave != null) { messageProxy.SetProps(this.dataToSetOnSave); } messageProxy.SaveChanges(); }
public static void CopyMimeStream(ISupportMime mimeSource, MessageRec message, IFolderProxy folderProxy) { ArgumentValidator.ThrowIfNull("mimeSource", mimeSource); ArgumentValidator.ThrowIfNull("message", message); ArgumentValidator.ThrowIfNull("folderProxy", folderProxy); using (mimeSource.RHTracker.Start()) { PropValueData[] array; using (Stream mimeStream = mimeSource.GetMimeStream(message, out array)) { using (IMessageProxy messageProxy = folderProxy.OpenMessage(message.EntryId)) { BufferPool bufferPool = BufferPoolCollection.AutoCleanupCollection.Acquire(BufferPoolCollection.BufferSize.Size128K); byte[] array2 = bufferPool.Acquire(); try { for (;;) { int num = mimeStream.Read(array2, 0, array2.Length); if (num == 0) { break; } if (num == array2.Length) { messageProxy.WriteToMime(array2); } else { byte[] array3 = new byte[num]; Array.Copy(array2, 0, array3, 0, num); messageProxy.WriteToMime(array3); } } } finally { bufferPool.Release(array2); } List <PropValueData> list = new List <PropValueData>(SyncEmailUtils.SyncEmailPropTags.Length); list.AddRange(Array.FindAll <PropValueData>(message.AdditionalProps, (PropValueData propValue) => Array.IndexOf <PropTag>(SyncEmailUtils.SyncEmailPropTags, (PropTag)propValue.PropTag) >= 0)); if (array != null) { list.AddRange(array); } using (mimeSource.RHTracker.StartExclusive()) { messageProxy.SetProps(list.ToArray()); messageProxy.SaveChanges(); } } } } }
IMessageProxy IFolderProxy.CreateMessage(bool isAssociated) { IMessageProxy messageProxy = null; using (base.CreateCostHandle()) { messageProxy = ((IFolderProxy)base.WrappedObject).CreateMessage(isAssociated); } if (messageProxy == null) { return(null); } return(new FxProxyPoolBudgetWrapper.MessageProxyBudgetWrapper(messageProxy, true, base.CreateCostHandle, base.Charge)); }
IMessageProxy IFolderProxy.OpenMessage(byte[] entryId) { IMessageProxy messageProxy = null; using (base.CreateCostHandle()) { messageProxy = ((IFolderProxy)base.WrappedObject).OpenMessage(entryId); } if (messageProxy == null) { return(null); } return(new FxProxyPoolBudgetWrapper.MessageProxyBudgetWrapper(messageProxy, true, base.CreateCostHandle, base.Charge)); }
public static void CopyItem(MessageRec messageRec, IMessage message, IFolderProxy folderProxy, PropTag[] propsToExclude) { using (IMessageProxy messageProxy = folderProxy.OpenMessage(messageRec.EntryId)) { FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(messageProxy); fxCollectorSerializer.Config(0, 1); using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, Encoding.Default, NullResourceTracker.Instance, new PropertyFilterFactory(false, false, (from ptag in propsToExclude select new PropertyTag((uint)ptag)).ToArray <PropertyTag>()), false)) { FastTransferMessageCopyTo fastTransferObject = new FastTransferMessageCopyTo(false, message, true); fastTransferDownloadContext.PushInitial(fastTransferObject); FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer); messageProxy.SaveChanges(); } } }
IMessageProxy IFolderProxy.CreateMessage(bool isAssociated) { IMessageProxy result = null; base.CreateContext("IFolderProxy.CreateMessage", new DataContext[] { new SimpleValueDataContext("IsAssociated", isAssociated) }).Execute(delegate { result = ((IFolderProxy)this.WrappedObject).CreateMessage(isAssociated); }, true); if (result == null) { return(null); } return(new FxProxyPoolWrapper.MessageProxyWrapper(result, base.CreateContext)); }
IMessageProxy IFolderProxy.OpenMessage(byte[] entryId) { IMessageProxy result = null; base.CreateContext("IFolderProxy.OpenMessage", new DataContext[] { new EntryIDsDataContext(entryId) }).Execute(delegate { result = ((IFolderProxy)this.WrappedObject).OpenMessage(entryId); }, true); if (result == null) { return(null); } return(new FxProxyPoolWrapper.MessageProxyWrapper(result, base.CreateContext)); }
protected override void CopySingleMessage(MessageRec message, IFolderProxy targetFolderProxy, PropTag[] propsToCopyExplicitly, PropTag[] propTagsToExclude) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("PstSourceMailbox.CopySingleMessage", OperationType.None), new EntryIDsDataContext(message.EntryId) }).Execute(delegate { try { uint nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId); IMessage message2 = this.IPst.ReadMessage(nodeIdFromEntryId); if (message2 == null) { throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, nodeIdFromEntryId); } PSTMessage pstmessage = new PSTMessage(this, message2); using (IMessageProxy messageProxy = targetFolderProxy.OpenMessage(message.EntryId)) { FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(messageProxy); fxCollectorSerializer.Config(0, 1); using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, pstmessage.RawPropertyBag.CachedEncoding, NullResourceTracker.Instance, this.GetPropertyFilterFactory(PstMailbox.MoMTPtaFromPta(propTagsToExclude)), false)) { FastTransferMessageCopyTo fastTransferObject = new FastTransferMessageCopyTo(false, pstmessage, true); fastTransferDownloadContext.PushInitial(fastTransferObject); FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer); messageProxy.SaveChanges(); } } } catch (PSTExceptionBase innerException) { throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId), innerException); } }); }
public MessageProxyWrapper(IMessageProxy proxy, CommonUtils.CreateContextDelegate createContext) : base(proxy, createContext) { }
public ProcessSignUp(ICoursesService coursesServiceProxy, IMessageProxy messageProxy) { _coursesServiceProxy = coursesServiceProxy; _messageProxy = messageProxy; }
public void Start() { lock (_padlock) { Logger.WriteDebug("Starting autotest.net engine"); BootStrapper.SetBuildConfiguration( new BuildConfiguration((original, @new) => { var detector = new PublicContractChangeDetector(); var changes = detector.GetAllPublicContractChangesBetween(original, @new).ToArray(); var optimisticBuildPossible = changes.Length == 0; if (!optimisticBuildPossible) { Debug.WriteDebug("Optimistic build changes"); foreach (var change in changes) Debug.WriteDebug("\t" + change.ItemChanged); } return optimisticBuildPossible; })); BootStrapper.Configure(_writeLocator); Logger.WriteDebug("Setting up log writer"); Logger.SetWriter(BootStrapper.Services.Locate<IWriteDebugInfo>()); BootStrapper.Container.Register(Component.For<IMessageProxy>() .Forward<IConsumerOf<AssembliesMinimizedMessage>>() .Forward<IConsumerOf<AbortMessage>>() .ImplementedBy<AutoTestMessageProxy>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IPreProcessTestruns>().ImplementedBy<MinimizingPreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IPreProcessBuildruns>().ImplementedBy<MinimizingBuildPreProcessor>()); BootStrapper.Container.Register(Component.For<IPreProcessBuildruns>().Forward<IPreProcessTestruns>().ImplementedBy<OnDemanTestrunPreprocessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IPreProcessBuildruns>().ImplementedBy<RealtimeChangePreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IConsumerOf<FileChangeMessage>>().ImplementedBy<RecursiveRunCauseConsumer>().Named("RecursiveRunConsumer")); BootStrapper.Container.Register(Component.For<ICustomIgnoreProvider>().ImplementedBy<IgnoreProvider>()); Logger.WriteDebug("Setting up message proxy"); _proxy = BootStrapper.Services.Locate<IMessageProxy>(); _proxy.SetMessageForwarder(_server); _proxy.RunStarted += _proxy_RunStarted; _proxy.RunFinished += _proxy_RunFinished; _configuration = BootStrapper.Services.Locate<IConfiguration>(); if (_configuration.DebuggingEnabled) Logger.EnableWriter(); Logger.WriteDebug("Checking license"); if (licenseIsInvalid()) return; _realtimeChangeTracker = new ChangeTracker(getRealtimeRunPreprocessor(), _configuration, BootStrapper.Services.Locate<IMessageBus>(), BootStrapper.Services.Locate<IGenerateBuildList>()); Logger.WriteDebug("Setting up cache"); var runCache = BootStrapper.Services.Locate<IRunResultCache>(); runCache.EnabledDeltas(); BootStrapper.InitializeCache(_watchPath); _watcher = BootStrapper.Services.Locate<IDirectoryWatcher>(); Logger.WriteDebug("Looking for config in "+_localConfigLocation); _watcher.LocalConfigurationIsLocatedAt(_localConfigLocation); _watcher.Watch(_watchPath); _configuration.ValidateSettings(); _configuredCustomOutput = _configuration.CustomOutputPath; var disableAll = _configuration.AllSettings("mm-AllDisabled").ToLower().Equals("true"); StartedPaused = _configuration.StartPaused || disableAll; _isPaused = StartedPaused; setCustomOutputPath(); var minimizer = getMinimizer(); minimizer.ProfilerCompletedUpdate += minimizer_ProfilerCompletedUpdate; minimizer.ProfilerInitialized += minimizer_ProfilerInitialized; minimizer.MinimizerInitialized += minimizer_MinimizerInitialized; minimizer.ProfilingStarted += (sender, e) => _server.Send(new ProfiledTestRunStarted()); minimizer.ProfilerLoadError += profiler_profilercorrupted; minimizer.SetManualUpdateProvider(() => _isPaused); initializeAllForPreProcessor(minimizer); if (disableAll) Pause(); IsRunning = true; } }
public MessageProxyBudgetWrapper(IMessageProxy proxy, bool ownsObject, Func <IDisposable> createCostHandleDelegate, Action <uint> chargeDelegate) : base(proxy, ownsObject, createCostHandleDelegate, chargeDelegate) { }
void IMessageProxy.WriteToMime(byte[] buffer) { IMessageProxy messageProxy = (IMessageProxy)base.WrappedObject; messageProxy.WriteToMime(buffer); }
public void Start() { lock (_padlock) { Logger.WriteDebug("Starting autotest.net engine"); BootStrapper.SetBuildConfiguration( new BuildConfiguration((original, @new) => { var detector = new PublicContractChangeDetector(); var changes = detector.GetAllPublicContractChangesBetween(original, @new).ToArray(); var optimisticBuildPossible = changes.Length == 0; if (!optimisticBuildPossible) { Debug.WriteDebug("Optimistic build changes"); foreach (var change in changes) { Debug.WriteDebug("\t" + change.ItemChanged); } } return(optimisticBuildPossible); })); BootStrapper.Configure(_writeLocator); Logger.WriteDebug("Setting up log writer"); Logger.SetWriter(BootStrapper.Services.Locate <IWriteDebugInfo>()); BootStrapper.Container.Register(Component.For <IMessageProxy>() .Forward <IConsumerOf <AssembliesMinimizedMessage> >() .Forward <IConsumerOf <AbortMessage> >() .ImplementedBy <AutoTestMessageProxy>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IPreProcessTestruns>().ImplementedBy <MinimizingPreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().ImplementedBy <MinimizingBuildPreProcessor>()); BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().Forward <IPreProcessTestruns>().ImplementedBy <OnDemanTestrunPreprocessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().ImplementedBy <RealtimeChangePreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IConsumerOf <FileChangeMessage> >().ImplementedBy <RecursiveRunCauseConsumer>().Named("RecursiveRunConsumer")); BootStrapper.Container.Register(Component.For <ICustomIgnoreProvider>().ImplementedBy <IgnoreProvider>()); Logger.WriteDebug("Setting up message proxy"); _proxy = BootStrapper.Services.Locate <IMessageProxy>(); _proxy.SetMessageForwarder(_server); _proxy.RunStarted += _proxy_RunStarted; _proxy.RunFinished += _proxy_RunFinished; _configuration = BootStrapper.Services.Locate <IConfiguration>(); if (_configuration.DebuggingEnabled) { Logger.EnableWriter(); } Logger.WriteDebug("Checking license"); if (licenseIsInvalid()) { return; } _realtimeChangeTracker = new ChangeTracker(getRealtimeRunPreprocessor(), _configuration, BootStrapper.Services.Locate <IMessageBus>(), BootStrapper.Services.Locate <IGenerateBuildList>()); Logger.WriteDebug("Setting up cache"); var runCache = BootStrapper.Services.Locate <IRunResultCache>(); runCache.EnabledDeltas(); BootStrapper.InitializeCache(_watchPath); _watcher = BootStrapper.Services.Locate <IDirectoryWatcher>(); _watcher.Watch(_watchPath); _configuration.ValidateSettings(); _configuredCustomOutput = _configuration.CustomOutputPath; var disableAll = _configuration.AllSettings("mm-AllDisabled").ToLower().Equals("true"); StartedPaused = _configuration.StartPaused || disableAll; _isPaused = StartedPaused; setCustomOutputPath(); var minimizer = getMinimizer(); minimizer.ProfilerCompletedUpdate += minimizer_ProfilerCompletedUpdate; minimizer.ProfilerInitialized += minimizer_ProfilerInitialized; minimizer.MinimizerInitialized += minimizer_MinimizerInitialized; minimizer.ProfilingStarted += (sender, e) => _server.Send(new ProfiledTestRunStarted()); minimizer.ProfilerLoadError += profiler_profilercorrupted; minimizer.SetManualUpdateProvider(() => _isPaused); initializeAllForPreProcessor(minimizer); if (disableAll) { Pause(); } IsRunning = true; } }
public TranslatingMessageProxy(IMessageProxy destMessage, PropValueData[] dataToSetOnSave, FolderContentsMapper mapper) : base(destMessage, mapper) { this.dataToSetOnSave = dataToSetOnSave; }