Exemple #1
0
        public ActionResult UpdaterInfo(string IsUpdate, string IsAdd, string Vid, string AddVid)
        {
            ViewData["IsUpdate"] = "";
            ViewData["IsAdd"]    = IsAdd;
            ViewData["Vid"]      = Vid;
            VersionTrack v = new VersionTrack();

            if (!string.IsNullOrEmpty(IsUpdate))//若为修改
            {
                string id = "";
                if (AddVid.Equals("-1"))
                {
                    id = Vid;
                }
                else
                {
                    id = AddVid;
                }
                ViewData["IsUpdate"] = IsUpdate;
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = id;
                v          = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
            }
            return(View(v));
        }
Exemple #2
0
        public ActionResult UpdateConfigInfo(string id)
        {
            ViewData["vid"] = id;
            IList <PluginInfo> plist = new List <PluginInfo>();

            ViewData["configList"] = 0;

            SearchVersionTrack searchv = new SearchVersionTrack();

            searchv.VID = id;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];

            SearchConfig search = new SearchConfig();

            search.PluginCode         = Constants.UpdaterCode;
            search.ConfigCategoryCode = Constants.UpdaterConfig;
            IList <ConfigInfo> listconfigs = BoFactory.GetVersionTrackBo.GetConfigList(search);

            listconfigs  = InitConfigs(listconfigs);//初始化
            v.configList = listconfigs;

            IEnumerable <IGrouping <string, ConfigInfo> > listccc = v.configList.GroupBy(T => T.ConfigCategoryCode).ToList();

            ViewData["keys"]       = listccc.First().Key;
            ViewData["lists"]      = listccc;
            ViewData["configList"] = v.configList.Count;

            return(View(v));
        }
Exemple #3
0
        /// <summary>
        /// 写入XML
        /// </summary>
        /// <param name="path"></param>
        private XmlConfigInfo InsertXml(string Vid)
        {
            XmlConfigInfo          xml     = new XmlConfigInfo();
            ArrayList              vids    = GetArray(Vid);//获得相关联的VID
            IList <PluginInfoTemp> list    = new List <PluginInfoTemp>();
            SearchVersionTrack     searchv = new SearchVersionTrack();
            VersionTrack           v       = null;
            SearchConfig           serach  = new SearchConfig();

            foreach (string vid in vids)
            {
                searchv.VID = vid;
                v           = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];
                PluginInfoTemp p = BoFactory.GetVersionTrackBo.GetPluginTempInfo(v.PluginCode.ToString());
                serach.PluginCode = v.PluginCode.ToString();
                IList <ConfigTemp> listct = BoFactory.GetVersionTrackBo.GetConfigListTemp(serach);//获取配置信息

                IList <ConfigInfo> listc = new List <ConfigInfo>();
                foreach (ConfigTemp c in listct)
                {
                    listc.Add(CommonMethods.ConvertToConfigInfo(c));//转换
                }
                p.configList = listc;

                list.Add(p);
            }
            xml.PluginInfo = list;
            xml.PluginInfo = xml.PluginInfo.OrderBy(T => T.PluginCode).ToList();

            CommonMethods.WritePluginfoConfigXml(xml, Path.Combine(v.FilePath.Trim(), Constants.pluginName));

            return(xml);
        }
Exemple #4
0
        public ActionResult ViewPluginInfo(string id)
        {
            ViewData["Vid"] = id;
            SearchVersionTrack search = new SearchVersionTrack();

            search.VID = id;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];

            PluginInfo   p       = BoFactory.GetVersionTrackBo.GetPluginInfo(v.PluginCode);
            SearchConfig searchc = new SearchConfig();

            searchc.PluginCode = v.PluginCode;
            IList <ConfigInfo> list = BoFactory.GetVersionTrackBo.GetConfigList(searchc);

            //转换
            foreach (ConfigInfo c in list)
            {
                c.Value1 = c.Value1.Replace("<", "&lt;").Replace(">", "&gt;");
            }
            p.configList     = list;
            p.VersionSummary = v.VersionSummary;

            SearchPlugin sh = new SearchPlugin();

            sh.PluginCateCode = p.PluginCateCode;
            p.PCname          = BoFactory.GetVersionTrackBo.GetPluginCategoryInfos(sh)[0].DisplayName;

            return(View(p));
        }
