Exemple #1
0
        private PlyProperty ReadProperty()
        {
            var tokens = CurrentLine.Split(' ');

            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];
            }
            else
            {
                property.TypeName = tokens[1];
                property.Name     = tokens[2];
            }

            return(property);
        }
Exemple #2
0
 public void AddProperty(PlyProperty property)
 {
     property.Index = Properties.Count;
     Properties.Add(property.Name, property);
 }
Exemple #3
0
 public void AddProperty(PlyProperty property)
 {
     property.Index = Properties.Count;
     Properties.Add(property.Name, property);
 }
Exemple #4
0
        private PlyProperty ReadProperty()
        {
            var tokens = CurrentLine.Split(' ');

            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];
            }
            else {
                property.TypeName = tokens[1];
                property.Name = tokens[2];
            }

            return property;
        }