public static bool TypeStarsWith(this TLRPCError error, TLErrorType type) { var strings = error.ErrorMessage.Split(':'); var typeString = strings[0]; return(typeString.StartsWith(type.ToString(), StringComparison.OrdinalIgnoreCase)); }
public static bool TypeEquals(this Error error, TLErrorType type) { if (error == null || error.Message == null) { return(false); } var strings = error.Message.Split(':'); var typeString = strings[0]; if (Enum.IsDefined(typeof(TLErrorType), typeString)) { var value = (TLErrorType)Enum.Parse(typeof(TLErrorType), typeString, true); return(value == type); } return(false); }