private string CheckProperty(string propname) { string result = null; if (propname == "AuthKey" && !string.IsNullOrEmpty(AuthKey) && !CommonSteamMethods.IsBase64(AuthKey)) { result = "Shared Secret is not valid"; } else if (propname == "Email" && !string.IsNullOrEmpty(Email) && !System.Text.RegularExpressions.Regex.IsMatch(Email, @"[\w-]+@[\w-]+\.(\w{2,6})+")) { result = "Email must be filled correctly or left blank"; } else if (propname == "Username" && string.IsNullOrWhiteSpace(Username)) { result = "Username is obligatory"; } else if (propname == "ProfileID" && !string.IsNullOrWhiteSpace(ProfileID) && !Models.CommonSteamMethods.IsValidProfileID(ProfileID)) { result = "ProfileID is not valid, must have at least 18 digits"; } else if (propname == "SteamID" && !string.IsNullOrWhiteSpace(SteamID) && !Models.CommonSteamMethods.IsValidSteamID(SteamID)) { result = "SteamID is not valid. Has to be like STEAM_0:1:1337"; } Error = result != null ? "Error" : null; return(result); }
private void CalculateIDs(string newID) { try { if (!string.IsNullOrWhiteSpace(newID)) { if (Models.CommonSteamMethods.IsValidSteamID(newID)) { steamID = newID; profID = CommonSteamMethods.CalculateProfId(newID); } else if (Models.CommonSteamMethods.IsValidProfileID(newID)) { profID = newID; steamID = CommonSteamMethods.CalculateSteamID(newID); } OnChange("ProfileID"); OnChange("SteamID"); } } catch { } }