void ConfigurateETL() { string path = AppDomain.CurrentDomain.BaseDirectory; OptionsManager optionsManager = new OptionsManager(path); etlOptions = optionsManager.GetOptions <EtlOptions>() as EtlOptions; Directory.CreateDirectory(etlOptions.DirectoryOptions.SourceDirectory); Directory.CreateDirectory(etlOptions.DirectoryOptions.TargetDirectory); sourceWatcher = new FileSystemWatcher(etlOptions.DirectoryOptions.SourceDirectory); sourceWatcher.Filter = "*.txt"; sourceWatcher.EnableRaisingEvents = true; sourceWatcher.IncludeSubdirectories = true; sourceWatcher.Created += SourceWatcher_Created; sourceWatcher.EnableRaisingEvents = true; logger = new Logger(etlOptions.LoggingOptions); Thread loggerThread = new Thread(new ThreadStart(logger.Start)); loggerThread.Start(); logger.Log($"Domain directory: {path}"); logger.Log(optionsManager.log); logger.Log($"Source Directory: {etlOptions.DirectoryOptions.SourceDirectory}"); logger.Log($"Encryption Enabled: {etlOptions.EncryptionOptions.EncryptionEnabled}"); logger.Log($"Compression Enabled: {etlOptions.ArchiveOptions.CompressionEnabled}"); }
public EtlJsonOptions(string json) { EtlOptions etlJsonOptions = Converter.DeserializeJSON <EtlOptions>(json); DirectoryOptions = etlJsonOptions.DirectoryOptions; EncryptionOptions = etlJsonOptions.EncryptionOptions; ArchiveOptions = etlJsonOptions.ArchiveOptions; LoggingOptions = etlJsonOptions.LoggingOptions; }
public EtlXmlOptions(string xml) { EtlOptions etlXmlOptions = Converter.DeserializeXML <EtlOptions>(xml); DirectoryOptions = etlXmlOptions.DirectoryOptions; EncryptionOptions = etlXmlOptions.EncryptionOptions; ArchiveOptions = etlXmlOptions.ArchiveOptions; LoggingOptions = etlXmlOptions.LoggingOptions; }
Options FindOption <T>(EtlOptions options) { if (typeof(T) == typeof(EtlOptions)) { return(options); } string name = typeof(T).Name; try { return(options.GetType().GetProperty(name).GetValue(options, null) as Options); } catch { throw new NotImplementedException(); } }