1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-24 22:36:19 -04:00
This commit is contained in:
Qstick
2021-08-03 00:43:28 -04:00
committed by Mark McDowall
parent 878d1561aa
commit 1c22a1ec0d
1201 changed files with 5620 additions and 4303 deletions
+3 -12
View File
@@ -53,7 +53,6 @@ namespace Sonarr.Http.ClientSchema
}
return target;
}
public static T ReadFromSchema<T>(List<Field> fields)
@@ -61,7 +60,6 @@ namespace Sonarr.Http.ClientSchema
return (T)ReadFromSchema(fields, typeof(T));
}
// Ideally this function should begin a System.Linq.Expression expression tree since it's faster.
// But it's probably not needed till performance issues pop up.
public static FieldMapping[] GetFieldMappings(Type type)
@@ -81,6 +79,7 @@ namespace Sonarr.Http.ClientSchema
_mappings[type] = result;
}
return result;
}
}
@@ -189,32 +188,26 @@ namespace Sonarr.Http.ClientSchema
{
return fieldValue => fieldValue?.ToString().ParseInt32() ?? 0;
}
else if (propertyType == typeof(long))
{
return fieldValue => fieldValue?.ToString().ParseInt64() ?? 0;
}
else if (propertyType == typeof(double))
{
return fieldValue => fieldValue?.ToString().ParseDouble() ?? 0.0;
}
else if (propertyType == typeof(int?))
{
return fieldValue => fieldValue?.ToString().ParseInt32();
}
else if (propertyType == typeof(Int64?))
else if (propertyType == typeof(long?))
{
return fieldValue => fieldValue?.ToString().ParseInt64();
}
else if (propertyType == typeof(double?))
{
return fieldValue => fieldValue?.ToString().ParseDouble();
}
else if (propertyType == typeof(IEnumerable<int>))
{
return fieldValue =>
@@ -233,7 +226,6 @@ namespace Sonarr.Http.ClientSchema
}
};
}
else if (propertyType == typeof(IEnumerable<string>))
{
return fieldValue =>
@@ -252,7 +244,6 @@ namespace Sonarr.Http.ClientSchema
}
};
}
else
{
return fieldValue => fieldValue;
@@ -261,7 +252,7 @@ namespace Sonarr.Http.ClientSchema
private static string GetCamelCaseName(string name)
{
return Char.ToLowerInvariant(name[0]) + name.Substring(1);
return char.ToLowerInvariant(name[0]) + name.Substring(1);
}
}
}