public static void Execute(ProgramExecutionOptions options) { if (ProgramUtil.ShowHelpIfNeeded(options)) { return; } if (CommandLineUtil.ValidateArguments(options.ParsedArguments, Validations)) { Pair <string, string> pathArg = CommandLineUtil.FindArgumentByName(options.ParsedArguments, PathArgName); Pair <string, string> passwordArg = CommandLineUtil.FindArgumentByName(options.ParsedArguments, PasswordArgName); var path = pathArg.Value; var password = passwordArg.Value; HashFile file = FileSystem.FindFileByPath(path); if (file == null) { var msg = string.Format("The path '{0}' is not a valid file path.", path); ShowErrorMessage(msg); } else { if (file.Status != FileStatus.Encrypted) { var msg = string.Format("The file '{0}' is not encrypt. You can open it using 'open {0}'", path); msg = TextUtil.ApplyNGUIColor(msg, Constants.Colors.Success); TerminalUtil.ShowText(msg); } else { var filePassword = file.Password; if (string.Equals(password, filePassword)) { var msg = string.Format("File '{0}' decrypted successfully. Use 'open {0}' to open the file.", path); msg = TextUtil.ApplyNGUIColor(msg, Constants.Colors.Success); TerminalUtil.ShowText(msg); FileSystem.ChangeFileStatus(file, FileStatus.Normal); } else { var msg = "Invalid password."; ShowErrorMessage(msg); } } } } else { var pathResult = (int)PathValidation.ValidationResult; var passwordResult = (int)PasswordValidation.ValidationResult; if (MathUtil.ContainsFlag(pathResult, (int)ArgValidationResult.NotFound) || MathUtil.ContainsFlag(pathResult, (int)ArgValidationResult.EmptyValue)) { var msg = "You need to supply a path. Please use 'help cracker' for more info."; ShowErrorMessage(msg); } else if (MathUtil.ContainsFlag(passwordResult, (int)ArgValidationResult.NotFound) || MathUtil.ContainsFlag(passwordResult, (int)ArgValidationResult.EmptyValue)) { var msg = "You need to supply a password. Please use 'help cracker' for more info."; ShowErrorMessage(msg); } } }