Esempio n. 1
0
 public sCallContext(string name, sCallExtension[] extensions)
 {
     _name = name;
     if (extensions == null)
         throw new Exception("You must have at least one extension in a context");
     else if (extensions.Length == 0)
         throw new Exception("You must have at least one extension in a context");
     _extensions = extensions;
 }
 private void WriteCallExtension(sCallExtension ext, XmlContextFile file)
 {
     file.WriteStartElement("extension");
     file.WriteStartAttribute("name");
     file.WriteValue(ext.Name);
     file.WriteEndAttribute();
     if (ext.Continue)
     {
         file.WriteStartAttribute("continue");
         file.WriteValue("true");
         file.WriteEndAttribute();
     }
     if (ext.Inline)
     {
         file.WriteStartAttribute("inline");
         file.WriteValue("true");
         file.WriteEndAttribute();
     }
     foreach (ICallCondition cond in ext.Conditions)
     {
         file.WriteStartElement("condition");
         _AppendElementAttributes(file, cond.ConditionTagAttributes);
         if (cond.Break.HasValue)
         {
             file.WriteStartAttribute("break");
             switch (cond.Break.Value)
             {
                 case CallConditionBreakTypes.Never:
                     file.WriteValue("never");
                     break;
                 case CallConditionBreakTypes.OnFalse:
                     file.WriteValue("on-false");
                     break;
                 case CallConditionBreakTypes.OnTrue:
                     file.WriteValue("on-true");
                     break;
             }
             file.WriteEndAttribute();
         }
         if (cond.PreActionElements!=null)
         {
             foreach (sPreActionsElement pae in cond.PreActionElements)
             {
                 file.WriteStartElement(pae.Name);
                 _AppendElementAttributes(file, pae.ElementAttributes);
                 file.WriteEndElement();
             }
         }
         if (cond.Actions != null)
         {
             foreach (ICallAction act in cond.Actions)
             {
                 file.WriteStartElement("action");
                 _AppendElementAttributes(file, act.ActionXMLAttributes);
                 file.WriteEndElement();
             }
         }
         if (cond.AntiActions != null)
         {
             foreach (ICallAction act in cond.AntiActions)
             {
                 file.WriteStartElement("anti-action");
                 _AppendElementAttributes(file, act.ActionXMLAttributes);
                 file.WriteEndElement();
             }
         }
         file.WriteEndElement();
     }
     file.WriteEndElement();
 }
Esempio n. 3
0
        private void WriteCallExtension(sCallExtension ext, XmlContextFile file)
        {
            file.WriteStartElement("extension");
            file.WriteStartAttribute("name");
            file.WriteValue(ext.Name);
            file.WriteEndAttribute();
            if (ext.Continue)
            {
                file.WriteStartAttribute("continue");
                file.WriteValue("true");
                file.WriteEndAttribute();
            }
            if (ext.Inline)
            {
                file.WriteStartAttribute("inline");
                file.WriteValue("true");
                file.WriteEndAttribute();
            }
            foreach (ICallCondition cond in ext.Conditions)
            {
                file.WriteStartElement("condition");
                _AppendElementAttributes(file, cond.ConditionTagAttributes);
                if (cond.Break.HasValue)
                {
                    file.WriteStartAttribute("break");
                    switch (cond.Break.Value)
                    {
                    case CallConditionBreakTypes.Never:
                        file.WriteValue("never");
                        break;

                    case CallConditionBreakTypes.OnFalse:
                        file.WriteValue("on-false");
                        break;

                    case CallConditionBreakTypes.OnTrue:
                        file.WriteValue("on-true");
                        break;
                    }
                    file.WriteEndAttribute();
                }
                if (cond.PreActionElements != null)
                {
                    foreach (sPreActionsElement pae in cond.PreActionElements)
                    {
                        file.WriteStartElement(pae.Name);
                        _AppendElementAttributes(file, pae.ElementAttributes);
                        file.WriteEndElement();
                    }
                }
                if (cond.Actions != null)
                {
                    foreach (ICallAction act in cond.Actions)
                    {
                        file.WriteStartElement("action");
                        _AppendElementAttributes(file, act.ActionXMLAttributes);
                        file.WriteEndElement();
                    }
                }
                if (cond.AntiActions != null)
                {
                    foreach (ICallAction act in cond.AntiActions)
                    {
                        file.WriteStartElement("anti-action");
                        _AppendElementAttributes(file, act.ActionXMLAttributes);
                        file.WriteEndElement();
                    }
                }
                file.WriteEndElement();
            }
            file.WriteEndElement();
        }