public void LoadParameters() { _parameters = new Dictionary <string, SectionParamInfo>(); string loc = Application.StartupPath + "/MovesetData/CharSpecific/Fit" + ((CharFolder)(int)_charId).ToString() + ".txt"; string n = "", attrName = ""; if (File.Exists(loc)) { using (StreamReader sr = new StreamReader(loc)) while (!sr.EndOfStream) { n = sr.ReadLine(); SectionParamInfo info = new SectionParamInfo(); info._newName = sr.ReadLine(); info._attributes = new List <AttributeInfo>(); while (true && !sr.EndOfStream) { if (String.IsNullOrEmpty(attrName = sr.ReadLine())) { break; } else { AttributeInfo i = new AttributeInfo(); i._name = attrName; i._description = sr.ReadLine(); i._type = int.Parse(sr.ReadLine()); info._attributes.Add(i); sr.ReadLine(); } } if (!_parameters.ContainsKey(n)) { _parameters.Add(n, info); } } } }
public void LoadParameters() { _parameters = new Dictionary<string, SectionParamInfo>(); string loc = Application.StartupPath + "/MovesetData/CharSpecific/Fit" + ((CharFolder)(int)_charId).ToString() + ".txt"; string n = "", attrName = ""; if (File.Exists(loc)) using (StreamReader sr = new StreamReader(loc)) while (!sr.EndOfStream) { n = sr.ReadLine(); SectionParamInfo info = new SectionParamInfo(); info._newName = sr.ReadLine(); info._attributes = new List<AttributeInfo>(); while (true && !sr.EndOfStream) { if (String.IsNullOrEmpty(attrName = sr.ReadLine())) break; else { AttributeInfo i = new AttributeInfo(); i._name = attrName; i._description = sr.ReadLine(); i._type = int.Parse(sr.ReadLine()); info._attributes.Add(i); sr.ReadLine(); } } if (!_parameters.ContainsKey(n)) _parameters.Add(n, info); } }
protected override void OnParse(VoidPtr address) { _nameID = _name; if (_initSize == 0) { throw new Exception("Nothing to read"); } CharacterInfo cInfo = Manager.SelectedInfo; SectionParamInfo data = null; if (_name != null && cInfo._parameters.ContainsKey(_name)) { data = cInfo._parameters[_name]; _info = data._attributes; if (!String.IsNullOrEmpty(data._newName)) { _name = data._newName; } } else { _info = new List <AttributeInfo>(); } if (_initSize > 0) { attributeBuffer = new UnsafeBuffer(_initSize); byte *pOut = (byte *)attributeBuffer.Address; byte *pIn = (byte *)address; for (int i = 0; i < _initSize; i++) { if (i % 4 == 0) { if (data == null) { AttributeInfo info = new AttributeInfo(); //Guess if the value is a an integer or float if (((((uint)*((buint *)pIn)) >> 24) & 0xFF) != 0 && *((bint *)pIn) != -1 && !float.IsNaN(((float)*((bfloat *)pIn)))) { info._type = 0; } else { info._type = 1; } info._name = (info._type == 1 ? "*" : "") + "0x" + i.ToString("X"); info._description = "No Description Available."; _info.Add(info); } } *pOut++ = *pIn++; } } }