mirror of
https://github.com/aaru-dps/Aaru.Helpers.git
synced 2025-12-16 19:24:35 +00:00
Redo Reformat and cleanup.
Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted. This is now done with Rider-stable.
This commit is contained in:
@@ -83,7 +83,7 @@ resharper_braces_for_ifelse
|
||||
resharper_braces_for_while = required_for_multiline
|
||||
resharper_builtin_type_apply_to_native_integer = false
|
||||
resharper_constructor_or_destructor_body = expression_body
|
||||
resharper_csharp_align_first_arg_by_paren = false
|
||||
resharper_csharp_align_first_arg_by_paren = true
|
||||
resharper_csharp_empty_block_style = together_same_line
|
||||
resharper_csharp_place_comments_at_first_column = true
|
||||
resharper_csharp_prefer_qualified_reference = false
|
||||
@@ -108,6 +108,7 @@ resharper_int_align_enum_initializers
|
||||
resharper_int_align_eq = true
|
||||
resharper_keep_existing_embedded_arrangement = false
|
||||
resharper_keep_existing_initializer_arrangement = false
|
||||
resharper_keep_existing_linebreaks = false
|
||||
resharper_keep_existing_list_patterns_arrangement = false
|
||||
resharper_keep_existing_property_patterns_arrangement = false
|
||||
resharper_keep_existing_switch_expression_arrangement = false
|
||||
@@ -125,6 +126,7 @@ resharper_outdent_statement_labels
|
||||
resharper_parentheses_redundancy_style = remove
|
||||
resharper_place_attribute_on_same_line = false
|
||||
resharper_place_simple_embedded_statement_on_same_line = false
|
||||
resharper_place_simple_initializer_on_single_line = false
|
||||
resharper_qualified_using_at_nested_scope = true
|
||||
resharper_show_autodetect_configure_formatting_tip = false
|
||||
resharper_simple_block_style = on_single_line
|
||||
@@ -146,6 +148,8 @@ resharper_use_indent_from_vs
|
||||
resharper_wrap_after_dot_in_method_calls = true
|
||||
resharper_wrap_base_clause_style = chop_if_long
|
||||
resharper_wrap_braced_init_list_style = chop_if_long
|
||||
resharper_wrap_chained_binary_expressions = chop_if_long
|
||||
resharper_wrap_chained_method_calls = chop_if_long
|
||||
resharper_wrap_ctor_initializer_style = chop_if_long
|
||||
resharper_wrap_lines = true
|
||||
resharper_xmldoc_attribute_indent = align_by_first_attribute
|
||||
|
||||
@@ -35,7 +35,10 @@ public static partial class ArrayHelpers
|
||||
/// <param name="destinationArray">Array</param>
|
||||
/// <param name="value">Value</param>
|
||||
/// <typeparam name="T">Array type</typeparam>
|
||||
public static void ArrayFill<T>(T[] destinationArray, T value) => ArrayFill(destinationArray, new[] { value });
|
||||
public static void ArrayFill<T>(T[] destinationArray, T value) => ArrayFill(destinationArray, new[]
|
||||
{
|
||||
value
|
||||
});
|
||||
|
||||
/// <summary>Fills an array with the contents of the specified array</summary>
|
||||
/// <param name="destinationArray">Array</param>
|
||||
|
||||
@@ -215,9 +215,8 @@ public static class DateHandlers
|
||||
int day = (dateRecord & 0x01F0) >> 4;
|
||||
int month = dateRecord & 0x000F;
|
||||
|
||||
AaruConsole.DebugWriteLine(PASCAL_MODULE_NAME,
|
||||
"dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}", dateRecord, year, month,
|
||||
day);
|
||||
AaruConsole.DebugWriteLine(PASCAL_MODULE_NAME, "dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}",
|
||||
dateRecord, year, month, day);
|
||||
|
||||
return new DateTime(year, month, day);
|
||||
}
|
||||
@@ -235,11 +234,11 @@ public static class DateHandlers
|
||||
int minute = (time & 0x7E0) >> 5;
|
||||
int second = (time & 0x1F) * 2;
|
||||
|
||||
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", date,
|
||||
year, month, day);
|
||||
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", date, year,
|
||||
month, day);
|
||||
|
||||
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}",
|
||||
time, hour, minute, second);
|
||||
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}", time,
|
||||
hour, minute, second);
|
||||
|
||||
DateTime dosDate;
|
||||
|
||||
@@ -326,8 +325,7 @@ public static class DateHandlers
|
||||
/// <returns>.NET DateTime</returns>
|
||||
public static DateTime Os9ToDateTime(byte[] date)
|
||||
{
|
||||
if(date == null ||
|
||||
date.Length != 3 && date.Length != 5)
|
||||
if(date == null || date.Length != 3 && date.Length != 5)
|
||||
return DateTime.MinValue;
|
||||
|
||||
DateTime os9Date;
|
||||
|
||||
25
Marshal.cs
25
Marshal.cs
@@ -326,20 +326,22 @@ public static class Marshal
|
||||
var flt = (float)(fi.GetValue(str) ?? default(float));
|
||||
byte[] flt_b = BitConverter.GetBytes(flt);
|
||||
|
||||
fi.SetValue(str, BitConverter.ToSingle(new[] { flt_b[3], flt_b[2], flt_b[1], flt_b[0] }, 0));
|
||||
fi.SetValue(str, BitConverter.ToSingle(new[]
|
||||
{
|
||||
flt_b[3], flt_b[2], flt_b[1], flt_b[0]
|
||||
}, 0));
|
||||
}
|
||||
else if(fi.FieldType == typeof(double))
|
||||
{
|
||||
var dbl = (double)(fi.GetValue(str) ?? default(double));
|
||||
byte[] dbl_b = BitConverter.GetBytes(dbl);
|
||||
|
||||
fi.SetValue(
|
||||
str,
|
||||
BitConverter.ToDouble(
|
||||
new[] { dbl_b[7], dbl_b[6], dbl_b[5], dbl_b[4], dbl_b[3], dbl_b[2], dbl_b[1], dbl_b[0] }, 0));
|
||||
fi.SetValue(str, BitConverter.ToDouble(new[]
|
||||
{
|
||||
dbl_b[7], dbl_b[6], dbl_b[5], dbl_b[4], dbl_b[3], dbl_b[2], dbl_b[1], dbl_b[0]
|
||||
}, 0));
|
||||
}
|
||||
else if(fi.FieldType == typeof(byte) ||
|
||||
fi.FieldType == typeof(sbyte))
|
||||
else if(fi.FieldType == typeof(byte) || fi.FieldType == typeof(sbyte))
|
||||
{
|
||||
// Do nothing, can't byteswap them!
|
||||
}
|
||||
@@ -349,8 +351,7 @@ public static class Marshal
|
||||
}
|
||||
|
||||
// TODO: Swap arrays
|
||||
else if(fi.FieldType.IsValueType &&
|
||||
fi.FieldType is { IsEnum: false, IsArray: false })
|
||||
else if(fi.FieldType.IsValueType && fi.FieldType is { IsEnum: false, IsArray: false })
|
||||
{
|
||||
object obj = fi.GetValue(str);
|
||||
object strc = SwapStructureMembersEndian(obj);
|
||||
@@ -398,8 +399,7 @@ public static class Marshal
|
||||
}
|
||||
|
||||
// TODO: Swap arrays
|
||||
else if(fi.FieldType.IsValueType &&
|
||||
fi.FieldType is { IsEnum: false, IsArray: false })
|
||||
else if(fi.FieldType.IsValueType && fi.FieldType is { IsEnum: false, IsArray: false })
|
||||
{
|
||||
object obj = fi.GetValue(str);
|
||||
object strc = SwapStructureMembersEndianPdp(obj);
|
||||
@@ -446,8 +446,7 @@ public static class Marshal
|
||||
|
||||
var off = 0;
|
||||
|
||||
if(hex[0] == '0' &&
|
||||
(hex[1] == 'x' || hex[1] == 'X'))
|
||||
if(hex[0] == '0' && (hex[1] == 'x' || hex[1] == 'X'))
|
||||
off = 2;
|
||||
|
||||
outBuf = new byte[(hex.Length - off) / 2];
|
||||
|
||||
@@ -62,8 +62,7 @@ public static class StringHandlers
|
||||
{
|
||||
if(twoBytes)
|
||||
{
|
||||
if(i + 1 < cString.Length &&
|
||||
cString[i + 1] == 0)
|
||||
if(i + 1 < cString.Length && cString[i + 1] == 0)
|
||||
{
|
||||
len++;
|
||||
|
||||
@@ -160,8 +159,7 @@ public static class StringHandlers
|
||||
byte compId = dstring[0];
|
||||
var temp = "";
|
||||
|
||||
if(compId != 8 &&
|
||||
compId != 16)
|
||||
if(compId != 8 && compId != 16)
|
||||
return null;
|
||||
|
||||
for(var byteIndex = 1; byteIndex < dstring.Length;)
|
||||
|
||||
Reference in New Issue
Block a user