示例#1
0
        public SimpleContext(NvdlContext context)
        {
            source = context;
            FillLocation(context);

            this.useModeName = context.UseMode;

            try {
                string [] spaths = context.Path.Split('|');
                ArrayList al     = new ArrayList();
                foreach (string spathws in spaths)
                {
                    string spath = spathws.Trim(
                        Nvdl.Whitespaces);
                    if (spath.Length == 0)
                    {
                        continue;
                    }
                    ParsePath(al, TrimName(spath));
                }
                path = (SimplePath [])al.ToArray(
                    typeof(SimplePath));
            } catch (XmlException ex) {
                throw new NvdlCompileException(String.Format("Invalid path string: {0}", path), ex, context);
            }
        }
示例#2
0
        private NvdlContext ReadContext()
        {
            NvdlContext el = new NvdlContext();

            FillLocation(el);
            el.Path    = reader.GetAttribute("path");
            el.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 "mode":
                    el.NestedMode = ReadNestedMode();
                    break;

                default:
                    throw new NotSupportedException();
                }
            } while (!reader.EOF);
            if (!reader.EOF)
            {
                reader.Read();
            }
            return(el);
        }
示例#3
0
 public void Remove(NvdlContext item)
 {
     List.Add(item);
 }
示例#4
0
 public void Add(NvdlContext item)
 {
     List.Add(item);
 }
示例#5
0
 internal SimpleMode GetCompiledMode(NvdlContext c)
 {
     return(compiledModes [c] as SimpleMode);
 }
示例#6
0
 internal void AddCompiledMode(NvdlContext c, SimpleMode m)
 {
     compiledModes.Add(c, m);
 }
示例#7
0
		internal SimpleMode GetCompiledMode (NvdlContext c)
		{
			return compiledModes [c] as SimpleMode;
		}
示例#8
0
		internal void AddCompiledMode (NvdlContext c, SimpleMode m)
		{
			compiledModes.Add (c, m);
		}
示例#9
0
		public void Remove (NvdlContext item)
		{
			List.Add (item);
		}
示例#10
0
		public void Add (NvdlContext item)
		{
			List.Add (item);
		}
示例#11
0
 internal SimpleMode GetCompiledMode(NvdlContext c)
 {
     return(compiledModes.ContainsKey(c) ? compiledModes [c] : null);
 }
示例#12
0
		private NvdlContext ReadContext ()
		{
			NvdlContext el = new NvdlContext ();
			FillLocation (el);
			el.Path = reader.GetAttribute ("path");
			el.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 "mode":
					el.NestedMode = ReadNestedMode ();
					break;
				default:
					throw new NotSupportedException ();
				}
			} while (!reader.EOF);
			if (!reader.EOF)
				reader.Read ();
			return el;
		}
示例#13
0
		public SimpleContext (NvdlContext context)
		{
			source = context;
			FillLocation (context);

			this.useModeName = context.UseMode;

			try {
				string [] spaths = context.Path.Split ('|');
				ArrayList al = new ArrayList ();
				foreach (string spathws in spaths) {
					string spath = spathws.Trim (
						Nvdl.Whitespaces);
					if (spath.Length == 0)
						continue;
					ParsePath (al, TrimName (spath));
				}
				path = (SimplePath []) al.ToArray (
					typeof (SimplePath));
			} catch (XmlException ex) {
				throw new NvdlCompileException (String.Format ("Invalid path string: {0}", path), ex, context);
			}
		}