Example #1
0
        public SettingsScreenView(Screen screen) : base(screen)
        {
            background  = new Background("settings_background");
            button_back = new ReturnButton("settings_button_back", AnchorUtil.FindScreenPosition(Anchor.BottomLeft));
            button_save = new SaveButton("settings_button_save", AnchorUtil.FindScreenPosition(Anchor.BottomRight));

            Groups = new List <SettingsGroup>();

            Groups.Add(new GameplaySettings(new Vector2(400, GetNextGroupPos())));
            Groups.Add(new AudioSettings(new Vector2(400, GetNextGroupPos())));
            Groups.Add(new BindingsSettings(new Vector2(400, GetNextGroupPos())));
            Groups.Add(new JudgementsSettings(new Vector2(400, GetNextGroupPos())));
        }
        private ServiceHost StartServiceEndpoint(object serviceInstance, ServiceEndpointAddress serviceAddress)
        {
            AnchorUtil.ThrowOnNullArgument(serviceInstance, "serviceInstance");
            ServiceHost result;

            try
            {
                ServiceHost serviceHost = new ServiceHost(serviceInstance, serviceAddress.GetBaseUris());
                serviceHost.AddDefaultEndpoints();
                this.logger.Log(MigrationEventType.Verbose, "Opening service host for {0}, with service type {1} and namespace {2}.", new object[]
                {
                    serviceHost.Description.Name,
                    serviceHost.Description.ServiceType.FullName,
                    serviceHost.Description.Namespace
                });
                ServiceDebugBehavior serviceDebugBehavior = serviceHost.Description.Behaviors.Find <ServiceDebugBehavior>();
                if (serviceDebugBehavior == null)
                {
                    serviceDebugBehavior = new ServiceDebugBehavior();
                    serviceHost.Description.Behaviors.Add(serviceDebugBehavior);
                }
                serviceDebugBehavior.IncludeExceptionDetailInFaults = true;
                foreach (System.ServiceModel.Description.ServiceEndpoint serviceEndpoint in serviceHost.Description.Endpoints)
                {
                    NetTcpBinding netTcpBinding = serviceEndpoint.Binding as NetTcpBinding;
                    if (netTcpBinding != null)
                    {
                        netTcpBinding.MaxReceivedMessageSize = 10485760L;
                        netTcpBinding.ReceiveTimeout         = TimeSpan.FromMinutes(10.0);
                        netTcpBinding.SendTimeout            = TimeSpan.FromMinutes(10.0);
                    }
                    this.logger.LogVerbose("Using binging: {0} ({1})", new object[]
                    {
                        serviceEndpoint.Binding.Name,
                        serviceEndpoint.Binding.MessageVersion
                    });
                    LoadBalanceUtils.UpdateAndLogServiceEndpoint(this.logger, serviceEndpoint);
                }
                serviceHost.Open();
                result = serviceHost;
            }
            catch (Exception exception)
            {
                this.logger.LogError(exception, "Failed to register endpoint for service {0}", new object[]
                {
                    serviceInstance.GetType().Name
                });
                throw;
            }
            return(result);
        }
Example #3
0
        public override void Save(SaveMode saveMode)
        {
            FolderSaveResult folderSaveResult = this.Folder.Save(saveMode);

            if (folderSaveResult.OperationResult == OperationResult.Succeeded)
            {
                return;
            }
            if (AnchorUtil.IsTransientException(folderSaveResult.Exception))
            {
                throw new MigrationTransientException(folderSaveResult.Exception.LocalizedString, folderSaveResult.Exception);
            }
            throw new MigrationPermanentException(folderSaveResult.Exception.LocalizedString, folderSaveResult.Exception);
        }
