Winform版本发布更新

 

版本发布:

一、局域网共享文件方式

 

发布界面:

更新界面:

 

二、FTP方式

发布界面

更新界面:

 

 

(只会更新有变动的文件)
同步新增,替换与删除
实现方式XML(文件名+文件最后修改时间)
状态判断:LINQ(通过对比本地XML和服务器XML的不同)

 

XML实质是一张DataSet

包含两张表

#region 获得数据集结构
        /// <summary>
        /// 获得数据集结构
        /// </summary>
        /// <returns></returns>
        protected DataSet GenerateDataSchema()
        {
            DataTable dtV = new DataTable(DataSchema.VersionSchema.TableName);
            dtV.Columns.Add(DataSchema.VersionSchema.Version);

            DataTable dtD = new DataTable(DataSchema.DetailSchema.TableName);
            dtD.Columns.Add(DataSchema.DetailSchema.Name, typeof(System.String));//名称
            dtD.Columns.Add(DataSchema.DetailSchema.EditDate, typeof(System.DateTime));//修改时间
            dtD.Columns.Add(DataSchema.DetailSchema.Size, typeof(System.String));//大小
            dtD.Columns.Add(DataSchema.DetailSchema.Path, typeof(System.String));//路径

            DataSet ds = new DataSet();

            ds.Tables.Add(dtV);
            ds.Tables.Add(dtD);

            return ds;
        }
        #endregion

 

LINQ服务器和本地对比代码:

版本发布:

//需要新增的
            //需要删除的
            //需要替换的

            var DataEdit = from dtLocation in LocalDetailFiles.AsEnumerable()
                           join dtServer in ServerDetailFiles.AsEnumerable()
                           on dtLocation.Field<string>(DataSchema.DetailSchema.Path) + dtLocation.Field<string>(DataSchema.DetailSchema.Name) equals
                              dtServer.Field<string>(DataSchema.DetailSchema.Path) + dtServer.Field<string>(DataSchema.DetailSchema.Name)
                           where dtLocation.Field<DateTime>(DataSchema.DetailSchema.EditDate) > dtServer.Field<DateTime>(DataSchema.DetailSchema.EditDate)
                           select new
                           {
                               Name = dtLocation.Field<string>(DataSchema.DetailSchema.Name),
                               Path = dtLocation.Field<string>(DataSchema.DetailSchema.Path)
                           };
            var DataAdd = from dtLocal in LocalDetailFiles.AsEnumerable()
                          where !ServerDetailFiles.AsEnumerable().Any(y => y.Field<string>(DataSchema.DetailSchema.Path) + y.Field<string>(DataSchema.DetailSchema.Name) == dtLocal.Field<string>(DataSchema.DetailSchema.Path) + dtLocal.Field<string>(DataSchema.DetailSchema.Name))
                          select new
                          {
                              Name = dtLocal.Field<string>(DataSchema.DetailSchema.Name),
                              Path = dtLocal.Field<string>(DataSchema.DetailSchema.Path)
                          };
            var DataDelete = from dtServer in ServerDetailFiles.AsEnumerable()
                             where !LocalDetailFiles.AsEnumerable().Any(y => y.Field<string>(DataSchema.DetailSchema.Path) + y.Field<string>(DataSchema.DetailSchema.Name) == dtServer.Field<string>(DataSchema.DetailSchema.Path) + dtServer.Field<string>(DataSchema.DetailSchema.Name))
                             select new
                             {
                                 Name = dtServer.Field<string>(DataSchema.DetailSchema.Name),
                                 Path = dtServer.Field<string>(DataSchema.DetailSchema.Path)
                             };

            dtUpdateFiles = new DataTable();
            dtUpdateFiles.Columns.Add("Name", typeof(System.String));
            dtUpdateFiles.Columns.Add("Path", typeof(System.String));
            dtUpdateFiles.Columns.Add("Type", typeof(System.String));

            foreach (var v in DataAdd)
            {
                DataRow dr = dtUpdateFiles.Rows.Add();
                dr["Type"] = "1";
                dr["Name"] = v.Name;
                dr["Path"] = v.Path;

                //ListViewItem item = new ListViewItem("新增");
                //item.SubItems.Add(v.Name);//文件名
                //item.SubItems.Add(v.Path);//路径
                //LVFile.Items.Add(item);
            }
            foreach (var v in DataEdit)
            {
                DataRow dr = dtUpdateFiles.Rows.Add();
                dr["Type"] = "2";
                dr["Name"] = v.Name;
                dr["Path"] = v.Path;

                //ListViewItem item = new ListViewItem("替换");
                //item.SubItems.Add(v.Name);//文件名
                //item.SubItems.Add(v.Path);//路径
                //LVFile.Items.Add(item);
            }
            foreach (var v in DataDelete)
            {
                DataRow dr = dtUpdateFiles.Rows.Add();
                dr["Type"] = "3";
                dr["Name"] = v.Name;
                dr["Path"] = v.Path;

                //ListViewItem item = new ListViewItem("删除");
                //item.SubItems.Add(v.Name);//文件名
                //item.SubItems.Add(v.Path);//路径
                //LVFile.Items.Add(item);
            }

