示例#1
0
 public void Add(DomainConf domainConf)
 {
     base.BaseAdd(domainConf);
 }
示例#2
0
 public void Remove(DomainConf domainConf)
 {
     base.BaseRemove(this.GetElementKey(domainConf));
 }
示例#3
0
        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();
                    }
                }
            }
        }