Beispiel #1
0
        public static void Run()
        {
            CodgenXml cx   = new CodgenXml();
            string    path = "CodgenTemplates/CSharp/ClassBuilder/ClassBuilder.xml";

            Console.WriteLine(cx.ReadFile(path));
        }
Beispiel #2
0
        public static string Run(string fullFileName)
        {
            string    rlt;
            CodgenXml cx = new CodgenXml(Assembly.GetCallingAssembly());

            rlt = cx.ReadFile(fullFileName);
            return(rlt);
        }
Beispiel #3
0
        protected string ParseElement(XmlReader xr)
        {
            string elName, rlt = "";

            elName = xr.Name.ToLower();
            if (elName.Equals("import"))
            {
                string url = XmlReaderHelper.ReadAttribute(xr, "Url");
                if (!string.IsNullOrEmpty(url) && url.IndexOf(':') < 0)
                {
                    url = BaseDir + url;
                }
                CodgenXml cx = new CodgenXml(CallingAssembly);
                foreach (CodgenParam cp in Params)
                {
                    if (cp.ParamType.Equals("globalreplace"))
                    {
                        CodgenParam ncp = new CodgenParam(cp.Key, cp.Value, cp.ParamType);
                        cx.Params.Add(ncp);
                    }
                }
                rlt = cx.ReadFile(url);
            }
            else if (elName.Equals("contentreplace"))
            {
                string key   = XmlReaderHelper.ReadAttribute(xr, "Handler");
                string scope = XmlReaderHelper.ReadAttribute(xr, "Scope");
                string val   = XmlReaderHelper.ReadContent(xr);
                if (string.IsNullOrEmpty(scope))
                {
                    scope = "replace";
                }
                CodgenParam par = new CodgenParam(key, val, scope.ToLower());
                Params.Add(par);
                //xr.Read();
                //xr.Read();
            }
            else
            {
                XmlReaderHelper.EnumAttributes(xr, delegate(string k, string v, string n)
                {
                    CodgenParam par;
                    par = new CodgenParam(k, v, n);
                    Params.Add(par);
                });
            }
            return(rlt);
        }
Beispiel #4
0
		public static string Run(string fullFileName)
		{
			string rlt;
			CodgenXml cx = new CodgenXml(Assembly.GetCallingAssembly());
			rlt = cx.ReadFile(fullFileName);
			return rlt;
		}
Beispiel #5
0
		protected string ParseElement(XmlReader xr)
		{
			string elName, rlt = "";
			elName = xr.Name.ToLower();
			if (elName.Equals("import"))
			{
				string url = XmlReaderHelper.ReadAttribute(xr, "Url");
				if (!string.IsNullOrEmpty(url) && url.IndexOf(':') < 0)
				{
					url = BaseDir + url;
				}
				CodgenXml cx = new CodgenXml(CallingAssembly);
				foreach (CodgenParam cp in Params)
				{
					if (cp.ParamType.Equals("globalreplace"))
					{
						CodgenParam ncp = new CodgenParam(cp.Key, cp.Value, cp.ParamType);
						cx.Params.Add(ncp);
					}
				}
				rlt = cx.ReadFile(url);
			}
			else if (elName.Equals("contentreplace"))
			{
				string key = XmlReaderHelper.ReadAttribute(xr, "Handler");
				string scope = XmlReaderHelper.ReadAttribute(xr, "Scope");
				string val = XmlReaderHelper.ReadContent(xr);
				if (string.IsNullOrEmpty(scope))
				{
					scope = "replace";
				}
				CodgenParam par = new CodgenParam(key, val, scope.ToLower());
				Params.Add(par);
				//xr.Read();
				//xr.Read();
			}
			else
			{
				XmlReaderHelper.EnumAttributes(xr, delegate(string k, string v, string n)
				{
					CodgenParam par;
					par = new CodgenParam(k, v, n);
					Params.Add(par);
				});
			}
			return rlt;
		}
Beispiel #6
0
		public static void Run()
		{
			CodgenXml cx = new CodgenXml();
			string path = "CodgenTemplates/CSharp/ClassBuilder/ClassBuilder.xml";
			Console.WriteLine(cx.ReadFile(path));
		}