Example #4
0
        /// <summary>
        /// HitObject is an "Arc", the main gameplay element for Pulsarc.
        /// They move from the outer edges of the screen towards the center to
        /// the crosshair. The player can press corresponding keys to "hit" these arcs.
        /// </summary>
        /// <param name="time">The time (in ms) from the start of the audio to a Perfect hit</param>
        /// <param name="angle">The direction this HitObject is "falling" from.</param>
        /// <param name="keys">How many keys are in the current Beatmap. Only 4 keys is working right now.</param>
        /// <param name="baseSpeed">The user-defined base speed for this arc.</param>
        /// <param name="hidden">Whether or not this arc should fade before reaching the crosshair.</param>
        public HitObject(int time, double angle, int keys, double baseSpeed, bool hidden) : base(Skin.Assets["arcs"])
        {
            Time      = time;
            Angle     = angle;
            BaseSpeed = baseSpeed;
            Hidden    = hidden;

            // Find the origin (center) of this Crosshair
            int width  = Pulsarc.CurrentWidth;
            int height = Pulsarc.CurrentHeight;

            origin.X = (width / 2) + ((Texture.Width - width) / 2);
            origin.Y = (height / 2) + ((Texture.Height - height) / 2);

            // Position this HitOjbect
            ChangePosition(AnchorUtil.FindScreenPosition(Anchor.Center));

            drawnPart.Width  = Texture.Width / 2;
            drawnPart.Height = Texture.Height / 2;

            // Should be changed if we want different than 4 keys.
            // Currently no solution available with drawn rectangles
            switch (angle)
            {
            case 0:
                drawnPart.X = Texture.Width / 2;
                origin.X   -= Texture.Width / 2;
                break;

            case 180:
                drawnPart.Y = Texture.Height / 2;
                origin.Y   -= Texture.Height / 2;
                break;

            case 90:
                drawnPart.X = Texture.Width / 2;
                drawnPart.Y = Texture.Height / 2;
                origin.X   -= Texture.Width / 2;
                origin.Y   -= Texture.Height / 2;
                break;
            }

            // Set the rotation of the object
            // TODO: Make this customizeable by the beatmap.
            Rotation = (float)(45 * (Math.PI / 180));

            // Set the HitObject's position
            ChangePosition(TruePosition);
        }
Example #5
0
 // Token: 0x060001E3 RID: 483 RVA: 0x00006F74 File Offset: 0x00005174
 public void RemoveMessage(StoreObjectId messageId)
 {
     AnchorUtil.ThrowOnNullArgument(messageId, "messageId");
     try
     {
         this.MailboxSession.Delete(DeleteItemFlags.HardDelete, new StoreId[]
         {
             messageId
         });
     }
     catch (ObjectNotFoundException exception)
     {
         this.anchorContext.Logger.Log(MigrationEventType.Error, exception, "Encountered an object not found  exception when deleting a migration job cache entry message", new object[0]);
     }
 }
Example #6
0
 private static StoreObjectId GetFolderId(AnchorContext context, MailboxSession mailboxSession, StoreObjectId rootFolderId, string folderName)
 {
     AnchorUtil.ThrowOnNullArgument(mailboxSession, "mailboxSession");
     AnchorUtil.ThrowOnNullArgument(rootFolderId, "rootFolderId");
     AnchorUtil.ThrowOnNullArgument(folderName, "folderName");
     try
     {
         using (Folder folder = Folder.Bind(mailboxSession, rootFolderId))
         {
             using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.None, null, null, new PropertyDefinition[]
             {
                 FolderSchema.Id,
                 StoreObjectSchema.DisplayName
             }))
             {
                 QueryFilter seekFilter = new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.DisplayName, folderName);
                 if (queryResult.SeekToCondition(SeekReference.OriginBeginning, seekFilter))
                 {
                     object[][] rows = queryResult.GetRows(1);
                     if (rows.Length > 0)
                     {
                         VersionedId versionedId = (VersionedId)rows[0][0];
                         return(versionedId.ObjectId);
                     }
                 }
             }
         }
         context.Logger.Log(MigrationEventType.Warning, "Couldn't find subfolder {0}", new object[]
         {
             folderName
         });
     }
     catch (ObjectNotFoundException exception)
     {
         context.Logger.Log(MigrationEventType.Warning, exception, "Folder {0} missing, will try to create it", new object[]
         {
             folderName
         });
     }
     catch (StorageTransientException exception2)
     {
         context.Logger.Log(MigrationEventType.Warning, exception2, "Transient exception when trying to get Folder {0} will try to create it", new object[]
         {
             folderName
         });
     }
     return(null);
 }
