0
0
mirror of https://github.com/sp-tarkov/assembly-tool.git synced 2025-02-13 09:50:44 -05:00

Clean up logging

This commit is contained in:
Cj 2024-12-29 13:38:04 -05:00
parent f1d8ac1ccb
commit b763071384
6 changed files with 5 additions and 38 deletions

View File

@ -71,7 +71,6 @@ public class ReCodeItRemapper
tasks.Add( tasks.Add(
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
{ {
Logger.Log($"\nFinding best match for {remap.NewTypeName}...", ConsoleColor.Gray);
ScoreMapping(remap, types); ScoreMapping(remap, types);
}) })
); );

View File

@ -89,8 +89,6 @@ internal static class RenameHelper
// Dont need to do extra work // Dont need to do extra work
if (field.Name == newFieldName) { continue; } if (field.Name == newFieldName) { continue; }
Logger.Log($"Renaming field on type {type.Name} named `{field.Name}` with type `{field.FieldType.TypeName}` to `{newFieldName}`", ConsoleColor.Green);
var oldName = field.Name.ToString(); var oldName = field.Name.ToString();
field.Name = newFieldName; field.Name = newFieldName;
@ -127,7 +125,6 @@ internal static class RenameHelper
{ {
//if (!memRef.Name.IsFieldOrPropNameInList(TokensToMatch)) continue; //if (!memRef.Name.IsFieldOrPropNameInList(TokensToMatch)) continue;
Logger.Log($"Renaming MemRef in method {method.DeclaringType.Name}::{method.Name} from `{memRef.Name}` to `{newDef.Name}`", ConsoleColor.Yellow);
memRef.Name = newDef.Name; memRef.Name = newDef.Name;
} }
} }
@ -161,7 +158,6 @@ internal static class RenameHelper
{ {
if (!fieldDef.Name.IsFieldOrPropNameInList(TokensToMatch)) continue; if (!fieldDef.Name.IsFieldOrPropNameInList(TokensToMatch)) continue;
Logger.Log($"Renaming fieldDef in method {method.Name} from `{fieldDef.Name}` to `{newDef.Name}`", ConsoleColor.Yellow);
fieldDef.Name = newDef.Name; fieldDef.Name = newDef.Name;
} }
} }
@ -197,7 +193,6 @@ internal static class RenameHelper
// Dont need to do extra work // Dont need to do extra work
if (property.Name == newPropertyName) { continue; } if (property.Name == newPropertyName) { continue; }
Logger.Log($"Renaming property on type {type.Name} named `{property.Name}` with type `{property.PropertySig.RetType.TypeName}` to `{newPropertyName}`", ConsoleColor.Green);
property.Name = new UTF8String(newPropertyName); property.Name = new UTF8String(newPropertyName);
propertyCount++; propertyCount++;

View File

@ -69,7 +69,6 @@ internal static class FieldTypeFilters
if (parms.FieldCount >= 0) if (parms.FieldCount >= 0)
{ {
Logger.Log("Matching field count", ConsoleColor.Yellow);
types = types.Where(t => t.Fields.Count == parms.FieldCount); types = types.Where(t => t.Fields.Count == parms.FieldCount);
} }

View File

