コード例 #1
0
        internal static ValueTemplateContent Parse(XmlNode node)
        {
            ValueTemplateContent valueContent = null;

            switch (node.Name)
            {
            case "boolean":
                valueContent = new BooleanValueTemplateContent(node);
                break;

            case "integer":
                valueContent = new IntegerValueTemplateContent(node);
                break;

            case "number":
                valueContent = new NumberValueTemplateContent(node);
                break;

            case "string":
            // Fallthrough.
            case "text":
                valueContent = new StringValueTemplateContent(node);
                break;
            }
            return(valueContent);
        }
 internal static void Write(ContentWriter writer, ValueTemplateContent content)
 {
     if (content is BooleanValueTemplateContent)
     {
         BooleanValueTemplateContent bContent = content as BooleanValueTemplateContent;
         writer.Write("b");
         writer.Write(bContent.Name);
         writer.Write(bContent.Default);
     }
     else if (content is IntegerValueTemplateContent)
     {
         IntegerValueTemplateContent iContent = content as IntegerValueTemplateContent;
         writer.Write("i");
         writer.Write(iContent.Name);
         writer.Write(iContent.Default);
         writer.Write(iContent.Max);
         writer.Write(iContent.Min);
     }
     else if (content is NumberValueTemplateContent)
     {
         NumberValueTemplateContent nContent = content as NumberValueTemplateContent;
         writer.Write("n");
         writer.Write(nContent.Name);
         writer.Write(nContent.Default);
         writer.Write(nContent.Max);
         writer.Write(nContent.Min);
     }
     else if (content is StringValueTemplateContent)
     {
         StringValueTemplateContent sContent = content as StringValueTemplateContent;
         writer.Write("s");
         writer.Write(sContent.Name);
         writer.Write(sContent.Default);
         writer.Write(sContent.MaxChars);
     }
 }