Exemple #5
0
        public ActionResult PublishInfo(string Vid)
        {
            SearchVersionTrack search = new SearchVersionTrack();

            search.VID = Vid;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];

            SearchConfig searchc = new SearchConfig();

            searchc.PluginCode = Constants.UpdaterCode;
            IList <ConfigTemp> list = BoFactory.GetVersionTrackBo.GetConfigListTemp(searchc);

            IList <ConfigInfo> listc = new List <ConfigInfo>();

            foreach (ConfigTemp c in list)
            {
                c.Value1 = c.Value1.Replace("<", "&lt;").Replace(">", "&gt;");
                listc.Add(CommonMethods.ConvertToConfigInfo(c));
            }

            listc        = InitConfigs(listc);//初始化
            v.configList = listc;
            IEnumerable <IGrouping <string, ConfigInfo> > listccc = v.configList.GroupBy(T => T.ConfigCategoryCode).ToList();

            listccc = listccc.OrderBy(T => T.Key);

            ViewData["keys"]       = listccc.First().Key;
            ViewData["lists"]      = listccc;
            ViewData["configList"] = v.configList.Count;

            return(View(v));
        }
Exemple #6
0
        public ActionResult PublishInfo(string Vid) //vid一定是上一个版本的vid
        {
            ArrayList vids = GetArray(Vid);         //获得相关联的VID

            IList <PluginInfoTemp> listtemp = new List <PluginInfoTemp>();

            foreach (string vid in vids)
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = vid;
                VersionTrack   v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                PluginInfoTemp p = BoFactory.GetVersionTrackBo.GetPluginTempInfo(v.PluginCode.ToString());

                SearchConfig searchc = new SearchConfig();
                searchc.PluginCode = p.PluginCode.ToString();
                IList <ConfigTemp> list = BoFactory.GetVersionTrackBo.GetConfigListTemp(searchc);

                IList <ConfigInfo> listc = new List <ConfigInfo>();
                foreach (ConfigTemp c in list)
                {
                    c.Value1 = c.Value1.Replace("<", "&lt;").Replace(">", "&gt;");
                    listc.Add(CommonMethods.ConvertToConfigInfo(c));
                }
                p.configList = listc;

                listtemp.Add(p);
            }
            ViewData["vids"] = Vid;
            return(View(listtemp));
        }
Exemple #7
0
        public ActionResult UpdatePluginInfo(string Vid, string IsAdd)
        {
            ViewData["configList"] = 0;
            ViewData["IsAdd"]      = IsAdd;
            SearchVersionTrack     search = new SearchVersionTrack();
            IList <PluginInfoTemp> plist  = new List <PluginInfoTemp>();

            ArrayList arrVid = GetArray(Vid);//获得相关联的VID

            foreach (string vid in arrVid)
            {
                search.VID = vid;
                VersionTrack   v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                PluginInfoTemp p = BoFactory.GetVersionTrackBo.GetPluginTempInfo(v.PluginCode.ToString());

                if (p.IsIgnoreConfig == false)//若不忽略配置信息
                {
                    SearchConfig searchc = new SearchConfig();
                    searchc.PluginCode         = v.PluginCode.ToString();
                    searchc.ConfigCategoryCode = Constants.configCategory;
                    IList <ConfigInfo> list = BoFactory.GetVersionTrackBo.GetConfigList(searchc);//获取原有参数

                    Dictionary <string, ConfigInfo> dic = new Dictionary <string, ConfigInfo>();
                    foreach (var item in list)
                    {
                        var        key  = item.Key1 + "_FG$SP_" + item.PluginCode;
                        ConfigInfo temp = new ConfigInfo();
                        temp.Key1     = item.Key1;
                        temp.OldValue = item.Value1;
                        dic.Add(key, temp);
                    }
                    IList <ConfigTemp> listT = BoFactory.GetVersionTrackBo.GetConfigListTemp(searchc);//现有临时表数据
                    foreach (var item in listT)
                    {
                        var key = item.Key1 + "_FG$SP_" + item.PluginCode;
                        if (dic.ContainsKey(key))
                        {
                            dic[key].Value1 = item.Value1;
                        }
                        else
                        {
                            ConfigInfo temp = new ConfigInfo();
                            temp.Key1     = item.Key1;
                            temp.Value1   = item.Value1;
                            temp.OldValue = "";
                            dic.Add(key, temp);
                        }
                    }
                    p.configList           = dic.Values.ToList <ConfigInfo>();
                    ViewData["configList"] = (int)ViewData["configList"] + p.configList.Count;

                    SearchPlugin sh = new SearchPlugin();
                    sh.PluginCateCode = p.PluginCateCode;
                    p.PCname          = BoFactory.GetVersionTrackBo.GetPluginCategoryInfos(sh)[0].DisplayName;
                }
                plist.Add(p);
            }
            return(View(plist));
        }
