Ejemplo n.º 1
0
        private static void InitializeConfig(string configName)
        {
            string path = Path.Combine(siteRoot, "web.config");

            if (!File.Exists(path))
            {
                Console.WriteLine("Cannot locate web.config" + Environment.NewLine +
                                  "VCompile should run from the bin directory of the website");
                Environment.Exit(1);
            }
            XmlNode aspViewNode;

            using (XmlTextReader reader = new XmlTextReader(path))
            {
                reader.Namespaces = false;
                XmlDocument xml = new XmlDocument();
                xml.Load(reader);
                aspViewNode = xml.SelectSingleNode("/configuration/" + configName);
            }

            if (aspViewNode != null)
            {
                AspViewConfigurationSection section = new AspViewConfigurationSection();
                options = (AspViewEngineOptions)section.Create(null, null, aspViewNode);
            }
        }
Ejemplo n.º 2
0
        private static void InitializeConfig(string configName)
        {
            string path = Path.Combine(siteRoot, "web.config");

            if (!File.Exists(path))
            {
                path = Path.Combine(siteRoot, "app.config");

                if (!File.Exists(path))
                {
                    Console.WriteLine("Cannot locate web.config or app.config" + Environment.NewLine + "VCompile is normally run from the bin directory of the website");
                    Environment.Exit(1);
                }
            }

            XmlNode aspViewNode = null;

            using (XmlTextReader reader = new XmlTextReader(path))
            {
                reader.Namespaces = false;
                XmlDocument xml = new XmlDocument();
                xml.Load(reader);
                aspViewNode = xml.SelectSingleNode("/configuration/aspview");
            }

            AspViewConfigurationSection section = new AspViewConfigurationSection();

            options = (AspViewEngineOptions)section.Create(null, null, aspViewNode);
            if (options != null)
            {
                Console.WriteLine(options.CompilerOptions.Debug ? "Compiling in DEBUG mode" : "");
            }
        }
Ejemplo n.º 3
0
        private static AspViewConfigurationSection.Model GetConfigFromWebConfig(string configName)
        {
            var path = Path.Combine(arguments.SiteRoot, "web.config");

            if (!File.Exists(path))
            {
                Console.WriteLine("Cannot locate web.config" + Environment.NewLine +
                                  "VCompile should run from the bin directory of the website");
                Environment.Exit(1);
            }
            XmlNode aspViewNode;

            using (var reader = new XmlTextReader(path))
            {
                reader.Namespaces = false;
                var xml = new XmlDocument();
                xml.Load(reader);
                aspViewNode = xml.SelectSingleNode("/configuration/" + configName);
            }

            if (aspViewNode == null)
            {
                return(null);
            }

            var section = new AspViewConfigurationSection();

            return((AspViewConfigurationSection.Model)section.Create(null, null, aspViewNode));
        }
Ejemplo n.º 4
0
		private static AspViewEngineOptions InitializeConfig(string configName)
		{
			string path = Path.Combine(arguments.SiteRoot, "web.config");
			if (!File.Exists(path))
			{
				Console.WriteLine("Cannot locate web.config" + Environment.NewLine +
								  "VCompile should run from the bin directory of the website");
				Environment.Exit(1);
			}
			XmlNode aspViewNode;
			using (XmlTextReader reader = new XmlTextReader(path))
			{
				reader.Namespaces = false;
				XmlDocument xml = new XmlDocument();
				xml.Load(reader);
				aspViewNode = xml.SelectSingleNode("/configuration/" + configName);
			}

			if (aspViewNode == null)
			{
				return null;
			}

			AspViewConfigurationSection section = new AspViewConfigurationSection();
			return (AspViewEngineOptions)section.Create(null, null, aspViewNode);
		}