private OEMType getActualOemType() { if (TabletConfigUtils.isHuionTablet(HNStruct.globalInfo.tabletInfo.devType)) { return(OEMType.HUION); } if (TabletConfigUtils.isGaomonTablet(HNStruct.globalInfo.tabletInfo.devType)) { return(OEMType.GAOMON); } if (TabletConfigUtils.isYinengTablet(HNStruct.globalInfo.tabletInfo.devType)) { return(OEMType.YINENG); } if (TabletConfigUtils.isYoushangTablet(HNStruct.globalInfo.tabletInfo.devType)) { return(OEMType.YOUSHANG); } if (TabletConfigUtils.isShijunTablet(HNStruct.globalInfo.tabletInfo.devType)) { return(OEMType.SHIJUN); } if (TabletConfigUtils.isKJCTablet(HNStruct.globalInfo.tabletInfo.devType)) { return(OEMType.KJC); } return(HNStruct.OemType); }
private void onDelayCallback(object o) { uint num = (uint)o; string currentDirectory = Environment.CurrentDirectory; try { IntPtr tabletInfo = HuionDriverDLL.hnd_get_tablet_info(); HNStruct.globalInfo.tabletInfo = (HNStruct.HNTabletInfo)Marshal.PtrToStructure(tabletInfo, typeof(HNStruct.HNTabletInfo)); if (HNStruct.globalInfo.tabletInfo.devType != 0U) { Console.Write(HNStruct.globalInfo.tabletInfo.devType.ToString()); HNStruct.OemType = getActualOemType(); switch (HNStruct.OemType) { case OEMType.HUION: HNStruct.globalInfo.bOpenedTablet = TabletConfigUtils.isHuionTablet(HNStruct.globalInfo.tabletInfo.devType); Console.WriteLine(HNStruct.globalInfo.bOpenedTablet.ToString()); if (HNStruct.globalInfo.tabletInfo.devType == 19U) { HNStruct.globalInfo.tabletInfo.maxP = (ushort)4095; break; } break; case OEMType.GAOMON: HNStruct.globalInfo.bOpenedTablet = TabletConfigUtils.isGaomonTablet(HNStruct.globalInfo.tabletInfo.devType); break; case OEMType.YINENG: HNStruct.globalInfo.bOpenedTablet = TabletConfigUtils.isYinengTablet(HNStruct.globalInfo.tabletInfo.devType); break; case OEMType.YOUSHANG: HNStruct.globalInfo.bOpenedTablet = TabletConfigUtils.isYoushangTablet(HNStruct.globalInfo.tabletInfo.devType); break; case OEMType.SHIJUN: HNStruct.globalInfo.bOpenedTablet = TabletConfigUtils.isShijunTablet(HNStruct.globalInfo.tabletInfo.devType); break; case OEMType.KJC: HNStruct.globalInfo.bOpenedTablet = TabletConfigUtils.isKJCTablet(HNStruct.globalInfo.tabletInfo.devType); break; default: HNStruct.globalInfo.bOpenedTablet = false; break; } if (HNStruct.globalInfo.bOpenedTablet) { new TabletConfigUtils().readConfig(); } else { ThreadPool.QueueUserWorkItem(new WaitCallback(TabletConfigUtils.closeDevice)); } MiddleModule.PostMessage((object)this, (object)num); } else { HNStruct.globalInfo.bOpenedTablet = false; MiddleModule.PostMessage((object)this, (object)0); } } catch (Exception ex) { HuionLog.printSaveLog("open device callback", ex.Message); HuionLog.printSaveLog("当前路径", currentDirectory); HuionLog.printSaveLog("open device callback", ex.StackTrace); HNStruct.globalInfo.bOpenedTablet = false; MiddleModule.PostMessage((object)this, (object)0); } }