Exemple #8
0
        public ActionResult PublishInfo(string id)
        {
            SearchVersionTrack search = new SearchVersionTrack();

            search.VID = id;
            VersionTrack ver = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];

            return(View(ver));
        }
Exemple #9
0
        public ActionResult UpdateConfigInfo(string id)
        {
            string type = Request.QueryString["type"];

            ViewData["vid"] = id;
            IList <PluginInfo> plist = new List <PluginInfo>();

            ViewData["configList"] = 0;

            SearchVersionTrack searchv = new SearchVersionTrack();

            searchv.VID = id;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];

            SearchConfig search = new SearchConfig();

            search.PluginCode = Constants.MianName;

            if (type == "pc")
            {
                search.ConfigCategoryCode = Constants.SystemConfig; //Constants.PCGlobalConfig;
            }
            else if (type == "mobile")
            {
                search.ConfigCategoryCode = Constants.SystemConfig + "," + Constants.AppNameConfig + "," + Constants.GlobalConfig;
            }
            //search.ConfigCategoryCode = Constants.PCGlobalConfig + "," + Constants.SystemConfig + "," + Constants.AppNameConfig + "," + Constants.GlobalConfig;
            IList <ConfigInfo> listconfigs = null;

            switch (type)
            {
            case "pc":
                listconfigs = BoFactory.GetVersionTrackBo.GetPCConfigList(search);
                break;

            case "mobile":
                listconfigs = BoFactory.GetVersionTrackBo.GetMobileConfigList(search);
                break;
            }


            //if (type == "mobile")
            if (listconfigs == null || listconfigs.Count == 0)
            {
                listconfigs = InitConfigs(listconfigs);//初始化
            }
            v.configList = listconfigs;

            IEnumerable <IGrouping <string, ConfigInfo> > listccc = v.configList.GroupBy(T => T.ConfigCategoryCode).ToList();

            ViewData["keys"]       = listccc.First().Key;
            ViewData["lists"]      = listccc;
            ViewData["configList"] = v.configList.Count;

            return(View(v));
        }
Exemple #10
0
        public ActionResult SaveFileInfo(VersionTrack ver, string IsAdd, string IsUpdate, FormCollection form)
        {
            var               vmobject = new JsonReturnMessages();
            string            vid      = form["VersionIds"].ToString();
            XmlMainConfigInfo xmlInfo  = null;

            try
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = vid;
                VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                if (Request.Files.Count > 0)                //若有上传文件
                {
                    xmlInfo = Decompressing(v.VersionName); //解压
                }
                vid = BoFactory.GetVersionTrackBo.SaveUpdaterZipInfo(ver, xmlInfo, IsAdd, IsUpdate, base.CurrentUser.UserUId, form["VersionIds"].ToString());

                if (Request.Files.Count > 0)            //若有上传文件
                {
                    MoveFolder(xmlInfo, v.VersionName); //移动文件夹及文件
                }
            }
            catch (Exception ex)
            {
                try
                {
                    string thisFilePath = AppConfig.filePath + Common.Entities.Constants.TempName;
                    while (Directory.Exists(thisFilePath))//先删除原由临时文件夹
                    {
                        Directory.Delete(thisFilePath, true);
                    }
                    if (!string.IsNullOrEmpty(xmlInfo.savefile))
                    {
                        FileInfo f = new FileInfo(xmlInfo.savefile);//删除原本保存的zip
                        if (f.Exists)
                        {
                            f.Delete();
                        }
                    }
                }
                catch (Exception fe)
                {
                    vmobject.IsSuccess = false;
                    vmobject.Msg       = fe.Message;
                }

                vmobject.IsSuccess = false;
                vmobject.Msg       = vmobject.Msg + "," + ex.Message;
                return(Json(vmobject, "text/html"));
            }

            vmobject.Msg       = vid;
            vmobject.IsSuccess = true;
            return(Json(vmobject, "text/html"));
        }
