Ejemplo n.º 1
0
            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();
                    }
                }
            }
Ejemplo n.º 2
0
            public string GetString(string propName)
            {
                TextLineProperty prop = GetProperty(propName);

                if (prop != null)
                {
                    return(prop.Value);
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 3
0
            public Vector4i?GetVector4i(string propName)
            {
                TextLineProperty prop = GetProperty(propName);

                if (prop != null)
                {
                    return(prop.ToVector4i());
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 4
0
            public uint?GetUInt(string propName)
            {
                TextLineProperty prop = GetProperty(propName);

                if (prop != null)
                {
                    return(prop.ToUInt());
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 5
0
            public bool?GetBool(string propName)
            {
                TextLineProperty prop = GetProperty(propName);

                if (prop != null)
                {
                    return(prop.ToBool());
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 6
0
            public byte?GetByte(string propName)
            {
                TextLineProperty prop = GetProperty(propName);

                if (prop != null)
                {
                    return(prop.ToByte());
                }
                else
                {
                    return(null);
                }
            }