public static bool ValidateBusinessEvent(string currency, int amount, string cartType, string itemType, string itemId) { if (!GAValidator.ValidateCurrency(currency)) { Debug.Log(string.Concat("Validation fail - business event - currency: Cannot be (null) and need to be A-Z, 3 characters and in the standard at openexchangerates.org. Failed currency: ", currency)); return(false); } if (!GAValidator.ValidateShortString(cartType, true)) { Debug.Log(string.Concat("Validation fail - business event - cartType. Cannot be above 32 length. String: ", cartType)); return(false); } if (!GAValidator.ValidateEventPartLength(itemType, false)) { Debug.Log(string.Concat("Validation fail - business event - itemType: Cannot be (null), empty or above 64 characters. String: ", itemType)); return(false); } if (!GAValidator.ValidateEventPartCharacters(itemType)) { Debug.Log(string.Concat("Validation fail - business event - itemType: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: ", itemType)); return(false); } if (!GAValidator.ValidateEventPartLength(itemId, false)) { Debug.Log(string.Concat("Validation fail - business event - itemId. Cannot be (null), empty or above 64 characters. String: ", itemId)); return(false); } if (GAValidator.ValidateEventPartCharacters(itemId)) { return(true); } Debug.Log(string.Concat("Validation fail - business event - itemId: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: ", itemId)); return(false); }
public static bool ValidateProgressionEvent(GAProgressionStatus progressionStatus, string progression01, string progression02, string progression03) { if (progressionStatus == GAProgressionStatus.Undefined) { Debug.Log("Validation fail - progression event: Invalid progression status."); return(false); } if (!string.IsNullOrEmpty(progression03) && string.IsNullOrEmpty(progression02) && !string.IsNullOrEmpty(progression01)) { Debug.Log("Validation fail - progression event: 03 found but 01+02 are invalid. Progression must be set as either 01, 01+02 or 01+02+03."); return(false); } if (!string.IsNullOrEmpty(progression02) && string.IsNullOrEmpty(progression01)) { Debug.Log("Validation fail - progression event: 02 found but not 01. Progression must be set as either 01, 01+02 or 01+02+03"); return(false); } if (string.IsNullOrEmpty(progression01)) { Debug.Log("Validation fail - progression event: progression01 not valid. Progressions must be set as either 01, 01+02 or 01+02+03"); return(false); } if (!GAValidator.ValidateEventPartLength(progression01, false)) { Debug.Log(string.Concat("Validation fail - progression event - progression01: Cannot be (null), empty or above 64 characters. String: ", progression01)); return(false); } if (!GAValidator.ValidateEventPartCharacters(progression01)) { Debug.Log(string.Concat("Validation fail - progression event - progression01: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: ", progression01)); return(false); } if (!string.IsNullOrEmpty(progression02)) { if (!GAValidator.ValidateEventPartLength(progression02, true)) { Debug.Log(string.Concat("Validation fail - progression event - progression02: Cannot be empty or above 64 characters. String: ", progression02)); return(false); } if (!GAValidator.ValidateEventPartCharacters(progression02)) { Debug.Log(string.Concat("Validation fail - progression event - progression02: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: ", progression02)); return(false); } } if (!string.IsNullOrEmpty(progression03)) { if (!GAValidator.ValidateEventPartLength(progression03, true)) { Debug.Log(string.Concat("Validation fail - progression event - progression03: Cannot be empty or above 64 characters. String: ", progression03)); return(false); } if (!GAValidator.ValidateEventPartCharacters(progression03)) { Debug.Log(string.Concat("Validation fail - progression event - progression03: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: ", progression03)); return(false); } } return(true); }
public static bool ValidateResourceEvent( GAResourceFlowType flowType, string currency, float amount, string itemType, string itemId) { if (string.IsNullOrEmpty(currency)) { Debug.Log((object)"Validation fail - resource event - currency: Cannot be (null)"); return(false); } if (flowType == GAResourceFlowType.Undefined) { Debug.Log((object)"Validation fail - resource event - flowType: Invalid flowType"); } if (!GAState.HasAvailableResourceCurrency(currency)) { Debug.Log((object)("Validation fail - resource event - currency: Not found in list of pre-defined resource currencies. String: " + currency)); return(false); } if ((double)amount <= 0.0) { Debug.Log((object)("Validation fail - resource event - amount: Float amount cannot be 0 or negative. Value: " + (object)amount)); return(false); } if (string.IsNullOrEmpty(itemType)) { Debug.Log((object)"Validation fail - resource event - itemType: Cannot be (null)"); return(false); } if (!GAValidator.ValidateEventPartLength(itemType, false)) { Debug.Log((object)("Validation fail - resource event - itemType: Cannot be (null), empty or above 64 characters. String: " + itemType)); return(false); } if (!GAValidator.ValidateEventPartCharacters(itemType)) { Debug.Log((object)("Validation fail - resource event - itemType: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: " + itemType)); return(false); } if (!GAState.HasAvailableResourceItemType(itemType)) { Debug.Log((object)("Validation fail - resource event - itemType: Not found in list of pre-defined available resource itemTypes. String: " + itemType)); return(false); } if (!GAValidator.ValidateEventPartLength(itemId, false)) { Debug.Log((object)("Validation fail - resource event - itemId: Cannot be (null), empty or above 64 characters. String: " + itemId)); return(false); } if (GAValidator.ValidateEventPartCharacters(itemId)) { return(true); } Debug.Log((object)("Validation fail - resource event - itemId: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: " + itemId)); return(false); }
public static bool ValidateResourceItemTypes(params string[] resourceItemTypes) { if (!GAValidator.ValidateArrayOfStrings(20L, 32L, false, "resource item types", resourceItemTypes)) { return(false); } foreach (string resourceItemType in resourceItemTypes) { if (!GAValidator.ValidateEventPartCharacters(resourceItemType)) { Debug.Log((object)("resource item types validation failed: a resource item type cannot contain other characters than A-z, 0-9, -_., ()!?. String was: " + resourceItemType)); return(false); } } return(true); }
public static bool ValidateResourceItemTypes(params string[] resourceItemTypes) { if (!GAValidator.ValidateArrayOfStrings((long)20, (long)32, false, "resource item types", resourceItemTypes)) { return(false); } string[] strArrays = resourceItemTypes; for (int i = 0; i < (int)strArrays.Length; i++) { string str = strArrays[i]; if (!GAValidator.ValidateEventPartCharacters(str)) { Debug.Log(string.Concat("resource item types validation failed: a resource item type cannot contain other characters than A-z, 0-9, -_., ()!?. String was: ", str)); return(false); } } return(true); }