public static void ProcessGameData() { IniLoader.RegisterType(new IniLoader.IniTypeDescription("LoadSubsystem", typeof(SubSystem), new IniLoader.IIniDescription[] { new IniLoader.IniPropertyDescription( "Loader", typeof(SubSystem).GetProperty("Loader"), typeof(EnumType<SubSystem.LoaderType>), new ParseHandler(CommonParser.ParseEnumData)), new IniLoader.IniPropertyDescription("InitFile", typeof(SubSystem).GetProperty("InitFiles"), null, new ParseHandler(CommonParser.ParseString), 1, 0), new IniLoader.IniPropertyDescription("InitPath", typeof(SubSystem).GetProperty("InitPaths"), null, new ParseHandler(CommonParser.ParseString), maxOccurrences: 0), new IniLoader.IniPropertyDescription("Extension", typeof(SubSystem).GetProperty("Extensions"), null, new ParseHandler(CommonParser.ParseString), maxOccurrences: 0), new IniLoader.IniPropertyDescription("ExcludePath", typeof(SubSystem).GetProperty("ExcludePaths"), null, new ParseHandler(CommonParser.ParseString), maxOccurrences: 0) })); IniLoader.RegisterType(new IniLoader.IniTypeDescription("MouseCursor", typeof(MouseCursor), new IniLoader.IIniDescription[] { new IniLoader.IniPropertyDescription("File", typeof(MouseCursor).GetProperty("Filename"), null, new ParseHandler(CommonParser.ParseString)), new IniLoader.IniPropertyDescription("Directions", typeof(MouseCursor).GetProperty("Directions"), null, new ParseHandler(CommonParser.ParseInt32)) })); SubSystem subsystemLegend = new SubSystem("GameEngine", SubSystem.LoaderType.INI, new[] { "Data\\INI\\SubsystemLegend.ini" }, null, null, null); subsystemLegend.Load(); SubsystemLegend.TheSubSystems = subsystemLegend.LoadedTypes; for (int idx = 0; idx < SubsystemLegend.TheSubSystems.Length; ++idx) { if (SubsystemLegend.TheSubSystems[idx].Id.Equals(GlobalData.SubSystemGameEngine)) // GameEngine { SubSystem gameEngine = (SubsystemLegend.TheSubSystems[idx] as SubSystem); gameEngine.Load(); for (int idy = 0; idy < gameEngine.LoadedTypes.Length; ++idy) { if (gameEngine.LoadedTypes[idy] is MouseCursor) { IntPtr[] hCurorArray; (gameEngine.LoadedTypes[idy] as MouseCursor).LoadCursors(out hCurorArray); if (hCurorArray.Length == 1) { if (hCurorArray[0] != IntPtr.Zero) { GlobalData.Current.Cursors.Add(gameEngine.LoadedTypes[idy].Id, new System.Windows.Forms.Cursor(hCurorArray[0])); } } else { for (int idz = 0; idz < hCurorArray.Length; ++idz) { if (hCurorArray[idz] != IntPtr.Zero) { GlobalData.Current.Cursors.Add(gameEngine.LoadedTypes[idy].Id.TheString + idz, new System.Windows.Forms.Cursor(hCurorArray[idz])); } } } } } break; } } }
public static ABaseAssetType[] LoadAssetTypes(SubSystem subsystem) { List<ABaseAssetType> resultList = new List<ABaseAssetType>(); if (subsystem.InitFiles != null) { for (int idx = 0; idx < subsystem.InitFiles.Count; ++idx) { switch (subsystem.Loader.Value) { case SubSystem.LoaderType.INI: resultList.AddRange(IniLoader.Load(FileLoader.GetFileBuffer(subsystem.InitFiles[idx]))); break; case SubSystem.LoaderType.XML: break; } } } return resultList.ToArray(); }