Exemple #11
0
        public ActionResult UpdatePluginInfo(string verid, string isAdd)
        {
            PluginInfo pinfo = null;

            ViewData["vername"]    = "";
            ViewData["actionCode"] = "";
            ViewData["summary"]    = "";
            ViewData["versionId"]  = "";
            ViewData["isAdd"]      = "";//是否升级

            IResourceData[] datas = new IResourceData[1];
            datas[0]         = ResourceDataFactory.GetResourceDataInstance();
            datas[0].Code    = "WebPlugin";
            datas[0].Name    = "Web页面插件";
            ViewData["list"] = datas;

            if (string.IsNullOrEmpty(verid))//若为新增
            {
                pinfo = new PluginInfo();
            }
            else
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = verid;
                VersionTrack vsion = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];    //获取版本信息

                pinfo = BoFactory.GetVersionTrackBo.GetPluginInfo(vsion.PluginCode.ToString()); //获取插件信息

                if (isAdd.Equals("0"))                                                          //若为修改(可修改版本信息,扩展信息,插件信息)
                {
                    ViewData["vername"] = vsion.VersionName;                                    //获取版本信息

                    SearchConfig searchconfig = new SearchConfig();
                    searchconfig.PluginCode = vsion.PluginCode.ToString();
                    IList <ActionExtend> listAction = BoFactory.GetVersionTrackBo.QueryActionExtend(searchconfig);//获取扩展信息
                    if (listAction.Count > 0)
                    {
                        ViewData["actionCode"] = listAction[0].ActionCode;
                        ViewData["summary"]    = listAction[0].Summary;
                    }
                }
                else//(只可修改插件信息)
                {
                }
                ViewData["versionId"] = verid;
            }
            if (!string.IsNullOrEmpty(isAdd))
            {
                ViewData["isAdd"] = isAdd;
            }

            return(View(pinfo));
        }
Exemple #12
0
        /// <summary>
        /// 写入XML
        /// </summary>
        /// <param name="path"></param>
        private void InsertXml(VersionTrack ver)
        {
            XmlConfigInfo xml = new XmlConfigInfo();
            //xml.VersionName = ver.VersionName;
            //xml.PluginInfo = BoFactory.GetVersionTrackBo.GetPluginInfo(ver.PluginCode.ToString());//获取插件信息

            SearchConfig serach = new SearchConfig();

            serach.PluginCode = ver.PluginCode.ToString();
            //xml.configList = BoFactory.GetVersionTrackBo.GetConfigList(serach);//获取配置信息

            CommonMethods.WritePluginfoConfigXml(xml, ver.FilePath.Trim() + @"\" + Constants.pluginName);
        }
Exemple #13
0
        public ActionResult SaveConfigInfo(FormCollection form, string Vid)
        {
            var vmobject = new JsonReturnMessages();

            try
            {
                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.UpdaterCode;
                        list.Add(config);
                    }
                }
                //更新
                BoFactory.GetVersionTrackBo.UpdateUpdaterConfigInfos(list); //发布

                InsertConfigXml(Vid);                                       //生成config

                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));
        }
Exemple #14
0
        public ActionResult UpdatePluginInfo(string verid)
        {
            ViewData["actionCode"] = "";
            ViewData["summary"]    = "";
            ViewData["IsAction"]   = "";
            SearchVersionTrack search = new SearchVersionTrack();

            search.VID = verid;
            VersionTrack version = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];               //获取插件ID

            PluginInfo pinfo = BoFactory.GetVersionTrackBo.GetPluginInfo(version.PluginCode.ToString()); //获取插件信息

            if (pinfo.PluginCateCode.Equals(Constants.ActionCateCode))
            {
                ViewData["IsAction"] = "1";
            }

            IList <PluginCategory> list = BoFactory.GetVersionTrackBo.GetPluginCategoryInfo();//获取非web插件的分类信息

            if (list != null)
            {
                if (list.Count > 0)
                {
                    IResourceData[] datas = new IResourceData[list.Count];
                    for (int i = 0; i < list.Count; i++)
                    {
                        datas[i]      = ResourceDataFactory.GetResourceDataInstance();
                        datas[i].Code = list[i].PluginCateCode;
                        datas[i].Name = list[i].DisplayName;
                    }
                    ViewData["list"] = datas;
                }
            }

            SearchConfig searchconfig = new SearchConfig();

            searchconfig.PluginCode = version.PluginCode.ToString();
            IList <ActionExtend> listAction = BoFactory.GetVersionTrackBo.QueryActionExtend(searchconfig);//获取扩展信息

            if (listAction.Count > 0)
            {
                ViewData["actionCode"] = listAction[0].ActionCode;
                ViewData["summary"]    = listAction[0].Summary;
            }

            ViewData["versionId"] = verid;
            ViewData["vername"]   = version.VersionName;

            return(View(pinfo));
        }
