public void SaveSettings() { ConfigNode node = new ConfigNode("MAFSettings"); node.AddValue("name", "default"); node.AddValue("toggleKey", toggleKeyCode.ToString()); node.AddValue("cursorStyle", cursor.ToString()); node.AddValue("mouseSensitivity", mouseSensitivity.ToString()); node.AddValue("invertX", invertX.ToString()); node.AddValue("invertY", invertY.ToString()); ConfigNode saveNode = new ConfigNode(); saveNode.AddNode(node); saveNode.Save(KSPUtil.ApplicationRootPath.Replace("\\", "/") + "GameData/MouseAimFlight/MAFSettings.cfg"); }
/// <summary> /// Gets the cursor style. Returns 'cursor: {0};' without the quotes, /// and with {0} replaced by the cursor style. This method may /// also return a compound style, such as 'cursor: {0};cursor: {1};'. /// Always ends in a trailing semicolon; /// </summary> /// <param name="cursor">The cursor.</param> /// <returns></returns> public static string GetStyle(CursorStyle cursor) { string result = null; switch (cursor) { case CursorStyle.ResizeEast: result = "cursor: e-resize;"; break; case CursorStyle.ResizeNorth: result = "cursor: n-resize;"; break; case CursorStyle.ResizeNorthEast: result = "cursor: ne-resize;"; break; case CursorStyle.ResizeNorthWest: result = "cursor: nw-resize;"; break; case CursorStyle.ResizeSouth: result = "cursor: s-resize;"; break; case CursorStyle.ResizeSouthEast: result = "cursor: se-resize;"; break; case CursorStyle.ResizeSouthWest: result = "cursor: sw-resize;"; break; case CursorStyle.ResizeWest: result = "cursor: w-resize;"; break; case CursorStyle.AllScroll: result = "cursor: all-scroll;"; break; case CursorStyle.ColumnResize: result = "cursor: col-resize;"; break; case CursorStyle.RowResize: result = "cursor: row-resize;"; break; case CursorStyle.NoDrop: result = "cursor: no-drop;"; break; case CursorStyle.NotAllowed: result = "cursor: not-allowed;"; break; case CursorStyle.VerticalText: result = "cursor: vertical-text;"; break; case CursorStyle.Inherit: return ""; case CursorStyle.HandAndPointer: result = HandAndPointer; break; default: result = "cursor: " + cursor.ToString().ToLower() + ";"; break; } return result; }
/// <summary> /// Gets the cursor style. Returns 'cursor: {0};' without the quotes, /// and with {0} replaced by the cursor style. This method may /// also return a compound style, such as 'cursor: {0};cursor: {1};'. /// Always ends in a trailing semicolon; /// </summary> /// <param name="cursor">The cursor.</param> /// <returns></returns> public static string GetStyle(CursorStyle cursor) { string result = null; switch (cursor) { case CursorStyle.ResizeEast: result = "cursor: e-resize;"; break; case CursorStyle.ResizeNorth: result = "cursor: n-resize;"; break; case CursorStyle.ResizeNorthEast: result = "cursor: ne-resize;"; break; case CursorStyle.ResizeNorthWest: result = "cursor: nw-resize;"; break; case CursorStyle.ResizeSouth: result = "cursor: s-resize;"; break; case CursorStyle.ResizeSouthEast: result = "cursor: se-resize;"; break; case CursorStyle.ResizeSouthWest: result = "cursor: sw-resize;"; break; case CursorStyle.ResizeWest: result = "cursor: w-resize;"; break; case CursorStyle.AllScroll: result = "cursor: all-scroll;"; break; case CursorStyle.ColumnResize: result = "cursor: col-resize;"; break; case CursorStyle.RowResize: result = "cursor: row-resize;"; break; case CursorStyle.NoDrop: result = "cursor: no-drop;"; break; case CursorStyle.NotAllowed: result = "cursor: not-allowed;"; break; case CursorStyle.VerticalText: result = "cursor: vertical-text;"; break; case CursorStyle.Inherit: return(""); case CursorStyle.HandAndPointer: result = HandAndPointer; break; default: result = "cursor: " + cursor.ToString().ToLower() + ";"; break; } return(result); }