From eee4e9c0fe434e3c49d53b5b8dcca1836a08abf8 Mon Sep 17 00:00:00 2001 From: Zoryn Date: Thu, 3 Mar 2016 14:01:32 -0500 Subject: updates to change working location --- StardewModdingAPI/Extensions.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'StardewModdingAPI/Extensions.cs') diff --git a/StardewModdingAPI/Extensions.cs b/StardewModdingAPI/Extensions.cs index 8b99be1c..8fd34b6c 100644 --- a/StardewModdingAPI/Extensions.cs +++ b/StardewModdingAPI/Extensions.cs @@ -29,15 +29,26 @@ namespace StardewModdingAPI return result; } - public static bool IsInt32(this string s) + public static bool IsInt32(this object o) { int i; - return Int32.TryParse(s, out i); + return Int32.TryParse(o.ToString(), out i); } - public static Int32 AsInt32(this string s) + public static Int32 AsInt32(this object o) { - return Int32.Parse(s); + return Int32.Parse(o.ToString()); + } + + public static bool IsBool(this object o) + { + bool b; + return Boolean.TryParse(o.ToString(), out b); + } + + public static bool AsBool(this object o) + { + return Boolean.Parse(o.ToString()); } public static int GetHash(this IEnumerable enumerable) -- cgit