static int Main(string[] args) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; siteRoot = baseDirectory.Substring(0, baseDirectory.LastIndexOf("\\bin")); Console.WriteLine("Compiling [" + siteRoot + "] ..."); InitializeConfig(); if (!Directory.Exists(siteRoot)) { PrintHelpMessage(string.Format("The path '{0}' does not exist", siteRoot)); Console.ReadLine(); return(1); } AspViewCompiler compiler = new AspViewCompiler(options.CompilerOptions); if (compiler == null) { PrintHelpMessage("Could not start the compiler."); return(2); } try { compiler.CompileSite(siteRoot); Console.WriteLine("[" + siteRoot + "] compilation finished."); return(0); } catch (Exception ex) { PrintHelpMessage("Could not compile." + Environment.NewLine + ex.ToString()); return(3); } }
static int Main(string[] args) { if (args != null && args.Length == 1) { if (args[0].Equals("-w", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("-wait", StringComparison.InvariantCultureIgnoreCase)) { Console.ReadLine(); } else { siteRoot = args[0]; } } if (siteRoot == null) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; siteRoot = baseDirectory.Substring(0, baseDirectory.LastIndexOf("\\bin", StringComparison.InvariantCultureIgnoreCase)); } Console.WriteLine("Compiling [" + siteRoot + "] ..."); InitializeConfig(); if (!Directory.Exists(siteRoot)) { PrintHelpMessage(string.Format("The path '{0}' does not exist", siteRoot)); Console.ReadLine(); return(-1); } AspViewCompiler compiler; try { compiler = new AspViewCompiler(options.CompilerOptions); } catch { PrintHelpMessage("Could not start the compiler."); return(-2); } try { compiler.CompileSite(siteRoot); Console.WriteLine("[" + siteRoot + "] compilation finished."); return(0); } catch (Exception ex) { PrintHelpMessage("Could not compile." + Environment.NewLine + ex); return(-3); } }
static int Main(string[] args) { if (args != null && args.Length == 1) { if (args[0].Equals("-w", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("-wait", StringComparison.InvariantCultureIgnoreCase)) Console.ReadLine(); else siteRoot = args[0]; } if (siteRoot == null) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; siteRoot = baseDirectory.Substring(0, baseDirectory.LastIndexOf("\\bin", StringComparison.InvariantCultureIgnoreCase)); } Console.WriteLine("Compiling [" + siteRoot + "] ..."); InitializeConfig(); if (!Directory.Exists(siteRoot)) { PrintHelpMessage(string.Format("The path '{0}' does not exist", siteRoot)); Console.ReadLine(); return -1; } AspViewCompiler compiler; try { compiler = new AspViewCompiler(options.CompilerOptions); } catch { PrintHelpMessage("Could not start the compiler."); return -2; } try { compiler.CompileSite(siteRoot); Console.WriteLine("[" + siteRoot + "] compilation finished."); return 0; } catch (Exception ex) { PrintHelpMessage("Could not compile." + Environment.NewLine + ex); return -3; } }