Esempio n. 1
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));
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public JsonResult PublicSkin(FormCollection form)
        {
            string             tempSkinRoot = System.IO.Path.Combine(Server.MapPath("/"), @"res_temp\themes");
            JsonReturnMessages result       = new JsonReturnMessages();

            try
            {
                //初始化发布器
                var publicor     = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                var smartBoxInfo = SmartBox.Console.Bo.BoFactory.GetVersionTrackBo.GetCurrentSmartBoxInfo();
                //SmartBox根路径
                string smartBoxRootPath = smartBoxInfo.FilePath;  //@"D:\WorkPlace\SmartBox2\SmartBox.Console\SmartBox.Console\SmartBox.Console.Web\MainSystem\SmartBox\SmartBox_1";
                if (string.IsNullOrEmpty(smartBoxRootPath) || !System.IO.Directory.Exists(smartBoxRootPath))
                {
                    throw new Exception("SmartBox主程序未发布!");
                }
                string skinPubFolder = System.IO.Path.Combine(smartBoxRootPath, @"res\themes");
                if (!System.IO.Directory.Exists(tempSkinRoot) || System.IO.Directory.GetDirectories(tempSkinRoot).Length == 0)
                {
                    throw new Exception("未上传皮肤");
                }
                else
                {
                    if (!System.IO.Directory.Exists(skinPubFolder))
                    {
                        System.IO.Directory.CreateDirectory(skinPubFolder);
                    }
                    Beyondbit.AutoUpdate.FileHelper.MergeCopyDir(tempSkinRoot, skinPubFolder);
                    //删除临时数据
                    Directory.Delete(tempSkinRoot, true);
                    result.IsSuccess = true;
                    result.Msg       = "发布成功!";
                }
                //更新SmartBox主程序
                publicor.UpdateApplication(smartBoxRootPath, "smartbox");
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Msg       = "发布失败," + ex.Message;
            }
            return(Json(result, "text/html"));
        }
Esempio n. 4
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));
        }
 public JsonResult PublicSkin(FormCollection form)
 {
     string tempSkinRoot = System.IO.Path.Combine(Server.MapPath("/"), @"res_temp\themes");
     JsonReturnMessages result = new JsonReturnMessages();
     try
     {
         //初始化发布器
         var publicor = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
         var smartBoxInfo = SmartBox.Console.Bo.BoFactory.GetVersionTrackBo.GetCurrentSmartBoxInfo();
         //SmartBox根路径
         string smartBoxRootPath = smartBoxInfo.FilePath;  //@"D:\WorkPlace\SmartBox2\SmartBox.Console\SmartBox.Console\SmartBox.Console.Web\MainSystem\SmartBox\SmartBox_1";
         if (string.IsNullOrEmpty(smartBoxRootPath) || !System.IO.Directory.Exists(smartBoxRootPath))
             throw new Exception("SmartBox主程序未发布!");
         string skinPubFolder = System.IO.Path.Combine(smartBoxRootPath, @"res\themes");
         if (!System.IO.Directory.Exists(tempSkinRoot) || System.IO.Directory.GetDirectories(tempSkinRoot).Length == 0)
         {
             throw new Exception("未上传皮肤");
         }
         else
         {
             if (!System.IO.Directory.Exists(skinPubFolder))
                 System.IO.Directory.CreateDirectory(skinPubFolder);
             Beyondbit.AutoUpdate.FileHelper.MergeCopyDir(tempSkinRoot, skinPubFolder);
             //删除临时数据
             Directory.Delete(tempSkinRoot,true);
             result.IsSuccess = true;
             result.Msg = "发布成功!";
         }
         //更新SmartBox主程序
         publicor.UpdateApplication(smartBoxRootPath, "smartbox");
     }
     catch (Exception ex)
     {
         result.IsSuccess = false;
         result.Msg = "发布失败,"+ex.Message;
     }
     return Json(result, "text/html");
 }
Esempio n. 6
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));
        }
        public ActionResult SavePublishInfo(string Vid, FormCollection form)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                XmlMainConfigInfo x = InsertXml(Vid);//�XML
                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);

                BoFactory.GetVersionTrackBo.UpdateUpdaterPlushVersionTracks(x, Vid, base.CurrentUser.UserUId);//����״̬

                vmobject.IsSuccess = true;
                vmobject.Msg = "�����ɹ�";
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
            }

            return Json(vmobject);
        }
        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);
        }
 public JsonResult Reflush()
 {
     JsonReturnMessages data = new JsonReturnMessages();
     data.IsSuccess = true;
     data.Msg = "�ɹ�";
     try
     {
         var pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
         pub.RefreshUpdateList();
     }
     catch (Exception ex)
     {
         data.IsSuccess = false;
         data.Msg = ex.Message;
     }
     return Json(data);
 }
        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);
        }
        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);
        }
