/// <summary> /// Initializes the plugin. /// This method is called when PinballX loads and initializes the plugin. /// Be sure to return false if a exception ocurres during plugin initialization (plugin will be disabled). /// </summary> /// <param name="InfoPtr">The InfoPTR for the PinballXInfo struct.</param> /// <returns><c>true</c> if the plugins has been initialized succesfully, otherwise <c>false</c></returns> public bool Initialize(IntPtr InfoPtr) { PinballXInfo Info = (PinballXInfo)Marshal.PtrToStructure(InfoPtr, typeof(PinballXInfo)); bool InitOK = true; try { LoadConfig(); Config.EnableLogging = true; Log("Initializing plugin"); ReadPBXConfig(); Log("Initializing DOF"); DM.Init(); Log("DOF initialized"); SetupRomNameLinks(); Log("Sending initial PBX state to DOF"); UpdatePBXState(10); DM.UpdateNamedTableElement("PBXScreenSaver", 0); Log("Init complete"); } catch (Exception E) { Log("Init failed: " + E.Message); Log(". Stack: " + E.StackTrace); String depth = "."; for (Exception ei = E.InnerException; ei != null; ei = ei.InnerException, depth += ".") { Log(depth + " Inner exception: " + ei.Message); Log(depth + ". Stack: " + ei.StackTrace); } InitOK = false; } return(InitOK); }
/// <summary> /// Initializes the plugin. /// This method is called when PinballX loads and initializes the plugin. /// Be sure to return false if a exception ocurres during plugin initialization (plugin will be disabled). /// </summary> /// <param name="InfoPtr">The InfoPTR for the PinballXInfo struct.</param> /// <returns><c>true</c> if the plugins has been initialized succesfully, otherwise <c>false</c></returns> public bool Initialize(IntPtr InfoPtr) { PinballXInfo Info = (PinballXInfo)Marshal.PtrToStructure(InfoPtr, typeof(PinballXInfo)); bool InitOK = true; try { LoadConfig(); Config.EnableLogging = true; Log("Initializing plugin"); ReadPBXConfig(); Log("Initializing DOF"); DM.Init(); Log("DOF initialized"); SetupRomNameLinks(); Log("Sending initial PBX state to DOF"); UpdatePBXState(10); DM.UpdateNamedTableElement("PBXScreenSaver", 0); Log("Init complete"); } catch (Exception E) { Log("Init failed: " + E.Message); InitOK = false; } return(InitOK); }