diff --git a/ArchiSteamFarm/CardsFarmer.cs b/ArchiSteamFarm/CardsFarmer.cs index aadc7d4a0..5241d8aab 100755 --- a/ArchiSteamFarm/CardsFarmer.cs +++ b/ArchiSteamFarm/CardsFarmer.cs @@ -1064,7 +1064,7 @@ namespace ArchiSteamFarm { return obj is Game game && Equals(game); } - public override int GetHashCode() => (int) (AppID - int.MaxValue); + public override int GetHashCode() => (int) (AppID - 1 - int.MaxValue); } } } \ No newline at end of file diff --git a/ArchiSteamFarm/IPC.cs b/ArchiSteamFarm/IPC.cs index 56db6fb43..37ef3ec47 100644 --- a/ArchiSteamFarm/IPC.cs +++ b/ArchiSteamFarm/IPC.cs @@ -549,24 +549,35 @@ namespace ArchiSteamFarm { return true; } - Dictionary result = new Dictionary(); + Dictionary properties = new Dictionary { + { nameof(targetType.BaseType), targetType.BaseType?.GetUnifiedName() }, + { nameof(targetType.CustomAttributes), targetType.CustomAttributes.Select(attribute => attribute.AttributeType.GetUnifiedName()) } + }; + + Dictionary body = new Dictionary(); if (targetType.IsClass) { foreach (FieldInfo field in targetType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(field => !field.IsPrivate)) { - result[field.Name] = field.FieldType.GetUnifiedName(); + body[field.Name] = field.FieldType.GetUnifiedName(); } foreach (PropertyInfo property in targetType.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(property => property.CanRead && !property.GetMethod.IsPrivate)) { - result[property.Name] = property.PropertyType.GetUnifiedName(); + body[property.Name] = property.PropertyType.GetUnifiedName(); } } else if (targetType.IsEnum) { Type enumType = Enum.GetUnderlyingType(targetType); + properties["UnderlyingType"] = enumType.GetUnifiedName(); foreach (object value in Enum.GetValues(targetType)) { - result[value.ToString()] = Convert.ChangeType(value, enumType).ToString(); + body[value.ToString()] = Convert.ChangeType(value, enumType).ToString(); } } + Dictionary result = new Dictionary(2) { + { "Properties", properties }, + { "Body", body } + }; + await ResponseJsonObject(request, response, new GenericResponse(true, "OK", result)).ConfigureAwait(false); return true; }