Example #7
0
        // Token: 0x060001E6 RID: 486 RVA: 0x00007328 File Offset: 0x00005528
        public IAnchorStoreObject GetFolderByName(string folderName, PropertyDefinition[] properties)
        {
            AnchorUtil.ThrowOnNullArgument(properties, "properties");
            AnchorUtil.AssertOrThrow(this.MailboxSession != null, "Should have a MailboxSession", new object[0]);
            IAnchorStoreObject result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                IAnchorStoreObject anchorStoreObject = AnchorFolder.GetFolder(this.anchorContext, this.MailboxSession, folderName);
                disposeGuard.Add <IAnchorStoreObject>(anchorStoreObject);
                anchorStoreObject.Load(properties);
                disposeGuard.Success();
                result = anchorStoreObject;
            }
            return(result);
        }
 public virtual void CreateInStore(IAnchorDataProvider dataProvider, Action <IAnchorStoreObject> streamAction)
 {
     AnchorUtil.ThrowOnNullArgument(dataProvider, "dataProvider");
     AnchorUtil.AssertOrThrow(this.StoreObjectId == null, "Object should not have been created already.", new object[0]);
     using (IAnchorStoreObject anchorStoreObject = this.CreateStoreObject(dataProvider))
     {
         if (streamAction != null)
         {
             streamAction(anchorStoreObject);
         }
         this.WriteToMessageItem(anchorStoreObject, false);
         anchorStoreObject.Save(SaveMode.FailOnAnyConflict);
         anchorStoreObject.Load(this.PropertyDefinitions);
         this.ReadStoreObjectIdProperties(anchorStoreObject);
     }
 }
Example #9
0
        public static LoadMetricStorage operator +(LoadMetricStorage left, LoadMetricStorage right)
        {
            AnchorUtil.ThrowOnNullArgument(left, "left");
            AnchorUtil.ThrowOnNullArgument(right, "right");
            LoadMetricStorage loadMetricStorage = new LoadMetricStorage();

            foreach (LoadMetric metric in left.values.Keys)
            {
                loadMetricStorage[metric] = left[metric];
            }
            foreach (LoadMetric metric2 in right.values.Keys)
            {
                loadMetricStorage[metric2] += right[metric2];
            }
            return(loadMetricStorage);
        }
Example #10
0
        public GetMoveRequestStatistics(DirectoryMailbox mailbox, ILogger logger, CmdletExecutionPool cmdletPool) : base("Get-MoveRequestStatistics", cmdletPool, logger)
        {
            this.Mailbox = mailbox;
            AnchorUtil.ThrowOnNullArgument(mailbox, "mailbox");
            string value;

            if (mailbox.OrganizationId == TenantPartitionHint.ExternalDirectoryOrganizationIdForRootOrg)
            {
                value = string.Format("{0}", mailbox.Guid);
            }
            else
            {
                value = string.Format("{0}\\{1}", mailbox.OrganizationId, mailbox.Guid);
            }
            base.Command.AddParameter("Identity", value);
        }
Example #11
0
        private void SetUpBackgroundAndIcon()
        {
            background = new Background("menu_background");

            gameIcon = new GameIcon(
                Skin.GetConfigStartPosition("main_menu", "Properties", "IconStartPos"),
                GetSkinnablePropertyAnchor("IconAnchor"));

            Vector2 offset = new Vector2(
                GetSkinnablePropertyInt("IconX"),
                GetSkinnablePropertyInt("IconY"));

            gameIcon.Move(offset);

            version = new VersionCounter(AnchorUtil.FindScreenPosition(Anchor.BottomRight));
        }
Example #12
0
        /// <summary>
        /// Updates all the elements on this card to move in the right spot.
        /// Inherited classes can add new elements in an overriden method,
        /// don't forget "base.UpdateElements()"
        /// </summary>
        protected virtual void UpdateElements()
        {
            // Don't bother updating if we aren't on screen.
            if (!OnScreen())
            {
                return;
            }

            for (int i = 0; i < TextElements.Count; i++)
            {
                TextElements[i]?.ChangePosition
                (
                    AnchorUtil.FindDrawablePosition(TextElementStartAnchors[i], this)
                    + TextElementOffsets[i]
                );
            }
        }
