// Token: 0x06001AD3 RID: 6867 RVA: 0x00065D98 File Offset: 0x00063F98
        private static IdAndSession GetIdAndSession(CallContext callContext, string id, bool isAttachmentId)
        {
            IdAndSession idAndSession;

            try
            {
                if (isAttachmentId)
                {
                    idAndSession = new IdConverter(callContext).ConvertAttachmentIdToIdAndSessionReadOnly(id);
                }
                else
                {
                    idAndSession = new IdConverter(callContext).ConvertItemIdToIdAndSessionReadOnly(id);
                }
                if (idAndSession == null)
                {
                    List <AttachmentId> attachmentIds       = new List <AttachmentId>();
                    IdHeaderInformation idHeaderInformation = IdConverter.ConvertFromConcatenatedId(id, BasicTypes.Attachment, attachmentIds, false);
                    throw new OwaInvalidRequestException("Unsupported Attachment ID. Storage type: " + idHeaderInformation.IdStorageType);
                }
            }
            catch (InvalidStoreIdException)
            {
                throw new OwaInvalidRequestException("Invalid attachment ID: " + id);
            }
            catch (AccessDeniedException)
            {
                throw new OwaInvalidRequestException("You do not have permission to access this mailbox.");
            }
            if (idAndSession.Session == null)
            {
                throw new OwaInvalidRequestException("The mailbox was not specified.");
            }
            return(idAndSession);
        }
Ejemplo n.º 2
0
 /// <summary>Compares an entry with a game name and add it to the available list if it's true.</summary>
 /// <param name="clearName">The clear name to be compared.</param>
 /// <param name="hash">The hashed name.</param>
 /// <returns>void</returns>
 private void checkAndAddGame(string clearName, string hash)
 {
     if (Crypto.verifyMd5(clearName, hash))
     {
         availableGames.Add(IdConverter.levelToGame(clearName));
     }
 }
Ejemplo n.º 3
0
        // Token: 0x06001B88 RID: 7048 RVA: 0x000699B0 File Offset: 0x00067BB0
        internal bool Execute()
        {
            StoreObjectId defaultFolderId = this.session.GetDefaultFolderId(DefaultFolderType.QuickContacts);
            PersonId      personId        = IdConverter.EwsIdToPersonId(this.personaId.GetId());
            AllPersonContactsEnumerator allPersonContactsEnumerator = AllPersonContactsEnumerator.Create(this.session, personId, RemoveFavorite.ContactProperties);

            ExTraceGlobals.RemoveFavoriteTracer.TraceDebug((long)this.GetHashCode(), "Processing contacts.");
            int num = 0;

            foreach (IStorePropertyBag storePropertyBag in allPersonContactsEnumerator)
            {
                byte[]        valueOrDefault = storePropertyBag.GetValueOrDefault <byte[]>(StoreObjectSchema.ParentEntryId, null);
                StoreObjectId objA           = StoreObjectId.FromProviderSpecificIdOrNull(valueOrDefault);
                if (object.Equals(objA, defaultFolderId))
                {
                    num++;
                    VersionedId valueOrDefault2 = storePropertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
                    if (valueOrDefault2 != null)
                    {
                        StoreId objectId = valueOrDefault2.ObjectId;
                        this.utilities.RemoveContactFromGroup(objectId, this.favoritesPdlId);
                        this.UnsetIsFavoriteFlagIfContactExists(objectId);
                    }
                }
            }
            this.SetLogValue(RemoveFavoriteMetadata.NumberOfContacts, num);
            if (num == 0)
            {
                ExTraceGlobals.RemoveFavoriteTracer.TraceDebug <ItemId>((long)this.GetHashCode(), "No contacts found with personId: {0}", this.personaId);
            }
            return(true);
        }
