// Token: 0x06001C62 RID: 7266 RVA: 0x000714E0 File Offset: 0x0006F6E0
 public FindInGALSpeechRecognitionEWSBinding(SmtpAddress orgMboxSmtpAddress, Uri serviceUri, object state) : base("FindInGALSpeechRecognition", new RemoteCertificateValidationCallback(FindInGALSpeechRecognitionEWSBinding.CertificateErrorHandler))
 {
     ValidateArgument.NotNull(orgMboxSmtpAddress, "orgMboxSmtpAddress");
     ValidateArgument.NotNull(serviceUri, "serviceUri");
     ValidateArgument.NotNull(state, "state");
     base.Url = serviceUri.ToString();
     this.RequestServerVersionValue = FindInGALSpeechRecognitionEWSBinding.RequestServerVersion;
     base.UserAgent     = "FindInGALSpeechRecognition";
     base.Proxy         = new WebProxy();
     base.Authenticator = SoapHttpClientAuthenticator.CreateNetworkService();
     base.Authenticator.AdditionalSoapHeaders.Add(new OpenAsAdminOrSystemServiceType
     {
         ConnectingSID = new ConnectingSIDType
         {
             Item = new SmtpAddressType
             {
                 Value = orgMboxSmtpAddress.ToString()
             }
         },
         LogonType           = SpecialLogonType.SystemService,
         BudgetType          = 2,
         BudgetTypeSpecified = true
     });
     this.State = state;
     NetworkServiceImpersonator.Initialize();
 }
 // Token: 0x060010DA RID: 4314 RVA: 0x00062924 File Offset: 0x00060B24
 public OrgMailboxScaleOutHelper(RunData runData, Logger logger)
 {
     ValidateArgument.NotNull(runData, "runData");
     ValidateArgument.NotNull(logger, "logger");
     this.RunData = runData;
     this.Logger  = logger;
 }
Example #3
0
 private static void ValidateProperty(Assembly assembly)
 {
     ValidateArgument.For(assembly, nameof(assembly))
     .NotNull()                          // <- The argument must not be `null`
     .For(x => x.Location, v => v        // <- Validate property
          .NotNullOrEmpty()              // <- The `Location` property must not be `null` or an empty string
          );
 }
Example #4
0
 private static void ValidateEnumerable(IReadOnlyCollection <Guid> ids)
 {
     ValidateArgument.For(ids, nameof(ids))
     .NotNullOrEmpty()                   // <- The enumerable must not be `null` and must contain at least one element
     .ForEach(x => x, v => v             // <- Validate all elements in the enumerable
              .NotEmpty()                // <- Each individual element in the enumerable must not be empty an empty GUID
              );
 }
        // Token: 0x06001021 RID: 4129 RVA: 0x0005E774 File Offset: 0x0005C974
        private RunData CreateRunData(DirectoryProcessorMailboxData mailboxData)
        {
            ValidateArgument.NotNull(mailboxData, "mailboxData");
            RunData runData = new RunData(Guid.NewGuid(), mailboxData, new ThrowIfShuttingDown(this.ThrowIfShuttingDown));

            runData.CreateRunFolder();
            return(runData);
        }
 // Token: 0x0600106A RID: 4202 RVA: 0x0005FCFC File Offset: 0x0005DEFC
 public DtmfMapGeneratorTaskContext(MailboxData mailboxData, TimeBasedDatabaseJob job, Queue <TaskQueueItem> taskQueue, AssistantStep step, TaskStatus taskStatus, XmlReader adEntriesReader, DtmfMapGenerationMetadata metadata, bool isFullUpdate, RunData runData, IList <DirectoryProcessorBaseTask> deferredFinalizeTasks) : base(mailboxData, job, taskQueue, step, taskStatus, runData, deferredFinalizeTasks)
 {
     ValidateArgument.NotNull(adEntriesReader, "adEntriesReader");
     ValidateArgument.NotNull(metadata, "metadata");
     this.AdEntriesReader = adEntriesReader;
     this.Metadata        = metadata;
     this.IsFullUpdate    = isFullUpdate;
 }
