public bool GetAllSet(out System.Collections.Generic.List <string> problems) { problems = new System.Collections.Generic.List <string>(); int i = 0; bool r = true; foreach (var k in keys) { bool nc = needsChange[i]; // must be diffirent than original value bool wc = defaultValue[i] == value[i]; // check if original value.. var tmp = false; if (tmp) { Debug.Log("tmp" + tmp + " " + k); } BTSFormat fmt = IntToFormat(format[i]); string problemstr = ""; bool formatOk = true; if (fmt == BTSFormat.CanBeEmptyString) { // everything is ok. } else if (fmt == BTSFormat.MustBeNonEmptyStr) { if (string.IsNullOrEmpty(value[i].Trim())) { formatOk = false; problemstr = "" + dispName[i] + ": cannot be empty string"; } } else if (fmt == BTSFormat.MustBeValidURL) { } if ((nc && wc) && problemstr == "") { problemstr = "" + dispName[i] + ": must be set"; } if (problemstr != "") { problems.Add(problemstr); } if ((nc && wc) || !formatOk) { r = false; } i++; } return(r); }
public static BTSFormat IntToFormat(int i) { BTSFormat r = BTSFormat.CanBeEmptyString; if (i >= (int)BTSFormat.CanBeEmptyString && i < (int)BTSFormat._LAST) { r = (BTSFormat)i; } return(r); }
public void AddItem(int prio, string key, string _dispName, string str_type, string _defaultValue, bool _writeEnabled, bool _needsChange, BTSFormat fmt = BTSFormat.CanBeEmptyString, string _sgroup = "", string _logic = "") { if (keys.IndexOf(key) >= 0) { throw new System.Exception("cannot add key more than one time : " + key); } keys.Add(key); types.Add(str_type); value.Add(_defaultValue); dispName.Add(_dispName); defaultValue.Add(_defaultValue); writeEnabled.Add(_writeEnabled); needsChange.Add(_needsChange); this.group.Add(_sgroup); this.logic.Add(_logic); this.format.Add((int)fmt); }