Ejemplo n.º 4
0
        public override IAttachment Read(string attachmentId)
        {
            IList <AttachmentId> attachmentIds = IdConverter.GetAttachmentIds(attachmentId);
            IAttachment          result;

            using (IItem item = this.BindToParentItem())
            {
                using (DisposeGuard disposeGuard = default(DisposeGuard))
                {
                    IItem      item2      = item;
                    Attachment attachment = null;
                    for (int i = 0; i < attachmentIds.Count; i++)
                    {
                        attachment = IrmUtils.GetAttachmentCollection(item2).Open(attachmentIds[i]);
                        disposeGuard.Add <Attachment>(attachment);
                        if (i < attachmentIds.Count - 1)
                        {
                            if (!(attachment is ItemAttachment))
                            {
                                throw new CorruptDataException(Strings.ErrorAllButLastNestedAttachmentMustBeItemAttachment);
                            }
                            ItemAttachment itemAttachment = attachment as ItemAttachment;
                            item2 = itemAttachment.GetItem();
                            disposeGuard.Add <IItem>(item2);
                        }
                    }
                    StorageTranslator <IAttachment, IAttachment> attachmentTranslator = this.GetAttachmentTranslator(attachment.AttachmentType, false);
                    IAttachment attachment2 = attachmentTranslator.ConvertToEntity(attachment);
                    attachment2.Id = attachmentId;
                    result         = attachment2;
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
 public RemoveBuddy(CallContext callContext, InstantMessageBuddy instantMessageBuddy, ItemId personId) : base(callContext)
 {
     WcfServiceCommandBase.ThrowIfNull(instantMessageBuddy, "instantMessageBuddy", "RemoveBuddy");
     WcfServiceCommandBase.ThrowIfNull(personId, "personId", "RemoveBuddy");
     this.instantMessageBuddy = instantMessageBuddy;
     this.personId            = IdConverter.EwsIdToPersonId(personId.Id);
 }
Ejemplo n.º 6
0
        public static OwaStoreObjectId CreateFromStoreObjectId(StoreObjectId storeObjectId, OwaStoreObjectId relatedStoreObjectId)
        {
            if (storeObjectId == null)
            {
                throw new ArgumentNullException("storeObjectId");
            }
            StoreObjectId        storeObjectId2       = null;
            OwaStoreObjectIdType owaStoreObjectIdType = OwaStoreObjectIdType.MailBoxObject;

            if (IdConverter.IsFromPublicStore(storeObjectId))
            {
                if (IdConverter.IsMessageId(storeObjectId))
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreItem;
                    storeObjectId2       = IdConverter.GetParentIdFromMessageId(storeObjectId);
                }
                else
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreFolder;
                }
            }
            else if (relatedStoreObjectId != null)
            {
                if (!relatedStoreObjectId.IsConversationId)
                {
                    owaStoreObjectIdType = relatedStoreObjectId.OwaStoreObjectIdType;
                }
                else if (relatedStoreObjectId.OwaStoreObjectIdType == OwaStoreObjectIdType.ArchiveConversation)
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.ArchiveMailboxObject;
                }
            }
            return(new OwaStoreObjectId(owaStoreObjectIdType, storeObjectId, storeObjectId2, (relatedStoreObjectId == null) ? null : relatedStoreObjectId.MailboxOwnerLegacyDN));
        }