@ -20,15 +20,12 @@ internal static class GenericTypeFilters
{ {
if (parms.IsNested is true) if (parms.IsNested is true)
{ {
Logger.Log("IsNested Public", ConsoleColor.Yellow);
types = types.Where(t => t.IsNestedPublic); types = types.Where(t => t.IsNestedPublic);
types = FilterNestedByName(types, parms); types = FilterNestedByName(types, parms);
} }
else else
{ {
Logger.Log("IsPublic is true", ConsoleColor.Yellow);
types = types.Where(t => t.IsPublic); types = types.Where(t => t.IsPublic);
} }
} }
@ -36,8 +33,6 @@ internal static class GenericTypeFilters
{ {
if (parms.IsNested is true) if (parms.IsNested is true)
{ {
Logger.Log("IsNested Private or family", ConsoleColor.Yellow);
types = types.Where(t => t.IsNestedPrivate types = types.Where(t => t.IsNestedPrivate
|| t.IsNestedFamily || t.IsNestedFamily
|| t.IsNestedFamilyAndAssembly || t.IsNestedFamilyAndAssembly
@ -47,7 +42,6 @@ internal static class GenericTypeFilters
} }
else else
{ {
Logger.Log("IsPublic is false", ConsoleColor.Yellow);
types = types.Where(t => t.IsNotPublic); types = types.Where(t => t.IsNotPublic);
} }
} }
@ -59,7 +53,6 @@ internal static class GenericTypeFilters
{ {
if (parms.NTParentName is not null) if (parms.NTParentName is not null)
{ {
Logger.Log($"NT Parent: {parms.NTParentName}", ConsoleColor.Yellow);
types = types.Where(t => t.DeclaringType.Name.String == parms.NTParentName); types = types.Where(t => t.DeclaringType.Name.String == parms.NTParentName);
} }
@ -77,12 +70,10 @@ internal static class GenericTypeFilters
// Filter based on abstract or not // Filter based on abstract or not
if (parms.IsAbstract is true) if (parms.IsAbstract is true)
{ {
Logger.Log("IsAbstract is true", ConsoleColor.Yellow);
types = types.Where(t => t.IsAbstract && !t.IsInterface); types = types.Where(t => t.IsAbstract && !t.IsInterface);
} }
else if (parms.IsAbstract is false) else if (parms.IsAbstract is false)
{ {
Logger.Log("IsAbstract is false", ConsoleColor.Yellow);
types = types.Where(t => !t.IsAbstract); types = types.Where(t => !t.IsAbstract);
} }
@ -100,12 +91,10 @@ internal static class GenericTypeFilters
// Filter based on abstract or not // Filter based on abstract or not
if (parms.IsSealed is true) if (parms.IsSealed is true)
{ {
Logger.Log("IsSealed is true", ConsoleColor.Yellow);
types = types.Where(t => t.IsSealed); types = types.Where(t => t.IsSealed);
} }
else if (parms.IsSealed is false) else if (parms.IsSealed is false)
{ {
Logger.Log("IsSealed is false", ConsoleColor.Yellow);
types = types.Where(t => !t.IsSealed); types = types.Where(t => !t.IsSealed);
} }
@ -123,12 +112,10 @@ internal static class GenericTypeFilters
// Filter based on interface or not // Filter based on interface or not
if (parms.IsInterface is true) if (parms.IsInterface is true)
{ {
Logger.Log("IsInterface is true", ConsoleColor.Yellow);
types = types.Where(t => t.IsInterface); types = types.Where(t => t.IsInterface);
} }
else if (parms.IsInterface is false) else if (parms.IsInterface is false)
{ {
Logger.Log("IsInterface is false", ConsoleColor.Yellow);
types = types.Where(t => !t.IsInterface); types = types.Where(t => !t.IsInterface);
} }
@ -145,12 +132,10 @@ internal static class GenericTypeFilters
{ {
if (parms.IsStruct is true) if (parms.IsStruct is true)
{ {
Logger.Log("IsStruct is true", ConsoleColor.Yellow);
types = types.Where(t => t.IsValueType && !t.IsEnum); types = types.Where(t => t.IsValueType && !t.IsEnum);
} }
else if (parms.IsStruct is false) else if (parms.IsStruct is false)
{ {
Logger.Log("IsStruct is false", ConsoleColor.Yellow);
types = types.Where(t => !t.IsValueType); types = types.Where(t => !t.IsValueType);
} }
@ -168,12 +153,10 @@ internal static class GenericTypeFilters
// Filter based on enum or not // Filter based on enum or not
if (parms.IsEnum is true) if (parms.IsEnum is true)
{ {
Logger.Log("IsEnum is true", ConsoleColor.Yellow);
types = types.Where(t => t.IsEnum); types = types.Where(t => t.IsEnum);
} }
else if (parms.IsEnum is false) else if (parms.IsEnum is false)
{ {
Logger.Log("IsEnum is false", ConsoleColor.Yellow);
types = types.Where(t => !t.IsEnum); types = types.Where(t => !t.IsEnum);
} }
@ -191,12 +174,10 @@ internal static class GenericTypeFilters
// Filter based on HasAttribute or not // Filter based on HasAttribute or not
if (parms.HasAttribute is true) if (parms.HasAttribute is true)
{ {
Logger.Log("HasAttribute is true", ConsoleColor.Yellow);
types = types.Where(t => t.HasCustomAttributes); types = types.Where(t => t.HasCustomAttributes);
} }
else if (parms.HasAttribute is false) else if (parms.HasAttribute is false)
{ {
Logger.Log("HasAttribute is false", ConsoleColor.Yellow);
types = types.Where(t => !t.HasCustomAttributes); types = types.Where(t => !t.HasCustomAttributes);
} }
@ -214,24 +195,20 @@ internal static class GenericTypeFilters
// Filter based on IsDerived or not // Filter based on IsDerived or not
if (parms.IsDerived is true) if (parms.IsDerived is true)
{ {
Logger.Log("IsDerived is true", ConsoleColor.Yellow);
types = types.Where(t => t.GetBaseType()?.Name?.String != "Object"); types = types.Where(t => t.GetBaseType()?.Name?.String != "Object");
if (parms.MatchBaseClass is not null and not "") if (parms.MatchBaseClass is not null and not "")
{ {
Logger.Log($"Matching base class: {parms.MatchBaseClass}", ConsoleColor.Yellow);
types = types.Where(t => t.GetBaseType()?.Name?.String == parms.MatchBaseClass); types = types.Where(t => t.GetBaseType()?.Name?.String == parms.MatchBaseClass);
} }
if (parms.IgnoreBaseClass is not null and not "") if (parms.IgnoreBaseClass is not null and not "")
{ {
Logger.Log($"Ignoring base class: {parms.MatchBaseClass}", ConsoleColor.Yellow);
types = types.Where(t => t.GetBaseType()?.Name?.String != parms.IgnoreBaseClass); types = types.Where(t => t.GetBaseType()?.Name?.String != parms.IgnoreBaseClass);
} }
} }
else if (parms.IsDerived is false) else if (parms.IsDerived is false)
{ {
Logger.Log("IsDerived is false", ConsoleColor.Yellow);
types = types.Where(t => t.GetBaseType()?.Name?.String is "Object"); types = types.Where(t => t.GetBaseType()?.Name?.String is "Object");
} }
@ -248,7 +225,6 @@ internal static class GenericTypeFilters
{ {
if (parms.HasGenericParameters is null) return types; if (parms.HasGenericParameters is null) return types;
Logger.Log("Matching generic parameters", ConsoleColor.Yellow);
types = types.Where(t => t.HasGenericParameters == parms.HasGenericParameters); types = types.Where(t => t.HasGenericParameters == parms.HasGenericParameters);
return types; return types;

View File

@ -69,7 +69,6 @@ internal static class MethodTypeFilters
if (parms.MethodCount >= 0) if (parms.MethodCount >= 0)
{ {
Logger.Log("Matching method count", ConsoleColor.Yellow);
types = types.Where(t => GetMethodCountExcludingConstructors(t) == parms.MethodCount); types = types.Where(t => GetMethodCountExcludingConstructors(t) == parms.MethodCount);
} }

View File

@ -69,7 +69,6 @@ internal static class PropertyTypeFilters
if (parms.PropertyCount >= 0) if (parms.PropertyCount >= 0)
{ {
Logger.Log("Matching property count", ConsoleColor.Yellow);
types = types.Where(t => t.Properties.Count == parms.PropertyCount); types = types.Where(t => t.Properties.Count == parms.PropertyCount);
} }