/// <summary> /// Application entry point /// </summary> /// <param name="args">Command line arguments</param> private static void Main(string[] args) { // Parse the provided arguments if (args.Length > 0) { ParseArguments(args); } WriteOutput(); var appVersion = Assembly.GetExecutingAssembly().GetName().Version; WriteOutput("pfSense Backup Tool v{0}.{1}.{2} by Koen Zomers", new object[] { appVersion.Major, appVersion.Minor, appVersion.Build }); WriteOutput(); // Check if parameters have been provided if (args.Length == 0) { // No arguments have been provided WriteOutput("ERROR: No arguments provided"); WriteOutput(); DisplayHelp(); Environment.Exit(1); } // Make sure the provided arguments have been provided if (string.IsNullOrEmpty(PfSenseServerDetails.Username) || string.IsNullOrEmpty(PfSenseServerDetails.Password) || string.IsNullOrEmpty(PfSenseServerDetails.ServerAddress)) { WriteOutput("ERROR: Not all required options have been provided"); DisplayHelp(); Environment.Exit(1); } // Check if the output filename parsed resulted in an error if (!string.IsNullOrEmpty(OutputFileName) && OutputFileName.Equals("ERROR", StringComparison.InvariantCultureIgnoreCase)) { WriteOutput("ERROR: Provided output filename contains illegal characters"); Environment.Exit(1); } // Retrieve the backup file from pfSense RetrieveBackupFile(); Environment.Exit(0); }