Ejemplo n.º 7
0
        // Token: 0x06002292 RID: 8850 RVA: 0x0007F0D0 File Offset: 0x0007D2D0
        private bool ConvertLegacyItemIdFormatIfNecessary(SimpleConfiguration <TargetFolderMRUEntry> folderMruConfig, CallContext callContext)
        {
            bool result = false;

            foreach (TargetFolderMRUEntry targetFolderMRUEntry in folderMruConfig.Entries)
            {
                if (targetFolderMRUEntry.EwsFolderIdEntry == null)
                {
                    try
                    {
                        OwaStoreObjectId  owaStoreObjectId  = OwaStoreObjectId.CreateFromString(targetFolderMRUEntry.FolderId);
                        ExchangePrincipal exchangePrincipal = (owaStoreObjectId.MailboxOwnerLegacyDN != null) ? ExchangePrincipal.FromLegacyDN(callContext.SessionCache.GetMailboxIdentityMailboxSession().GetADSessionSettings(), owaStoreObjectId.MailboxOwnerLegacyDN) : callContext.AccessingPrincipal;
                        new IdConverter(callContext);
                        FolderId folderIdFromStoreId = IdConverter.GetFolderIdFromStoreId(owaStoreObjectId.StoreId, new MailboxId(exchangePrincipal.MailboxInfo.MailboxGuid));
                        targetFolderMRUEntry.EwsFolderIdEntry = folderIdFromStoreId.Id;
                        result = true;
                    }
                    catch (OwaInvalidIdFormatException)
                    {
                    }
                    catch (OwaInvalidRequestException)
                    {
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 8
0
        private AttachmentRetriever(string id, IdConverterDependencies converterDependencies)
        {
            bool flag = false;

            try
            {
                ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "Initialize IdAndSession to get attachment, id = {0}", id);
                List <AttachmentId> attachmentIds     = new List <AttachmentId>();
                IdHeaderInformation headerInformation = ServiceIdConverter.ConvertFromConcatenatedId(id, BasicTypes.ItemOrAttachment, attachmentIds);
                Item         item = null;
                IdAndSession idAndSession;
                try
                {
                    idAndSession = IdConverter.ConvertId(converterDependencies, headerInformation, IdConverter.ConvertOption.IgnoreChangeKey | IdConverter.ConvertOption.NoBind, BasicTypes.ItemOrAttachment, attachmentIds, null, this.GetHashCode(), false, ref item);
                }
                finally
                {
                    if (item != null)
                    {
                        item.Dispose();
                        item = null;
                    }
                }
                this.attachmentHierarchy = new AttachmentHierarchy(idAndSession, false, true);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    this.Dispose();
                }
            }
        }
        // Token: 0x060018A0 RID: 6304 RVA: 0x00054F7C File Offset: 0x0005317C
        private Persona GetPersonaFromADObject(object[] values)
        {
            ADObjectId adobjectId  = (ADObjectId)values[0];
            string     displayName = values[1].ToString();
            string     text        = values[2].ToString();
            string     text2       = values[3].ToString();
            Persona    persona     = new Persona
            {
                Attributions = new Attribution[]
                {
                    GetPersonaOrganizationHierarchyCommand.galAttribution
                },
                ADObjectId  = adobjectId.ObjectGuid,
                DisplayName = displayName,
                Title       = text,
                Titles      = new StringAttributedValue[]
                {
                    new StringAttributedValue(text, new string[]
                    {
                        "0"
                    })
                },
                EmailAddress = new EmailAddressWrapper
                {
                    EmailAddress = text2,
                    RoutingType  = "SMTP",
                    MailboxType  = MailboxHelper.MailboxTypeType.Mailbox.ToString()
                }
            };

            persona.PersonaId = IdConverter.PersonaIdFromADObjectId(persona.ADObjectId);
            return(persona);
        }
Ejemplo n.º 10
0
        private ParticipantOrigin GetOriginFromStore(EmailAddressWrapper emailAddressWrapper)
        {
            StoreId storeId = null;

            try
            {
                storeId = IdConverter.ConvertItemIdToStoreId(emailAddressWrapper.ItemId, BasicTypes.Item);
            }
            catch (Exception ex)
            {
                this.LogException(ex, "Error occurred when getting store id from item id: {0}", new object[]
                {
                    emailAddressWrapper.ItemId
                });
            }
            if (storeId == null)
            {
                return(new OneOffParticipantOrigin());
            }
            int emailAddressIndex;

            if (!string.IsNullOrEmpty(emailAddressWrapper.EmailAddressIndex) && int.TryParse(emailAddressWrapper.EmailAddressIndex, out emailAddressIndex))
            {
                return(new StoreParticipantOrigin(storeId, (EmailAddressIndex)emailAddressIndex));
            }
            return(new StoreParticipantOrigin(storeId));
        }
 public bool IdSetGivenContainsEntryId(byte[] entryId)
 {
     try
     {
         if (this.Data == null)
         {
             MrsTracer.Common.Warning("Data not created to generate idset.  default to true", new object[0]);
             return(true);
         }
         if (this.IdSetGiven == null)
         {
             MrsTracer.Common.Warning("Couldn't generate idset to check. default to true", new object[0]);
             return(true);
         }
         return(this.IdSetGiven.Contains(IdConverter.MessageGuidGlobCountFromEntryId(entryId)));
     }
     catch (MapiPermanentException ex)
     {
         MrsTracer.Common.Warning("Couldn't generate idset to check. default to true {0}", new object[]
         {
             CommonUtils.FullExceptionMessage(ex)
         });
     }
     catch (MapiRetryableException ex2)
     {
         MrsTracer.Common.Warning("Couldn't generate idset to check. default to true {0}", new object[]
         {
             CommonUtils.FullExceptionMessage(ex2)
         });
     }
     return(true);
 }
        public bool TryOpenLocalStore(byte[] folderEntryId, out Folder folder)
        {
            folder = null;
            StoreObjectId storeObjectId = null;

            if (!IdConverter.IsFolderId(folderEntryId))
            {
                this.TraceDebug <byte[]>("Can't open folder, id {0} is not an Exchange folder entry id.", folderEntryId);
                return(false);
            }
            try
            {
                storeObjectId = StoreObjectId.FromProviderSpecificId(folderEntryId, StoreObjectType.Folder);
            }
            catch (CorruptDataException argument)
            {
                this.TraceDebug <byte[], CorruptDataException>("Can't open folder, id {0} is corrupt: {1}", folderEntryId, argument);
                return(false);
            }
            bool result;

            try
            {
                folder = this.OpenFolder(storeObjectId);
                result = true;
            }
            catch (ObjectNotFoundException argument2)
            {
                this.TraceDebug <StoreObjectId, ObjectNotFoundException>("Can't open the folder with id {0} due to error {1}", storeObjectId, argument2);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 13
0
        public void When_generating_hundred_thousand_ids_with_one_single_generator_then_every_id_is_unique()
        {
            const int number = 100000;

            // warm-up
            GetIds(0, number);

            var stopwatch = Stopwatch.StartNew();
            var ids       = GetIds(0, number);

            stopwatch.Stop();
            Console.WriteLine("Duration: {0}ms", stopwatch.ElapsedMilliseconds);

            var    unique  = new HashSet <string>(StringComparer.Ordinal);
            string current = "AAAAAAAAAAA=";

            foreach (var id in ids)
            {
                Assert.IsTrue(IdConverter.ToLong(id).CompareTo(IdConverter.ToLong(current)) == 1);
                //Assert.IsTrue(id.CompareTo(current) == 1);
                Assert.IsFalse(unique.Contains(id), id);


                unique.Add(id);
                current = id;
            }

            for (int i = 0; i < 100; i++)
            {
                Console.WriteLine(ids[i]);
            }
        }
Ejemplo n.º 14
0
        public void Throws_on_writing_decimal()
        {
            IdConverter converter = new IdConverter();

            Assert.Throws <NotSupportedException>(
                () => converter.WriteJson(new JsonTextWriter(new StringWriter()), 1.1, JsonSerializer.CreateDefault()));
        }
Ejemplo n.º 15
0
        // Token: 0x0600172B RID: 5931 RVA: 0x0008A724 File Offset: 0x00088924
        public static IEvents GetEvents(ICalendaringContainer calendaringContainer, IStoreSession storeSession, StoreObjectId itemId)
        {
            StoreObjectId parentFolderId = storeSession.GetParentFolderId(itemId);
            IdConverter   instance       = IdConverter.Instance;
            string        calendarId     = instance.ToStringId(parentFolderId, storeSession);

            return(calendaringContainer.Calendars[calendarId].Events);
        }
Ejemplo n.º 16
0
        public void CanConvert_WithValidType_ReturnsTrue()
        {
            var converter = new IdConverter();

            converter.CanConvert(typeof(Id <int>)).Should().BeTrue();
            converter.CanConvert(typeof(Id <string>)).Should().BeTrue();
            converter.CanConvert(typeof(Id <Guid>)).Should().BeTrue();
        }
Ejemplo n.º 17
0
        public void ReadJson_Throws()
        {
            var converter = new IdConverter();

            Assert.Throws <NotSupportedException>(() => converter.ReadJson(
                                                      Arg.Any <JsonReader>(),
                                                      Arg.Any <Type>(),
                                                      Arg.Any <object>(),
                                                      Arg.Any <JsonSerializer>()));
        }
Ejemplo n.º 18
0
        public List <ChampionMastery> GetTopMasteryByPoints()
        {
            List <ChampionMastery> aux = _summoner.ChampionMasteryList.OrderByDescending(m => m.ChampionPoints)
                                         .Take(3)
                                         .ToList();

            aux.ForEach(mastery => mastery.ChampionName = IdConverter.ByName(mastery.ChampionId));

            return(aux);
        }
Ejemplo n.º 19
0
        public static AttachmentId GetAttachmentId(string attachmentId)
        {
            IList <AttachmentId> attachmentIds = IdConverter.GetAttachmentIds(attachmentId);

            if (attachmentIds.Count > 0)
            {
                return(attachmentIds[0]);
            }
            return(null);
        }
        // Token: 0x06001AD4 RID: 6868 RVA: 0x00065E44 File Offset: 0x00064044
        internal static AttachmentIdType GetEwsAttachmentIdType(CallContext callContext, VersionedId itemId, string ewsAttachmentId)
        {
            IdAndSession idAndSession = GetWacAttachmentInfo.GetIdAndSession(callContext, ewsAttachmentId, true);
            ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(itemId, idAndSession, null);

            return(new AttachmentIdType
            {
                Id = ewsAttachmentId,
                RootItemId = concatenatedId.Id
            });
        }
Ejemplo n.º 21
0
        //internal Identity(M modl)
        //{
        //    //this.modl = modl;

        //    //var definitions = modl.Modl.Backer.Definitions;
            
        //}

        private Identity(object idValue, Definitions definitions, bool isNewId = false)
        {
            //this.IdValue = idValue;
            this.Definitions = definitions;
            this.IsNewId = isNewId;

            if (Definitions.HasIdProperty && !IsNewId)
                this.IdValue = IdConverter.Convert(idValue, true, Definitions.IdProperty.PropertyType);
            else
                this.IdValue = IdConverter.ConvertToGuid(idValue);
        }
Ejemplo n.º 22
0
    /// <summary>Adds a game to the list. The server will activate the games during the course using this function.</summary>
    /// <param name="name">The ame of the game to be activated.</param>
    /// <returns>void</returns>
    public void onGameAdded(string name)
    {
        EnumGame g = IdConverter.levelToGame(name);

        if (!availableGames.Contains(g))
        {
            availableGames.Add(g);
        }
        gameList.md5List.Add(Crypto.encryptMd5(name));
        BinarySerializer.SerializeData(gameList);
        updateactiveButton();
    }
Ejemplo n.º 23
0
 private static bool HasIdChanged(M modl)
 {
     if (!Definitions.HasAutomaticId && Definitions.HasIdProperty)
     {
         var id = Definitions.IdProperty.GetValue(modl);
         return(IdConverter.HasValue(id) && modl.Modl.Id != id);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 24
0
        // Token: 0x06000F5C RID: 3932 RVA: 0x0003B790 File Offset: 0x00039990
        private static ConversationType GetConversationFromDataRow(OwaSearchContext searchContext, MailboxSession mailboxSession, object[] row, Dictionary <PropertyDefinition, int> orderDictionary)
        {
            ConversationType conversationType = new ConversationType();

            conversationType.InstanceKey = SearchFolderDataRetrieverBase.GetItemProperty <byte[]>(row, orderDictionary[ItemSchema.InstanceKey], null);
            ConversationId itemProperty = SearchFolderDataRetrieverBase.GetItemProperty <ConversationId>(row, orderDictionary[ConversationItemSchema.ConversationId], null);

            conversationType.ConversationId    = new ItemId(IdConverter.ConversationIdToEwsId(mailboxSession.MailboxGuid, itemProperty), null);
            conversationType.ConversationTopic = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ConversationItemSchema.ConversationTopic]);
            conversationType.UniqueRecipients  = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMVTo]);
            conversationType.UniqueSenders     = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMVFrom]);
            conversationType.LastDeliveryTime  = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[ConversationItemSchema.ConversationLastDeliveryTime]);
            conversationType.Categories        = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationCategories]);
            if (SearchFolderDataRetrieverBase.IsPropertyDefined(row, orderDictionary[ConversationItemSchema.ConversationFlagStatus]))
            {
                FlagStatus itemProperty2 = (FlagStatus)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationFlagStatus], 0);
                if (itemProperty2 != FlagStatus.NotFlagged)
                {
                    conversationType.FlagStatus = new FlagType
                    {
                        FlagStatus = itemProperty2
                    }.FlagStatus;
                }
            }
            conversationType.HasAttachments     = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ConversationItemSchema.ConversationHasAttach]));
            conversationType.HasIrm             = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ConversationItemSchema.ConversationHasIrm]));
            conversationType.MessageCount       = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationMessageCount]));
            conversationType.GlobalMessageCount = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalMessageCount]));
            conversationType.UnreadCount        = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationUnreadMessageCount]));
            conversationType.GlobalUnreadCount  = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalUnreadMessageCount]));
            conversationType.Size             = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationMessageSize]));
            conversationType.ItemClasses      = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMessageClasses]);
            conversationType.ImportanceString = ((ImportanceType)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationImportance], 1)).ToString();
            StoreId[] itemProperty3 = SearchFolderDataRetrieverBase.GetItemProperty <StoreId[]>(row, orderDictionary[ConversationItemSchema.ConversationItemIds], new StoreId[0]);
            conversationType.ItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty3, (StoreId s) => new ItemId(SearchFolderDataRetrieverBase.GetEwsId(s, mailboxSession.MailboxGuid), null));
            StoreId[] itemProperty4 = SearchFolderDataRetrieverBase.GetItemProperty <StoreId[]>(row, orderDictionary[ConversationItemSchema.ConversationGlobalItemIds], new StoreId[0]);
            conversationType.GlobalItemIds    = Array.ConvertAll <StoreId, ItemId>(itemProperty4, (StoreId s) => new ItemId(SearchFolderDataRetrieverBase.GetEwsId(s, mailboxSession.MailboxGuid), null));
            conversationType.LastModifiedTime = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[StoreObjectSchema.LastModifiedTime]);
            conversationType.Preview          = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ConversationItemSchema.ConversationPreview]);
            IconIndex itemProperty5 = (IconIndex)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationReplyForwardState]);

            if (itemProperty5 > (IconIndex)0)
            {
                conversationType.IconIndexString = itemProperty5.ToString();
            }
            itemProperty5 = (IconIndex)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalReplyForwardState]);
            if (itemProperty5 > (IconIndex)0)
            {
                conversationType.GlobalIconIndexString = itemProperty5.ToString();
            }
            return(conversationType);
        }