Example #13
0
 public bool SupportsAdditional(LoadMetricStorage incomingLoad, out LoadMetric exceededMetric, out long requestedUnits, out long availableUnits)
 {
     AnchorUtil.ThrowOnNullArgument(incomingLoad, "incomingLoad");
     exceededMetric = null;
     requestedUnits = 0L;
     availableUnits = 0L;
     foreach (LoadMetric loadMetric in this.values.Keys)
     {
         if (this[loadMetric] < incomingLoad[loadMetric] || this[loadMetric] == 0L)
         {
             exceededMetric = loadMetric;
             availableUnits = this[loadMetric];
             requestedUnits = incomingLoad[loadMetric];
             return(false);
         }
     }
     return(true);
 }
Example #14
0
        // Token: 0x060001EA RID: 490 RVA: 0x00007478 File Offset: 0x00005678
        private static AnchorDataProvider CreateProviderForMailboxSession(AnchorContext context, AnchorADProvider activeDirectoryProvider, string folderName, Func <ExchangePrincipal, MailboxSession> mailboxSessionCreator)
        {
            AnchorUtil.ThrowOnNullArgument(mailboxSessionCreator, "mailboxSessionCreator");
            AnchorDataProvider result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                ExchangePrincipal mailboxOwner = activeDirectoryProvider.GetMailboxOwner(AnchorDataProvider.GetMailboxFilter(context.AnchorCapability));
                MailboxSession    disposable   = mailboxSessionCreator(mailboxOwner);
                disposeGuard.Add <MailboxSession>(disposable);
                AnchorFolder disposable2 = AnchorFolder.GetFolder(context, disposable, folderName);
                disposeGuard.Add <AnchorFolder>(disposable2);
                AnchorDataProvider anchorDataProvider = new AnchorDataProvider(context, activeDirectoryProvider, disposable, disposable2, true);
                disposeGuard.Success();
                result = anchorDataProvider;
            }
            return(result);
        }
        public virtual TopologyExtractorFactoryContext GetContext(IClientFactory clientFactory, Band[] bands, IList <Guid> nonMovableOrgs, ILogger logger)
        {
            AnchorUtil.ThrowOnNullArgument(clientFactory, "clientFactory");
            TimeSpan instanceCacheExpirationPeriod = LoadBalanceADSettings.Instance.Value.IdleRunDelay + LoadBalanceADSettings.Instance.Value.IdleRunDelay;
            TopologyExtractorFactoryContext context2;

            lock (this.factoryInstances.GetSyncRoot <TopologyExtractorFactoryContextPool.ContextInstanceRecord>())
            {
                this.factoryInstances.RemoveAll((TopologyExtractorFactoryContextPool.ContextInstanceRecord factoryContext) => factoryContext.IsExpired(instanceCacheExpirationPeriod));
                TopologyExtractorFactoryContextPool.ContextInstanceRecord contextInstanceRecord = this.factoryInstances.FirstOrDefault((TopologyExtractorFactoryContextPool.ContextInstanceRecord context) => context.Matches(clientFactory, bands, nonMovableOrgs, logger));
                if (contextInstanceRecord == null)
                {
                    contextInstanceRecord = new TopologyExtractorFactoryContextPool.ContextInstanceRecord(new TopologyExtractorFactoryContext(clientFactory, bands, nonMovableOrgs, logger));
                    this.factoryInstances.Add(contextInstanceRecord);
                }
                contextInstanceRecord.UpdateLastAccessTimestamp();
                context2 = contextInstanceRecord.Context;
            }
            return(context2);
        }