Exemple #15
0
        public ActionResult PublishInfo(string id, string IsLoadFile)
        {
            ViewData["IsLoadFile"] = "";
            if (!string.IsNullOrEmpty(IsLoadFile))
            {
                ViewData["IsLoadFile"] = IsLoadFile;//是否单个上传文件
            }
            SearchVersionTrack search = new SearchVersionTrack();

            search.VID = id;
            VersionTrack ver = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];

            return(View(ver));
        }
Exemple #16
0
        public ActionResult UploadVersionFile(string id)//版本ID
        {
            VersionTrack VerInfo = null;

            if (string.IsNullOrEmpty(id))
            {
                VerInfo = new VersionTrack();
                ViewData["versionId"] = "";//初始化
            }
            else
            {
                ViewData["versionId"] = id;//版本ID
            }
            return(View(VerInfo));
        }
Exemple #17
0
        /// <summary>
        /// 解压、获取信息
        /// </summary>
        /// <returns></returns>
        private XmlConfigInfo Decompressing(string vid, string isAdd)
        {
            string thisFilePath = AppConfig.filePath + Common.Entities.Constants.TempName;

            while (!Directory.Exists(thisFilePath))//创建临时文件夹
            {
                Directory.CreateDirectory(thisFilePath);
            }
            string zipPaht = AppConfig.SaveZipPath;

            while (!Directory.Exists(zipPaht))//创建存放zip文件的文件夹
            {
                Directory.CreateDirectory(zipPaht);
            }

            string saveFile = Path.Combine(zipPaht, System.Guid.NewGuid().ToString() + ".zip");

            Request.Files[0].SaveAs(saveFile);                //保存zip去文件夹下

            CommonMethods.Uncompress(saveFile, thisFilePath); //解压

            XmlConfigInfo xmlInfo = new XmlConfigInfo();

            xmlInfo.savefile = saveFile;

            xmlInfo = GetXmlInfo(thisFilePath);//获取解析出来的配置信息
            //若升级,以原由CODE文件夹+第一个插件版本名命
            if (isAdd.Equals("0"))
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = vid;
                VersionTrack v     = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                string[]     codes = v.FilePath.Split(new string[] { "\\" }, StringSplitOptions.None);
                xmlInfo.oldCode = codes[codes.Length - 2];
            }
            else
            {
                xmlInfo.oldCode = xmlInfo.PluginInfo[0].PluginCode;//否则以第一个排序后的CODE为文件夹
            }
            //zip文件有第一个CODE+版本号命名
            string oldfilepath = Path.Combine(zipPaht, xmlInfo.PluginInfo[0].PluginCode + "_FG$SP_" + xmlInfo.PluginInfo[0].Version + ".zip");//重命名的zip文件

            xmlInfo.savefile = saveFile;
            xmlInfo.oldfile  = oldfilepath;

            return(xmlInfo);
        }
Exemple #18
0
        public ActionResult Publishs(VersionTrack ver, string IsLoadFile)
        {
            var vmobject = new JsonReturnMessages();

            try
            {
                //1。写入XML
                InsertXml(ver.FilePath);
                Beyondbit.AutoUpdate.IPublisher pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                if (!string.IsNullOrEmpty(IsLoadFile))//若为单个上传文件发布
                {
                    //读去ver.FilePath发布单个文件
                    pub.UpdateFile(ver.FilePath + @"\" + Common.Entities.Constants.globalName, Constants.MianName, "./");
                    pub.UpdateFile(ver.FilePath + @"\" + Common.Entities.Constants.systemName, Constants.MianName, "./");
                }
                else
                {
                    //2。发布
                    SearchVersionTrack search = new SearchVersionTrack();
                    search.VID = ver.PreVersionId.ToString(); //获取上一个版本。
                    IList <VersionTrack> list = BoFactory.GetVersionTrackBo.GetVersionTrack(search);
                    if (list.Count > 0)                       //若不存在此记录说明是第一次发布
                    {
                        pub.UpdateApplication(ver.FilePath, Common.Entities.Constants.MianName);
                    }
                    else
                    {
                        pub.CreateApplication(ver.FilePath, Common.Entities.Constants.MianName);
                    }

                    //3。更新
                    ver.LastModTime   = DateTime.Now;
                    ver.LastModUid    = base.CurrentUser.UserUId;
                    ver.VersionStatus = 1;
                    BoFactory.GetVersionTrackBo.UpdatePlushVersionTrack(ver);
                }
                vmobject.IsSuccess = true;
                vmobject.Msg       = "操作成功!";
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg       = ex.Message;
            }
            return(Json(vmobject));
        }
Exemple #19
0
        public ActionResult GetPluginNames(string vid)
        {
            var       vmobject = new JsonReturnMessages();
            ArrayList arr      = GetArrays(vid);
            string    status   = "";

            foreach (string a in arr)
            {
                SearchVersionTrack searchv = new SearchVersionTrack();
                searchv.VID = a;
                VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];
                vmobject.Msg += v.PluginCode + ",";
                status        = v.VersionStatus.ToString();
            }
            vmobject.IsSuccess = true;
            vmobject.Msg       = vmobject.Msg.Substring(0, vmobject.Msg.Length - 1) + "|" + status;
            return(Json(vmobject));
        }
Exemple #20
0
        /// <summary>
        /// 写入XML
        /// </summary>
        /// <param name="path"></param>
        private XmlMainConfigInfo InsertConfigXml(string Vid)
        {
            XmlMainConfigInfo  xml     = new XmlMainConfigInfo();
            SearchVersionTrack searchv = new SearchVersionTrack();
            SearchConfig       serach  = new SearchConfig();

            searchv.VID = Vid;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];

            serach.PluginCode = v.PluginCode.ToString();
            IList <ConfigInfoPC> listc = BoFactory.GetVersionTrackBo.GetConfigPCList(serach);//获取配置信息

            xml.configList = listc;

            CommonMethods.WriteMaininfoConfigXml(listc, Path.Combine(v.FilePath.Trim(), Constants.UpdaterName));

            return(xml);
        }
