private void LoadSettings() { location2Enabled = Convert.ToBoolean(HS.GetINISetting("Settings", "bUseLocation2", Convert.ToString(false), "")); if (location2Enabled) { location1First = Convert.ToBoolean(HS.GetINISetting("Settings", "bLocationFirst", Convert.ToString(false), "")); } else { location1First = true; } }
private T GetValue <T>(string key, T defaultValue, string section) { string stringValue = HS.GetINISetting(section, key, null, FileName); if (stringValue != null) { try { T result = (T)System.Convert.ChangeType(stringValue, typeof(T), CultureInfo.InvariantCulture); return(result); } catch (Exception) { return(defaultValue); } } return(defaultValue); }
public override string InitIO(string port) { // debug HS.WriteLog(Name, "Entering InitIO"); // initialise everything here, return a blank string only if successful, or an error message var _port = HS.GetINISetting("Config", "Port", "8080", IniFilename); // Configure events for when values change Callback.RegisterEventCB(Enums.HSEvent.VALUE_SET, PLUGIN_NAME, ""); Callback.RegisterEventCB(Enums.HSEvent.VALUE_CHANGE, PLUGIN_NAME, ""); Callback.RegisterEventCB(Enums.HSEvent.STRING_CHANGE, PLUGIN_NAME, ""); HS.RegisterPage("WebSocketNotificationConfig", Name, ""); WebPageDesc configLink = new WebPageDesc { plugInName = Name, plugInInstance = "", link = "WebSocketNotificationConfig", linktext = "Config", order = 1, page_title = "WebSockets Notifications Settings" }; Callback.RegisterConfigLink(configLink); Callback.RegisterLink(configLink); WebSocketServer.Start("http://localhost:" + _port + "/"); // debug HS.WriteLog(Name, "Completed InitIO"); return(""); }