Exemplo n.º 1
0
        /// <summary>
        /// 初始化存储者
        /// </summary>
        private void initSaver()
        {
            //读取配置文件,使用不同Saver
            string name = AqiManage.Setting["Saver"];
            Type   type = Type.GetType("AQISet.Saver." + name);

            aqiSaver = Activator.CreateInstance(type, new object[] { this }) as IAqiSave;
        }
Exemplo n.º 2
0
 /// <summary>
 /// 一般构造
 ///     独立运行模式使用
 /// </summary>
 /// <param name="aqiManage"></param>
 /// <param name="srcUrls"></param>
 /// <param name="strName">名称一般同 数据源TAG</param>
 public AqiRunner(AqiManage aqiManage, Dictionary<string, ISrcUrl> srcUrls, string strName)
 {
     name = strName;
     sugtlist = SrcUrlGroupTimer.BuildList(srcUrls);
     ias = aqiManage.AqiSave;
     an = aqiManage.AqiNote;
     ar = aqiManage.AqiRetry;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 默认构造
 ///     合并运行模式使用
 /// </summary>
 /// <param name="aqiManage"></param>
 /// <param name="srcUrls"></param>
 public AqiRunner(AqiManage aqiManage, Dictionary <string, ISrcUrl> srcUrls)
 {
     name     = "DefaultRunner";
     sugtlist = SrcUrlGroupTimer.BuildList(srcUrls);
     ias      = aqiManage.AqiSave;
     an       = aqiManage.AqiNote;
     ar       = aqiManage.AqiRetry;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 一般构造
 ///     独立运行模式使用
 /// </summary>
 /// <param name="aqiManage"></param>
 /// <param name="listSrcUrl"></param>
 /// <param name="name">名称一般同 数据源tag</param>
 public AqiRunner(AqiManage aqiManage, List<ISrcUrl> listSrcUrl, string name)
 {
     this.name = name;
     this.dictTimer = SrcUrlGroupTimer.CreateList(listSrcUrl, new Action<object, ElapsedEventArgs>(this.timer_RunEvent));
     this.ias = aqiManage.AqiSave;
     this.an = aqiManage.AqiNote;
     this.ar = aqiManage.AqiRetry;
     this.thisLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 }
Exemplo n.º 5
0
        private ReaderWriterLockSlim thisLock; //读写锁

        #endregion Fields

        #region Constructors

        /// <summary>
        /// 默认构造
        ///     合并运行模式使用
        /// </summary>
        /// <param name="manage"></param>
        /// <param name="listSrcUrl"></param>
        public AqiRunner(AqiManage manage, List<ISrcUrl> listSrcUrl)
        {
            this.name = "DefaultRunner";
            this.dictTimer = SrcUrlGroupTimer.CreateList(listSrcUrl, new Action<object, System.Timers.ElapsedEventArgs>(this.timer_RunEvent));
            this.ias = manage.AqiSave;
            this.an = manage.AqiNote;
            this.ar = manage.AqiRetry;
            this.thisLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 一般构造
 ///     独立运行模式使用
 /// </summary>
 /// <param name="aqiManage"></param>
 /// <param name="listSrcUrl"></param>
 /// <param name="name">名称一般同 数据源tag</param>
 public AqiRunner(AqiManage aqiManage, List <ISrcUrl> listSrcUrl, string name)
 {
     this.name      = name;
     this.dictTimer = SrcUrlGroupTimer.CreateList(listSrcUrl, new Action <object, ElapsedEventArgs>(this.timer_RunEvent));
     this.ias       = aqiManage.AqiSave;
     this.an        = aqiManage.AqiNote;
     this.ar        = aqiManage.AqiRetry;
     this.thisLock  = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 }
Exemplo n.º 7
0
        private ReaderWriterLockSlim thisLock;                   //读写锁

        #endregion

        #region 构造

        /// <summary>
        /// 默认构造
        ///     合并运行模式使用
        /// </summary>
        /// <param name="manage"></param>
        /// <param name="listSrcUrl"></param>
        public AqiRunner(AqiManage manage, List <ISrcUrl> listSrcUrl)
        {
            this.name      = "DefaultRunner";
            this.dictTimer = SrcUrlGroupTimer.CreateList(listSrcUrl, new Action <object, System.Timers.ElapsedEventArgs>(this.timer_RunEvent));
            this.ias       = manage.AqiSave;
            this.an        = manage.AqiNote;
            this.ar        = manage.AqiRetry;
            this.thisLock  = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
        }
Exemplo n.º 8
0
        private void initAqiWeb()
        {
            this.allAqiWebs = new Dictionary <string, IAqiWeb>();
            foreach (Assembly assembly in this.allDLLs)
            {
                Type[] types = assembly.GetTypes();
                foreach (Type type in types)
                {
                    if (type.GetInterface(typeof(IAqiWeb).Name) != null)
                    {
                        try
                        {
                            IAqiWeb iaw = Activator.CreateInstance(type) as IAqiWeb;
                            this.allAqiWebs.Add(iaw.Tag, iaw);
                            AqiManage.Remind.Log_Debug("加载数据源:" + iaw.Name, AqiPlugin.tag);
                        }
                        catch (Exception ex)
                        {
                            AqiManage.Remind.Log_Error("加载数据源错误", ex, AqiPlugin.tag);
                        }
                    }
                    else if (type.GetInterface(typeof(IAqiSave).Name) != null)
                    {
/*                        AddTypeToMapping(typeof (IAqiSave), type);*/
//                         string name = typeof(IAqiSave).Name;
//                         this.allPluginInterface[name].Add(type);
//                         AqiManage.Remind.Log_Debug("加载持久插件:" + type.Name, AqiPlugin.tag);
                        try
                        {
                            IAqiSave ias = Activator.CreateInstance(type) as IAqiSave;
                            this.allAqiSaves.Add(ias.Name, ias);
                            AqiManage.Remind.Log_Debug("加载持久插件:" + ias.Name, AqiPlugin.tag);
                        }
                        catch (Exception ex)
                        {
                            AqiManage.Remind.Log_Error("加载持久插件错误", ex, AqiPlugin.tag);
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 初始化存储者
        /// </summary>
        private void initSaver()
        {
            this.aqiSaver = Plugin.CreateSave(AqiManage.Setting["Saver"]);

            Remind.Log_Debug("初始化Saver:" + this.aqiSaver.Name, tag);
        }
Exemplo n.º 10
0
 /// <summary>
 /// 初始化存储者
 /// </summary>
 private void initSaver()
 {
     //读取配置文件,使用不同Saver
     string name = AqiManage.Setting["Saver"];
     Type type = Type.GetType("AQISet.Saver." + name);
     aqiSaver = Activator.CreateInstance(type,new object[]{ this }) as IAqiSave;
 }
Exemplo n.º 11
0
        /// <summary>
        /// 初始化存储者
        /// </summary>
        private void initSaver()
        {
            this.aqiSaver = Plugin.CreateSave(AqiManage.Setting["Saver"]);

            Remind.Log_Debug("初始化Saver:" + this.aqiSaver.Name, tag);
        }