Example #16
0
        /// <summary>
        /// The crosshair, or "Judgement Circle" of Pulsarc.
        /// </summary>
        /// <param name="baseCrosshairDiameter">The base diameter for this Crosshair. Default is 300 (the diameter of Intralism's crosshair)</param>
        public Crosshair(float baseCrosshairDiameter = 300, bool hidden = false) : base(Skin.Assets["crosshair"])
        {
            this.hidden = hidden;

            // Find the origin (center) of this Crosshair
            int width  = Pulsarc.CurrentWidth;
            int height = Pulsarc.CurrentHeight;

            origin.X = (width / 2) + ((Texture.Width - width) / 2);
            origin.Y = (height / 2) + ((Texture.Height - height) / 2);

            // Set the diameter and resize
            Resize(baseCrosshairDiameter * Pulsarc.HeightScale);

            ChangePosition(AnchorUtil.FindScreenPosition(Anchor.Center));

            // Set the rotation of the object.
            // TODO: Make this customizeable by the beatmap/user setting.
            Rotation = (float)(45 * (Math.PI / 180));
        }
        internal static void DeleteAttachment(MessageItem message, string name)
        {
            AnchorUtil.ThrowOnNullArgument(message, "message");
            AnchorUtil.ThrowOnNullOrEmptyArgument(name, "name");
            List <AttachmentHandle> list = new List <AttachmentHandle>(message.AttachmentCollection.Count);

            foreach (AttachmentHandle attachmentHandle in message.AttachmentCollection)
            {
                AttachmentType type = AttachmentType.Stream;
                using (StreamAttachment streamAttachment = (StreamAttachment)message.AttachmentCollection.Open(attachmentHandle, type))
                {
                    if (streamAttachment.FileName.Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        list.Add(attachmentHandle);
                    }
                }
            }
            foreach (AttachmentHandle handle in list)
            {
                message.AttachmentCollection.Remove(handle);
            }
        }
        internal static AnchorAttachment GetAttachment(AnchorContext context, MessageItem message, string name, PropertyOpenMode openMode)
        {
            AnchorUtil.ThrowOnNullArgument(message, "message");
            AnchorUtil.ThrowOnNullOrEmptyArgument(name, "name");
            if (openMode != PropertyOpenMode.ReadOnly && openMode != PropertyOpenMode.Modify)
            {
                throw new ArgumentException("Invalid OpenMode for GetAttachment", "openMode");
            }
            AnchorAttachment anchorAttachment = null;

            foreach (AttachmentHandle handle in message.AttachmentCollection)
            {
                StreamAttachment streamAttachment = null;
                try
                {
                    AttachmentType type = AttachmentType.Stream;
                    streamAttachment = (StreamAttachment)message.AttachmentCollection.Open(handle, type);
                    if (streamAttachment.FileName.Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        anchorAttachment = new AnchorAttachment(context, streamAttachment, openMode);
                        streamAttachment = null;
                        break;
                    }
                }
                finally
                {
                    if (streamAttachment != null)
                    {
                        streamAttachment.Dispose();
                        streamAttachment = null;
                    }
                }
            }
            if (anchorAttachment == null)
            {
                throw new MigrationAttachmentNotFoundException(name);
            }
            return(anchorAttachment);
        }
Example #19
0
 // Token: 0x060001E4 RID: 484 RVA: 0x000072C0 File Offset: 0x000054C0
 public IEnumerable <StoreObjectId> FindMessageIds(QueryFilter queryFilter, PropertyDefinition[] properties, SortBy[] sortBy, AnchorRowSelector rowSelector, int?maxCount)
 {
     AnchorUtil.ThrowOnCollectionEmptyArgument(sortBy, "sortBy");
     if (maxCount == null || maxCount.Value > 0)
     {
         if (properties == null)
         {
             properties = new PropertyDefinition[0];
         }
         PropertyDefinition[] columns = new PropertyDefinition[1 + properties.Length];
         columns[0] = ItemSchema.Id;
         Array.Copy(properties, 0, columns, 1, properties.Length);
         using (IQueryResult itemQueryResult = this.folder.Folder.IItemQuery(ItemQueryType.Associated, queryFilter, sortBy, columns))
         {
             foreach (StoreObjectId id in AnchorDataProvider.ProcessQueryRows(columns, itemQueryResult, rowSelector, 0, maxCount))
             {
                 yield return(id);
             }
         }
     }
     yield break;
 }