Ejemplo n.º 25
0
        protected EntityConverter(IServiceProvider services, bool isCustomType)
        {
            Contract = Typeof <TEntity> .Raw;

            _customTypeName = isCustomType
                ? SourceDescriptions.BuildTypeName(Typeof <TEntity> .Raw)
                : null;

            _properties = SerializationUtils.ActivatePropertyConverters <TEntity>(services);

            _idConverter         = (IdConverter)_properties[nameof(IEntity.Id)];
            _componentsConverter = (ComponentsConverter)_properties[nameof(IEntity.Components)];
        }
Ejemplo n.º 26
0
        private static Identity GetId(M modl)
        {
            if (!Definitions.HasAutomaticId && Definitions.HasIdProperty)
            {
                var id = Definitions.IdProperty.GetValue(modl);
                if (IdConverter.HasValue(id))
                {
                    return(Identity.FromId(id, Definitions));
                }
            }

            return(Identity.GenerateNewId(Definitions));
        }
Ejemplo n.º 27
0
            public static ItemId GetItemId(IdAndSession idAndSession, StoreId storeId)
            {
                ConcatenatedIdAndChangeKey concatenatedIdAndChangeKey;

                if (idAndSession.Session is PublicFolderSession)
                {
                    concatenatedIdAndChangeKey = IdConverter.GetConcatenatedIdForPublicFolderItem(storeId, StoreId.GetStoreObjectId(idAndSession.ParentFolderId), null);
                }
                else
                {
                    concatenatedIdAndChangeKey = IdConverter.GetConcatenatedId(storeId, idAndSession, null);
                }
                return(new ItemId(concatenatedIdAndChangeKey.Id, concatenatedIdAndChangeKey.ChangeKey));
            }
