Esempio n. 1
0
        private MotionRecord makeRecord(string line)
        {
            string[] tokens = line.Split(new char[] { ' ' });
            // There must be room for at least a name and two positions.
            if (tokens.Length < 3)
            {
                throw new MalformedException("Need at least three tokens per line.");
            }
            // The first token should be the name. If this is not the correct, throw exception.
            string name = tokens[0].Trim();

            if (!name.EndsWith("="))
            {
                throw new MalformedException("Name was not specified with = operator.");
            }
            // Finally create the returnvalue.
            MotionRecord rv = new MotionRecord(name.Trim(new char[] { '=', ' ', '\t' }));

            // And fill it up!
            for (int i = 1; i < tokens.Length; i++)
            {
                rv.Add(SequenceItem.FromToken(tokens[i]));
            }

            // We still need to enable the modifiers.
            rv.InitModifiers();
            return(rv);
        }