Example #20
0
        internal static PersistableDictionary GetDictionaryProperty(IAnchorStoreObject item, PropertyDefinition propertyDefinition, bool required)
        {
            AnchorUtil.ThrowOnNullArgument(item, "item");
            AnchorUtil.ThrowOnNullArgument(propertyDefinition, "propertyDefinition");
            string property = AnchorHelper.GetProperty <string>(item, propertyDefinition, required);

            if (property == null)
            {
                return(null);
            }
            PersistableDictionary result;

            try
            {
                result = PersistableDictionary.Create(property);
            }
            catch (XmlException innerException)
            {
                throw new InvalidDataException(AnchorHelper.GetPropertyErrorMessage(propertyDefinition, property), innerException);
            }
            return(result);
        }
Example #21
0
        /// <summary>
        /// Add a TextDisplayElement to the Card, using the config to
        /// determine their positioning and other properties.
        /// </summary>
        /// <param name="typeName">The "typeName" of the button, or the prefix in the config.</param>
        protected virtual void AddTextDisplayElement(string typeName)
        {
            // Find variables for TDE
            Anchor  startAnchor;
            Vector2 position = Skin.GetConfigStartPosition(Config, Section, typeName + "StartPos", out startAnchor, this);
            int     fontSize = GetSkinnableInt(typeName + "FontSize");
            Anchor  anchor   = GetSkinnableAnchor(typeName + "Anchor");
            Color   color    = Skin.GetConfigColor(Config, Section, typeName + "Color");

            // Make TDE
            TextDisplayElement text = new TextDisplayElement("", position, fontSize, anchor, color);

            // Offset
            Vector2 offset = new Vector2(
                GetSkinnableInt(typeName + "X"),
                GetSkinnableInt(typeName + "Y"));

            text.Move(offset);

            //Add TDE
            TextElements.Add(text);
            TextElementOffsets.Add(text.Position - AnchorUtil.FindDrawablePosition(startAnchor, this));
            TextElementStartAnchors.Add(startAnchor);
        }
Example #22
0
        private void SetDiffBar()
        {
            float difficulty = (float)Beatmap.Difficulty;

            Anchor  startAnchor;
            Vector2 startPos = Skin.GetConfigStartPosition(Config, Section, "DiffBarStartPos", out startAnchor, this);

            Anchor diffAnchor = GetSkinnableAnchor("DiffBarAnchor");

            diffBar = new BeatmapCardDifficulty
                      (
                startPos,
                // diffbar displayed percentage is 0 if less than 0, and 10 if greater than 10
                difficulty <= 10 ? difficulty >= 0 ? difficulty : 0 : 10,
                diffAnchor
                      );

            int diffBarXOffset = GetSkinnableInt("DiffBarX");
            int diffBarYOffset = GetSkinnableInt("DiffBarY");

            diffBar.Move(diffBarXOffset, diffBarYOffset);
            diffBarOffset      = diffBar.Position - AnchorUtil.FindDrawablePosition(startAnchor, this);
            diffBarStartAnchor = startAnchor;
        }
