public SimpleModeUsage(NvdlModeUsage usage) { this.source = usage; contexts = new SimpleContext [usage.Contexts.Count]; for (int i = 0; i < contexts.Length; i++) { contexts [i] = new SimpleContext( usage.Contexts [i]); } }
private void ReadCommonActionContent(NvdlNoCancelAction el) { FillLocation(el); NvdlModeUsage mu = new NvdlModeUsage(); el.ModeUsage = mu; FillLocation(el); el.SimpleMessage = reader.GetAttribute("message"); mu.UseMode = reader.GetAttribute("useMode"); FillForeignAttribute(el); if (reader.IsEmptyElement) { reader.Skip(); return; } reader.Read(); do { reader.MoveToContent(); if (reader.NodeType == XmlNodeType.EndElement) { break; } if (reader.NamespaceURI != Nvdl.Namespace) { el.Foreign.Add(XDocument.ReadFrom(reader)); continue; } switch (reader.LocalName) { case "mode": mu.NestedMode = ReadNestedMode(); break; case "message": el.Messages.Add(ReadMessage()); break; case "context": mu.Contexts.Add(ReadContext()); break; default: throw new NotSupportedException(); } } while (!reader.EOF); if (!reader.EOF) { reader.Read(); } }
private void SimplifyModeUsage( NvdlNoCancelAction nca, NvdlCompileContext ctx) { NvdlModeUsage usage = nca.ModeUsage; if (usage.NestedMode != null && ctx.GetCompiledMode(usage) == null) { SimpleMode sm = new SimpleMode(String.Empty, usage.NestedMode, ctx); ctx.AddCompiledMode(usage, sm); } foreach (NvdlContext c in usage.Contexts) { if (c.NestedMode != null) { SimpleMode sm = new SimpleMode( String.Empty, c.NestedMode, ctx); ctx.AddCompiledMode(c, sm); } } }
internal SimpleMode GetCompiledMode(NvdlModeUsage u) { return(compiledModes [u] as SimpleMode); }
internal void AddCompiledMode(NvdlModeUsage u, SimpleMode m) { compiledModes.Add(u, m); }
internal SimpleMode GetCompiledMode (NvdlModeUsage u) { return compiledModes [u] as SimpleMode; }
internal void AddCompiledMode (NvdlModeUsage u, SimpleMode m) { compiledModes.Add (u, m); }
private NvdlValidate ReadValidate() { NvdlValidate el = new NvdlValidate(); NvdlModeUsage mu = new NvdlModeUsage(); el.ModeUsage = mu; FillLocation(el); el.SchemaType = reader.GetAttribute("schemaType"); el.SimpleMessage = reader.GetAttribute("message"); el.SchemaUri = reader.GetAttribute("schema"); mu.UseMode = reader.GetAttribute("useMode"); FillForeignAttribute(el); if (reader.IsEmptyElement) { reader.Skip(); return(el); } reader.Read(); do { reader.MoveToContent(); if (reader.NodeType == XmlNodeType.EndElement) { break; } if (reader.NamespaceURI != Nvdl.Namespace) { el.Foreign.Add(XDocument.ReadFrom(reader)); continue; } switch (reader.LocalName) { case "message": el.Messages.Add(ReadMessage()); break; case "option": el.Options.Add(ReadOption()); break; case "schema": el.SchemaBody = (XElement)XDocument.ReadFrom(reader); break; case "mode": mu.NestedMode = ReadNestedMode(); break; case "context": mu.Contexts.Add(ReadContext()); break; default: throw new NotSupportedException(); } } while (!reader.EOF); if (!reader.EOF) { reader.Read(); } return(el); }
internal SimpleMode GetCompiledMode(NvdlModeUsage u) { return(compiledModes.ContainsKey(u) ? compiledModes [u] : null); }
private void ReadCommonActionContent (NvdlNoCancelAction el) { FillLocation (el); NvdlModeUsage mu = new NvdlModeUsage (); el.ModeUsage = mu; FillLocation (el); el.SimpleMessage = reader.GetAttribute ("message"); mu.UseMode = reader.GetAttribute ("useMode"); FillForeignAttribute (el); if (reader.IsEmptyElement) { reader.Skip (); return; } reader.Read (); do { reader.MoveToContent (); if (reader.NodeType == XmlNodeType.EndElement) break; if (reader.NamespaceURI != Nvdl.Namespace) { el.Foreign.Add (doc.ReadNode (reader)); continue; } switch (reader.LocalName) { case "mode": mu.NestedMode = ReadNestedMode (); break; case "message": el.Messages.Add (ReadMessage ()); break; case "context": mu.Contexts.Add (ReadContext ()); break; default: throw new NotSupportedException (); } } while (!reader.EOF); if (!reader.EOF) reader.Read (); }
private NvdlValidate ReadValidate () { NvdlValidate el = new NvdlValidate (); NvdlModeUsage mu = new NvdlModeUsage (); el.ModeUsage = mu; FillLocation (el); el.SchemaType = reader.GetAttribute ("schemaType"); el.SimpleMessage = reader.GetAttribute ("message"); el.SchemaUri = reader.GetAttribute ("schema"); mu.UseMode = reader.GetAttribute ("useMode"); FillForeignAttribute (el); if (reader.IsEmptyElement) { reader.Skip (); return el; } reader.Read (); do { reader.MoveToContent (); if (reader.NodeType == XmlNodeType.EndElement) break; if (reader.NamespaceURI != Nvdl.Namespace) { el.Foreign.Add (doc.ReadNode (reader)); continue; } switch (reader.LocalName) { case "message": el.Messages.Add (ReadMessage ()); break; case "option": el.Options.Add (ReadOption ()); break; case "schema": el.SchemaBody = (XmlElement) doc.ReadNode (reader); break; case "mode": mu.NestedMode = ReadNestedMode (); break; case "context": mu.Contexts.Add (ReadContext ()); break; default: throw new NotSupportedException (); } } while (!reader.EOF); if (!reader.EOF) reader.Read (); return el; }
public SimpleModeUsage (NvdlModeUsage usage) { this.source = usage; contexts = new SimpleContext [usage.Contexts.Count]; for (int i = 0; i < contexts.Length; i++) contexts [i] = new SimpleContext ( usage.Contexts [i]); }