Exemple #21
0
        public ActionResult SaveVersions(string IsAdd, string IsUpdate, string Vid, VersionTrack version, FormCollection form)
        {
            var    vmobject = new JsonReturnMessages();
            string vid      = "";

            try
            {
                vid = BoFactory.GetVersionTrackBo.SaveUpdaterVerInfo(version, IsAdd, IsUpdate, base.CurrentUser.UserUId, Vid);
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg       = ex.Message;
                return(Json(vmobject, "text/html"));
            }

            vmobject.Msg       = vid;
            vmobject.IsSuccess = true;
            return(Json(vmobject, "text/html"));
        }
Exemple #22
0
        //获取当前关联的vid
        private ArrayList GetArrays(string Vid)
        {
            SearchVersionTrack search = new SearchVersionTrack();

            //获得第一个vid(肯能多个VID,也可能是1个,但至少有一个,根据相同的filepath获得相关的VID)
            search.VID = Vid;
            VersionTrack       vs = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
            SearchVersionTrack se = new SearchVersionTrack();

            se.filepath = vs.FilePath;
            IList <VersionTrack> vlist  = BoFactory.GetVersionTrackBo.GetVersionTrack(se);
            ArrayList            arrVid = new ArrayList();

            foreach (VersionTrack v1 in vlist)
            {
                arrVid.Add(v1.VersionId.ToString());
            }

            return(arrVid);
        }
Exemple #23
0
        public ActionResult Publishs(VersionTrack ver)
        {
            var vmobject = new JsonReturnMessages();

            try
            {
                InsertXml(ver);//1。写入XML

                ver.LastModTime   = DateTime.Now;
                ver.LastModUid    = base.CurrentUser.UserUId;
                ver.VersionStatus = 1;

                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = ver.PreVersionId.ToString();
                IList <VersionTrack> list = BoFactory.GetVersionTrackBo.GetVersionTrack(search);               //获取上一个版本。

                string name = BoFactory.GetVersionTrackBo.GetPluginInfo(ver.PluginCode.ToString()).PluginCode; //获取插件code

                Beyondbit.AutoUpdate.IPublisher pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                if (list.Count > 0)//若不存在此记录说明是第一次发布
                {
                    pub.UpdateApplication(ver.FilePath, name);
                }
                else
                {
                    pub.CreateApplication(ver.FilePath, name);
                }

                BoFactory.GetVersionTrackBo.UpdatePlushVersionTrack(ver);//更新状态

                vmobject.IsSuccess = true;
                vmobject.Msg       = "操作成功!";
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg       = ex.Message;
            }
            return(Json(vmobject));
        }
