public static Point GetCoordsProperty(PropertyItem item) { string stringItem = configuration.Get(item); if (stringItem.Contains('|')) { string[] stringItemSplit = stringItem.Split('|'); if (stringItemSplit.Length == 2) { return(new Point() { X = int.Parse(stringItemSplit[0]), Y = int.Parse(stringItemSplit[1]) }); } } stringItem = defaultConfig.Get(item); if (stringItem.Contains('|')) { string[] stringItemSplit = stringItem.Split('|'); if (stringItemSplit.Length == 2) { return(new Point() { X = int.Parse(stringItemSplit[0]), Y = int.Parse(stringItemSplit[1]) }); } } throw new InvalidOperationException("Parsing error on property :" + item.ToString()); }
public static Keys GetKeybindProperty(PropertyItem item) { if (Enum.TryParse <Keys>(configuration.Get(item), out Keys consoleKey)) { return(consoleKey); } else { throw new InvalidOperationException("Parsing error on property :" + item.ToString()); } }
public static bool GetBooleanProperty(PropertyItem item) { string temp = configuration.Get(item); bool result; if (bool.TryParse(temp, out result)) { return(result); } else { throw new InvalidOperationException("Parsing error on property :" + item.ToString()); } }
public static int GetIntegerProperty(PropertyItem item) { string temp = configuration.Get(item); int result; if (int.TryParse(temp, out result)) { return(result); } else { throw new InvalidOperationException("Parsing error on property :" + item.ToString()); } }