public TextLine(StreamReader reader) { properties = new Dictionary <string, TextLineProperty>(); string line = reader.ReadLine(); StringBuilder sb = new StringBuilder(); bool inQuotes = false; for (int i = 0; i < line.Length; i++) { char c = line[i]; if (c == '"') { inQuotes = !inQuotes; } if (c != ' ') { sb.Append(c); } if (sb.Length > 0 && ((!inQuotes && c == ' ') || i == line.Length - 1)) { if (Id == null) { Id = sb.ToString(); } else { TextLineProperty prop = new TextLineProperty(sb.ToString()); properties.Add(prop.Name, prop); } sb.Clear(); } } }
public string GetString(string propName) { TextLineProperty prop = GetProperty(propName); if (prop != null) { return(prop.Value); } else { return(null); } }
public Vector4i?GetVector4i(string propName) { TextLineProperty prop = GetProperty(propName); if (prop != null) { return(prop.ToVector4i()); } else { return(null); } }
public uint?GetUInt(string propName) { TextLineProperty prop = GetProperty(propName); if (prop != null) { return(prop.ToUInt()); } else { return(null); } }
public bool?GetBool(string propName) { TextLineProperty prop = GetProperty(propName); if (prop != null) { return(prop.ToBool()); } else { return(null); } }
public byte?GetByte(string propName) { TextLineProperty prop = GetProperty(propName); if (prop != null) { return(prop.ToByte()); } else { return(null); } }