版本更新:

//需要新增的
            //需要删除的
            //需要替换的

            var DataEdit = from dtServer in ServerDetailFiles.AsEnumerable()
                           join dtLocation in LocalDetailFiles.AsEnumerable()
                           on dtServer.Field<string>(DataSchema.DetailSchema.Path) + dtServer.Field<string>(DataSchema.DetailSchema.Name) equals
                                dtLocation.Field<string>(DataSchema.DetailSchema.Path) + dtLocation.Field<string>(DataSchema.DetailSchema.Name)
                           where dtServer.Field<DateTime>(DataSchema.DetailSchema.EditDate) > dtLocation.Field<DateTime>(DataSchema.DetailSchema.EditDate)
                           select new
                           {
                               Name = dtServer.Field<string>(DataSchema.DetailSchema.Name),
                               Path = dtServer.Field<string>(DataSchema.DetailSchema.Path)
                           };
            var DataAdd = from dtServer in ServerDetailFiles.AsEnumerable()
                          where !LocalDetailFiles.AsEnumerable().Any(y => y.Field<string>(DataSchema.DetailSchema.Path) + y.Field<string>(DataSchema.DetailSchema.Name) == dtServer.Field<string>(DataSchema.DetailSchema.Path) + dtServer.Field<string>(DataSchema.DetailSchema.Name))
                          select new
                          {
                              Name = dtServer.Field<string>(DataSchema.DetailSchema.Name),
                              Path = dtServer.Field<string>(DataSchema.DetailSchema.Path)
                          };
            var DataDelete = from dtLocation in LocalDetailFiles.AsEnumerable()
                             where !ServerDetailFiles.AsEnumerable().Any(y => y.Field<string>(DataSchema.DetailSchema.Path) + y.Field<string>(DataSchema.DetailSchema.Name) == dtLocation.Field<string>(DataSchema.DetailSchema.Path) + dtLocation.Field<string>(DataSchema.DetailSchema.Name))
                             select new
                             {
                                 Name = dtLocation.Field<string>(DataSchema.DetailSchema.Name),
                                 Path = dtLocation.Field<string>(DataSchema.DetailSchema.Path)
                             };
时间: 2024-08-05 02:44:37

Winform版本发布更新的相关文章

winform版本自动更新

我们在使用软件的时候经常会遇到升级版本,这也是Winform程序的一个功能,今天就大概说下我是怎么实现的吧(代码有点不完美有小BUG,后面再说) 先说下我的思路:首先在打开程序的时候去拿到我之前在网站上写好的xml里边的版本号,判断是否要更新,之后要更新的话就调用更新的exe(ps:这个是单独出来的,因为更新肯定要覆盖当前的文件,文件运行的时候不能被覆盖),然后下载最新的压缩包到本地,调用7z解压覆盖即可 思路明确了之后就开始写代码(所以说思路很重要啊!!!): <?xml version=&quo

二维码加密解密工具——优密 更新版本发布!

优密--二维码加解密工具该工具是一款强大的二维码加密与解密扫码的手机软件,适用于Android 2.2及以上平台.使用本工具可以制作出具有加密信息的二维码,该二维码无法被普通的二维码扫码工具解码其中的内容,可以非常方便的将机密的信息隐藏在二维码中,帮助保护机密信息不被非法的扫码解读! 优密二维码加密解密工具主要特点: 1.制作包含加密信息的二维码:软件可在手机中直接生成需要的内容的加密二维码,无需借助电脑等设备,该二维码外观与普通二维码无异,并且也可被常见的普通二维码扫码工具扫描识别,但是却无法

