mirror of
https://github.com/SabreTools/NDecrypt.git
synced 2026-02-04 05:35:53 +00:00
Add editorconfig, fix issues
This commit is contained in:
167
.editorconfig
Normal file
167
.editorconfig
Normal file
@@ -0,0 +1,167 @@
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
# Indentation and spacing
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# New line preferences
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
max_line_length = unset
|
||||
|
||||
# using directive preferences
|
||||
csharp_using_directive_placement = outside_namespace
|
||||
dotnet_diagnostic.IDE0005.severity = error
|
||||
|
||||
# Code-block preferences
|
||||
csharp_style_namespace_declarations = block_scoped
|
||||
csharp_style_prefer_method_group_conversion = true
|
||||
csharp_style_prefer_top_level_statements = false
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true
|
||||
csharp_style_inlined_variable_declaration = true
|
||||
csharp_style_unused_value_assignment_preference = discard_variable
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable
|
||||
dotnet_diagnostic.IDE0001.severity = warning
|
||||
dotnet_diagnostic.IDE0002.severity = warning
|
||||
dotnet_diagnostic.IDE0004.severity = warning
|
||||
dotnet_diagnostic.IDE0010.severity = error
|
||||
dotnet_diagnostic.IDE0051.severity = warning
|
||||
dotnet_diagnostic.IDE0052.severity = warning
|
||||
dotnet_diagnostic.IDE0072.severity = warning
|
||||
dotnet_diagnostic.IDE0080.severity = warning
|
||||
dotnet_diagnostic.IDE0100.severity = error
|
||||
dotnet_diagnostic.IDE0110.severity = error
|
||||
dotnet_diagnostic.IDE0120.severity = warning
|
||||
dotnet_diagnostic.IDE0121.severity = warning
|
||||
dotnet_diagnostic.IDE0240.severity = error
|
||||
dotnet_diagnostic.IDE0241.severity = error
|
||||
dotnet_style_coalesce_expression = true
|
||||
dotnet_style_namespace_match_folder = false
|
||||
dotnet_style_null_propagation = true
|
||||
dotnet_style_prefer_auto_properties = true
|
||||
dotnet_style_prefer_collection_expression = when_types_loosely_match
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
|
||||
dotnet_style_prefer_compound_assignment = true
|
||||
csharp_style_prefer_simple_property_accessors = true
|
||||
dotnet_style_prefer_simplified_interpolation = true
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true
|
||||
csharp_style_prefer_unbound_generic_type_in_nameof = true
|
||||
|
||||
# Field preferences
|
||||
dotnet_diagnostic.IDE0044.severity = warning
|
||||
dotnet_style_readonly_field = true
|
||||
|
||||
# Language keyword vs. framework types preferences
|
||||
dotnet_diagnostic.IDE0049.severity = error
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||
dotnet_style_predefined_type_for_member_access = true
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true
|
||||
csharp_style_prefer_readonly_struct = true
|
||||
dotnet_diagnostic.IDE0036.severity = warning
|
||||
dotnet_diagnostic.IDE0040.severity = error
|
||||
dotnet_diagnostic.IDE0380.severity = error
|
||||
dotnet_style_require_accessibility_modifiers = always
|
||||
|
||||
# New-line preferences
|
||||
dotnet_diagnostic.IDE2000.severity = warning
|
||||
dotnet_diagnostic.IDE2002.severity = warning
|
||||
dotnet_diagnostic.IDE2003.severity = warning
|
||||
dotnet_diagnostic.IDE2004.severity = warning
|
||||
dotnet_diagnostic.IDE2005.severity = warning
|
||||
dotnet_diagnostic.IDE2006.severity = warning
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
|
||||
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
|
||||
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = false
|
||||
dotnet_style_allow_statement_immediately_after_block_experimental = false
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all
|
||||
dotnet_diagnostic.IDE0280.severity = error
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_diagnostic.IDE0047.severity = warning
|
||||
dotnet_diagnostic.IDE0048.severity = warning
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||
|
||||
# Pattern-matching preferences
|
||||
dotnet_diagnostic.IDE0019.severity = warning
|
||||
dotnet_diagnostic.IDE0020.severity = warning
|
||||
dotnet_diagnostic.IDE0038.severity = warning
|
||||
dotnet_diagnostic.IDE0066.severity = none
|
||||
dotnet_diagnostic.IDE0083.severity = warning
|
||||
dotnet_diagnostic.IDE0260.severity = warning
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true
|
||||
csharp_style_prefer_not_pattern = true
|
||||
csharp_style_prefer_pattern_matching = true
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false
|
||||
dotnet_style_qualification_for_field = false
|
||||
dotnet_style_qualification_for_method = false
|
||||
dotnet_style_qualification_for_property = false
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_for_built_in_types = false
|
||||
csharp_style_var_when_type_is_apparent = true
|
||||
|
||||
# .NET formatting options
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = true
|
||||
|
||||
# C# formatting options
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = false
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
@@ -28,7 +28,7 @@ namespace NDecrypt.Core
|
||||
try
|
||||
{
|
||||
// If the output is provided, copy the input file
|
||||
if (output != null)
|
||||
if (output is not null)
|
||||
File.Copy(input, output, overwrite: true);
|
||||
else
|
||||
output = input;
|
||||
@@ -38,14 +38,14 @@ namespace NDecrypt.Core
|
||||
|
||||
// Deserialize the cart information
|
||||
var nitro = Nitro.Create(reader);
|
||||
if (nitro == null)
|
||||
if (nitro is null)
|
||||
{
|
||||
Console.WriteLine("Error: Not a DS or DSi Rom!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ensure the secure area was read
|
||||
if (nitro.SecureArea == null)
|
||||
if (nitro.SecureArea is null)
|
||||
{
|
||||
Console.WriteLine("Error: Invalid secure area!");
|
||||
return false;
|
||||
@@ -80,7 +80,7 @@ namespace NDecrypt.Core
|
||||
try
|
||||
{
|
||||
// If the output is provided, copy the input file
|
||||
if (output != null)
|
||||
if (output is not null)
|
||||
File.Copy(input, output, overwrite: true);
|
||||
else
|
||||
output = input;
|
||||
@@ -90,14 +90,14 @@ namespace NDecrypt.Core
|
||||
|
||||
// Deserialize the cart information
|
||||
var nitro = Nitro.Create(reader);
|
||||
if (nitro == null)
|
||||
if (nitro is null)
|
||||
{
|
||||
Console.WriteLine("Error: Not a DS or DSi Rom!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ensure the secure area was read
|
||||
if (nitro.SecureArea == null)
|
||||
if (nitro.SecureArea is null)
|
||||
{
|
||||
Console.WriteLine("Error: Invalid secure area!");
|
||||
return false;
|
||||
@@ -136,7 +136,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Deserialize the cart information
|
||||
var cart = Nitro.Create(input);
|
||||
if (cart?.Model == null)
|
||||
if (cart?.Model is null)
|
||||
return "Error: Not a DS/DSi cart image!";
|
||||
|
||||
// Get a string builder for the status
|
||||
@@ -145,7 +145,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Get the encryption status
|
||||
bool? decrypted = cart.CheckIfDecrypted(out _);
|
||||
if (decrypted == null)
|
||||
if (decrypted is null)
|
||||
sb.Append("Empty");
|
||||
else if (decrypted == true)
|
||||
sb.Append("Decrypted");
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace NDecrypt.Core
|
||||
/// <param name="keyfile">Path to the keyfile</param>
|
||||
public DecryptArgs(string? config)
|
||||
{
|
||||
if (config == null || !File.Exists(config))
|
||||
if (config is null || !File.Exists(config))
|
||||
{
|
||||
IsReady = false;
|
||||
return;
|
||||
@@ -252,7 +252,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Try to read the configuration file
|
||||
var configObj = Configuration.Create(config);
|
||||
if (configObj == null)
|
||||
if (configObj is null)
|
||||
{
|
||||
IsReady = false;
|
||||
return;
|
||||
@@ -284,7 +284,7 @@ namespace NDecrypt.Core
|
||||
if (NitroEncryptionData.Length > 0)
|
||||
{
|
||||
byte[]? actual = HashTool.GetByteArrayHashArray(NitroEncryptionData, HashType.SHA512);
|
||||
if (actual == null || !actual.EqualsExactly(ExpectedNitroSha512Hash))
|
||||
if (actual is null || !actual.EqualsExactly(ExpectedNitroSha512Hash))
|
||||
{
|
||||
Console.WriteLine($"NitroEncryptionData invalid value, disabling...");
|
||||
NitroEncryptionData = [];
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/// <param name="force">Indicates if the operation should be forced</param>
|
||||
/// <returns>True if the file could be encrypted, false otherwise</returns>
|
||||
/// <remarks>If an output filename is not provided, the input file will be overwritten</remarks>
|
||||
bool EncryptFile(string input, string? output, bool force);
|
||||
public bool EncryptFile(string input, string? output, bool force);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to decrypt an input file
|
||||
@@ -20,13 +20,13 @@
|
||||
/// <param name="force">Indicates if the operation should be forced</param>
|
||||
/// <returns>True if the file could be decrypted, false otherwise</returns>
|
||||
/// <remarks>If an output filename is not provided, the input file will be overwritten</remarks>
|
||||
bool DecryptFile(string input, string? output, bool force);
|
||||
public bool DecryptFile(string input, string? output, bool force);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to get information on an input file
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file get information on</param>
|
||||
/// <returns>String representing the info, null on error</returns>
|
||||
string? GetInformation(string filename);
|
||||
public string? GetInformation(string filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace NDecrypt.Core
|
||||
// Validate inputs
|
||||
if (args.IsReady != true)
|
||||
throw new InvalidOperationException($"{nameof(args)} must be initialized before use");
|
||||
if (signature != null && signature.Length < 16)
|
||||
if (signature is not null && signature.Length < 16)
|
||||
throw new ArgumentOutOfRangeException(nameof(signature), $"{nameof(signature)} must be at least 16 bytes");
|
||||
|
||||
// Set fields for future use
|
||||
@@ -55,7 +55,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Backup headers can't have a KeyY value set
|
||||
KeyY = new byte[16];
|
||||
if (signature != null)
|
||||
if (signature is not null)
|
||||
Array.Copy(signature, KeyY, 16);
|
||||
|
||||
// Set the standard normal key values
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace NDecrypt.Core
|
||||
try
|
||||
{
|
||||
// If the output is provided, copy the input file
|
||||
if (output != null)
|
||||
if (output is not null)
|
||||
File.Copy(input, output, overwrite: true);
|
||||
else
|
||||
output = input;
|
||||
@@ -58,7 +58,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Deserialize the cart information
|
||||
var cart = N3DS.Create(reader);
|
||||
if (cart?.Model == null)
|
||||
if (cart?.Model is null)
|
||||
{
|
||||
Console.WriteLine("Error: Not a 3DS cart image!");
|
||||
return false;
|
||||
@@ -86,7 +86,7 @@ namespace NDecrypt.Core
|
||||
private void DecryptAllPartitions(N3DS cart, bool force, Stream reader, Stream writer)
|
||||
{
|
||||
// Check the partitions table
|
||||
if (cart.PartitionsTable == null || cart.Partitions == null)
|
||||
if (cart.PartitionsTable is null || cart.Partitions is null)
|
||||
{
|
||||
Console.WriteLine("Invalid partitions table!");
|
||||
return;
|
||||
@@ -96,7 +96,7 @@ namespace NDecrypt.Core
|
||||
for (int p = 0; p < 8; p++)
|
||||
{
|
||||
var partition = cart.Partitions[p];
|
||||
if (partition == null || partition.MagicID != NCCHMagicNumber)
|
||||
if (partition is null || partition.MagicID != NCCHMagicNumber)
|
||||
{
|
||||
Console.WriteLine($"Partition {p} Not found... Skipping...");
|
||||
continue;
|
||||
@@ -104,7 +104,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Check the partition has data
|
||||
var partitionEntry = cart.PartitionsTable[p];
|
||||
if (partitionEntry == null || partitionEntry.Length == 0)
|
||||
if (partitionEntry is null || partitionEntry.Length == 0)
|
||||
{
|
||||
Console.WriteLine($"Partition {p} No data... Skipping...");
|
||||
continue;
|
||||
@@ -168,7 +168,7 @@ namespace NDecrypt.Core
|
||||
{
|
||||
// Get the partition
|
||||
var partition = cart.Partitions?[index];
|
||||
if (partition?.Flags == null)
|
||||
if (partition?.Flags is null)
|
||||
return;
|
||||
|
||||
// Get partition-specific values
|
||||
@@ -325,7 +325,7 @@ namespace NDecrypt.Core
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private void DecryptExeFSFileEntries(N3DS cart, int index, Stream reader, Stream writer)
|
||||
{
|
||||
if (cart.ExeFSHeaders == null || index < 0 || index > cart.ExeFSHeaders.Length)
|
||||
if (cart.ExeFSHeaders is null || index < 0 || index > cart.ExeFSHeaders.Length)
|
||||
{
|
||||
Console.WriteLine($"Partition {index} ExeFS: No Data... Skipping...");
|
||||
return;
|
||||
@@ -338,7 +338,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Get the ExeFS header
|
||||
var exeFsHeader = cart.ExeFSHeaders[index];
|
||||
if (exeFsHeader?.FileHeaders == null)
|
||||
if (exeFsHeader?.FileHeaders is null)
|
||||
{
|
||||
Console.WriteLine($"Partition {index} ExeFS header does not exist. Skipping...");
|
||||
return;
|
||||
@@ -356,7 +356,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Get the file header
|
||||
var fileHeader = exeFsHeader.FileHeaders[i];
|
||||
if (fileHeader == null)
|
||||
if (fileHeader is null)
|
||||
continue;
|
||||
|
||||
// Create the ExeFS AES ciphers for this partition
|
||||
@@ -466,7 +466,7 @@ namespace NDecrypt.Core
|
||||
try
|
||||
{
|
||||
// If the output is provided, copy the input file
|
||||
if (output != null)
|
||||
if (output is not null)
|
||||
File.Copy(input, output, overwrite: true);
|
||||
else
|
||||
output = input;
|
||||
@@ -477,7 +477,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Deserialize the cart information
|
||||
var cart = N3DS.Create(reader);
|
||||
if (cart?.Model == null)
|
||||
if (cart?.Model is null)
|
||||
{
|
||||
Console.WriteLine("Error: Not a 3DS cart image!");
|
||||
return false;
|
||||
@@ -505,7 +505,7 @@ namespace NDecrypt.Core
|
||||
private void EncryptAllPartitions(N3DS cart, bool force, Stream reader, Stream writer)
|
||||
{
|
||||
// Check the partitions table
|
||||
if (cart.PartitionsTable == null || cart.Partitions == null)
|
||||
if (cart.PartitionsTable is null || cart.Partitions is null)
|
||||
{
|
||||
Console.WriteLine("Invalid partitions table!");
|
||||
return;
|
||||
@@ -516,7 +516,7 @@ namespace NDecrypt.Core
|
||||
{
|
||||
// Check the partition exists
|
||||
var partition = cart.Partitions[p];
|
||||
if (partition == null || partition.MagicID != NCCHMagicNumber)
|
||||
if (partition is null || partition.MagicID != NCCHMagicNumber)
|
||||
{
|
||||
Console.WriteLine($"Partition {p} Not found... Skipping...");
|
||||
continue;
|
||||
@@ -524,7 +524,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Check the partition has data
|
||||
var partitionEntry = cart.PartitionsTable[p];
|
||||
if (partitionEntry == null || partitionEntry.Length == 0)
|
||||
if (partitionEntry is null || partitionEntry.Length == 0)
|
||||
{
|
||||
Console.WriteLine($"Partition {p} No data... Skipping...");
|
||||
continue;
|
||||
@@ -588,12 +588,12 @@ namespace NDecrypt.Core
|
||||
{
|
||||
// Get the partition
|
||||
var partition = cart.Partitions?[index];
|
||||
if (partition == null)
|
||||
if (partition is null)
|
||||
return;
|
||||
|
||||
// Get the backup header
|
||||
var backupHeader = cart.BackupHeader;
|
||||
if (backupHeader?.Flags == null)
|
||||
if (backupHeader?.Flags is null)
|
||||
return;
|
||||
|
||||
// Get partition-specific values
|
||||
@@ -658,7 +658,7 @@ namespace NDecrypt.Core
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private bool EncryptExeFS(N3DS cart, int index, Stream reader, Stream writer)
|
||||
{
|
||||
if (cart.ExeFSHeaders == null || index < 0 || index > cart.ExeFSHeaders.Length)
|
||||
if (cart.ExeFSHeaders is null || index < 0 || index > cart.ExeFSHeaders.Length)
|
||||
{
|
||||
Console.WriteLine($"Partition {index} ExeFS: No Data... Skipping...");
|
||||
return false;
|
||||
@@ -666,7 +666,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Get the ExeFS header
|
||||
var exefsHeader = cart.ExeFSHeaders[index];
|
||||
if (exefsHeader == null)
|
||||
if (exefsHeader is null)
|
||||
{
|
||||
Console.WriteLine($"Partition {index} ExeFS header does not exist. Skipping...");
|
||||
return false;
|
||||
@@ -764,7 +764,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// If the header failed to read, log and return
|
||||
var exeFsHeader = cart.ExeFSHeaders?[index];
|
||||
if (exeFsHeader?.FileHeaders == null)
|
||||
if (exeFsHeader?.FileHeaders is null)
|
||||
{
|
||||
Console.WriteLine($"Partition {index} ExeFS header does not exist. Skipping...");
|
||||
return;
|
||||
@@ -779,7 +779,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Get the file header
|
||||
var fileHeader = exeFsHeader.FileHeaders[i];
|
||||
if (fileHeader == null)
|
||||
if (fileHeader is null)
|
||||
continue;
|
||||
|
||||
// Create the ExeFS AES ciphers for this partition
|
||||
@@ -863,7 +863,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Get the backup header
|
||||
var backupHeader = cart.BackupHeader;
|
||||
if (backupHeader?.Flags == null)
|
||||
if (backupHeader?.Flags is null)
|
||||
return;
|
||||
|
||||
// Seek to the CryptoMethod location
|
||||
@@ -901,7 +901,7 @@ namespace NDecrypt.Core
|
||||
|
||||
// Deserialize the cart information
|
||||
var cart = N3DS.Create(input);
|
||||
if (cart?.Model == null)
|
||||
if (cart?.Model is null)
|
||||
return "Error: Not a 3DS cart image!";
|
||||
|
||||
// Get a string builder for the status
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace NDecrypt.Features
|
||||
|
||||
// Get the hash string from the file
|
||||
string? hashString = HashingHelper.GetInfo(filename);
|
||||
if (hashString == null)
|
||||
if (hashString is null)
|
||||
return;
|
||||
|
||||
// Open the output file and write the hashes
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace NDecrypt.Features
|
||||
{
|
||||
// Attempt to derive the tool for the path
|
||||
var tool = DeriveTool(input);
|
||||
if (tool == null)
|
||||
if (tool is null)
|
||||
return;
|
||||
|
||||
// Derive the output filename, if required
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace NDecrypt.Features
|
||||
{
|
||||
// Attempt to derive the tool for the path
|
||||
var tool = DeriveTool(input);
|
||||
if (tool == null)
|
||||
if (tool is null)
|
||||
return;
|
||||
|
||||
// Derive the output filename, if required
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace NDecrypt.Features
|
||||
{
|
||||
// Attempt to derive the tool for the path
|
||||
var tool = DeriveTool(input);
|
||||
if (tool == null)
|
||||
if (tool is null)
|
||||
return;
|
||||
|
||||
Console.WriteLine($"Processing {input}");
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace NDecrypt
|
||||
// Get the file information, if possible
|
||||
HashType[] hashTypes = [HashType.CRC32, HashType.MD5, HashType.SHA1, HashType.SHA256];
|
||||
var hashDict = HashTool.GetFileHashesAndSize(input, hashTypes, out long size);
|
||||
if (hashDict == null)
|
||||
if (hashDict is null)
|
||||
return null;
|
||||
|
||||
// Get the results
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace NDecrypt
|
||||
var commandSet = CreateCommands();
|
||||
|
||||
// If we have no args, show the help and quit
|
||||
if (args == null || args.Length == 0)
|
||||
if (args is null || args.Length == 0)
|
||||
{
|
||||
commandSet.OutputAllHelp();
|
||||
return;
|
||||
@@ -25,7 +25,7 @@ namespace NDecrypt
|
||||
|
||||
// Get the associated feature
|
||||
var topLevel = commandSet.GetTopLevel(featureName);
|
||||
if (topLevel == null || topLevel is not Feature feature)
|
||||
if (topLevel is null || topLevel is not Feature feature)
|
||||
{
|
||||
Console.WriteLine($"'{featureName}' is not valid feature flag");
|
||||
commandSet.OutputFeatureHelp(featureName);
|
||||
|
||||
Reference in New Issue
Block a user