Exemplo n.º 1
0
        private async Task <CampaignParams> LoadDefaultParamsFromJsonFile()
        {
            CampaignParams campaigns = null;

            var assembly = typeof(UrlCleaner).Assembly;

            var resourceFile = "MSiccDev.Libs.LinkTools.campaignparams.json";

            using var resourceStream = assembly.GetManifestResourceStream(resourceFile);
            using var streamReader   = new StreamReader(resourceStream);

            var fileContent = await streamReader.ReadToEndAsync();

            if (!string.IsNullOrEmpty(fileContent))
            {
                campaigns = JsonConvert.DeserializeObject <CampaignParams>(fileContent);
            }

            return(campaigns);
        }
Exemplo n.º 2
0
        public async Task InitializeAsync()
        {
            _campaignParams = await LoadDefaultParamsFromJsonFile();

            IsInitialized = true;
        }