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_braces_for_while = required_for_multiline
|
||||||
resharper_builtin_type_apply_to_native_integer = false
|
resharper_builtin_type_apply_to_native_integer = false
|
||||||
resharper_constructor_or_destructor_body = expression_body
|
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_empty_block_style = together_same_line
|
||||||
resharper_csharp_place_comments_at_first_column = true
|
resharper_csharp_place_comments_at_first_column = true
|
||||||
resharper_csharp_prefer_qualified_reference = false
|
resharper_csharp_prefer_qualified_reference = false
|
||||||
@@ -108,6 +108,7 @@ resharper_int_align_enum_initializers
|
|||||||
resharper_int_align_eq = true
|
resharper_int_align_eq = true
|
||||||
resharper_keep_existing_embedded_arrangement = false
|
resharper_keep_existing_embedded_arrangement = false
|
||||||
resharper_keep_existing_initializer_arrangement = false
|
resharper_keep_existing_initializer_arrangement = false
|
||||||
|
resharper_keep_existing_linebreaks = false
|
||||||
resharper_keep_existing_list_patterns_arrangement = false
|
resharper_keep_existing_list_patterns_arrangement = false
|
||||||
resharper_keep_existing_property_patterns_arrangement = false
|
resharper_keep_existing_property_patterns_arrangement = false
|
||||||
resharper_keep_existing_switch_expression_arrangement = false
|
resharper_keep_existing_switch_expression_arrangement = false
|
||||||
@@ -125,6 +126,7 @@ resharper_outdent_statement_labels
|
|||||||
resharper_parentheses_redundancy_style = remove
|
resharper_parentheses_redundancy_style = remove
|
||||||
resharper_place_attribute_on_same_line = false
|
resharper_place_attribute_on_same_line = false
|
||||||
resharper_place_simple_embedded_statement_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_qualified_using_at_nested_scope = true
|
||||||
resharper_show_autodetect_configure_formatting_tip = false
|
resharper_show_autodetect_configure_formatting_tip = false
|
||||||
resharper_simple_block_style = on_single_line
|
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_after_dot_in_method_calls = true
|
||||||
resharper_wrap_base_clause_style = chop_if_long
|
resharper_wrap_base_clause_style = chop_if_long
|
||||||
resharper_wrap_braced_init_list_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_ctor_initializer_style = chop_if_long
|
||||||
resharper_wrap_lines = true
|
resharper_wrap_lines = true
|
||||||
resharper_xmldoc_attribute_indent = align_by_first_attribute
|
resharper_xmldoc_attribute_indent = align_by_first_attribute
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ public static partial class ArrayHelpers
|
|||||||
/// <param name="destinationArray">Array</param>
|
/// <param name="destinationArray">Array</param>
|
||||||
/// <param name="value">Value</param>
|
/// <param name="value">Value</param>
|
||||||
/// <typeparam name="T">Array type</typeparam>
|
/// <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>
|
/// <summary>Fills an array with the contents of the specified array</summary>
|
||||||
/// <param name="destinationArray">Array</param>
|
/// <param name="destinationArray">Array</param>
|
||||||
|
|||||||
@@ -215,9 +215,8 @@ public static class DateHandlers
|
|||||||
int day = (dateRecord & 0x01F0) >> 4;
|
int day = (dateRecord & 0x01F0) >> 4;
|
||||||
int month = dateRecord & 0x000F;
|
int month = dateRecord & 0x000F;
|
||||||
|
|
||||||
AaruConsole.DebugWriteLine(PASCAL_MODULE_NAME,
|
AaruConsole.DebugWriteLine(PASCAL_MODULE_NAME, "dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}",
|
||||||
"dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}", dateRecord, year, month,
|
dateRecord, year, month, day);
|
||||||
day);
|
|
||||||
|
|
||||||
return new DateTime(year, month, day);
|
return new DateTime(year, month, day);
|
||||||
}
|
}
|
||||||
@@ -235,11 +234,11 @@ public static class DateHandlers
|
|||||||
int minute = (time & 0x7E0) >> 5;
|
int minute = (time & 0x7E0) >> 5;
|
||||||
int second = (time & 0x1F) * 2;
|
int second = (time & 0x1F) * 2;
|
||||||
|
|
||||||
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", date,
|
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", date, year,
|
||||||
year, month, day);
|
month, day);
|
||||||
|
|
||||||
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}",
|
AaruConsole.DebugWriteLine(DOS_MODULE_NAME, "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}", time,
|
||||||
time, hour, minute, second);
|
hour, minute, second);
|
||||||
|
|
||||||
DateTime dosDate;
|
DateTime dosDate;
|
||||||
|
|
||||||
@@ -326,8 +325,7 @@ public static class DateHandlers
|
|||||||
/// <returns>.NET DateTime</returns>
|
/// <returns>.NET DateTime</returns>
|
||||||
public static DateTime Os9ToDateTime(byte[] date)
|
public static DateTime Os9ToDateTime(byte[] date)
|
||||||
{
|
{
|
||||||
if(date == null ||
|
if(date == null || date.Length != 3 && date.Length != 5)
|
||||||
date.Length != 3 && date.Length != 5)
|
|
||||||
return DateTime.MinValue;
|
return DateTime.MinValue;
|
||||||
|
|
||||||
DateTime os9Date;
|
DateTime os9Date;
|
||||||
|
|||||||
25
Marshal.cs
25
Marshal.cs
@@ -326,20 +326,22 @@ public static class Marshal
|
|||||||
var flt = (float)(fi.GetValue(str) ?? default(float));
|
var flt = (float)(fi.GetValue(str) ?? default(float));
|
||||||
byte[] flt_b = BitConverter.GetBytes(flt);
|
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))
|
else if(fi.FieldType == typeof(double))
|
||||||
{
|
{
|
||||||
var dbl = (double)(fi.GetValue(str) ?? default(double));
|
var dbl = (double)(fi.GetValue(str) ?? default(double));
|
||||||
byte[] dbl_b = BitConverter.GetBytes(dbl);
|
byte[] dbl_b = BitConverter.GetBytes(dbl);
|
||||||
|
|
||||||
fi.SetValue(
|
fi.SetValue(str, BitConverter.ToDouble(new[]
|
||||||
str,
|
{
|
||||||
BitConverter.ToDouble(
|
dbl_b[7], dbl_b[6], dbl_b[5], dbl_b[4], dbl_b[3], dbl_b[2], dbl_b[1], dbl_b[0]
|
||||||
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));
|
}, 0));
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(byte) ||
|
else if(fi.FieldType == typeof(byte) || fi.FieldType == typeof(sbyte))
|
||||||
fi.FieldType == typeof(sbyte))
|
|
||||||
{
|
{
|
||||||
// Do nothing, can't byteswap them!
|
// Do nothing, can't byteswap them!
|
||||||
}
|
}
|
||||||
@@ -349,8 +351,7 @@ public static class Marshal
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Swap arrays
|
// TODO: Swap arrays
|
||||||
else if(fi.FieldType.IsValueType &&
|
else if(fi.FieldType.IsValueType && fi.FieldType is { IsEnum: false, IsArray: false })
|
||||||
fi.FieldType is { IsEnum: false, IsArray: false })
|
|
||||||
{
|
{
|
||||||
object obj = fi.GetValue(str);
|
object obj = fi.GetValue(str);
|
||||||
object strc = SwapStructureMembersEndian(obj);
|
object strc = SwapStructureMembersEndian(obj);
|
||||||
@@ -398,8 +399,7 @@ public static class Marshal
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Swap arrays
|
// TODO: Swap arrays
|
||||||
else if(fi.FieldType.IsValueType &&
|
else if(fi.FieldType.IsValueType && fi.FieldType is { IsEnum: false, IsArray: false })
|
||||||
fi.FieldType is { IsEnum: false, IsArray: false })
|
|
||||||
{
|
{
|
||||||
object obj = fi.GetValue(str);
|
object obj = fi.GetValue(str);
|
||||||
object strc = SwapStructureMembersEndianPdp(obj);
|
object strc = SwapStructureMembersEndianPdp(obj);
|
||||||
@@ -446,8 +446,7 @@ public static class Marshal
|
|||||||
|
|
||||||
var off = 0;
|
var off = 0;
|
||||||
|
|
||||||
if(hex[0] == '0' &&
|
if(hex[0] == '0' && (hex[1] == 'x' || hex[1] == 'X'))
|
||||||
(hex[1] == 'x' || hex[1] == 'X'))
|
|
||||||
off = 2;
|
off = 2;
|
||||||
|
|
||||||
outBuf = new byte[(hex.Length - off) / 2];
|
outBuf = new byte[(hex.Length - off) / 2];
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ public static class StringHandlers
|
|||||||
{
|
{
|
||||||
if(twoBytes)
|
if(twoBytes)
|
||||||
{
|
{
|
||||||
if(i + 1 < cString.Length &&
|
if(i + 1 < cString.Length && cString[i + 1] == 0)
|
||||||
cString[i + 1] == 0)
|
|
||||||
{
|
{
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
@@ -160,8 +159,7 @@ public static class StringHandlers
|
|||||||
byte compId = dstring[0];
|
byte compId = dstring[0];
|
||||||
var temp = "";
|
var temp = "";
|
||||||
|
|
||||||
if(compId != 8 &&
|
if(compId != 8 && compId != 16)
|
||||||
compId != 16)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
for(var byteIndex = 1; byteIndex < dstring.Length;)
|
for(var byteIndex = 1; byteIndex < dstring.Length;)
|
||||||
|
|||||||
Reference in New Issue
Block a user