Exemple #24
0
        public ActionResult SaveVerInfo(VersionTrack ver, string IsAdd, FormCollection form)
        {
            var vmobject = new JsonReturnMessages();


            string vid = "";

            if (Request.Files.Count > 0)
            {
                XmlConfigInfo xmlInfo = Decompressing();
                try
                {
                    //vid = BoFactory.GetVersionTrackBo.SavePluingZipInfo(ver, xmlInfo, IsAdd, base.CurrentUser.UserUId);
                    MoveFolder(xmlInfo);
                }
                catch (Exception ex)
                {
                    string thisFilePath = AppConfig.filePath + Common.Entities.Constants.TempName;
                    while (Directory.Exists(thisFilePath))    //先删除原由临时文件夹
                    {
                        Directory.Delete(thisFilePath, true);
                    }
                    FileInfo f = new FileInfo(xmlInfo.savefile);    //删除原本保存的zip
                    f.Delete();
                    vmobject.IsSuccess = false;
                    vmobject.Msg       = ex.Message;
                    return(Json(vmobject, "text/html"));
                }
            }
            else
            {
                vid = ver.VersionId.ToString();
            }

            vmobject.IsSuccess = true;
            vmobject.Msg       = vid;

            return(Json(vmobject, "text/html"));
        }
Exemple #25
0
        public ActionResult SavePublishInfo(string Vid, FormCollection form)
        {
            var vmobject = new JsonReturnMessages();

            try
            {
                XmlConfigInfo      x      = InsertXml(Vid); //写入XML
                SearchVersionTrack search = new SearchVersionTrack();
                ArrayList          vids   = GetArray(Vid);  //获得相关联的VID
                search.VID = vids[0].ToString();
                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);
                }

                BoFactory.GetVersionTrackBo.UpdatePlushVersionTracks(x, Vid, base.CurrentUser.UserUId);//更新状态


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

            return(Json(vmobject));
        }
Exemple #26
0
        //获取最新版本关联VID,因为列表中修改时,数据现实的是上一版本
        private ArrayList GetArray(string Vid)
        {
            SearchVersionTrack search = new SearchVersionTrack();

            search.VID = Vid;
            VersionTrack       vs       = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
            string             filepath = vs.FilePath;
            SearchVersionTrack setemp   = new SearchVersionTrack();

            setemp.filepath = filepath;
            IList <VersionTrack> vlisttemp = BoFactory.GetVersionTrackBo.GetVersionTrack(setemp);//获得上一所有插件版本

            //升级时,必须满足上传插件CODE中至少有一个CODE匹配
            foreach (VersionTrack vtemp in vlisttemp)
            {
                SearchVersionTrack searcht = new SearchVersionTrack();
                searcht.PreVersionId = vtemp.VersionId.ToString();//查找下一个最新版本是否存在
                IList <VersionTrack> templist = BoFactory.GetVersionTrackBo.GetVersionTrack(searcht);
                if (templist.Count > 0)
                {
                    filepath = templist[0].FilePath;
                    break;
                }
            }
            //若未找到,就沿用当前这个版本
            SearchVersionTrack se = new SearchVersionTrack();

            se.filepath = filepath;
            IList <VersionTrack> vlist  = BoFactory.GetVersionTrackBo.GetVersionTrack(se);
            ArrayList            arrVid = new ArrayList();

            foreach (VersionTrack v1 in vlist)
            {
                arrVid.Add(v1.VersionId.ToString());
            }

            return(arrVid);
        }
Exemple #27
0
        /// <summary>
        /// 写入XML
        /// </summary>
        /// <param name="path"></param>
        private XmlMainConfigInfo InsertXml(string Vid)
        {
            XmlMainConfigInfo  xml     = new XmlMainConfigInfo();
            SearchVersionTrack searchv = new SearchVersionTrack();
            SearchConfig       serach  = new SearchConfig();

            searchv.VID = Vid;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];

            serach.PluginCode = v.PluginCode.ToString();
            IList <ConfigTemp> listct = BoFactory.GetVersionTrackBo.GetConfigListTemp(serach);//获取配置信息

            IList <ConfigInfoPC> listc = new List <ConfigInfoPC>();

            foreach (ConfigTemp c in listct)
            {
                listc.Add(CommonMethods.ConvertToConfigInfoPC(c));//转换
            }
            xml.configList = listc;

            CommonMethods.WriteMaininfoConfigXml(listc, Path.Combine(v.FilePath.Trim(), Constants.UpdaterName));

            return(xml);
        }
