public KeySender(PaneHotKeys KeyItems) { // Store the hotkeys. HotKeys = KeyItems; KeyStrings = new List <string>(); // Name of OBS Window. ProcName = ConfigurationManager.AppSettings.Get("OBSWindowName"); ServiceAppType = ConfigurationManager.AppSettings.Get("StreamServiceSW"); // Find the refocus value. bool.TryParse(ConfigurationManager.AppSettings.Get("ForceRefocus").ToLower(), out ForceFocusOBS); // Check for null. if (string.IsNullOrEmpty(ServiceAppType)) { throw new Exception("PLEASE SPECIFY SERVICE APP TYPE (OBS, XPLIT, ETC)"); } if (string.IsNullOrEmpty(ProcName)) { throw new Exception("PLEASE SPECIFY THE OBS WINDOW NAME AND RESTART THIS APP"); } // Pull in the SendAttempts and SendDelayTime if (!int.TryParse(ConfigurationManager.AppSettings.Get("KeySendCount"), out SendAttempts)) { SendAttempts = 2; // Default send count. } if (!int.TryParse(ConfigurationManager.AppSettings.Get("SendDelayValue"), out SendDelayTime)) { SendDelayTime = 50; // Default delay time. } // Make sure we don't have some absurd value here. uint CheckNegativeSendAttempts = (uint)SendAttempts; uint CheckNegativeSendDelayTime = (uint)SendDelayTime; // Negative value check. SendAttempts = (int)CheckNegativeSendAttempts; SendDelayTime = (int)CheckNegativeSendDelayTime; // Gigantic number check if (SendAttempts >= 5) { SendAttempts = 5; } if (SendDelayTime >= 500) { SendAttempts = 500; } // Convert the list of ConsoleKey items into string items. foreach (var KeyItem in HotKeys.HotKeysList) { KeyStrings.Add(KeyItem.ToString()); } }
private void Awake() { // Initialize the inventory inventory = new Inventory(UseItem); uiInventory.SetPlayer(this); uiInventory.SetInventory(inventory); // Set the inventory as inactive UI_Inventory.SetActive(false); // Initialize the healthbar currentHealth = maxHealth; healthBar.SetMaxHealth(maxHealth); // Initialize the oxygenbar currentOxygen = maxOxygen1; oxygenBar.SetMaxOxygen(maxOxygen1); Debug.Log(keyItem.ToString()); }
/// <summary> /// 检查浏览器 /// </summary> /// <param name="item"></param> /// <param name="ua"></param> public static void KeyItemCheck4Browser(KeyItem item, UserAgent ua) { if (ua.BrowserItem != null && ua.tempBrowser == null) { if (ua.BrowserItem.key == "MSIE") { ua.tempBrowser = ua.BrowserItem.ToString(); } else { ua.Browser = ua.BrowserItem.ToString(); } return; } switch (item.key) { case "Chrome": ua.tempBrowser = item.ToString(); break; case "Firefox": ua.Browser = item.ToString(); break; case "360SE": ua.Browser = item.ToString(); break; case "SE": ua.Browser = string.Format("Sogou Browser:{0}", item.ver); break; case "Maxthon": ua.Browser = item.ToString(); break; case "TencentTraveler": ua.Browser = item.ToString(); break; case "The World": ua.Browser = item.ToString(); break; case "LBBROWSER": ua.Browser = item.ToString(); break; case "Avant": ua.Browser = item.ToString(); break; case "Opera": ua.Browser = item.ToString(); break; case "UCWEB": ua.Browser = item.ToString(); break; case "AppleWebKit": ua.tempBrowser = item.key; break; case "Edge": if (item.next == null && item.ver != null) { ua.Browser = string.Format("Microsoft Edge:{0}", item.ver); } break; case "Version": if (ua.Platform == "Android") { ua.Browser = string.Format("Android Browser:{0}", item.ver); break; } if (ua.tempBrowser == "AppleWebKit") { ua.Browser = string.Format("{0}:{1}", ua.tempBrowser, item.ver); } break; case "rv": if (CheckItem(ua, "Trident", "7.0")) { ua.Browser = string.Format("MSIE:{0}", item.ver); } break; } }
/// <summary> /// 检查平台 /// </summary> /// <param name="item"></param> /// <param name="ua"></param> public static void KeyItemCheck4Plantform(KeyItem item, UserAgent ua) { switch (item.key) { case "Windows NT": switch (item.ver) { case "10.0": case "6.4": ua.Platform = "Windows 10"; break; case "6.3": ua.Platform = "Windows 8.1/Server 2012 R2"; break; case "6.2": ua.Platform = "Windows 8/Server 2012"; break; case "6.1": ua.Platform = "Windows 7/Server 2008 R2"; break; case "6.0": ua.Platform = "Windows Vista/Server 2008"; break; case "5.2": ua.Platform = "Windows Server 2003"; break; case "5.1": ua.Platform = "Windows xp"; break; case "5.0": ua.Platform = "Windows 2000"; break; default: ua.Platform = item.ToString(); break; } break; case "Windows RT": ua.Platform = item.ToString(); break; case "Windows ME": ua.Platform = "Windows ME"; break; case "Windows": if (item.ver == "98") { ua.Platform = "Windows 98"; } else { ua.tempPlatform = "Windows"; } break; case "iPad": ua.Platform = "iPad"; break; case "Macintosh": ua.Platform = "MAC"; break; case "iphone": case "iPhone": ua.Platform = "iPhone"; break; case "iPod": ua.Platform = "iPod"; break; case "Android": ua.Platform = "Android"; break; case "X11": ua.tempPlatform = item.next != null ? item.next.key : "X11"; break; case "Linux": case "Linux x86_64": ua.tempPlatform = "Linux"; break; case "BlackBerry": ua.Platform = "BlackBerry"; break; case "hpwOS": ua.Platform = "Web OS"; break; case "SymbianOS": ua.Platform = "Symbian"; break; //case "Windows Phone OS": // ua.Platform = "Windows Phone"; // break; case "Windows Phone": ua.Platform = "Windows Phone"; break; case "SunOS": ua.Platform = "SunOS"; break; case "Unix": ua.Platform = "Unix"; break; case "FreeBSD": ua.Platform = "FreeBSD"; break; default: break; } }