예제 #1
0
 public MultiDataUpdater(DataUpdaterPackageConfigInfo package)
 {
     this.package = package;
     for (int i = 0; i < package.DataUpdaters.Count; i++)
     {
         DataUpdaterConfigInfo configInfo = package.DataUpdaters[i];
         names.Add(configInfo.Name);
     }
 }
예제 #2
0
        public List <IUpdateHelper> GetDataUpdaters()
        {
            if (updateStepGetters != null)
            {
                return(updateStepGetters);
            }
            updateStepGetters = new List <IUpdateHelper>();

            for (int i = 0; i < package.DataUpdaters.Count; i++)
            {
                DataUpdaterConfigInfo configInfo = package.DataUpdaters[i];
                updateStepGetters.Add(configInfo.DataUpdater.PluginHelper);
            }

            return(updateStepGetters);
        }
예제 #3
0
        public void LoadConfig(XmlElement elem)
        {
            this.name = elem.GetAttribute("name");
            XmlNodeList nodes = elem.GetElementsByTagName("DataUpdater");

            for (int i = 0; i < nodes.Count; i++)
            {
                XmlNode node = nodes[i];
                if (node is XmlElement)
                {
                    DataUpdaterConfigInfo config = new DataUpdaterConfigInfo();
                    config.LoadConfig((XmlElement)node);
                    dataUpdaters.Add(config);
                }
            }
        }
예제 #4
0
        private IPlugin_DataUpdater GetDataUpdater(DataUpdaterConfigInfo updaterInfo)
        {
            if (updaterInfo.pluginName != null && updaterInfo.pluginName != "")
            {
                IPluginMgr pluginMgr  = PluginMgrFactory.DefaultPluginMgr;
                PluginInfo pluginInfo = pluginMgr.GetPlugin(updaterInfo.PluginName);
                if (pluginInfo != null)
                {
                    IPlugin_DataUpdater dataUpdater = pluginMgr.GetPluginObject <IPlugin_DataUpdater>(pluginInfo);
                    foreach (string key in dic_Arguments.Keys)
                    {
                        dataUpdater.SetValue(key, dic_Arguments[key]);
                    }
                    return(dataUpdater);
                }
                LogHelper.Warn(GetType(), "数据更新配置:‘" + updaterInfo.name + "’配置的更新插件" + updaterInfo.pluginName + "找不到对应插件");
            }

            string clsName = updaterInfo.ClassName;

            if (clsName != null && clsName != "")
            {
                Type type = Type.GetType(clsName);
                if (type == null)
                {
                    LogHelper.Warn(GetType(), "");
                }
                IPlugin_DataUpdater dataUpdater = (IPlugin_DataUpdater)Activator.CreateInstance(type);
                foreach (string key in dic_Arguments.Keys)
                {
                    dataUpdater.SetValue(key, dic_Arguments[key]);
                }
                return(dataUpdater);
            }
            LogHelper.Warn(GetType(), "数据更新配置:‘" + updaterInfo.name + "’没有配置任何更新类");
            return(null);
        }