Ejemplo n.º 28
0
        private static Persona GetPersonaFromADObject(ADRawEntry rawEntry)
        {
            if (rawEntry == null)
            {
                return(null);
            }
            ADObjectId adobjectId = rawEntry[ADObjectSchema.Id] as ADObjectId;

            if (adobjectId == null)
            {
                return(null);
            }
            Persona persona = new Persona();

            persona.PersonaId = IdConverter.PersonaIdFromADObjectId(adobjectId.ObjectGuid);
            RecipientType        recipientType        = (RecipientType)rawEntry[ADRecipientSchema.RecipientType];
            PersonType           personType           = ADRecipient.IsRecipientTypeDL(recipientType) ? PersonType.DistributionList : PersonType.Person;
            RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)rawEntry[ADRecipientSchema.RecipientTypeDetails];

            if (recipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                personType = PersonType.ModernGroup;
            }
            persona.PersonaType = PersonaTypeConverter.ToString(personType);
            object obj = rawEntry[ADRecipientSchema.DisplayName];

            if (obj != null)
            {
                persona.DisplayName = (obj as string);
            }
            object obj2 = rawEntry[ADRecipientSchema.PrimarySmtpAddress];

            if (obj2 != null)
            {
                persona.EmailAddress = new EmailAddressWrapper
                {
                    Name         = (persona.DisplayName ?? string.Empty),
                    EmailAddress = obj2.ToString(),
                    RoutingType  = "SMTP",
                    MailboxType  = MailboxHelper.ConvertToMailboxType(personType).ToString()
                };
            }
            object obj3 = rawEntry[ADUserSchema.RTCSIPPrimaryUserAddress];

            if (obj3 != null)
            {
                persona.ImAddress = obj3.ToString();
            }
            return(persona);
        }
