static void Main(string[] args) { var options = new Options(); var parser = new CommandLineParser(new CommandLineParserSettings(false, false,Console.Error)); if (!parser.ParseArguments(args, options)) Environment.Exit(1); if (options.Backup) { string connectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", options.AzureAccount, options.AzureKey); BackupProcessorChain chain = new BackupProcessorChain( new List<Processor<BackupItem>>() { new FileLoadingBackupProcessor(), new GZipBackupProcessor(), new SHA1NamingBackupProcessor(), new AzureUploaderBackupProcessor(connectionString,"flywheel") }); var executor = new JobExecutor(); executor.SubmitBackupJob(new BackupJob(options.Folder, true, chain, options.MetadataFile)); executor.JobProgress += executor_JobProgress; executor.AwaitJobDone(); } else if (options.Restore) { string connectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", options.AzureAccount, options.AzureKey); RestoreProcessorChain chain = new RestoreProcessorChain( new List<Processor<RestoreItem>>() { new AzureDownloaderRestoreProcessor(connectionString,"flywheel"), new GZipRestoreProcessor(), new FileSavingRestoreProcessor(options.Folder) }); var executor = new JobExecutor(); executor.SubmitRestoreJob(new RestoreJob(options.Folder, chain, options.MetadataFile)); executor.JobProgress += executor_JobProgress; executor.AwaitJobDone(); } }