public ShellContext(Configuration cfg) { this.cfg = cfg; this.mgr = new PathManager(cfg); this.commandee = new Commandee(mgr); string server = cfg.GetValue<string>(Configuration._SERVER0); ConnectionProvider pvd = null; if (!string.IsNullOrEmpty(server)) pvd = cfg.GetProvider(server); if (pvd != null) { theSide = new Side(pvd); ChangeSide(theSide); } else if (cfg.Providers.Count() > 0) { theSide = new Side(cfg.Providers.First()); ChangeSide(theSide); } else { stdio.ErrorFormat("database server not defined"); } }
public void open(Command cmd, Configuration cfg) { if (cmd.HasHelp) { stdio.WriteLine("open files in the editor"); stdio.WriteLine("open files"); stdio.WriteLine("options:"); stdio.WriteLine(" log : open log file"); stdio.WriteLine(" viewer : open GUI viewer to see the last data table retrieved"); stdio.WriteLine(" output : open output file"); stdio.WriteLine(" config [/s] : open user configure file, /s open system configurate"); stdio.WriteLine(" dpo : open table class output directory"); stdio.WriteLine(" dc : open data contract class output directory"); stdio.WriteLine(" l2s : open Linq to SQL class output directory"); stdio.WriteLine(" release : open release notes"); return; } string path; switch (cmd.arg1) { case "output": stdio.OpenEditor(cfg.OutputFile); break; case "log": stdio.OpenEditor(Context.GetValue<string>("log")); break; case "config": if (cmd.IsSchema) stdio.OpenEditor("sqlcon.cfg"); else stdio.OpenEditor(cfg.CfgFile); break; case "release": stdio.OpenEditor("ReleaseNotes.txt"); break; case "dpo": path = cfg.GetValue<string>("dpo.path", $"{Configuration.MyDocuments}\\DataModel\\Dpo"); OpenDirectory(path, "table class"); break; case "dc": path = cfg.GetValue<string>("dc.path", $"{Configuration.MyDocuments}\\DataModel\\DataContracts"); OpenDirectory(path, "data contract class"); break; case "l2s": path = cfg.GetValue<string>("l2s.path", $"{Configuration.MyDocuments}\\DataModel\\L2s"); OpenDirectory(path, "data Linq to SQL class"); break; case "viewer": OpenEditor(); break; default: stdio.ErrorFormat("invalid arguments"); return; } }