public string GetSerializedPeopleIKnowGraph(IMailboxSession mailboxSession, IXSOFactory xsoFactory)
        {
            ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession);
            ArgumentValidator.ThrowIfNull("xsoFactory", xsoFactory);
            List <RelevantPerson> relevantContacts = this.GetRelevantContacts(mailboxSession, xsoFactory);
            PeopleIKnowGraph      peopleIKnowGraph = new PeopleIKnowGraph();

            peopleIKnowGraph.RelevantPeople = relevantContacts.ToArray();
            this.tracer.TraceDebug <int>((long)this.GetHashCode(), "PeopleIKnowService.GetSerializedPeopleIKnowGraph: Added {0} people to the PeopleIKnowGraph", relevantContacts.Count);
            return(this.serializer.Serialize(peopleIKnowGraph));
        }
        // Token: 0x06000F28 RID: 3880 RVA: 0x0003D220 File Offset: 0x0003B420
        public string Serialize(PeopleIKnowGraph peopleIKnowGraph)
        {
            ArgumentValidator.ThrowIfNull("peopleIKnowGraph", peopleIKnowGraph);
            DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(PeopleIKnowGraph), PeopleIKnowJsonSerializer.KnownTypes);
            string @string;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                dataContractJsonSerializer.WriteObject(memoryStream, peopleIKnowGraph);
                @string = Encoding.UTF8.GetString(memoryStream.ToArray());
            }
            return(@string);
        }
Exemple #3
0
 // Token: 0x06000F38 RID: 3896 RVA: 0x0003D5A8 File Offset: 0x0003B7A8
 internal PersonaComparerByRelevanceScore(PeopleIKnowGraph peopleIKnowGraph)
 {
     ArgumentValidator.ThrowIfNull("peopleIKnowGraph", peopleIKnowGraph);
     this.emailAddressToRelevanceScoreMapping = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase);
     RelevantPerson[] relevantPeople = peopleIKnowGraph.RelevantPeople;
     if (relevantPeople != null)
     {
         foreach (RelevantPerson relevantPerson in relevantPeople)
         {
             if (!string.IsNullOrEmpty(relevantPerson.EmailAddress))
             {
                 this.emailAddressToRelevanceScoreMapping[relevantPerson.EmailAddress] = relevantPerson.RelevanceScore;
             }
         }
     }
 }
        public IComparer <string> GetRelevancyComparer(string serializedPeopleIKnow)
        {
            PeopleIKnowGraph peopleIKnowGraph = this.serializer.Deserialize(serializedPeopleIKnow);

            return(new PersonaComparerByRelevanceScore(peopleIKnowGraph));
        }