protected void OnFoundClass(string InID, Type InType) { CheatCommandAttribute cheatCommandAttribute = InType.GetCustomAttributes(typeof(CheatCommandAttribute), false)[0] as CheatCommandAttribute; DebugHelper.Assert(cheatCommandAttribute != null); ICheatCommand cheatCommand = Activator.CreateInstance(InType) as ICheatCommand; DebugHelper.Assert(cheatCommand != null); this.CommandRepositories.Add(cheatCommand); Singleton <CheatCommandsRepository> .instance.RegisterCommand(cheatCommand); }
protected void CacheAttribute() { object[] customAttributes = base.GetType().GetCustomAttributes(typeof(CheatCommandAttribute), false); DebugHelper.Assert((customAttributes != null) && (customAttributes.Length > 0)); this.CachedAttribute = customAttributes[0] as CheatCommandAttribute; DebugHelper.Assert(this.CachedAttribute != null); if (this.CachedAttribute != null) { customAttributes = base.GetType().GetCustomAttributes(typeof(ArgumentDescriptionAttribute), false); if (customAttributes != null) { this.CachedAttribute.IndependentInitialize(customAttributes); } } }
protected void RegisterCommonCommands(Assembly InAssembly) { Type[] types = InAssembly.GetTypes(); for (int i = 0; (types != null) && (i < types.Length); i++) { Type inType = types[i]; object[] customAttributes = inType.GetCustomAttributes(typeof(CheatCommandAttribute), true); if (customAttributes != null) { for (int j = 0; j < customAttributes.Length; j++) { CheatCommandAttribute attribute = customAttributes[j] as CheatCommandAttribute; if (attribute != null) { this.OnFoundClass(attribute.ID, inType); } } } } }
protected void RegisterCommonCommands(Assembly InAssembly) { Type[] types = InAssembly.GetTypes(); int num = 0; while (types != null && num < types.Length) { Type type = types[num]; object[] customAttributes = type.GetCustomAttributes(typeof(CheatCommandAttribute), true); if (customAttributes != null) { for (int i = 0; i < customAttributes.Length; i++) { CheatCommandAttribute cheatCommandAttribute = customAttributes[i] as CheatCommandAttribute; if (cheatCommandAttribute != null) { this.OnFoundClass(cheatCommandAttribute.ID, type); } } } num++; } }