public int GetMultiSize(string Key) { cLineValue pLineValue = null; cMultiValue pMultiValue = null; return(( ((pLineValue = GetLineValue(Key)) != null) && ((pMultiValue = pLineValue.GetMultiValue()) != null)) ? (pMultiValue.Size() + 1) : 0); }
public void SetValue(string Key, cValue Value) { cLineValue pLineValue = GetLineValue(Key); // if not exists create one if (pLineValue == null) { pLineValue = new cLineValue(Key, ( byte )LineValueType.SINGLE); } pLineValue.Clear(); pLineValue.Set(Value); }
public void SetMultiValue(string Key, List <cValue> vValues) { cLineValue pLineValue = GetLineValue(Key); // if not exists create one if (pLineValue == null) { pLineValue = new cLineValue(Key, ( byte )LineValueType.MULTI); } pLineValue.Clear(); pLineValue.Set(new cMultiValue(vValues)); }
public string GetString(string Key, string Default = "") { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { return(pLineValue.GetValue().ToString()); } } return(Default); }
public float GetFloat(string Key, float Default = 0.0f) { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { return(pLineValue.GetValue().ToFloat()); } } return(Default); }
public int GetInt(string Key, int Default = 0) { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { return(pLineValue.GetValue().ToInteger()); } } return(Default); }
public bool GetBool(string Key, bool Default = false) { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { return(pLineValue.GetValue().ToBool()); } } return(Default); }
// INSERT A KEY VALUE PAIR INSIDE THE ACTUAL PARSING SECTION private bool Section_Add(KeyValue Pair, string sFilePath, int iLine) { cLineValue pLineValue = new cLineValue(Pair.Key, Pair.Value); if (!pLineValue.IsOK()) { Debug.LogError(" Reader::Section_Add:LineValue invalid for key |" + Pair.Key + "| in Section |" + pSection.Name() + "| in file |" + sFilePath + "|"); return(false); } pSection.Add(pLineValue); return(true); }
public bool bGetBool(string Key, out bool Out, bool Default = false) { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { Out = pLineValue.GetValue().ToBool(); return(true); } } Out = Default; return(false); }
public bool bGetInt(string Key, out int Out, int Default = 0) { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { Out = pLineValue.GetValue().ToInteger(); return(true); } } Out = Default; return(false); }
public bool bGetString(string Key, out string Out, string Default = "") { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { Out = pLineValue.GetValue().ToString(); return(true); } } Out = Default; return(false); }
public bool bGetFloat(string Key, out float Out, float Default = 0.0f) { cLineValue pLineValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if (pLineValue.Type() == ( byte )LineValueType.SINGLE) { Out = pLineValue.GetValue().ToFloat(); return(true); } } Out = Default; return(false); }
public void SetVec4(string Key, Vector4 Vec) { cLineValue pLineValue = GetLineValue(Key); // if not exists create one if (pLineValue == null) { pLineValue = new cLineValue(Key, ( byte )LineValueType.MULTI); } pLineValue.Clear(); List <cValue> vValues = new List <cValue> { new cValue(Vec.x), new cValue(Vec.y), new cValue(Vec.z), new cValue(Vec.w) }; pLineValue.Set(new cMultiValue(vValues)); }
public cValue GetMultiValue(string Key, int Index, int Type) { cLineValue pLineValue = null; cMultiValue pMultiValue = null; cValue pValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if ((pMultiValue = pLineValue.GetMultiValue()) != null) { if ((pValue = pMultiValue.At(Index - 1)) != null) { return(pValue); } } } return(null); }
public bool bGetMultiValue(string Key, out cValue Out, int Index, int Type) { cLineValue pLineValue = null; cMultiValue pMultiValue = null; cValue pValue = null; if ((pLineValue = GetLineValue(Key)) != null) { if ((pMultiValue = pLineValue.GetMultiValue()) != null) { if ((pValue = pMultiValue.At(Index - 1)) != null) { Out = pValue; return(true); } } } Out = null; return(false); }
public cLineValue GetLineValue(string Key) { if (vSection.Count < 1) { return(null); } cLineValue pLineValue = null; foreach (cLineValue LineValue in vSection) { if (LineValue.IsKey(Key)) { pLineValue = LineValue; } } return(pLineValue); }
public bool bGetVec2(string Key, out Vector2 Out, Vector2 Default) { cLineValue pLineValue = null; cMultiValue pMultiValue = null; cValue pValue1 = null; cValue pValue2 = null; if ((pLineValue = GetLineValue(Key)) != null) { if ((pMultiValue = pLineValue.GetMultiValue()) != null) { if (((pValue1 = pMultiValue.At(0)) != null) && (pValue2 = pMultiValue.At(1)) != null) { Out = new Vector2(pValue1.ToFloat(), pValue2.ToFloat()); return(true); } } } Out = Default; return(false); }
// Return the type of a value assigned to a key, or -1 public int KeyType(string Key) { if (vSection.Count < 1) { return(-1); } cLineValue pLineValue = null; cValue Value = null; if ((pLineValue = GetLineValue(Key)) != null) { int iType = pLineValue.Type(); switch (iType) { case ( byte )LineValueType.SINGLE: { if ((Value = pLineValue.GetValue()) != null) { return(Value.Type()); } Debug.LogError("cSection::KeyType:WARNING! In section " + sName + " a key has no value but designed as SINGLE !!!"); break; } case ( byte )LineValueType.MULTI: { if ((pLineValue.GetMultiValue() != null)) { return(iType); } Debug.LogError("cSection::KeyType:WARNING! In section " + sName + " a key has no value but designed as MULTI !!!"); break; } } } return(-1); }
public void Add(cLineValue LineValue) { vSection.Add(LineValue); }
public string GetRawValue(string Key, string Default = "") { cLineValue pLineValue = null; return(((pLineValue = GetLineValue(Key)) != null) ? pLineValue.RawValue() : Default); }