public JsonFileObjectLocalizer( ILoggerFactory loggerFactory, IJsonFileResourceManager resourceManager, JsonFileResource resource, string baseName, string location) { _baseName = baseName ?? throw new ArgumentNullException(nameof(baseName)); _location = location ?? throw new ArgumentNullException(nameof(location)); _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); _logger = loggerFactory.CreateLogger <JsonFileObjectLocalizer>(); _resourceManager = resourceManager ?? throw new ArgumentNullException(nameof(resourceManager)); Resource = resource ?? throw new ArgumentNullException(nameof(resource)); }
private static void WriteDataFiles(object source, ElapsedEventArgs e) { try { string contents = GenerateDatafileText(); PutObjectRequest txtPutRequest = new PutObjectRequest { BucketName = "vatsim-data-us", Key = "vatsim-data.txt", ContentBody = contents, CannedACL = S3CannedACL.PublicRead }; AmazonS3Client.PutObjectAsync(txtPutRequest); DefaultContractResolver contractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() }; JsonFileResource jsonFileResource = new JsonFileResource(_fsdClients, _fsdServers, _fsdPrefiles); string json = JsonConvert.SerializeObject(jsonFileResource, new JsonSerializerSettings { ContractResolver = contractResolver, }); PutObjectRequest jsonPutRequest = new PutObjectRequest { BucketName = "vatsim-data-us", Key = "vatsim-data.json", ContentBody = json, CannedACL = S3CannedACL.PublicRead }; AmazonS3Client.PutObjectAsync(jsonPutRequest); } catch (Exception ex) { Console.WriteLine(ex); } }