Пример #1
0
        private static IList <ConfigInfoPC> GetConfigInfoForA(XmlDocument xml, IList <ConfigInfoPC> list, string cate, string code)
        {
            var          configInfonodes = xml.SelectNodes("//appSettings/*");
            ConfigInfoPC c = null;

            if (configInfonodes == null)
            {
                throw new ArgumentNullException("没有appSettings节点");
            }
            foreach (XmlNode item in configInfonodes)
            {
                c                    = new ConfigInfoPC();
                c.Key1               = item.Attributes["key"].Value;
                c.Value1             = item.Attributes["value"].Value;
                c.PluginCode         = code;
                c.ConfigCategoryCode = cate;
                list.Add(c);
            }
            return(list);
        }
Пример #2
0
        public static ConfigInfoPC ConvertToConfigInfoPC(ConfigTemp model)
        {
            ConfigInfoPC configInfo = new ConfigInfoPC();

            Type ToModel   = configInfo.GetType();
            Type FromModel = model.GetType();
            var  fileds    = ToModel.GetProperties();

            foreach (var item in fileds)
            {
                object fromValue = Convert.ChangeType(model.GetType().GetProperty(item.Name).GetValue(model, null), item.PropertyType);

                if (fromValue != null)
                {
                    configInfo.GetType().GetProperty(item.Name).SetValue(configInfo, fromValue, null);
                }
            }

            return(configInfo);
        }
Пример #3
0
        private static IList <ConfigInfoPC> GetConfigInfoForS(XmlDocument xml, IList <ConfigInfoPC> list, string cate)
        {
            var          configInfonodes = xml.SelectNodes("//SmartBoxConfig/*");
            ConfigInfoPC c = null;

            if (configInfonodes == null)
            {
                throw new ArgumentNullException("没有SmartBoxConfig节点");
            }
            foreach (XmlNode item in configInfonodes)
            {
                c                    = new ConfigInfoPC();
                c.Key1               = GetNodeValue(item.SelectSingleNode("./key"));
                c.Value1             = GetNodeValue(item.SelectSingleNode("./value"));
                c.PluginCode         = Constants.MianName;
                c.ConfigCategoryCode = cate;
                list.Add(c);
            }
            return(list);
        }
Пример #4
0
        public ActionResult SaveConfigInfo(FormCollection form, string Vid)
        {
            var vmobject = new JsonReturnMessages();

            try
            {
                string type = form["tp"].ToLower();

                if (type == "pc")
                {
                    IList <ConfigInfoPC> list = new List <ConfigInfoPC>();
                    string[]             keys = form.AllKeys;

                    for (int i = 0; i < keys.Length; i++)
                    {
                        if (keys[i].EndsWith(".Key1"))
                        {
                            ConfigInfoPC config = new ConfigInfoPC();
                            string       prefix = keys[i].Split('.')[0];
                            UpdateModel(config, prefix);  //其他数据同时可以获得填充进实体对象
                            config.PluginCode = Constants.MianName;
                            list.Add(config);
                        }
                    }
                    //更新
                    BoFactory.GetVersionTrackBo.UpdateMainConfigInfoPCs(list); //发布
                    InsertConfigXml(Vid);                                      //生成config
                }
                else if (type == "mobile")
                {
                    IList <ConfigInfo> list = new List <ConfigInfo>();
                    string[]           keys = form.AllKeys;

                    for (int i = 0; i < keys.Length; i++)
                    {
                        if (keys[i].EndsWith(".Key1"))
                        {
                            ConfigInfo config = new ConfigInfo();
                            string     prefix = keys[i].Split('.')[0];
                            UpdateModel(config, prefix);  //其他数据同时可以获得填充进实体对象
                            config.PluginCode = Constants.MianName;
                            list.Add(config);
                        }
                    }
                    //更新
                    BoFactory.GetVersionTrackBo.UpdateMainConfigInfos(list);//发布
                }



                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = Vid;
                VersionTrack v     = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                string[]     codes = v.FilePath.Split(new string[] { "\\" }, StringSplitOptions.None);
                string       name  = codes[codes.Length - 2];//获取插件code

                Beyondbit.AutoUpdate.IPublisher pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                if (Directory.Exists(Path.Combine(AppConfig.pubFolder, name + AppConfig.subFix)))//如果存在次文件夹
                {
                    pub.UpdateApplication(v.FilePath, name);
                }
                else
                {
                    pub.CreateApplication(v.FilePath, name);
                }

                vmobject.IsSuccess = true;
                vmobject.Msg       = "操作成功";
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg       = ex.Message;
            }
            return(Json(vmobject));
        }