Example #23
0
        internal UpgradeHandlerScheduler(AnchorContext context, IOrganizationOperation orgOperationProxyInstance, ISymphonyProxy symphonyProxyInstance, WaitHandle stopEvent) : base(context, stopEvent)
        {
            string domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;

            AnchorUtil.AssertOrThrow(!string.IsNullOrEmpty(domainName), "Expect to have valid domain name set", new object[0]);
            int num = domainName.IndexOf('.');

            AnchorUtil.AssertOrThrow(num >= 0, "Expect a valid dns name {0}", new object[]
            {
                domainName
            });
            this.ForestName        = domainName.Substring(0, num);
            this.orgOperationProxy = orgOperationProxyInstance;
            if (orgOperationProxyInstance is OrgOperationProxy)
            {
                ((OrgOperationProxy)this.orgOperationProxy).Context = context;
            }
            this.symphonyProxy = symphonyProxyInstance;
            if (symphonyProxyInstance is SymphonyProxy)
            {
                ((SymphonyProxy)this.symphonyProxy).WorkloadUri = new Uri(context.Config.GetConfig <Uri>("WebServiceUri"), "WorkloadService.svc");
                ((SymphonyProxy)this.symphonyProxy).Cert        = CertificateHelper.GetExchangeCertificate(context.Config.GetConfig <string>("CertificateSubject"));
            }
        }
        internal static AnchorAttachment CreateAttachment(AnchorContext context, MessageItem message, string name)
        {
            AnchorUtil.ThrowOnNullArgument(message, "message");
            AnchorUtil.ThrowOnNullOrEmptyArgument(name, "name");
            AttachmentType type         = AttachmentType.Stream;
            AttachmentId   attachmentId = null;

            foreach (AttachmentHandle handle in message.AttachmentCollection)
            {
                using (StreamAttachment streamAttachment = (StreamAttachment)message.AttachmentCollection.Open(handle, type))
                {
                    if (streamAttachment.FileName.Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        attachmentId = streamAttachment.Id;
                        break;
                    }
                }
            }
            context.Logger.Log(MigrationEventType.Information, "Creating a new attachment with name {0}", new object[]
            {
                name
            });
            StreamAttachment streamAttachment2 = (StreamAttachment)message.AttachmentCollection.Create(type);

            streamAttachment2.FileName = name;
            if (attachmentId != null)
            {
                context.Logger.Log(MigrationEventType.Information, "Found an existing attachment with name {0} and id {1}, removing old one", new object[]
                {
                    name,
                    attachmentId.ToBase64String()
                });
                message.AttachmentCollection.Remove(attachmentId);
            }
            return(new AnchorAttachment(context, streamAttachment2, PropertyOpenMode.Create));
        }
Example #25
0
            public static string AppendDiagnosticHistory(string history, params string[] entryFields)
            {
                AnchorUtil.ThrowOnNullArgument(history, "history");
                int num = history.Count((char p) => p == ';');

                if (num >= 35)
                {
                    int num2 = -1;
                    while (num-- >= 35)
                    {
                        num2 = history.IndexOf(';', num2 + 1);
                        if (num2 < 0)
                        {
                            break;
                        }
                    }
                    if (num2 < 0)
                    {
                        throw new MigrationDataCorruptionException(string.Format("bad format of history {0}, expected to find delim", history));
                    }
                    history = history.Substring(num2);
                }
                return(history + string.Join(":", entryFields) + ';');
            }
 public MailboxLoadBalanceService(LoadBalanceAnchorContext serviceContext)
 {
     AnchorUtil.ThrowOnNullArgument(serviceContext, "serviceContext");
     this.serviceContext = serviceContext;
 }
 public virtual void WriteToMessageItem(IAnchorStoreObject message, bool loaded)
 {
     AnchorUtil.ThrowOnNullArgument(message, "message");
     this.WriteExtendedPropertiesToMessageItem(message);
 }
Example #28
0
 public MailboxStatisticsLogger(ILogger logger, ObjectLogCollector logCollector) : base(logger)
 {
     AnchorUtil.ThrowOnNullArgument(logCollector, "logCollector");
     this.logCollector = logCollector;
 }
 public BandAsMetricCapabilityDecorator(ILoadBalanceService service, LoadBalanceAnchorContext serviceContext, DirectoryServer targetServer) : base(service, targetServer)
 {
     AnchorUtil.ThrowOnNullArgument(serviceContext, "serviceContext");
     this.serviceContext = serviceContext;
 }
Example #30
0
 // Token: 0x060001E5 RID: 485 RVA: 0x00007302 File Offset: 0x00005502
 public IAnchorMessageItem FindMessage(StoreObjectId messageId, PropertyDefinition[] properties)
 {
     AnchorUtil.ThrowOnNullArgument(messageId, "messageId");
     AnchorUtil.ThrowOnNullArgument(properties, "properties");
     return(new AnchorMessageItem(this.mailboxSession, messageId, properties));
 }