Ejemplo n.º 29
0
        // Token: 0x0600199B RID: 6555 RVA: 0x0005A370 File Offset: 0x00058570
        internal static CreateAttachmentResponse CreateAttachmentResponse(AttachmentHierarchy attachmentHierarchy, Attachment attachment, AttachmentType attachmentType, IdAndSession parentIdAndSession, ServiceError warning)
        {
            IdAndSession idAndSession = parentIdAndSession.Clone();

            attachment.Load();
            idAndSession.AttachmentIds.Add(attachment.Id);
            AttachmentType attachmentType2;

            if (attachment is StreamAttachment)
            {
                attachmentType2 = new FileAttachmentType();
            }
            else if (attachment is ReferenceAttachment)
            {
                attachmentType2 = new ReferenceAttachmentType();
                ((ReferenceAttachmentType)attachmentType2).AttachLongPathName  = (string)attachment.TryGetProperty(AttachmentSchema.AttachLongPathName);
                ((ReferenceAttachmentType)attachmentType2).ProviderType        = (string)attachment.TryGetProperty(AttachmentSchema.AttachmentProviderType);
                ((ReferenceAttachmentType)attachmentType2).ProviderEndpointUrl = (string)attachment.TryGetProperty(AttachmentSchema.AttachmentProviderEndpointUrl);
                object obj = attachment.TryGetProperty(AttachmentSchema.AttachContentId);
                if (!(obj is PropertyError))
                {
                    ((ReferenceAttachmentType)attachmentType2).ContentId = (string)obj;
                }
                attachmentType2.Name = attachmentType.Name;
            }
            else
            {
                attachmentType2 = new ItemAttachmentType();
            }
            attachmentType2.AttachmentId = new AttachmentIdType(idAndSession.GetConcatenatedId().Id);
            if (attachmentType is ItemIdAttachmentType || attachmentType is ReferenceAttachmentType)
            {
                attachmentType2.Size = ((attachment.Size > 2147483647L) ? int.MaxValue : ((int)attachment.Size));
            }
            CreateAttachmentResponse       createAttachmentResponse = new CreateAttachmentResponse();
            ServiceResult <AttachmentType> serviceResult            = (warning == null) ? new ServiceResult <AttachmentType>(attachmentType2) : new ServiceResult <AttachmentType>(attachmentType2, warning);

            attachmentHierarchy.RootItem.Load();
            if (serviceResult.Value != null)
            {
                ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(attachmentHierarchy.RootItem.Id, parentIdAndSession, null);
                serviceResult.Value.AttachmentId.RootItemId        = concatenatedId.Id;
                serviceResult.Value.AttachmentId.RootItemChangeKey = concatenatedId.ChangeKey;
            }
            createAttachmentResponse.AddResponses(new ServiceResult <AttachmentType>[]
            {
                serviceResult
            });
            return(createAttachmentResponse);
        }
            private bool TryGetDeliveryFolderId(MbxTransportMailItem rmi, MailboxSession mailBoxSession, out StoreId deliveryFolderId)
            {
                deliveryFolderId = null;
                string textHeaderValue = ContentAggregationAgentFactory.ContentAggregationAgent.GetTextHeaderValue(rmi, "X-MS-Exchange-Organization-DeliveryFolder");

                if (string.IsNullOrEmpty(textHeaderValue))
                {
                    ExTraceGlobals.DeliveryAgentTracer.TraceDebug(rmi.RecordId, "Delivery Folder ID property is empty.");
                    return(false);
                }
                byte[] array = null;
                try
                {
                    array = HexConverter.HexStringToByteArray(textHeaderValue);
                }
                catch (FormatException arg)
                {
                    ExTraceGlobals.DeliveryAgentTracer.TraceError <FormatException>(rmi.RecordId, "Could not get Delivery Folder ID due to an invalid Mail Item header - Exception: {0}", arg);
                    return(false);
                }
                if (!IdConverter.IsFolderId(array))
                {
                    ExTraceGlobals.DeliveryAgentTracer.TraceError <string>(rmi.RecordId, "Can't open folder, id {0} is not a valid Exchange folder entry id.", array.ToString());
                    return(false);
                }
                try
                {
                    deliveryFolderId = StoreObjectId.FromProviderSpecificId(array);
                }
                catch (ArgumentException arg2)
                {
                    ExTraceGlobals.DeliveryAgentTracer.TraceError <ArgumentException>(rmi.RecordId, "Could not get Delivery Folder ID. Can't convert header value to StoreObjectId - Exception: {0}", arg2);
                    return(false);
                }
                bool result;

                try
                {
                    using (Folder.Bind(mailBoxSession, deliveryFolderId))
                    {
                        result = true;
                    }
                }
                catch (ObjectNotFoundException arg3)
                {
                    ExTraceGlobals.DeliveryAgentTracer.TraceError <StoreId, ObjectNotFoundException>(rmi.RecordId, "Can't open folder. Folder id {0} does not exist - Exception: {1}", deliveryFolderId, arg3);
                    result = false;
                }
                return(result);
            }