JeeWx全新版本发布!捷微二代微信活动平台1.0发布!活动插件持续开源更新!

JeeWx捷微二代微信活动平台 (专业微信营销活动平台,活动插件持续更新ing~)    终于等到你!还好我没放弃! 在团队持续多年的努力下,Jeewx微信管家和H5活动平台不断更新迭代,积累了许许多多的技术亮点和成功案例,而今天,集成了两者优秀基因的JeeWx捷微二代 H5微信活动平台诞生啦!   平台亮点:采用微服务架构支持插件式开发,可集成微信功能.微信营销活动.商城.网站.会员等各类插件:可灵活组合集成插件,支持热插拔:更专业的微信营销活动平台:支持大用户量.高并发支撑能力:活动插件不断

RDIFramework.NET ━ .NET快速信息化系统开发框架 V2.8 版本发布

(新年巨献) RDIFramework.NET ━ .NET快速信息化系统开发框架 V2.8 版本发布 历时数月,RDIFramework.NET V2.8版本发布了,感谢大家的支持. RDIFramework.NET,基于.NET的快速信息化系统开发.整合框架,为企业或个人在.NET环境下快速开发系统提供了强大的支持,开发人员不需要开发系统的基础功能和公共模块,框架自身提供了强大的函数库和开发包,开发人员只须集中精力专注于业务部分的开发,因此大大提高开发效率和节约开发成本.框架采用目前最主流的

[WinForm] VS2010发布、打包安装程序(超全超详细)

1. 在vs2010 选择"新建项目"→" 其他项目类型"→" Visual Studio Installer→"安装项目": 命名为:Setup1 . 这是在VS2010中将有三个文件夹, 1."应用程序文件夹"表示要安装的应用程序需要添加的文件: 2."用户的'程序'菜单"表示:应用程序安装完,用户的"开始菜单"中的显示的内容,一般在这个文件夹中,需要再创建一个文件用来存放

WinForm通用自动更新器AutoUpdater项目实战

一.项目背景介绍 最近单位开发一个项目,其中需要用到自动升级功能.因为自动升级是一个比较常用的功能,可能会在很多程序中用到,于是,我就想写一个自动升级的组件,在应用程序中,只需要引用这个自动升级组件,并添加少量代码,即可实现自动升级功能.因为我们的程序中可能包含多个类型的文件,比如exe.dll. config.xml.bat等等自定义格式的后缀名文件,所以要支持多文件类型的更新. 本期同样带给大家分享的是阿笨在实际工作中遇到真实项目场景,请跟随阿笨的视角去如何开发实现WinForm通用自动更新

Linux内核版本发布时间整理

有了这个Linux内核版本发布时间表(0.00到3.19,当然没有包含全部的版本), 大家就可以看看自己用的版本是何时发布的了! 或许有同学会大吃一惊,哇(⊙0⊙)我用的版本10年前就有了啊! 发展史我也没写全,有时间和必要的话再写吧! 版本号 时间 发展史 0.00 1991.2-4 两个进程分别显示AAABBB 0.01 1991.9 第一个正式向外公布的Linux内核版本 0.02 1991.10.5 Linux的第一个稳定的工作版本 0.03 1991.10.5 0.10 1991.10

Mybatis分页插件2.0版本发布

项目地址:http://git.oschina.net/free/Mybatis_PageHelper 分页插件示例: http://blog.csdn.net/isea533/article/details/24700339 v2.0更新内容: 支持Mybatis缓存,count和分页同时支持(二者同步) 修改拦截器签名,拦截Executor,签名如下: @Intercepts(@Signature(type = Executor.class, method = "query", a

EQueue 2.3.2版本发布(支持高可用)

前言 前段时间针对EQueue的完善终于告一段落了,实在值得庆祝,自己的付出和坚持总算有了成果.这次新版本主要为EQueue实现了集群功能,基本实现了Broker的高可用.另外还增加了很多实用的功能,对性能也做了很多优化.总之,EQueue越来越成熟了. EQueue最新版本信息 Nuget:https://www.nuget.org/packages/EQueue github:https://github.com/tangxuehua/equeue 版本发布说明 为Broker支持集群部署的