Exemple #28
0
        private XmlConfigInfo InsertXmlByConfig(string Vid)
        {
            XmlConfigInfo          xml     = new XmlConfigInfo();
            ArrayList              vids    = GetArrays(Vid);//获得相关联的VID
            IList <PluginInfoTemp> list    = new List <PluginInfoTemp>();
            SearchVersionTrack     searchv = new SearchVersionTrack();
            VersionTrack           v       = null;
            SearchConfig           serach  = new SearchConfig();

            foreach (string vid in vids)
            {
                searchv.VID = vid;
                v           = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];
                PluginInfo p = BoFactory.GetVersionTrackBo.GetPluginInfo(v.PluginCode.ToString());
                serach.PluginCode = v.PluginCode.ToString();
                IList <ConfigInfo> listct = BoFactory.GetVersionTrackBo.GetConfigList(serach);//获取配置信息
                p.configList     = listct;
                p.VersionSummary = v.VersionSummary;
                if (p.PluginCateCode.Equals(Constants.ActionCateCode))
                {
                    SearchConfig search = new SearchConfig();
                    search.PluginCode = p.PluginCode;
                    ActionExtend a = BoFactory.GetVersionTrackBo.QueryActionExtend(search)[0];
                    p.ActionCode    = a.ActionCode;
                    p.ActionSummary = a.Summary;
                }

                list.Add(TPluginInfo(p));
            }
            xml.PluginInfo = list;
            xml.PluginInfo = xml.PluginInfo.OrderBy(T => T.PluginCode).ToList();

            CommonMethods.WritePluginfoConfigXml(xml, Path.Combine(v.FilePath.Trim(), Constants.pluginName));

            return(xml);
        }
Exemple #29
0
        public ActionResult GetDownLoadFile(FormCollection form)
        {
            var vmobject = new JsonReturnMessages();

            try
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = form["vid"].ToString();
                VersionTrack v        = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                string[]     codes    = v.FilePath.Split(new string[] { "\\" }, StringSplitOptions.None);
                string       filename = Path.Combine(AppConfig.SaveZipPath, codes[codes.Length - 1] + ".zip");
                MemoryStream m        = new MemoryStream(System.IO.File.ReadAllBytes(filename));
                DownLoadFile(m.ToArray(), v.PluginCode + v.VersionName + ".zip", m);
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg       = ex.Message;
            }

            vmobject.IsSuccess = true;

            return(Json(vmobject));
        }
Exemple #30
0
        public ActionResult UpdatePluginInfo(string Vid, string IsAdd)
        {
            ViewData["configList"] = 0;
            ViewData["IsAdd"]      = IsAdd;
            SearchVersionTrack search = new SearchVersionTrack();

            search.VID = Vid;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];

            SearchConfig searchc = new SearchConfig();

            searchc.PluginCode         = v.PluginCode.ToString();
            searchc.ConfigCategoryCode = Constants.UpdaterConfig;
            IList <ConfigInfo> list = BoFactory.GetVersionTrackBo.GetConfigList(searchc);//获取原有参数

            Dictionary <string, ConfigInfo> dic = new Dictionary <string, ConfigInfo>();

            foreach (var item in list)
            {
                var        key  = item.Key1 + "_FG$SP_" + item.PluginCode + "_FG$SP_" + item.ConfigCategoryCode;
                ConfigInfo temp = new ConfigInfo();
                temp.Key1               = item.Key1;
                temp.OldValue           = item.Value1;
                temp.ConfigCategoryCode = item.ConfigCategoryCode;
                temp.PluginCode         = Constants.UpdaterCode;
                dic.Add(key, temp);
            }
            IList <ConfigTemp> listT = BoFactory.GetVersionTrackBo.GetConfigListTemp(searchc);//现有临时表数据

            foreach (var item in listT)
            {
                var key = item.Key1 + "_FG$SP_" + item.PluginCode + "_FG$SP_" + item.ConfigCategoryCode;
                if (dic.ContainsKey(key))
                {
                    dic[key].Value1 = item.Value1;
                }
                else
                {
                    ConfigInfo temp = new ConfigInfo();
                    temp.Key1               = item.Key1;
                    temp.Value1             = item.Value1;
                    temp.OldValue           = "";
                    temp.PluginCode         = Constants.UpdaterCode;
                    temp.ConfigCategoryCode = item.ConfigCategoryCode;
                    dic.Add(key, temp);
                }
            }

            IList <ConfigInfo> listconfigs = dic.Values.ToList <ConfigInfo>();

            listconfigs  = InitConfigs(listconfigs);//初始化
            v.configList = listconfigs;

            IEnumerable <IGrouping <string, ConfigInfo> > listccc = v.configList.GroupBy(T => T.ConfigCategoryCode).ToList();

            listccc                = listccc.OrderBy(T => T.Key);
            ViewData["keys"]       = listccc.First().Key;
            ViewData["lists"]      = listccc;
            ViewData["configList"] = v.configList.Count;

            return(View(v));
        }