static int Main(string[] args) { // set up a simple configuration that logs on the console. XmlConfigurator.Configure(); try { Options options = new Options(); CommandLineParser parser = new CommandLineParser(options); parser.Parse(); _log.Info(parser.UsageInfo.GetHeaderAsString(LINE_WIDTH)); if (options.Help) { _log.Info(parser.UsageInfo.GetOptionsAsString(LINE_WIDTH)); return(0); } else if (parser.HasErrors) { _log.Error(parser.UsageInfo.GetErrorsAsString(LINE_WIDTH)); return(-1); } // --- get mode ----------------------------------------------- string mode = options.m; // --- get zip file path -------------------------------------- string zipFilePath = options.f; // --- get destination directory string destinationDirectory = options.d; ProcessingCallback callback = new ProcessingCallback(); if (string.Equals(mode, "backup", StringComparison.CurrentCultureIgnoreCase)) // restore { string errorMessage = string.Empty; if (!BackupRestore.BackupFull(zipFilePath, callback)) { return(-1); } } else // back { string errorMessage = string.Empty; if (!BackupRestore.Restore(zipFilePath, callback)) { return(-1); } } } catch (System.Exception ex) { _log.Error(ex.ToString()); } return(0); }
public bool ImportarBackupDoBD(String caminho) { BackupRestore BR = new BackupRestore(); return(BR.Restore(caminho)); }