// Token: 0x06001190 RID: 4496 RVA: 0x00066CD0 File Offset: 0x00064ED0
        private AssistantTaskContext TrainStep(AssistantTaskContext context)
        {
            Guid guid = Guid.Empty;
            MailboxTrainingState     mailboxTrainingState     = null;
            MailboxTruthLoggingState mailboxTruthLoggingState = null;
            AssistantTaskContext     result;

            try
            {
                InferenceTrainingTaskContext assistantTaskContext = null;
                this.ValidateContext(context, delegate(AssistantTaskContext taskContext)
                {
                    assistantTaskContext = (taskContext as InferenceTrainingTaskContext);
                    ExAssert.RetailAssert(assistantTaskContext != null, "Assistant did not return InferenceTrainingTaskContext");
                });
                MailboxSession mailboxSession = assistantTaskContext.Args.StoreSession as MailboxSession;
                guid = assistantTaskContext.Args.StoreSession.MailboxGuid;
                mailboxTrainingState     = assistantTaskContext.MailboxTrainingState;
                mailboxTruthLoggingState = assistantTaskContext.MailboxTruthLoggingState;
                if (mailboxTrainingState.PrepareNextTrainingStep())
                {
                    this.DiagnosticsSession.TraceDebug <IExchangePrincipal>("{0}: Begin process mailbox for training", mailboxSession.MailboxOwner);
                    this.trainingFeeder.TrainMailbox(mailboxSession, mailboxTrainingState);
                    this.DiagnosticsSession.TraceDebug <IExchangePrincipal>("{0}: End process mailbox for training", mailboxSession.MailboxOwner);
                    mailboxTrainingState.MarkTrainingStepAsCompleted();
                    mailboxSession.Mailbox.Save();
                    result = new InferenceTrainingTaskContext(assistantTaskContext.MailboxData, assistantTaskContext.Job, new AssistantStep(this.TrainStep), mailboxTrainingState, mailboxTruthLoggingState);
                }
                else
                {
                    this.DiagnosticsSession.LogEvent(MSExchangeInferenceEventLogConstants.Tuple_TrainingStatisticsForMailbox, new object[]
                    {
                        mailboxSession.MailboxGuid.ToString()
                    });
                    result = new InferenceTrainingTaskContext(assistantTaskContext.MailboxData, assistantTaskContext.Job, new AssistantStep(this.TruthLogStep), mailboxTrainingState, mailboxTruthLoggingState);
                }
            }
            catch (Exception ex)
            {
                string text = string.Format("Reason=TrainStepFailed#Exception={0}", InferenceCommonUtility.StringizeException(ex));
                this.trainingStatusLogger.LogStatus(guid, 3, new DateTime?((mailboxTrainingState == null) ? DateTime.UtcNow : mailboxTrainingState.CurrentAttemptTimestamp), (mailboxTrainingState == null) ? null : mailboxTrainingState.LastAttemptTimestamp, (mailboxTrainingState == null) ? null : mailboxTrainingState.LastSuccessTimestamp, text);
                this.truthLabelsStatusLogger.LogStatus(guid, 3, new DateTime?((mailboxTruthLoggingState == null) ? DateTime.UtcNow : mailboxTruthLoggingState.CurrentAttemptTimestamp), (mailboxTruthLoggingState == null) ? null : mailboxTruthLoggingState.LastAttemptTimestamp, (mailboxTruthLoggingState == null) ? null : mailboxTruthLoggingState.LastSuccessTimestamp, text);
                this.groupingModelTrainingStatusLogger.LogStatus(guid, 3, text);
                if (ex is AbortOnProcessingRequestedException)
                {
                    result = null;
                }
                else
                {
                    if (!(ex is QuotaExceededException))
                    {
                        throw;
                    }
                    result = null;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        private static bool IsBulkMail(StoreDriverDeliveryEventArgsImpl argsImpl, MiniRecipient recipient)
        {
            bool   result = false;
            string name   = InferenceXsoUtil.IsMicrosoft(recipient) ? "X-Forefront-Antispam-Report-Untrusted" : "X-MS-Exchange-Organization-Antispam-Report";
            Header header = argsImpl.MailItem.Message.MimeDocument.RootPart.Headers.FindFirst(name);
            string data;

            if (header != null && header.TryGetValue(out data))
            {
                result = InferenceCommonUtility.MatchBulkHeader(data);
            }
            return(result);
        }
Exemplo n.º 3
0
 public void LogModelComparisonData(MdbDocument document, InferencePropertyBag classificationDiagnostics)
 {
     if (document != null && classificationDiagnostics != null)
     {
         object    obj;
         object    item  = classificationDiagnostics.TryGetValue(DocumentSchema.MailboxId, out obj) ? obj : null;
         object    item2 = classificationDiagnostics.TryGetValue(InferenceSchema.MessageIdentifier, out obj) ? obj : null;
         object    item3 = classificationDiagnostics.TryGetValue(InferenceSchema.InternetMessageId, out obj) ? obj : null;
         object    item4 = classificationDiagnostics.TryGetValue(InferenceSchema.MessageClassificationTime, out obj) ? obj : null;
         Exception ex    = classificationDiagnostics.TryGetValue(InferenceSchema.ClassificationAgentException, out obj) ? ((Exception)obj) : null;
         ModelVersionSelector.ModelVersionInfo modelVersionInfo = document.TryGetProperty(InferenceSchema.ModelVersionToLoad, out obj) ? ((ModelVersionSelector.ModelVersionInfo)obj) : null;
         object item5 = -1;
         object item6 = -1;
         object item7 = null;
         UserConfigurationOverride            userConfigurationOverride     = document.TryGetProperty(InferenceSchema.UserConfigurationOverride, out obj) ? ((UserConfigurationOverride)obj) : null;
         PredictedActionAndProbability        predictedActionAndProbability = null;
         List <PredictedActionAndProbability> list = classificationDiagnostics.TryGetValue(InferenceSchema.PredictedActionsAll, out obj) ? ((List <PredictedActionAndProbability>)obj) : null;
         if (list != null)
         {
             predictedActionAndProbability = list.FirstOrDefault((PredictedActionAndProbability entry) => entry.Action == PredictedMessageAction.Clutter);
         }
         IList <object> list2 = new List <object>(InferenceClassificationComparisonLogger.Columns.Count);
         list2.Add(DateTime.UtcNow);
         list2.Add(InferenceCommonUtility.ServerVersion);
         list2.Add(item);
         list2.Add(item2);
         list2.Add((modelVersionInfo == null) ? string.Empty : modelVersionInfo.Version.ToString());
         list2.Add(item5);
         list2.Add(item6);
         list2.Add(item4);
         list2.Add((predictedActionAndProbability == null) ? string.Empty : predictedActionAndProbability.Probability.ToString());
         list2.Add((userConfigurationOverride == null) ? string.Empty : userConfigurationOverride.ClutterThreshold.ToString());
         list2.Add(item3);
         list2.Add((ex == null) ? string.Empty : InferenceCommonUtility.StringizeException(ex));
         list2.Add(item7);
         this.dataLogger.Log(list2);
     }
 }
Exemplo n.º 4
0
        // Token: 0x060011A5 RID: 4517 RVA: 0x000674C4 File Offset: 0x000656C4
        public bool IsMailboxInteresting(MailboxInformation mailboxInformation)
        {
            bool     flag      = true;
            string   text      = null;
            DateTime?dateTime  = mailboxInformation.GetMailboxProperty(MailboxSchema.InferenceTrainingLastAttemptTimestamp) as DateTime?;
            DateTime?dateTime2 = mailboxInformation.GetMailboxProperty(MailboxSchema.InferenceTrainingLastSuccessTimestamp) as DateTime?;
            DateTime?dateTime3 = mailboxInformation.GetMailboxProperty(MailboxSchema.InferenceTruthLoggingLastAttemptTimestamp) as DateTime?;
            DateTime?dateTime4 = mailboxInformation.GetMailboxProperty(MailboxSchema.InferenceTruthLoggingLastSuccessTimestamp) as DateTime?;

            if (InferenceCommonUtility.IsNonUserMailbox(mailboxInformation.DisplayName))
            {
                text = string.Format("Reason=NonUserMailbox#Name={0}", mailboxInformation.DisplayName);
                flag = false;
            }
            if (flag && dateTime == null)
            {
                int?num = mailboxInformation.GetMailboxProperty(MailboxSchema.ItemCount) as int?;
                if (num != null && num < this.trainingConfiguration.MinNumberOfItemsForRetrospectiveTraining)
                {
                    text = string.Format("Reason=LowItemCount#ItemCount={0}#Threshold={1}", num, this.trainingConfiguration.MinNumberOfItemsForRetrospectiveTraining);
                    flag = false;
                }
            }
            if (flag)
            {
                string text2 = string.Format("ControlDataLastProcessedTime={0}", mailboxInformation.LastProcessedDate);
                this.trainingStatusLogger.LogStatus(mailboxInformation.MailboxGuid, 0, null, dateTime, dateTime2, text2);
                this.truthLabelsStatusLogger.LogStatus(mailboxInformation.MailboxGuid, 0, null, dateTime3, dateTime4, text2);
                this.groupingModelTrainingStatusLogger.LogStatus(mailboxInformation.MailboxGuid, 0, text2);
            }
            else
            {
                this.trainingStatusLogger.LogStatus(mailboxInformation.MailboxGuid, 4, new DateTime?(DateTime.UtcNow), null, null, text);
                this.truthLabelsStatusLogger.LogStatus(mailboxInformation.MailboxGuid, 4, new DateTime?(DateTime.UtcNow), null, null, text);
                this.groupingModelTrainingStatusLogger.LogStatus(mailboxInformation.MailboxGuid, 4, text);
            }
            return(flag);
        }
        // Token: 0x0600118E RID: 4494 RVA: 0x000668D4 File Offset: 0x00064AD4
        public override AssistantTaskContext InitialStep(AssistantTaskContext context)
        {
            DateTime             utcNow    = DateTime.UtcNow;
            DateTime?            dateTime  = null;
            DateTime?            dateTime2 = null;
            DateTime?            dateTime3 = null;
            DateTime?            dateTime4 = null;
            Guid                 guid      = Guid.Empty;
            AssistantTaskContext result;

            try
            {
                this.ValidateContext(context);
                guid = context.Args.StoreSession.MailboxGuid;
                ExDateTime?valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTrainingLastAttemptTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTrainingLastSuccessTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime2 = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTruthLoggingLastAttemptTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime3 = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTruthLoggingLastSuccessTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime4 = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                MailboxSession mailboxSession = context.Args.StoreSession as MailboxSession;
                if (mailboxSession == null)
                {
                    string text = "Reason=NonMailboxSession";
                    this.trainingStatusLogger.LogStatus(guid, 4, new DateTime?(utcNow), dateTime, dateTime2, text);
                    this.truthLabelsStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime3, dateTime4, text);
                    this.groupingModelTrainingStatusLogger.LogStatus(guid, 4, text);
                    result = null;
                }
                else if (mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.UserMailbox && mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.LinkedMailbox)
                {
                    string text2 = string.Format("Reason=NonUserMailbox#Name={0}#Type={1}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxOwner.RecipientTypeDetails.ToString());
                    this.trainingStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime, dateTime2, text2);
                    this.truthLabelsStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime3, dateTime4, text2);
                    this.groupingModelTrainingStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, text2);
                    result = null;
                }
                else
                {
                    VariantConfigurationSnapshot flightFeatures = FlightModule.GetFlightFeatures(mailboxSession);
                    Exception           ex;
                    OrganizationContext organizationInformation = this.orgContentExtractor.GetOrganizationInformation(mailboxSession.MailboxOwner, new ADRecipientInfo.TraceDelegate(this.DiagnosticsSession.TraceDebug), new ADRecipientInfo.TraceDelegate(this.DiagnosticsSession.TraceError), ref ex);
                    FolderDataSelectionConfig.RefreshSettings();
                    List <Exception> list = new List <Exception>();
                    if (ex != null)
                    {
                        list.Add(ex);
                    }
                    OutlookActivityManager.SafeProcess(mailboxSession);
                    ActivityHistory      activityHistory      = new ActivityHistory(mailboxSession, utcNow);
                    ModelVersionSelector modelVersionSelector = InferenceXsoUtil.CreateModelVersionSelector(ServerModelConfigurationWrapper.CurrentWrapper, mailboxSession, delegate(string str)
                    {
                        this.DiagnosticsSession.TraceDebug(str, new object[0]);
                    });
                    result = new InferenceTrainingTaskContext(context.MailboxData, context.Job, new AssistantStep(this.TrainStep), new MailboxTrainingState(modelVersionSelector, organizationInformation, activityHistory, utcNow, dateTime, dateTime2, flightFeatures, list), new MailboxTruthLoggingState(utcNow, dateTime3, dateTime4, activityHistory));
                }
            }
            catch (Exception ex2)
            {
                string text3 = string.Format("Reason=InitialStepFailed#Exception={0}", InferenceCommonUtility.StringizeException(ex2));
                this.trainingStatusLogger.LogStatus(guid, 3, new DateTime?(utcNow), dateTime, dateTime2, text3);
                this.truthLabelsStatusLogger.LogStatus(guid, 3, new DateTime?(utcNow), dateTime3, dateTime4, text3);
                this.groupingModelTrainingStatusLogger.LogStatus(guid, 3, text3);
                throw;
            }
            return(result);
        }
        // Token: 0x06001192 RID: 4498 RVA: 0x00067194 File Offset: 0x00065394
        private AssistantTaskContext GroupingModelTrainingStep(AssistantTaskContext context)
        {
            Guid guid = Guid.Empty;

            try
            {
                InferenceTrainingTaskContext assistantTaskContext = null;
                this.ValidateContext(context, delegate(AssistantTaskContext taskContext)
                {
                    assistantTaskContext = (taskContext as InferenceTrainingTaskContext);
                    ExAssert.RetailAssert(assistantTaskContext != null, "Assistant did not return InferenceTrainingTaskContext");
                });
                MailboxSession       mailboxSession       = assistantTaskContext.Args.StoreSession as MailboxSession;
                MailboxTrainingState mailboxTrainingState = assistantTaskContext.MailboxTrainingState;
                guid = assistantTaskContext.Args.StoreSession.MailboxGuid;
                if (mailboxTrainingState.FlightFeatures.Inference.InferenceGroupingModel.Enabled)
                {
                    this.DiagnosticsSession.TraceDebug <IExchangePrincipal>("{0}: Begin process mailbox for grouping model", mailboxSession.MailboxOwner);
                    GroupingModelVersionSelector groupingModelVersionSelector = new GroupingModelVersionSelector(InferenceTrainingAssistant.HookableGroupingModelConfiguration.Value);
                    GroupingModelTrainingContext groupingModelTrainingContext = new GroupingModelTrainingContext
                    {
                        ModelVersion = groupingModelVersionSelector.GetModelVersionToTrain()
                    };
                    this.groupingModelTrainingPipeline.TrainGroupingModel(mailboxSession, groupingModelTrainingContext);
                    this.DiagnosticsSession.TraceDebug <IExchangePrincipal>("{0}: End process mailbox for grouping model", mailboxSession.MailboxOwner);
                }
                else
                {
                    this.groupingModelTrainingStatusLogger.LogStatus(guid, 4, "User is not a member of grouping model flight");
                }
            }
            catch (Exception ex)
            {
                string text = string.Format("Reason=GroupingModelTrainingStepFailed#Exception={0}", InferenceCommonUtility.StringizeException(ex));
                this.groupingModelTrainingStatusLogger.LogStatus(guid, 3, text);
                if (ex is OutOfMemoryException || ex is StackOverflowException || ex is AccessViolationException)
                {
                    throw;
                }
                if (ex is QuotaExceededException)
                {
                    return(null);
                }
            }
            return(null);
        }
        // Token: 0x06001191 RID: 4497 RVA: 0x00066F64 File Offset: 0x00065164
        private AssistantTaskContext TruthLogStep(AssistantTaskContext context)
        {
            Guid guid = Guid.Empty;
            MailboxTruthLoggingState mailboxTruthLoggingState = null;
            AssistantTaskContext     result;

            try
            {
                InferenceTrainingTaskContext assistantTaskContext = null;
                this.ValidateContext(context, delegate(AssistantTaskContext taskContext)
                {
                    assistantTaskContext = (taskContext as InferenceTrainingTaskContext);
                    ExAssert.RetailAssert(assistantTaskContext != null, "Assistant did not return InferenceTrainingTaskContext");
                });
                MailboxSession       mailboxSession       = assistantTaskContext.Args.StoreSession as MailboxSession;
                MailboxTrainingState mailboxTrainingState = assistantTaskContext.MailboxTrainingState;
                mailboxTruthLoggingState = assistantTaskContext.MailboxTruthLoggingState;
                guid = assistantTaskContext.Args.StoreSession.MailboxGuid;
                if (this.isTruthLabelsLoggingEnabled)
                {
                    this.DiagnosticsSession.TraceDebug <IExchangePrincipal>("{0}: Begin process mailbox for truth labels logging", mailboxSession.MailboxOwner);
                    this.trainingFeeder.LogTruthLabels(mailboxSession, mailboxTruthLoggingState);
                    mailboxSession.Mailbox.Save();
                    this.DiagnosticsSession.TraceDebug <IExchangePrincipal>("{0}: End process mailbox for truth labels logging", mailboxSession.MailboxOwner);
                }
                else
                {
                    this.truthLabelsStatusLogger.LogStatus(guid, 5, new DateTime?((mailboxTruthLoggingState == null) ? DateTime.UtcNow : mailboxTruthLoggingState.CurrentAttemptTimestamp), (mailboxTruthLoggingState == null) ? null : mailboxTruthLoggingState.LastAttemptTimestamp, (mailboxTruthLoggingState == null) ? null : mailboxTruthLoggingState.LastSuccessTimestamp, "Truth labels logging is disabled");
                }
                result = new InferenceTrainingTaskContext(assistantTaskContext.MailboxData, assistantTaskContext.Job, new AssistantStep(this.GroupingModelTrainingStep), mailboxTrainingState, mailboxTruthLoggingState);
            }
            catch (Exception ex)
            {
                string text = string.Format("Reason=TruthLogStepFailed#Exception={0}", InferenceCommonUtility.StringizeException(ex));
                this.truthLabelsStatusLogger.LogStatus(guid, 3, new DateTime?((mailboxTruthLoggingState == null) ? DateTime.UtcNow : mailboxTruthLoggingState.CurrentAttemptTimestamp), (mailboxTruthLoggingState == null) ? null : mailboxTruthLoggingState.LastAttemptTimestamp, (mailboxTruthLoggingState == null) ? null : mailboxTruthLoggingState.LastSuccessTimestamp, text);
                this.groupingModelTrainingStatusLogger.LogStatus(guid, 3, text);
                if (ex is OutOfMemoryException || ex is StackOverflowException || ex is AccessViolationException)
                {
                    throw;
                }
                result = null;
            }
            return(result);
        }
        internal IList <object> ExtractClassificationProperties(InferencePropertyBag classificationDiagnostics, IDocument document, InferenceClassificationTracking tracking)
        {
            object item   = null;
            object item2  = null;
            object obj    = null;
            object obj2   = null;
            object obj3   = null;
            object obj4   = null;
            object obj5   = null;
            object obj6   = null;
            object obj7   = null;
            object item3  = null;
            object item4  = null;
            object obj8   = null;
            string item5  = string.Empty;
            string item6  = string.Empty;
            string item7  = string.Empty;
            string item8  = string.Empty;
            string value  = null;
            string item9  = null;
            string text   = "Null";
            string item10 = null;
            string value2 = null;
            string item11 = null;
            object obj9   = null;
            object obj10  = null;
            string item12 = null;
            object item13 = null;
            object item14 = null;
            object item15 = null;
            object item16 = null;
            object item17 = null;
            object item18 = null;
            object item19 = null;
            object item20 = null;
            object obj11  = null;
            object item21 = null;

            if (classificationDiagnostics != null)
            {
                classificationDiagnostics.TryGetValue(InferenceSchema.InternetMessageId, out item2);
                classificationDiagnostics.TryGetValue(InferenceSchema.MessageClassificationTime, out obj);
                classificationDiagnostics.TryGetValue(InferenceSchema.OriginalDeliveryFolder, out obj2);
                classificationDiagnostics.TryGetValue(InferenceSchema.MarkedAsBulk, out obj3);
                classificationDiagnostics.TryGetValue(InferenceSchema.TimeTakenToClassify, out obj4);
                classificationDiagnostics.TryGetValue(InferenceSchema.ModelVersion, out obj5);
                classificationDiagnostics.TryGetValue(InferenceSchema.TimeTakenToInfer, out obj6);
                classificationDiagnostics.TryGetValue(InferenceSchema.ServerName, out obj7);
                classificationDiagnostics.TryGetValue(InferenceSchema.ClassificationStatus, out item3);
                classificationDiagnostics.TryGetValue(InferenceSchema.ClassificationStatusMessage, out item4);
                classificationDiagnostics.TryGetValue(InferenceSchema.ClassificationAgentException, out obj8);
                classificationDiagnostics.TryGetValue(DocumentSchema.MailboxId, out item);
                classificationDiagnostics.TryGetValue(InferenceSchema.ClutterValueBeforeOverride, out obj9);
                classificationDiagnostics.TryGetValue(InferenceSchema.ClutterValueAfterOverride, out obj10);
                classificationDiagnostics.TryGetValue(InferenceSchema.Locale, out item13);
                classificationDiagnostics.TryGetValue(InferenceSchema.IsClutter, out item14);
                classificationDiagnostics.TryGetValue(InferenceSchema.TenantName, out item15);
                classificationDiagnostics.TryGetValue(InferenceSchema.IsUiEnabled, out item16);
                classificationDiagnostics.TryGetValue(InferenceSchema.ClutterEnabled, out item18);
                classificationDiagnostics.TryGetValue(InferenceSchema.ClassificationEnabled, out item19);
                classificationDiagnostics.TryGetValue(InferenceSchema.MessageIdentifier, out item20);
                classificationDiagnostics.TryGetValue(InferenceSchema.HasBeenClutterInvited, out item21);
                classificationDiagnostics.TryGetValue(InferenceSchema.InferenceClassificationResult, out obj11);
                if (obj11 is InferenceClassificationResult)
                {
                    obj11 = (int)obj11;
                }
                if (obj8 != null)
                {
                    Exception ex = obj8 as Exception;
                    if (ex != null)
                    {
                        item8 = InferenceCommonUtility.StringizeException(ex);
                        if (ex.TargetSite != null)
                        {
                            item7 = ex.TargetSite.Name;
                        }
                        item5 = ex.GetType().Name;
                        if (ex.InnerException != null)
                        {
                            item6 = ex.InnerException.GetType().Name;
                        }
                    }
                }
                object obj12 = null;
                if (classificationDiagnostics.TryGetValue(InferenceSchema.PredictedActionsThresholds, out obj12))
                {
                    IDictionary <PredictedMessageAction, short> dictionary = obj12 as IDictionary <PredictedMessageAction, short>;
                    if (dictionary != null)
                    {
                        value = string.Join(",", from kvp in dictionary
                                            select string.Format("{0}:{1}", (int)kvp.Key, kvp.Value));
                        item9 = string.Join("#", from kvp in dictionary
                                            select string.Format("{0}:{1}", ActionSets.GetActionName(kvp.Key), kvp.Value));
                    }
                }
                obj12 = null;
                if (classificationDiagnostics.TryGetValue(InferenceSchema.ConversationClutterInformation, out obj12))
                {
                    ConversationClutterInformation conversationClutterInformation = obj12 as ConversationClutterInformation;
                    if (conversationClutterInformation != null)
                    {
                        text = conversationClutterInformation.State.ToString();
                    }
                }
                else
                {
                    text = null;
                }
                obj12 = null;
                IList <PredictedActionAndProbability> list = null;
                if (classificationDiagnostics.TryGetValue(InferenceSchema.PredictedActionsAll, out obj12))
                {
                    list = (obj12 as IList <PredictedActionAndProbability>);
                }
                if (list != null)
                {
                    StringBuilder stringBuilder  = new StringBuilder();
                    StringBuilder stringBuilder2 = new StringBuilder();
                    foreach (PredictedActionAndProbability predictedActionAndProbability in list)
                    {
                        stringBuilder2.Append(string.Format("{0}:{1},", (int)predictedActionAndProbability.Action, predictedActionAndProbability.Probability));
                        stringBuilder.Append(string.Format("{0}:{1}#", ActionSets.GetActionName(predictedActionAndProbability.Action), predictedActionAndProbability.Probability));
                    }
                    item10 = stringBuilder.ToString();
                    value2 = stringBuilder2.ToString();
                }
                obj12 = null;
                if (classificationDiagnostics.TryGetValue(InferenceSchema.UserFlightFeatures, out obj12))
                {
                    VariantConfigurationSnapshot variantConfigurationSnapshot = (VariantConfigurationSnapshot)obj12;
                    StringBuilder stringBuilder3 = new StringBuilder();
                    foreach (IFeature feature in variantConfigurationSnapshot.Inference.GetObjectsOfType <IFeature>().Values)
                    {
                        stringBuilder3.Append(string.Format("{0}:{1}#", feature.Name, feature.Enabled));
                    }
                    item12 = stringBuilder3.ToString();
                }
            }
            int?   num    = null;
            string item22 = null;
            string value3 = null;
            object item23 = null;
            object item24 = null;
            object item25 = null;
            object item26 = null;

            if (document != null)
            {
                object obj13 = null;
                obj13 = null;
                ModelData modelData = null;
                if (document.TryGetProperty(InferenceSchema.ActionModel, out obj13))
                {
                    modelData = (obj13 as ModelData);
                }
                obj13 = null;
                if (document.TryGetProperty(InferenceSchema.ConversationImportanceProperties, out obj13))
                {
                    IConversationProperties conversationProperties = obj13 as IConversationProperties;
                    if (conversationProperties != null)
                    {
                        num = new int?(conversationProperties.NumberOfPreviousMessages);
                    }
                }
                if (modelData != null)
                {
                    obj13 = null;
                    if (document.TryGetProperty(InferenceSchema.MessageFeatureVectorData, out obj13))
                    {
                        IMessageData messageData = obj13 as IMessageData;
                        if (messageData != null)
                        {
                            item22 = InferenceUtil.GetMessageFeatureValuesAsString(messageData.FeatureValues, modelData);
                            value3 = InferenceUtil.GetMessageFeatureValuesAsCompactString(messageData.FeatureValues, modelData);
                        }
                    }
                }
                obj13 = null;
                PredictedActionAndProbability[] array = null;
                if (document.TryGetProperty(InferenceSchema.PredictedActions, out obj13))
                {
                    array = (obj13 as PredictedActionAndProbability[]);
                }
                if (array != null)
                {
                    StringBuilder stringBuilder4 = new StringBuilder();
                    foreach (PredictedActionAndProbability predictedActionAndProbability2 in array)
                    {
                        stringBuilder4.Append(string.Format("{0}:{1}#", ActionSets.GetActionName(predictedActionAndProbability2.Action), predictedActionAndProbability2.Probability));
                    }
                    item11 = stringBuilder4.ToString();
                }
                document.TryGetProperty(InferenceSchema.ConversationId, out item23);
                document.TryGetProperty(InferenceSchema.ModelVersionBreadCrumb, out item26);
                obj13 = null;
                if (document.TryGetProperty(InferenceSchema.ModelVersionToLoad, out obj13))
                {
                    ModelVersionSelector.ModelVersionInfo modelVersionInfo = obj13 as ModelVersionSelector.ModelVersionInfo;
                    if (modelVersionInfo != null)
                    {
                        item24 = modelVersionInfo.Version;
                    }
                }
                document.TryGetProperty(InferenceSchema.ComputedClutterValue, out item25);
            }
            tracking.Trace("SV", InferenceCommonUtility.ServerVersion);
            tracking.Trace("CT", obj);
            tracking.Trace("ODF", obj2);
            tracking.Trace("MAB", obj3);
            tracking.Trace("TTC", obj4);
            tracking.Trace("SN", obj7);
            if (text != null)
            {
                tracking.Trace("CCS", text);
            }
            tracking.Trace("MV", obj5);
            tracking.Trace("CPMC", num ?? 0);
            tracking.Trace("PA", value2);
            tracking.Trace("TI", obj6);
            tracking.Trace("PAT", value);
            tracking.Trace("CVBOR", obj9);
            tracking.Trace("CVAOR", obj10);
            tracking.Trace("FVW", value3);
            return(new List <object>(this.columnCount)
            {
                DateTime.UtcNow,
                item,
                item2,
                item3,
                item4,
                obj7,
                InferenceCommonUtility.ServerVersion,
                item24,
                obj5,
                obj,
                obj4,
                obj2,
                obj3,
                text,
                num,
                item11,
                item10,
                item25,
                item9,
                obj6,
                item22,
                item5,
                item6,
                item7,
                item8,
                obj9,
                obj10,
                item12,
                item23,
                item14,
                item16,
                item15,
                item13,
                item26,
                item17,
                item18,
                item19,
                item20,
                obj11,
                item21
            });
        }
