Esempio n. 1
0
        private PlyProperty ReadProperty(string line)
        {
            string[] tokens = line.Split(splitter, StringSplitOptions.RemoveEmptyEntries);

            if (tokens.Length != 3 && tokens.Length != 5)
            {
                throw new Exception(string.Format("Invalid number of tokens in property line: \"{0}\".", CurrentLine));
            }
            if (tokens[0] != "property")
            {
                throw new Exception(string.Format("Invalid property line: \"{0}\".", CurrentLine));
            }
            var property = new PlyProperty
            {
                Name = tokens.Last(),

                IsList = tokens[1] == "list",
            };

            if (property.IsList)
            {
                property.ListCountTypeName = tokens[2];
                property.TypeName          = tokens[3];
                property.Name = tokens[4];
                if (tokens[4] == PlyPropertyType.vertex_indices.ToString())
                {
                    property.Name = PlyPropertyType.vertex_index.ToString();
                }
            }
            else
            {
                property.TypeName = tokens[1];
                property.Name     = tokens[2];
            }
            property.Type = PlyPropertyType.other;
            PlyPropertyType tempType = PlyPropertyType.other;

            if (Enum.TryParse <PlyPropertyType>(property.Name, out tempType))
            {
                property.Type = tempType;
            }

            return(property);
        }
Esempio n. 2
0
 public void AddProperty(PlyProperty property)
 {
     Properties.Add(property);
     //Properties.Add(property.Name, property);
 }