Example #7
0
        // Token: 0x06001129 RID: 4393 RVA: 0x00063B08 File Offset: 0x00061D08
        public GrammarGenerator(RunData runData, ICollection <DirectoryProcessorMailboxData> mailboxesToProcess) : base(runData)
        {
            ValidateArgument.NotNull(mailboxesToProcess, "mailboxesToProcess");
            this.mailboxesToProcess = mailboxesToProcess;
            int grammarCultureCount = UMGrammarTenantCache.Instance.GetGrammarCultureCount();

            this.grammars            = new Dictionary <string, List <string> >(grammarCultureCount);
            this.normalizationCaches = new Dictionary <string, NormalizationCache>(grammarCultureCount);
        }
Example #8
0
        public void Test_For()
        {
            var test = new KeyValuePair <int, string>(1337, "test");
            var path = nameof(test);

            ValidateArgument
            .For(test, nameof(test))
            .AssertEqualValueAndPath(test, path);
        }
Example #9
0
        // Token: 0x06001052 RID: 4178 RVA: 0x0005EF08 File Offset: 0x0005D108
        public static DtmfMapGenerationMetadata Deserialize(string filePath)
        {
            ValidateArgument.NotNullOrEmpty(filePath, "filePath");
            Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Deserialize - filePath='{0}'", new object[]
            {
                filePath
            });
            DtmfMapGenerationMetadata result = null;

            try
            {
                using (Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    using (XmlTextReader xmlTextReader = new XmlTextReader(stream))
                    {
                        xmlTextReader.ReadToFollowing("DtmfMapGeneration");
                        xmlTextReader.MoveToAttribute("metadataVersion");
                        string attribute       = xmlTextReader.GetAttribute("metadataVersion");
                        int    metadataVersion = int.Parse(attribute);
                        xmlTextReader.MoveToAttribute("tenantId");
                        string attribute2 = xmlTextReader.GetAttribute("tenantId");
                        xmlTextReader.MoveToAttribute("runId");
                        string attribute3 = xmlTextReader.GetAttribute("runId");
                        Guid   runId      = Guid.Parse(attribute3);
                        xmlTextReader.MoveToAttribute("serverName");
                        string attribute4 = xmlTextReader.GetAttribute("serverName");
                        xmlTextReader.MoveToAttribute("serverVersion");
                        string attribute5 = xmlTextReader.GetAttribute("serverVersion");
                        xmlTextReader.MoveToAttribute("lastIncrementalUpdateTimeUtc");
                        string   attribute6 = xmlTextReader.GetAttribute("lastIncrementalUpdateTimeUtc");
                        DateTime lastIncrementalUpdateTimeUtc = DateTime.Parse(attribute6, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.RoundtripKind);
                        xmlTextReader.MoveToAttribute("lastFullUpdateTimeUtc");
                        string   attribute7            = xmlTextReader.GetAttribute("lastFullUpdateTimeUtc");
                        DateTime lastFullUpdateTimeUtc = DateTime.Parse(attribute7, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.RoundtripKind);
                        result = new DtmfMapGenerationMetadata(metadataVersion, attribute2, runId, attribute4, attribute5, lastIncrementalUpdateTimeUtc, lastFullUpdateTimeUtc);
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Serialize - exception='{0}'", new object[]
                {
                    ex
                });
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_LoadDtmfMapGenerationMetadataFailed, null, new object[]
                {
                    filePath,
                    CommonUtil.ToEventLogString(ex)
                });
                if (!DtmfMapGenerationMetadata.IsExpectedException(ex))
                {
                    throw;
                }
            }
            return(result);
        }
