static void Main(string[] args) { DomainAdapter da = new DomainAdapter(@"C:\Test", "TEST", new DomainArgs { Compiler=true, UpdateWatch= true, WatchFilter=new string[]{"*.cs"} }); da.Log = new ConsoleEventLogImpl(); da.Load(); Console.Read(); }
static void Main(string[] args) { DomainAdapter da = new DomainAdapter(@"C:\Test", "TEST", new DomainArgs { Compiler = true, UpdateWatch = true, WatchFilter = new string[] { "*.cs" } }); da.Log = new ConsoleEventLogImpl(); da.Load(); Console.Read(); }
public void Reload() { if (this.Log != null) { this.Log.Info("reload domain container ..."); } string pattern = "^([^\\\\]+)$"; ContainerSection configSection = this.GetConfigSection(); if (configSection != null) { IEnumerator enumerator = configSection.Domains.GetEnumerator(); try { DomainConf conf; while (enumerator.MoveNext()) { conf = (DomainConf)enumerator.Current; string text = conf.Path; if (Regex.IsMatch(text, pattern)) { text = AppDomain.CurrentDomain.BaseDirectory + text; } DomainAdapter domainAdapter = this.mDomains.Find((DomainAdapter i) => i.AppName == conf.Name); if (domainAdapter != null) { DomainConf domainConf = (DomainConf)domainAdapter["config"]; if (conf.Path != domainConf.Path || conf.Compiler != domainConf.Compiler || conf.UpdateWatch != domainConf.UpdateWatch || conf.WatchFilter != domainConf.WatchFilter) { domainAdapter.UnLoad(); this.mDomains.Remove(domainAdapter); domainAdapter = null; } } if (!Directory.Exists(text)) { if (this.Log != null) { this.Log.Error("<{1}> domain {0} path notfound!", new object[] { text, conf.Name }); } } else { if (domainAdapter == null) { if (this.Log != null) { this.Log.Info("load <{0}> domain.", new object[] { conf.Name }); } domainAdapter = this.AddDomain(conf.Name, text, conf.UpdateWatch, conf.WatchFilter.Split(new char[] { '|' }), conf.Compiler); domainAdapter.Log = this.Log; domainAdapter.Load(); domainAdapter["config"] = conf; } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } }