private bool ValidateOperation(string[] args, out CompressOperations compress) { compress = CompressOperations.Decompress; switch (args[0]) { case "compress": compress = CompressOperations.Compress; break; case "decompress": break; default: Console.WriteLine("Your first argument must be either compress or decompress. Perhaps you made a typo. Please try again"); return(false); } return(true); }
/// <summary> /// Validates whether all arguments from the console are correct, i.e. there are exactly 3 arguments, /// the original_file_name exists and archive_file_name is not taken /// </summary> internal bool ValidateArgs(string[] args, out string inputFilePath, out CompressOperations compress) { compress = CompressOperations.Decompress; inputFilePath = null; if (!ValidateLength(args)) { return(false); } if (!ValidateOperation(args, out compress)) { return(false); } if (!ValidateInputPath(args, out inputFilePath)) { return(false); } return(true); }