Example #10
0
        // Token: 0x060010A2 RID: 4258 RVA: 0x00061814 File Offset: 0x0005FA14
        public bool DownloadCookies(ICollection <string> pathCollection)
        {
            ValidateArgument.NotNull(pathCollection, "pathCollection");
            if (pathCollection.Count == 0)
            {
                GroupMetricsMailboxFileStore.Tracer.TraceDebug((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.DownloadCookies - skipping download due to empty cookie path collection");
                return(false);
            }
            bool result = true;

            using (MailboxSession mailboxSession = this.TryGetMailboxSession())
            {
                if (mailboxSession == null)
                {
                    GroupMetricsMailboxFileStore.Tracer.TraceDebug((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.DownloadCookies - skipping download due to null session");
                    return(false);
                }
                foreach (string text in pathCollection)
                {
                    try
                    {
                        string text2 = base.DownloadLatestFile(text, DateTime.MinValue, mailboxSession);
                        if (text2 != null)
                        {
                            GroupMetricsMailboxFileStore.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.DownloadCookie - Copying downloaded cookie '{0}' to '{1}'", text2, text);
                            string directoryName = Path.GetDirectoryName(text);
                            Directory.CreateDirectory(directoryName);
                            try
                            {
                                File.Copy(text2, text, true);
                                continue;
                            }
                            finally
                            {
                                base.DeleteFolder(Path.GetDirectoryName(text2));
                            }
                        }
                        result = false;
                    }
                    catch (Exception ex)
                    {
                        UmGlobals.ExEvent.LogEvent(InfoWorkerEventLogConstants.Tuple_DownloadGroupMetricsCookieFailed, null, new object[]
                        {
                            base.OrgId,
                            text,
                            CommonUtil.ToEventLogString(ex)
                        });
                        if (!GroupMetricsMailboxFileStore.IsExpectedException(ex))
                        {
                            throw;
                        }
                    }
                }
            }
            return(result);
        }
Example #11
0
        public static IConfigDataProvider GetDataProviderForCallAnsweringRuleTasks(UMCallAnsweringRuleIdParameter identityParam, MailboxIdParameter mailboxParam, ADSessionSettings sessionSettings, IRecipientSession globalCatalogSession, ADObjectId executingUserId, string clientString, DataAccessHelper.GetDataObjectDelegate getDataObjectDelegate, Task.TaskErrorLoggingDelegate errorLogger)
        {
            ValidateArgument.NotNull(sessionSettings, "sessionSettings");
            ValidateArgument.NotNull(globalCatalogSession, "globalCatalogSession");
            ValidateArgument.NotNull(getDataObjectDelegate, "getDataObjectDelegate");
            ValidateArgument.NotNull(errorLogger, "errorLogger");
            ValidateArgument.NotNullOrEmpty(clientString, "clientString");
            MailboxIdParameter mailboxIdParameter = null;
            ADUser             aduser             = null;

            if (identityParam != null)
            {
                if (identityParam.CallAnsweringRuleId != null)
                {
                    mailboxIdParameter = new MailboxIdParameter(identityParam.CallAnsweringRuleId.MailboxOwnerId);
                }
                else
                {
                    mailboxIdParameter = identityParam.RawMailbox;
                }
            }
            if (mailboxIdParameter != null && mailboxParam != null)
            {
                errorLogger(new InvalidOperationException(Strings.ErrorConflictingMailboxes), ErrorCategory.InvalidOperation, identityParam);
            }
            if (mailboxIdParameter == null && executingUserId == null)
            {
                errorLogger(new RecipientTaskException(Strings.ErrorParameterRequired("Mailbox")), ErrorCategory.InvalidOperation, null);
            }
            if (mailboxIdParameter == null)
            {
                mailboxIdParameter = (mailboxParam ?? new MailboxIdParameter(executingUserId));
            }
            aduser = (ADUser)getDataObjectDelegate(mailboxIdParameter, globalCatalogSession, null, null, new LocalizedString?(Strings.ErrorMailboxNotFound(mailboxIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(mailboxIdParameter.ToString())));
            if (identityParam != null && identityParam.CallAnsweringRuleId == null)
            {
                identityParam.CallAnsweringRuleId = new UMCallAnsweringRuleId(aduser.Id, (identityParam.RawRuleGuid != null) ? identityParam.RawRuleGuid.Value : Guid.Empty);
            }
            ADScopeException ex;

            if (!globalCatalogSession.TryVerifyIsWithinScopes(aduser, true, out ex))
            {
                errorLogger(new InvalidOperationException(Strings.ErrorCannotChangeMailboxOutOfWriteScope(aduser.Identity.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ErrorCategory.InvalidOperation, aduser.Identity);
            }
            UMCallAnsweringRuleDataProvider result = null;

            try
            {
                result = new UMCallAnsweringRuleDataProvider(sessionSettings, aduser, clientString);
            }
            catch (UMRecipientValidationException)
            {
                errorLogger(new InvalidOperationException(Strings.MailboxNotUmEnabled(aduser.Identity.ToString())), ErrorCategory.InvalidOperation, aduser.Identity);
            }
            return(result);
        }
 /// <summary>
 /// Execute update action for ToolStripItem by timer.
 /// </summary>
 public static void UpdateItemByTimer <T>(this T control, Action <T> updateAction)
     where T : ToolStripItem
 {
     ValidateArgument.IsNotNull(control);
     control.GetCurrentParent().ValidateControl().IsTrue(ctl =>
     {
         updateAction(control);
         return(true);
     });
 }
 /// <summary>
 /// Set Visibe property of this ToolStripItem by timer and expression result
 /// </summary>
 public static void VisibleItemByTimer <T>(this T control, Func <bool> visibleExpression)
     where T : ToolStripItem
 {
     ValidateArgument.IsNotNull(control);
     control.GetCurrentParent().ValidateControl().IsTrue(ctl =>
     {
         control.Visible = visibleExpression();
         return(true);
     });
 }
 /// <summary>
 /// Sets Checked property for corresponding ToolStripButton according on provided checkedExpression.
 /// </summary>
 public static void CheckButtonByTimer <T>(this T control, Func <bool> checkedExpression)
     where T : ToolStripButton
 {
     ValidateArgument.IsNotNull(control);
     control.GetCurrentParent().ValidateControl().IsTrue(ctl =>
     {
         control.Checked = checkedExpression();
         return(true);
     });
 }
 // Token: 0x06001147 RID: 4423 RVA: 0x00064DBC File Offset: 0x00062FBC
 public GrammarGeneratorTaskContext(MailboxData mailboxData, TimeBasedDatabaseJob job, Queue <TaskQueueItem> taskQueue, AssistantStep step, TaskStatus taskStatus, IGrammarGeneratorInterface grammarGeneratorInstance, CultureInfo[] grammarCultures, Logger logger, RunData runData, IList <DirectoryProcessorBaseTask> deferredFinalizeTasks) : base(mailboxData, job, taskQueue, step, taskStatus, runData, deferredFinalizeTasks)
 {
     ValidateArgument.NotNull(grammarGeneratorInstance, "grammarGeneratorInstance");
     ValidateArgument.NotNull(grammarCultures, "grammarCultures");
     ValidateArgument.NotNull(logger, "logger");
     this.GrammarCultures          = grammarCultures;
     this.CultureIdx               = 0;
     this.Logger                   = logger;
     this.GrammarGeneratorInstance = grammarGeneratorInstance;
 }
        public void Test_NotEmpty_Nullable_Throws(int?value)
        {
            var exception = Assert.Throws <ArgumentException>(() =>
            {
                ValidateArgument
                .For(value, nameof(value))
                .NotEmpty();
            });

            Assert.Equal(nameof(value), exception.ParamName);
        }
Example #17
0
        public void Test_Selector_For()
        {
            var test = new KeyValuePair <int, string>(1337, "test");
            var path = $"{nameof(test)}.{nameof(test.Key)}";

            ValidateArgument
            .For(test, nameof(test))
            .For(x => x.Key, v => v
                 .AssertEqualValueAndPath(test.Key, path)
                 );
        }
        public void Test_InRange_Nullable_Throws(int?value, int min, int max)
        {
            var exception = Assert.Throws <ArgumentException>(() =>
            {
                ValidateArgument
                .For(value, nameof(value))
                .InRange(min, max);
            });

            Assert.Equal(nameof(value), exception.ParamName);
        }
Example #19
0
 // Token: 0x060010E7 RID: 4327 RVA: 0x00062EE0 File Offset: 0x000610E0
 public RunData(Guid runId, DirectoryProcessorMailboxData mailboxData, ThrowIfShuttingDown throwIfShuttingDown)
 {
     ValidateArgument.NotNull(mailboxData, "mailboxData");
     ValidateArgument.NotNull(throwIfShuttingDown, "throwIfShuttingDown");
     this.RunId               = runId;
     this.MailboxData         = mailboxData;
     this.throwIfShuttingDown = throwIfShuttingDown;
     this.RunStartTime        = DateTime.UtcNow;
     this.TenantId            = RunData.GetTenantIdentifiableDN(this.MailboxData.OrgId);
     this.TenantGuid          = RunData.GetTenantGuid(this.MailboxData.OrgId);
 }
        public void Test_NotNull_Throws(object value)
        {
            var exception = Assert.Throws <ArgumentNullException>(() =>
            {
                ValidateArgument
                .For(value, nameof(value))
                .NotNull();
            });

            Assert.Equal(nameof(value), exception.ParamName);
        }
        public void Test_NotEqual_List_Throws(DateTimeKind[] blacklist, DateTimeKind value)
        {
            var exception = Assert.Throws <ArgumentNullException>(() =>
            {
                ValidateArgument
                .For(value, nameof(value))
                .NotEqual(blacklist);
            });

            Assert.Equal(nameof(value), exception.ParamName);
        }
        public void Test_NotEqual_Throws(DateTimeKind disallowed, DateTimeKind value)
        {
            var exception = Assert.Throws <ArgumentNullException>(() =>
            {
                ValidateArgument
                .For(value, nameof(value))
                .NotEqual(disallowed);
            });

            Assert.Equal(nameof(value), exception.ParamName);
        }
Example #23
0
        // Token: 0x0600112E RID: 4398 RVA: 0x00063CFC File Offset: 0x00061EFC
        protected override DirectoryProcessorBaseTaskContext DoChunkWork(DirectoryProcessorBaseTaskContext context, RecipientType recipientType)
        {
            ValidateArgument.NotNull(context, "context");
            base.Logger.TraceDebug(this, "Entering GrammarGenerator.DoChunkWork recipientType='{0}'", new object[]
            {
                recipientType
            });
            if ((RecipientType.Group == recipientType && (context.TaskStatus & TaskStatus.DLADCrawlerFailed) != TaskStatus.NoError) || (RecipientType.User == recipientType && (context.TaskStatus & TaskStatus.UserADCrawlerFailed) != TaskStatus.NoError))
            {
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationSkippedNoADFile, null, new object[]
                {
                    base.TenantId,
                    base.RunId,
                    recipientType
                });
                this.exception = new GrammarGeneratorADException();
                return(null);
            }
            if (!this.NoError)
            {
                base.Logger.TraceDebug(this, "GrammarGenerator.DoChunkWork - Skipping rest of grammar generation because of previous error='{0}'", new object[]
                {
                    this.exception
                });
                return(null);
            }
            GrammarGeneratorTaskContext grammarGeneratorTaskContext = context as GrammarGeneratorTaskContext;

            if (grammarGeneratorTaskContext == null)
            {
                base.Logger.TraceDebug(this, "First time GrammarGenerator.DoChunkWork is called", new object[0]);
                grammarGeneratorTaskContext = this.InitializeTask(recipientType, context);
            }
            DirectoryProcessorBaseTaskContext result = null;
            CultureInfo nextCultureToProcess         = grammarGeneratorTaskContext.GetNextCultureToProcess();

            if (nextCultureToProcess != null)
            {
                base.Logger.TraceDebug(this, "GrammarGenerator.DoChunkWork - Processing culture='{0}'", new object[]
                {
                    nextCultureToProcess
                });
                base.Logger.SetMetadataValues(this, recipientType, nextCultureToProcess.Name);
                this.GenerateGrammar(nextCultureToProcess, grammarGeneratorTaskContext.GrammarGeneratorInstance);
                result = grammarGeneratorTaskContext;
            }
            else if (this.DoBulkUpload)
            {
                base.Logger.TraceDebug(this, "GrammarGenerator.DoChunkWork - Do bulk upload", new object[0]);
                this.UploadResults(null);
            }
            return(result);
        }
Example #24
0
        // Token: 0x06001051 RID: 4177 RVA: 0x0005ECFC File Offset: 0x0005CEFC
        public static string Serialize(DtmfMapGenerationMetadata metadata, string fileName, string folderPath)
        {
            ValidateArgument.NotNull(metadata, "metadata");
            ValidateArgument.NotNullOrEmpty(fileName, "fileName");
            ValidateArgument.NotNullOrEmpty(folderPath, "folderPath");
            Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Serialize - fileName='{0}', folderPath='{1}'", new object[]
            {
                fileName,
                folderPath
            });
            string text = Path.Combine(folderPath, fileName);

            try
            {
                Directory.CreateDirectory(folderPath);
                using (Stream stream = new FileStream(text, FileMode.Create, FileAccess.ReadWrite))
                {
                    using (XmlTextWriter xmlTextWriter = new XmlTextWriter(stream, Encoding.UTF8))
                    {
                        xmlTextWriter.WriteStartDocument();
                        xmlTextWriter.WriteStartElement("DtmfMapGeneration");
                        xmlTextWriter.WriteAttributeString("metadataVersion", metadata.MetadataVersion.ToString("d"));
                        xmlTextWriter.WriteAttributeString("tenantId", metadata.TenantId);
                        xmlTextWriter.WriteAttributeString("runId", metadata.RunId.ToString());
                        xmlTextWriter.WriteAttributeString("serverName", metadata.ServerName);
                        xmlTextWriter.WriteAttributeString("serverVersion", metadata.ServerVersion);
                        xmlTextWriter.WriteAttributeString("lastIncrementalUpdateTimeUtc", metadata.LastIncrementalUpdateTimeUtc.ToString("u", DateTimeFormatInfo.InvariantInfo));
                        xmlTextWriter.WriteAttributeString("lastFullUpdateTimeUtc", metadata.LastFullUpdateTimeUtc.ToString("u", DateTimeFormatInfo.InvariantInfo));
                        xmlTextWriter.WriteEndElement();
                        xmlTextWriter.WriteEndDocument();
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Serialize - exception='{0}'", new object[]
                {
                    ex
                });
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_SaveDtmfMapGenerationMetadataFailed, null, new object[]
                {
                    text,
                    CommonUtil.ToEventLogString(ex)
                });
                if (!DtmfMapGenerationMetadata.IsExpectedException(ex))
                {
                    throw;
                }
                text = null;
            }
            return(text);
        }
        // Token: 0x06001122 RID: 4386 RVA: 0x000639F8 File Offset: 0x00061BF8
        public GrammarGenerationLog(string grammarFileFolderPath, Logger tracer)
        {
            ValidateArgument.NotNullOrEmpty(grammarFileFolderPath, "grammarFileFolderPath");
            ValidateArgument.NotNull(tracer, "tracer");
            this.tracer = tracer;
            this.tracer.TraceDebug(this, "Entering GrammarGenerationLog constructor grammarFileFolderPath='{0}'", new object[]
            {
                grammarFileFolderPath
            });
            string path = Path.Combine(grammarFileFolderPath, "GrammarGeneration.Log");

            this.logWriter = new StreamWriter(path, true);
        }
Example #26
0
        public void Test_Selector_ForEach_Parameter()
        {
            var test = new List <int> {
                1, 2, 3
            };
            var path = nameof(test);

            var i = 0;

            ValidateArgument
            .For(test, nameof(test))
            .ForEach(x => x, v => v
                     .AssertEqualValueAndPathIndexed(test[i], $"{path}[{i}]", ref i)
                     );
        }
Example #27
0
        public void Test_Selector_ForEach_Property()
        {
            var test = new KeyValuePair <int, List <int> >(1337, new List <int> {
                1, 2, 3
            });
            var path = $"{nameof(test)}.{nameof(test.Value)}";

            var i = 0;

            ValidateArgument
            .For(test, nameof(test))
            .ForEach(x => x.Value, v => v
                     .AssertEqualValueAndPathIndexed(test.Value[i], $"{path}[{i}]", ref i)
                     );
        }
Example #28
0
 public SpeechRecognition(RequestParameters requestParameters, SpeechRecognitionResultsPriority resultsPriority)
 {
     ValidateArgument.NotNull(requestParameters, "requestParameters is null");
     this.Parameters              = requestParameters;
     this.audioReady              = false;
     this.addRecoRequestReady     = false;
     this.ResultsPriority         = resultsPriority;
     this.Results                 = null;
     this.ResultsReceived         = false;
     this.HighestConfidenceResult = 0.0;
     this.ResultType              = MobileSpeechRecoResultType.None;
     this.audioReadyEvent         = new ManualResetEvent(false);
     this.audioBuffer             = null;
     this.recoContext             = new SpeechRecoContext(this);
 }
Example #29
0
        // Token: 0x06001058 RID: 4184 RVA: 0x0005F290 File Offset: 0x0005D490
        protected override DirectoryProcessorBaseTaskContext DoChunkWork(DirectoryProcessorBaseTaskContext context, RecipientType recipientType)
        {
            ValidateArgument.NotNull(context, "context");
            base.Logger.TraceDebug(this, "Entering DtmfMapGenerator.DoChunkWork recipientType='{0}'", new object[]
            {
                recipientType
            });
            if ((RecipientType.Group == recipientType && (context.TaskStatus & TaskStatus.DLADCrawlerFailed) != TaskStatus.NoError) || (RecipientType.User == recipientType && (context.TaskStatus & TaskStatus.UserADCrawlerFailed) != TaskStatus.NoError))
            {
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapGenerationSkippedNoADFile, null, new object[]
                {
                    base.TenantId,
                    base.RunId,
                    recipientType
                });
                return(null);
            }
            DtmfMapGeneratorTaskContext dtmfMapGeneratorTaskContext = context as DtmfMapGeneratorTaskContext;

            if (dtmfMapGeneratorTaskContext == null)
            {
                base.Logger.TraceDebug(this, "First time DtmfMapGenerator.DoChunkWork is called", new object[0]);
                dtmfMapGeneratorTaskContext = this.InitializeTask(recipientType, context);
            }
            DtmfMapGeneratorTaskContext dtmfMapGeneratorTaskContext2 = dtmfMapGeneratorTaskContext;

            try
            {
                if (this.ProcessNextChunk(dtmfMapGeneratorTaskContext))
                {
                    this.LogCompletion(dtmfMapGeneratorTaskContext, recipientType);
                    dtmfMapGeneratorTaskContext2 = null;
                }
            }
            catch (Exception)
            {
                dtmfMapGeneratorTaskContext2 = null;
                throw;
            }
            finally
            {
                if (dtmfMapGeneratorTaskContext2 == null)
                {
                    dtmfMapGeneratorTaskContext.Dispose();
                }
            }
            return(dtmfMapGeneratorTaskContext2);
        }
Example #30
0
        private static void ValidateNullable(int?value)
        {
            // Validation is implicitly executed if value is not `null`

            ValidateArgument.For(value, nameof(value))
            .NotEmpty();

            // .. which is equivalent to the following manual validation

            ValidateArgument.For(value, nameof(value))
            .When(x => x.HasValue, v => v
                  .Select(x => x.Value, v => v
                          .NotEmpty()
                          )
                  );
        }