public static void LoadStaticContent(string contentManagerName)
{
if (string.IsNullOrEmpty(contentManagerName))
{
throw new ArgumentException("contentManagerName cannot be empty or null");
}
ContentManagerName = contentManagerName;
#if DEBUG
if (contentManagerName == FlatRedBallServices.GlobalContentManager)
{
HasBeenLoadedWithGlobalContentManager = true;
}
else if (HasBeenLoadedWithGlobalContentManager)
{
throw new Exception("This type has been loaded with a Global content manager, then loaded with a non-global. This can lead to a lot of bugs");
}
#endif
// ReSharper disable once ConvertToConstant.Local
bool registerUnload = false;
if (LoadedContentManagers.Contains(contentManagerName) == false)
{
LoadedContentManagers.Add(contentManagerName);
lock (LockObject)
{
if (!RegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
{
FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("SpriterObjectTestEntityStaticUnload", UnloadStaticContent);
RegisteredUnloads.Add(ContentManagerName);
}
}
}
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
// ReSharper disable HeuristicUnreachableCode
{
lock (LockObject)
{
if (!RegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
{
FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("SpriterObjectTestEntityStaticUnload", UnloadStaticContent);
RegisteredUnloads.Add(ContentManagerName);
}
}
}
// ReSharper restore HeuristicUnreachableCode
}