private bool Init() { try { var dbLocation = string.Format(ConfigurationManager.AppSettings["dbLocation"], Directory.GetCurrentDirectory()); var dbConn = string.Format(ConfigurationManager.AppSettings["dbConnStr"], dbLocation); FirmwareSerialLoaderSqliteContext.DefaultConnectinoString = dbConn; var ctx = new FirmwareSerialLoaderSqliteContext(); BinFileOptionsHelper.UpdateConfigDicts(ctx.ConfigDicts); DownloadConfigs.InitConfigs(ctx.LocalConfigs); return(true); } catch (Exception ex) { SimpleLog.Fatal("加载数据库信息失败!", ex); return(false); } }
private bool FreeExclusiveDraw() { if (originalHandler == null) { return(true); } try { var dalamudAssembly = Service.PluginInterface.GetType().Assembly; var service1T = dalamudAssembly.GetType("Dalamud.Service`1"); var interfaceManagerT = dalamudAssembly.GetType("Dalamud.Interface.Internal.InterfaceManager"); if (service1T == null) { return(false); } if (interfaceManagerT == null) { return(false); } var serviceInterfaceManager = service1T.MakeGenericType(interfaceManagerT); var getter = serviceInterfaceManager.GetMethod("Get", BindingFlags.Static | BindingFlags.Public); if (getter == null) { return(false); } var interfaceManager = getter.Invoke(null, null); if (interfaceManager == null) { return(false); } var ef = interfaceManagerT.GetField("Draw", BindingFlags.Instance | BindingFlags.NonPublic); if (ef == null) { return(false); } ef.SetValue(interfaceManager, originalHandler); originalHandler = null; return(true); } catch (Exception ex) { SimpleLog.Fatal(ex); SimpleLog.Fatal("This could be messy..."); } return(false); }