Esempio n. 1
0
		public static void  Main(System.String[] args)
		{
			ConfGen gc = new ConfGen();
			CommandParser cp = new CommandParser();
			
			cp.parse(args);
			
			if (cp.HelpFlag)
			{
				System.Console.Out.WriteLine("Usage: ConfGen [-vht] SOURCE DESTINATION PACKAGENAME");
				return ;
			}
			
			if (cp.ErrFlag)
			{
				System.Console.Out.WriteLine("ConfGen: command line parse error");
				System.Console.Out.WriteLine("ConfGen: " + cp.Error);
				return ;
			}
			
			DeploymentManager dm = new DeploymentManager(cp.Dest, cp.Package);
			if (cp.TestFlag)
			{
				System.Console.Out.WriteLine("ConfGen: system test enabled");
				gc.test();
				return ;
			}
			if (cp.VerbFlag)
			{
				System.Console.Out.WriteLine("ConfGen: verbose display enabled");
				dm.Verbose = true;
			}
			
			System.Console.Out.WriteLine("Generating Source...");
			gc.generateConf(dm, cp);
			System.Console.Out.WriteLine("Done.");
		}
Esempio n. 2
0
		/// <summary>this method generates conformance</summary>
		/// <param name="dm">the DeploymentManager
		/// </param>
		/// <param name="cp">the CommandParser which parses the command line argument of ConfGen 
		/// </param>
		public virtual void  generateConf(DeploymentManager dm, CommandParser cp)
		{
			try
			{
				System.IO.FileInfo f = new System.IO.FileInfo(cp.Source);
				System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(f.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(f.FullName, System.Text.Encoding.Default).CurrentEncoding);
				char[] cbuf = new char[(int) SupportClass.FileLength(f)];
				in_Renamed.Read(cbuf, 0, (int) SupportClass.FileLength(f));
				dm.generate(System.Convert.ToString(cbuf));
			}
			catch (System.IO.FileNotFoundException e)
			{
				System.Console.Out.WriteLine("Filenotfoundexception: " + e.ToString());
			}
			catch (System.IO.IOException e)
			{
				System.Console.Out.WriteLine("IOexception:\n" + e.ToString() + "\n");
			}
			catch (ConformanceError e)
			{
				System.Console.Out.WriteLine("ConformanceError:\n" + e.ToString() + "\n");
			}
			catch (ConformanceException e)
			{
				System.Console.Out.WriteLine("ConformanceException:\n" + e.ToString() + "\n");
			}
		}