示例#1
0
 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]);
     }
 }
示例#2
0
        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();
            }
        }
示例#3
0
        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);
                }
            }
        }
示例#4
0
 internal SimpleMode GetCompiledMode(NvdlModeUsage u)
 {
     return(compiledModes [u] as SimpleMode);
 }
示例#5
0
 internal void AddCompiledMode(NvdlModeUsage u, SimpleMode m)
 {
     compiledModes.Add(u, m);
 }
示例#6
0
		internal SimpleMode GetCompiledMode (NvdlModeUsage u)
		{
			return compiledModes [u] as SimpleMode;
		}
示例#7
0
		internal void AddCompiledMode (NvdlModeUsage u, SimpleMode m)
		{
			compiledModes.Add (u, m);
		}
示例#8
0
        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);
        }
示例#9
0
 internal SimpleMode GetCompiledMode(NvdlModeUsage u)
 {
     return(compiledModes.ContainsKey(u) ? compiledModes [u] : null);
 }
示例#10
0
		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 ();
		}
示例#11
0
		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;
		}
示例#12
0
		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]);
		}