public T GetSettings <T>() where T : ModSettings, new() { if (modSettings != null && modSettings.GetType() != typeof(T)) { Log.Error($"Mod {Content.Name} attempted to read two different settings classes (was {modSettings.GetType()}, is now {typeof(T)})"); return(null); } if (modSettings != null) { return((T)modSettings); } modSettings = LoadedModManager.ReadModSettings <T>(intContent.FolderName, GetType().Name); modSettings.Mod = this; return(modSettings as T); }
public T GetSettings <T>() where T : ModSettings, new() { if (this.modSettings != null && this.modSettings.GetType() != typeof(T)) { Log.Error(string.Format("Mod {0} attempted to read two different settings classes (was {1}, is now {2})", this.Content.Name, this.modSettings.GetType(), typeof(T))); return((T)((object)null)); } if (this.modSettings != null) { return((T)((object)this.modSettings)); } this.modSettings = LoadedModManager.ReadModSettings <T>(this.intContent.Identifier, base.GetType().Name); this.modSettings.Mod = this; return(this.modSettings as T); }