예제 #1
0
        /// <summary>
        /// Parses a line that declares a Vendor-Specific attribute.
        /// </summary>
        private static void ParseVendorAttributeLine(IWritableDictionary dictionary, string[] tok, int lineNum)
        {
            if (tok.Length != 5)
            {
                throw new IOException("syntax error on line " + lineNum);
            }

            String vendor  = tok[1].Trim();
            String name    = tok[2].Trim();
            int    code    = Convert.ToInt32(tok[3].Trim());
            String typeStr = tok[4].Trim();

            Type type = GetAttributeTypeClass(code, typeStr);
            var  at   = new AttributeType(Convert.ToInt32(vendor), code, name, type);

            dictionary.AddAttributeType(at);
        }
예제 #2
0
        /// <summary>
        /// Parse a line that declares an attribute.
        /// </summary>
        private static void parseAttributeLine(IWritableDictionary dictionary, string[] tok, int lineNum)
        {
            if (tok.Length != 4)
            {
                throw new IOException("syntax error on line " + lineNum);
            }

            // read name, code, type
            String name    = tok[1];
            int    code    = Convert.ToInt32(tok[2]);
            String typeStr = tok[3];

            // translate type to class
            Type type = code == VendorSpecificAttribute.VENDOR_SPECIFIC
                            ? typeof(VendorSpecificAttribute)
                            : GetAttributeTypeClass(code, typeStr);

            // create and cache object
            dictionary.AddAttributeType(new AttributeType(code, name, type));
        }
예제 #3
0
        /// <summary>
        /// Parse a line that declares an attribute.
        /// </summary>
        private static void parseAttributeLine(IWritableDictionary dictionary, string[] tok, int lineNum)
        {
            if (tok.Length != 4)
            {
                throw new IOException("syntax error on line " + lineNum);
            }

            // read name, code, type
            String name = tok[1];
            int code = Convert.ToInt32(tok[2]);
            String typeStr = tok[3];

            // translate type to class
            Type type = code == VendorSpecificAttribute.VENDOR_SPECIFIC
                            ? typeof (VendorSpecificAttribute)
                            : GetAttributeTypeClass(code, typeStr);

            // create and cache object
            dictionary.AddAttributeType(new AttributeType(code, name, type));
        }
예제 #4
0
        /// <summary>
        /// Parses a line that declares a Vendor-Specific attribute.
        /// </summary>
        private static void ParseVendorAttributeLine(IWritableDictionary dictionary, string[] tok, int lineNum)
        {
            if (tok.Length != 5)
                throw new IOException("syntax error on line " + lineNum);

            String vendor = tok[1].Trim();
            String name = tok[2].Trim();
            int code = Convert.ToInt32(tok[3].Trim());
            String typeStr = tok[4].Trim();

            Type type = GetAttributeTypeClass(code, typeStr);
            var at = new AttributeType(Convert.ToInt32(vendor), code, name, type);
            dictionary.AddAttributeType(at);
        }