Exemplo n.º 9
0
        // Token: 0x0600146A RID: 5226 RVA: 0x00075DC0 File Offset: 0x00073FC0
        public bool IsMailboxInteresting(MailboxInformation mailboxInformation)
        {
            InferenceDataCollectionAssistantType.tracer.TraceFunction((long)this.GetHashCode(), "InferenceDataCollectionAssistantType.IsMailboxInteresting");
            if (InferenceCommonUtility.IsNonUserMailbox(mailboxInformation.DisplayName))
            {
                this.diagnosticLogger.LogDebug("Skipping mailbox with guid {0} and display name {1} since it is identified as a non-user mailbox.", new object[]
                {
                    mailboxInformation.MailboxGuid,
                    mailboxInformation.DisplayName
                });
                return(false);
            }
            if (this.collectionContext.Configuration.IsOutputSanitized)
            {
                if (!this.collectionContext.HashProvider.IsInitialized && !this.hashProviderInitializeAttemptedInWorkcycle)
                {
                    try
                    {
                        bool flag = this.collectionContext.HashProvider.Initialize();
                        this.diagnosticLogger.LogDebug("Hash provider initialization success = {0}", new object[]
                        {
                            flag
                        });
                    }
                    catch (Exception ex)
                    {
                        this.diagnosticLogger.LogDebug("Hash provider initialization failed with exception {0}", new object[]
                        {
                            ex.ToString()
                        });
                    }
                    this.hashProviderInitializeAttemptedInWorkcycle = true;
                }
                if (!this.collectionContext.HashProvider.IsInitialized)
                {
                    this.diagnosticLogger.LogDebug("Skipping mailbox with guid {0} and display name {1} as the hash provider is not initialized.", new object[]
                    {
                        mailboxInformation.MailboxGuid,
                        mailboxInformation.DisplayName
                    });
                    return(false);
                }
            }
            object mailboxProperty = mailboxInformation.GetMailboxProperty(MailboxSchema.InferenceDataCollectionProcessingState);

            if (mailboxProperty != null)
            {
                byte[]     array = mailboxProperty as byte[];
                ExDateTime t     = new ExDateTime(ExTimeZone.UtcTimeZone, mailboxInformation.LastProcessedDate).Add(this.config.MailboxReprocessAge);
                if (array[0] == 1 && ExDateTime.UtcNow < t)
                {
                    this.diagnosticLogger.LogDebug("Skipping mailbox with guid {0} and display name {1} since it reached {2} collection state on {3}", new object[]
                    {
                        mailboxInformation.MailboxGuid,
                        mailboxInformation.DisplayName,
                        (InferenceDataCollectionAssistantType.DataCollectionProcessingState)array[0],
                        mailboxInformation.LastProcessedDate
                    });
                    return(false);
                }
            }
            mailboxProperty = mailboxInformation.GetMailboxProperty(MailboxSchema.ItemCount);
            if (mailboxProperty != null && (int)mailboxProperty > this.config.MinimumItemCountInMailbox)
            {
                int  num   = InferenceDataCollectionAssistantType.IsGroupMailbox(mailboxInformation) ? this.config.ModuloNumberToRandomizeForGroups : this.config.ModuloNumberToRandomize;
                int  num2  = this.randomizer.Next(1, int.MaxValue);
                bool flag2 = num2 % num == 0;
                this.diagnosticLogger.LogDebug("{0} mailbox with guid {1} and display name {2} based on random selection (random number = {3}, modulo arithmetic number = {4})", new object[]
                {
                    flag2 ? "Picking" : "Skipping",
                    mailboxInformation.MailboxGuid,
                    mailboxInformation.DisplayName,
                    num2,
                    this.config.ModuloNumberToRandomize
                });
                return(flag2);
            }
            this.diagnosticLogger.LogDebug("Skipping mailbox with guid {0} and display name {1} since ContentCount property value {2} is less than the required minimum {3}", new object[]
            {
                mailboxInformation.MailboxGuid,
                mailboxInformation.DisplayName,
                (mailboxProperty != null) ? ((int)mailboxProperty) : -1,
                this.config.MinimumItemCountInMailbox
            });
            return(false);
        }