Reduce warning/suggestion count to zero.

This commit is contained in:
Dean Herbert
2017-03-09 15:52:40 +09:00
parent a048e666d7
commit d7497330b2
22 changed files with 84 additions and 87 deletions

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization;
@ -184,6 +185,9 @@ namespace osu.Game.IO.Legacy
{
if (formatter == null)
initialize();
Debug.Assert(formatter != null, "formatter != null");
return formatter.Deserialize(stream);
}
@ -203,46 +207,39 @@ namespace osu.Game.IO.Legacy
List<Type> tmpTypes = new List<Type>();
Type genType = null;
try
if (typeName.Contains("System.Collections.Generic") && typeName.Contains("[["))
{
if (typeName.Contains("System.Collections.Generic") && typeName.Contains("[["))
{
string[] splitTyps = typeName.Split('[');
string[] splitTyps = typeName.Split('[');
foreach (string typ in splitTyps)
foreach (string typ in splitTyps)
{
if (typ.Contains("Version"))
{
if (typ.Contains("Version"))
{
string asmTmp = typ.Substring(typ.IndexOf(',') + 1);
string asmName = asmTmp.Remove(asmTmp.IndexOf(']')).Trim();
string typName = typ.Remove(typ.IndexOf(','));
tmpTypes.Add(BindToType(asmName, typName));
}
else if (typ.Contains("Generic"))
{
genType = BindToType(assemblyName, typ);
}
string asmTmp = typ.Substring(typ.IndexOf(',') + 1);
string asmName = asmTmp.Remove(asmTmp.IndexOf(']')).Trim();
string typName = typ.Remove(typ.IndexOf(','));
tmpTypes.Add(BindToType(asmName, typName));
}
if (genType != null && tmpTypes.Count > 0)
else if (typ.Contains("Generic"))
{
return genType.MakeGenericType(tmpTypes.ToArray());
genType = BindToType(assemblyName, typ);
}
}
string toAssemblyName = assemblyName.Split(',')[0];
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly a in assemblies)
if (genType != null && tmpTypes.Count > 0)
{
if (a.FullName.Split(',')[0] == toAssemblyName)
{
typeToDeserialize = a.GetType(typeName);
break;
}
return genType.MakeGenericType(tmpTypes.ToArray());
}
}
catch (Exception exception)
string toAssemblyName = assemblyName.Split(',')[0];
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly a in assemblies)
{
throw exception;
if (a.FullName.Split(',')[0] == toAssemblyName)
{
typeToDeserialize = a.GetType(typeName);
break;
}
}
cache.Add(assemblyName + typeName, typeToDeserialize);

View File

@ -8,6 +8,8 @@ using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
// ReSharper disable ConditionIsAlwaysTrueOrFalse (we're allowing nulls to be passed to the writer where the underlying class doesn't).
// ReSharper disable HeuristicUnreachableCode
namespace osu.Game.IO.Legacy
{