Exemplo n.º 1
0
        public void LoadXml(XmlElement rootNode, XmlNamespaceManager nsmgr)
        {
            string pr = nsmgr.LookupPrefix(XmlSchemaUtil.WORKFLOW_NAMESPACE);

            pr = (pr != null && pr.Length > 0) ? pr + ":" : "";
            foreach (XmlElement el in rootNode.ChildNodes)
            {
                if (el.LocalName == "struct")
                {
                    StructDef sd = new StructDef();
                    sd.LoadFromXml(el, nsmgr);
                    AddType(sd);
                }
                else if (el.LocalName == "enum")
                {
                    EnumDef ed = new EnumDef();
                    ed.LoadFromXml(el, nsmgr);
                    AddType(ed);
                }
                else
                {
                    throw new Exception("Unexpected node: " + el.Name);
                }
            }
        }
Exemplo n.º 2
0
 public override TypeDef CloneTypeDef()
 {
     EnumDef ed = new EnumDef();
     ed.Name = this.Name;
     ed.EnumValues = new List<string>(this.EnumValues);
     return ed;
 }
Exemplo n.º 3
0
        public override TypeDef CloneTypeDef()
        {
            EnumDef ed = new EnumDef();

            ed.Name       = this.Name;
            ed.EnumValues = new List <string>(this.EnumValues);
            return(ed);
        }
Exemplo n.º 4
0
 private void ValidateTypeDef(TypeDef td, ValidationCtx ctx)
 {
     if (IsTypeDefined(td.Name))
     {
         return;
     }
     if (ctx.ValidatedTypes.ContainsKey(td.Name))
     {
         return;
     }
     ctx.ValidatedTypes.Add(td.Name, td);
     if (td is SimpleTypeDef)
     {
         return;
     }
     else if (td is StructDef)
     {
         StructDef sd = (StructDef)td;
         foreach (MemberDef md in sd.Members)
         {
             if (!IsTypeDefined(md.TypeName))
             {
                 if (!ctx.NewTypes.ContainsKey(md.TypeName))
                 {
                     throw new ApplicationException(string.Format("Member type ({0}) not defined for {1}.{2}", md.TypeName, sd.Name, md.Name));
                 }
                 TypeDef td2 = ctx.NewTypes[md.TypeName];
                 ValidateTypeDef(td2, ctx);
             }
         }
     }
     else if (td is EnumDef)
     {
         EnumDef ed = (EnumDef)td;
     }
     else
     {
         throw new Exception();
     }
 }
Exemplo n.º 5
0
 public void LoadXml(XmlElement rootNode, XmlNamespaceManager nsmgr)
 {
     string pr = nsmgr.LookupPrefix(XmlSchemaUtil.WORKFLOW_NAMESPACE);
     pr = (pr != null && pr.Length > 0) ? pr + ":" : "";
     foreach (XmlElement el in rootNode.ChildNodes)
     {
         if (el.LocalName == "struct")
         {
             StructDef sd = new StructDef();
             sd.LoadFromXml(el, nsmgr);
             AddType(sd);
         }
         else if (el.LocalName == "enum")
         {
             EnumDef ed = new EnumDef();
             ed.LoadFromXml(el, nsmgr);
             AddType(ed);
         }
         else throw new Exception("Unexpected node: " + el.Name);
     }
 }