/// <summary> /// Access the Dictionary from external sources /// </summary> public static string GetMySQLType(this AS_MySQLFieldType enumType) { // Try to get the result in the static Dictionary string result; if (mySQLTypes.TryGetValue(enumType, out result)) { return(result); } else { return(null); } }
// Name ~ Value ~ Type ~ Must Be Unique ~ Can Be Ommited public static AS_AccountInfo ToAccountInfo(this string _string) { // Debug.Log (_string); AS_AccountInfo accInfo = new AS_AccountInfo(); string[] _fieldsSeparator = new string[] { fieldsSeparator }; string[] _fieldNameValueSeparator = new string[] { fieldNameValueSeparator }; string[] fields = _string.Split(_fieldsSeparator, StringSplitOptions.RemoveEmptyEntries); foreach (string field in fields) { string[] words = field.Split(_fieldNameValueSeparator, StringSplitOptions.None); string fieldName = words[0]; string fieldValue = words[1]; AS_MySQLFieldType fieldType = words[2].GetEnumType(); bool mustBeUnique = (words[3].ToLower() == "true"); bool isRequired = (words[4].ToLower() == "true"); // Debug.Log("Name: " + fieldName + " ~ Value: " + fieldValue + " ~ Type: " + words[2] + " (" + fieldType + ") ~ Must Be Unique: " + mustBeUnique.ToString() + " ~ Can Be Ommited: " + canBeOmmited.ToString()); accInfo.fields.Add(new AS_MySQLField(fieldName, fieldValue, fieldType, mustBeUnique, isRequired, "")); } return(accInfo); }
public AS_MySQLField(string _name, string _stringValue, AS_MySQLFieldType _type, bool _mustBeUnique, bool _isRequired, string _comment = "") { name = _name; stringValue = _stringValue; type = _type; mustBeUnique = _mustBeUnique; isRequired = _isRequired; comment = _comment; }