Ejemplo n.º 1
0
        public static VmtFile FromStream(Stream stream)
        {
            var reader = new VmtFileReader(stream);
            var file   = new VmtFile(reader);

            return(file);
        }
Ejemplo n.º 2
0
        private VmtFile(VmtFileReader reader)
        {
            var shaderNameRegex = new Regex(@"^\s*(""(?<shader>[a-zA-Z0-9/\\]+)""|(?<shader>[a-zA-Z0-9/\\]+))\s*$", RegexOptions.Compiled);

            Match match;

            while (reader.ReadRegex(shaderNameRegex, out match))
            {
                var shader = match.Groups["shader"].Value;
                var group  = new PropertyGroup(reader);

                _propertyGroups.Add(shader, group);
            }
        }
Ejemplo n.º 3
0
        public PropertyGroup(VmtFileReader reader)
        {
            reader.AssertToken("{");

            while (!reader.ReadToken("}"))
            {
                Match match;
                if (reader.ReadRegex(_sNestedRegex, out match))
                {
                    // TODO
                    var nested = new PropertyGroup(reader);
                    continue;
                }

                reader.AssertRegex(_sPropertyRegex, out match, "shader property");

                var name  = match.Groups["name"];
                var value = match.Groups["value"];

                _properties.Add(name.Value, value.Value);
            }
        }