Esempio n. 12
0
        public JsonResult SaveStyleSetting(FormCollection form)
        {
            JsonReturnMessages returnResult = new JsonReturnMessages();

            try
            {
                var smartBox = BoFactory.GetVersionTrackBo.GetCurrentSmartBoxInfo();
                if (smartBox == null || string.IsNullOrEmpty(smartBox.FilePath))
                {
                    returnResult.IsSuccess = false;
                    returnResult.Msg       = "主程序版本信息不存在!";
                }
                else
                {
                    //初始化发布器
                    var publicor = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                    //SmartBox根路径
                    string smartBoxRootPath = smartBox.FilePath;
                    if (string.IsNullOrEmpty(smartBoxRootPath) || !System.IO.Directory.Exists(smartBoxRootPath))
                    {
                        throw new Exception("SmartBox主程序未发布!");
                    }
                    //1、上传登陆界面图片
                    string loginDestPath = Path.Combine(smartBoxRootPath, "res\\login");                                      //目的文件夹路径
                    //string loginDestPath = Path.Combine(@"D:\WorkPlace\SmartBox2\SmartBox.Console\SmartBox.Console\SmartBox.Console.Web\MainSystem\SmartBox\SmartBox_1", "res\\login");
                    string topImageDestPath = System.IO.Path.Combine(loginDestPath, "TopBanner");                             //目的顶部图片文件路径
                    string botImageDestPath = System.IO.Path.Combine(loginDestPath, "BottomBanner");                          //目的底部图片路径
                    string topImageTempPath = System.IO.Path.Combine(Server.MapPath("/"), _loginTempPath + "\\TopBanner");    //临时保存的顶部图片地址
                    string botImageTempPath = System.IO.Path.Combine(Server.MapPath("/"), _loginTempPath + "\\BottomBanner"); //临时保存的底部图片地址
                    if (!System.IO.Directory.Exists(loginDestPath))
                    {
                        System.IO.Directory.CreateDirectory(loginDestPath);
                    }
                    if (System.IO.File.Exists(topImageTempPath))
                    {
                        System.IO.File.Copy(topImageTempPath, topImageDestPath, true);
                        System.IO.File.Delete(topImageTempPath);//删除临时文件
                    }
                    if (System.IO.File.Exists(botImageTempPath))
                    {
                        System.IO.File.Copy(botImageTempPath, botImageDestPath, true);
                        System.IO.File.Delete(botImageTempPath);//删除临时文件
                    }
                    //2、上传登陆动画包Splash
                    string splashDestPath = Path.Combine(smartBoxRootPath, "res\\splash");
                    //string splashDestPath = Path.Combine(@"D:\WorkPlace\SmartBox2\SmartBox.Console\SmartBox.Console\SmartBox.Console.Web\MainSystem\SmartBox\SmartBox_1", "res\\splash");
                    string splashTempPath = System.IO.Path.Combine(Server.MapPath("/"), _splashTempPath);
                    if (System.IO.Directory.Exists(splashTempPath))
                    {
                        //删除原来目录,创建新的Splash目录
                        if (System.IO.Directory.Exists(splashDestPath))
                        {
                            Directory.Delete(splashDestPath, true);
                        }
                        Directory.CreateDirectory(splashDestPath);
                        Beyondbit.AutoUpdate.FileHelper.MergeCopyDir(splashTempPath, splashDestPath);
                        Directory.Delete(splashTempPath, true);//删除临时Splash目录
                    }
                    publicor.UpdateApplication(smartBoxRootPath, "smartbox");
                    returnResult.IsSuccess = true;
                    returnResult.Msg       = "Success";
                }
            }
            catch (Exception ex)
            {
                returnResult.IsSuccess = false;
                returnResult.Msg       = ex.Message;
            }
            return(Json(returnResult));
        }
        public virtual void DelAllVersionByMain(ArrayList arr)
        {
            try
            {
                string vpath = "";
                foreach (string a in arr)
                {
                    SearchVersionTrack se1 = new SearchVersionTrack();
                    se1.VID = a;
                    VersionTrack v = versionTrackDao.GetVersionTrackList(se1)[0];
                    vpath = v.FilePath;
                    string pcode = v.PluginCode;//查出当前插件code
                    SearchConfig search = new SearchConfig();
                    search.PluginCode = pcode;
                    configInfoDao.DeleteConfigInfo(search);//配置删除
                    SearchVersionTrack se = new SearchVersionTrack();
                    se.PluginCode = pcode;
                    versionTrackDao.DeleteInfo(se);//删版本
                    //删临时表
                    configTempDao.DeleteInfo(search);
                }

                string[] codes = vpath.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.DeleteApplication(name);

                //zip不删,由原来存在相同会自动删除
                vpath = vpath.Substring(0, vpath.LastIndexOf("\\"));

                if (Directory.Exists(vpath)) //删除原由文件夹
                    Directory.Delete(vpath, true);

            }
            catch (DalException ex)
            {
                throw new BOException("删除版本出错", ex);
            }
        }
 private void resumeVersionInfoByMain(ArrayList activeVersion, ArrayList resumeVersion, XmlMainConfigInfo xml, string code)
 {
     try
     {
         string filepaht = "";
         if (activeVersion != null)//若有正在使用的版本(未删除正在使用的版本)
         {
             foreach (var a in activeVersion)
             {
                 SearchVersionTrack searchv = new SearchVersionTrack();
                 searchv.VID = a.ToString();
                 VersionTrack v = versionTrackDao.GetVersionTrackList(searchv)[0];
                 v.VersionStatus = 2;
                 versionTrackDao.Update(v);//更新正在使用的版本为过期
             }
         }
         foreach (var a in resumeVersion)
         {
             SearchVersionTrack searchv = new SearchVersionTrack();
             searchv.VID = a.ToString();
             VersionTrack v = versionTrackDao.GetVersionTrackList(searchv)[0];
             v.VersionStatus = 1;
             filepaht = v.FilePath;
             versionTrackDao.Update(v);//更新正在使用的版本为正在使用
         }
         IList<ConfigInfoPC> plist = xml.configList;
         //更新除了versiontrack之外的所有表信息
         for (int i = 0; i < plist.Count; i++)
         {
             SearchConfig search = new SearchConfig();
             search.PluginCode = code;
             configInfoDao.DeleteConfigInfo(search);//删除配置
             foreach (ConfigInfoPC c in plist)
             {
                 c.PluginCode = code;
                 configInfoPCDao.Insert(c);//插入配置
             }
         }
         //发布更新
         string[] codes = filepaht.Split(new string[] { "\\" }, StringSplitOptions.None);
         string name = codes[codes.Length - 2];//获取插件code
         Beyondbit.AutoUpdate.IPublisher pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
         pub.UpdateApplication(filepaht, name);
     }
     catch (DalException ex)
     {
         throw new BOException("恢复版本出错", ex);
     }
     catch (Exception e)
     {
         throw new BOException("恢复版本出错", e);
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="activeVersion">正在使用的版本</param>
        /// <param name="resumeVersion">恢复的版本</param>
        private void resumeVersionInfo(ArrayList activeVersion, ArrayList resumeVersion, XmlConfigInfo xml)
        {
            try
            {
                string filepaht = "";
                if (activeVersion != null)//若有正在使用的版本(未删除正在使用的版本)
                {
                    foreach (var a in activeVersion)
                    {
                        SearchVersionTrack searchv = new SearchVersionTrack();
                        searchv.VID = a.ToString();
                        VersionTrack v = versionTrackDao.GetVersionTrackList(searchv)[0];
                        v.VersionStatus = 2;
                        versionTrackDao.Update(v);//更新正在使用的版本为过期
                    }
                }
                foreach (var a in resumeVersion)
                {
                    SearchVersionTrack searchv = new SearchVersionTrack();
                    searchv.VID = a.ToString();
                    VersionTrack v = versionTrackDao.GetVersionTrackList(searchv)[0];
                    v.VersionStatus = 1;
                    filepaht = v.FilePath;
                    versionTrackDao.Update(v);//更新正在使用的版本为正在使用
                }
                IList<PluginInfoTemp> plist = xml.PluginInfo;
                //更新除了versiontrack之外的所有表信息
                for (int i = 0; i < plist.Count; i++)
                {
                    SearchConfig search = new SearchConfig();
                    search.PluginCode = plist[i].PluginCode;
                    configInfoDao.DeleteConfigInfo(search);//删除配置

                    ActionExtend action = null;
                    if (plist[i].PluginCateCode.Equals(Constants.ActionCateCode))
                    {
                        actionExtendDao.DelActionExtendInfo(search);//删除action
                        action = new ActionExtend();
                        action.PluginCode = plist[i].PluginCode;
                        action.ActionCode = plist[i].ActionCode;
                        action.Summary = plist[i].ActionSummary;
                    }
                    PluginInfo p = TPluginInfo(plist[i]);//转换
                    p.IsUse = true;//设置使用
                    pluginDao.Delete(p);//删除插件(可能前一个版本是1个插件,当前版本2个插件)
                    ///////////////////////////////////////////////////////////////////////
                    pluginDao.Insert(p);//新增插件
                    foreach (ConfigInfo c in plist[i].configList)
                    {
                        c.ConfigCategoryCode = Constants.configCategory;
                        c.PluginCode = plist[i].PluginCode;
                        configInfoDao.Insert(c);//插入配置
                    }
                    if (plist[i].PluginCateCode.Equals(Constants.ActionCateCode))
                    {
                        InsertActionExtend(action);// 新增action
                    }
                }
                //发布更新
                if (!plist[0].PluginCateCode.Equals(Constants.PluginCateCode))
                {
                    string[] codes = filepaht.Split(new string[] { "\\" }, StringSplitOptions.None);
                    string name = codes[codes.Length - 2];//获取插件code
                    Beyondbit.AutoUpdate.IPublisher pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                    pub.UpdateApplication(filepaht, name);
                }
            }
            catch (DalException ex)
            {
                throw new BOException("恢复版本出错", ex);
            }
            catch (Exception e)
            {
                throw new BOException("恢复版本出错", e);
            }
        }
 public JsonResult SaveStyleSetting(FormCollection form)
 {
     JsonReturnMessages returnResult = new JsonReturnMessages();
     try
     {
         var smartBox = BoFactory.GetVersionTrackBo.GetCurrentSmartBoxInfo();
         if (smartBox == null || string.IsNullOrEmpty(smartBox.FilePath))
         {
             returnResult.IsSuccess = false;
             returnResult.Msg = "������汾��Ϣ�����ڣ�";
         }
         else
         {
             //��ʼ��������
             var publicor = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
             //SmartBox��·��
             string smartBoxRootPath = smartBox.FilePath;
             if (string.IsNullOrEmpty(smartBoxRootPath) || !System.IO.Directory.Exists(smartBoxRootPath))
                 throw new Exception("SmartBox�����������");
             //1���ϴ���½����ͼƬ
             string loginDestPath = Path.Combine(smartBoxRootPath, "res\\login");//Ŀ���ļ���·��
             //string loginDestPath = Path.Combine(@"D:\WorkPlace\SmartBox2\SmartBox.Console\SmartBox.Console\SmartBox.Console.Web\MainSystem\SmartBox\SmartBox_1", "res\\login");
             string topImageDestPath = System.IO.Path.Combine(loginDestPath, "TopBanner");//Ŀ�Ķ���ͼƬ�ļ�·��
             string botImageDestPath = System.IO.Path.Combine(loginDestPath, "BottomBanner");//Ŀ�ĵײ�ͼƬ·��
             string topImageTempPath = System.IO.Path.Combine(Server.MapPath("/"), _loginTempPath + "\\TopBanner");//��ʱ����Ķ���ͼƬ��ַ
             string botImageTempPath = System.IO.Path.Combine(Server.MapPath("/"), _loginTempPath + "\\BottomBanner");//��ʱ����ĵײ�ͼƬ��ַ
             if (!System.IO.Directory.Exists(loginDestPath))
                 System.IO.Directory.CreateDirectory(loginDestPath);
             if (System.IO.File.Exists(topImageTempPath))
             {
                 System.IO.File.Copy(topImageTempPath, topImageDestPath, true);
                 System.IO.File.Delete(topImageTempPath);//ɾ����ʱ�ļ�
             }
             if (System.IO.File.Exists(botImageTempPath))
             {
                 System.IO.File.Copy(botImageTempPath, botImageDestPath, true);
                 System.IO.File.Delete(botImageTempPath);//ɾ����ʱ�ļ�
             }
             //2���ϴ���½������Splash
             string splashDestPath = Path.Combine(smartBoxRootPath, "res\\splash");
             //string splashDestPath = Path.Combine(@"D:\WorkPlace\SmartBox2\SmartBox.Console\SmartBox.Console\SmartBox.Console.Web\MainSystem\SmartBox\SmartBox_1", "res\\splash");
             string splashTempPath = System.IO.Path.Combine(Server.MapPath("/"), _splashTempPath);
             if (System.IO.Directory.Exists(splashTempPath))
             {
                 //ɾ��ԭ��Ŀ¼�������µ�SplashĿ¼
                 if (System.IO.Directory.Exists(splashDestPath))
                     Directory.Delete(splashDestPath, true);
                 Directory.CreateDirectory(splashDestPath);
                 Beyondbit.AutoUpdate.FileHelper.MergeCopyDir(splashTempPath, splashDestPath);
                 Directory.Delete(splashTempPath, true);//ɾ����ʱSplashĿ¼
             }
             publicor.UpdateApplication(smartBoxRootPath, "smartbox");
             returnResult.IsSuccess = true;
             returnResult.Msg = "Success";
         }
     }
     catch (Exception ex)
     {
         returnResult.IsSuccess = false;
         returnResult.Msg = ex.Message;
     }
     return Json(returnResult);
 }