Example #1
0
        private void ReadAzureAppConfiguration()
        {
            Logger.Info($"AzureBLogic START - ReadAppConfiguration from app.config");
            if (readWriteConfiguration != null)
            {
                language                      = readWriteConfiguration.GetAzureLanguage();
                maxCandidate                  = readWriteConfiguration.GetAzureMaxCandidate();
                subscriptionKey               = readWriteConfiguration.GetAzureSubscriptionKey();
                urlAzure                      = readWriteConfiguration.GetAzureURL();
                maxRequestAzure               = readWriteConfiguration.GetMaxRequestAzure();
                useAzureTranslate             = readWriteConfiguration.GetUseAzureTranslate();
                AzureTranslateSubscriptionKey = readWriteConfiguration.GetAzureTranslateSubscriptionKey();
                AzureGeneralTranslateURL      = readWriteConfiguration.GetAzureGeneralTranslateURL();
                AzureTranslateRegion          = readWriteConfiguration.GetAzureTranslateRegion();

                urlDescribe  = $"{urlAzure}vision/v2.0/describe?maxCandidates={maxCandidate}&language={language}";
                urlTranslate = $"{AzureGeneralTranslateURL}?api-version=3.0&to=es";

                Logger.Info($"AzureBLogic - ReadAppConfiguration - Get Azure Configuration language: '{language}', maxCandidate: '{maxCandidate}', subscriptionKey: '{subscriptionKey}', urlAzure: '{urlAzure}', maxRequestAzure: '{maxRequestAzure}', translateKey: '{AzureTranslateSubscriptionKey}', translateURl: '{AzureGeneralTranslateURL}', azureRegion: '{AzureTranslateRegion}'");
            }
            else
            {
                Logger.Error($"AzureBLogic ERROR - ReadAppConfiguration object is null");
            }
        }
Example #2
0
        private void ReadConfiguration()
        {
            Logger.Info($"ConfigurationControl Start - ReadConfiguration Action");
            if (readWriteConfiguration == null)
            {
                Logger.Error($"ConfigurationControl - ReadConfiguration Action readWriteConfiguration object is null");
            }
            else
            {
                Logger.Info($"ConfigurationControl Start - ReadConfiguration Action old information: language: '{language}', maxCandidate: '{MaxCandidateNum}', subscriptionKey: '{Azurekey}', urlAzure: '{URLAzure}', requestAzure: '{RequestMaxAzure}'");

                language        = readWriteConfiguration.GetAzureLanguage();
                MaxCandidateNum = readWriteConfiguration.GetAzureMaxCandidate().ToString();
                Azurekey        = readWriteConfiguration.GetAzureSubscriptionKey();
                URLAzure        = readWriteConfiguration.GetAzureURL();
                RequestMaxAzure = readWriteConfiguration.GetMaxRequestAzure().ToString();

                switch (language)
                {
                case "en":
                    IsEnglish = true;
                    IsSpanish = false;
                    break;

                case "es":
                    IsEnglish = false;
                    IsSpanish = true;
                    break;
                }

                Logger.Info($"ConfigurationControl Start - ReadConfiguration Action NEW information: language: '{language}', maxCandidate: '{MaxCandidateNum}', subscriptionKey: '{Azurekey}', urlAzure: '{URLAzure}', requestAzure: '{RequestMaxAzure}'");


                Logger.Info($"ConfigurationControl Start - ReadConfiguration Action old translate information: TranslateAzureKey: '{RequestTranslateSubscriptionKey}', translateAzureKey: '{RequestGeneralTranslateURL}', azureRegion: '{RequestTranslateRegion}', useTranslate: '{IsSpanishWithTransalation}'");

                RequestTranslateSubscriptionKey = readWriteConfiguration.GetAzureTranslateSubscriptionKey();
                RequestGeneralTranslateURL      = readWriteConfiguration.GetAzureGeneralTranslateURL();
                RequestTranslateRegion          = readWriteConfiguration.GetAzureTranslateRegion();
                IsSpanishWithTransalation       = readWriteConfiguration.GetUseAzureTranslate();

                if (IsSpanishWithTransalation)
                {
                    IsEnglish = false;
                    IsSpanish = true;
                }

                Logger.Info($"ConfigurationControl Start - ReadConfiguration Action NEW translate information: TranslateAzureKey: '{RequestTranslateSubscriptionKey}', translateAzureKey: '{RequestGeneralTranslateURL}', azureRegion: '{RequestTranslateRegion}', useTranslate: '{IsSpanishWithTransalation}'");
            }

            Logger.Info("ConfigurationControl FINISH - ReadConfiguration Action");
        }