版本发布:

一、局域网共享文件方式

 

发布界面:

更新界面:

 

二、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)
};

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

  1. winform版本自动更新

    我们在使用软件的时候经常会遇到升级版本,这也是Winform程序的一个功能,今天就大概说下我是怎么实现的吧(代码有点不完美有小BUG,后面再说) 先说下我的思路:首先在打开程序的时候去拿到我之前在网站 ...

  2. Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):5、Maven版本发布与后续版本更新(大结局)

    文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...

  3. RDIFramework.NET平台代码生成器V3.0版本全新发布-更新于20160518(提供下载)

    最新版本请转到:RDIFramework.NET平台代码生成器V3.1版本全新发布-更新于2016-10-08(提供下载) RDIFramework.NET代码生成器V3.0版本修改了针对3.0版本的 ...

  4. go-wingui 2018 全新 v2.0 版本发布,包含重大更新!

    go-wingui 2018 全新 v2.0 版本发布,包含重大更新!使用新版CEF内核Chromium 63.0.3239.109,页面可以使用最新的css3,html5技术.使用delphi7重写 ...

  5. 自动化部署与统一安装升级 - 类ansible工具 udeploy0.3版本发布 (更新时间2014-12-24)

    下载地址:  unifyDeploy0.1版本  unifyDeploy0.2版本     unifyDeploy0.3版本 (更新时间2014-07-25)   自动化部署与统一安装升级,适用于多资 ...

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

    JeeWx捷微二代微信活动平台 (专业微信营销活动平台,活动插件持续更新ing~)    终于等到你!还好我没放弃! 在团队持续多年的努力下,Jeewx微信管家和H5活动平台不断更新迭代,积累了许许多 ...

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

    (新年巨献) RDIFramework.NET ━ .NET快速信息化系统开发框架 V2.8 版本发布 历时数月,RDIFramework.NET V2.8版本发布了,感谢大家的支持. RDIFram ...

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

    历时数月,RDIFramework.NET V2.7 版本发布了,感谢大家的支持. RDIFramework.NET,基于.NET的快速信息化系统开发.整合框架,为企业或个人在.NET环境下快速开发系 ...

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

    前言 前段时间针对EQueue的完善终于告一段落了,实在值得庆祝,自己的付出和坚持总算有了成果.这次新版本主要为EQueue实现了集群功能,基本实现了Broker的高可用.另外还增加了很多实用的功能, ...

随机推荐

  1. android 三种定位方式

    http://www.cnblogs.com/oudi/archive/2012/03/22/2411509.html 最近在看android关于定位的方式,查了很多资料,也做了相关实验,在手机上做了 ...

  2. Ubuntu + CentOS7 搭建tftp Server

    基于Ubuntu系统做的tftp服务器,基于CentOS 7都差不多,书写了关键命令,测试过Ubuntu 12.0.4 和CentOS 7环境 1.介绍tftp服务器     TFTP(Trivial ...

  3. 161117、使用spring声明式事务抛出 identifier of an instance of

    今天项目组有成员使用spring声明式事务出现下面异常,这里跟大家分享学习下. 异常信息: org.springframework.orm.hibernate3.HibernateSystemExce ...

  4. 160829、Java加解密与数字签名

    ** Java加解密 ** 实现方式:JDK实现,CC,BC JDK提供比较基础的底层的实现:CC提供一些简化的操作:BC提供补充 一.Base64加密 非常简单,加密解密就一个函数. 代码如下: 二 ...

  5. 搬瓦工的ShadowSock设置方法:

  6. C#(winform)浏览按钮

    FolderBrowserDialog folderBrowser = new FolderBrowserDialog();            //folderBrowser.SelectedPa ...

  7. C# Community Projects

    Community Supported C# Drivers See the officially supported MongoDB C# driver mongodb-csharp driver ...

  8. crontab 日志备份定时任务

    -l选项,查看当前用户的所有定时任务: [xiluhua@vm-xiluhua][/home]$ crontab -l * * * * * /home/xiluhua/shell_script/log ...

  9. ecshop的几个小瑕疵

    在安装Ecshop的时候,遇到两个问题: 1.Strict Standards: Non-static method cls_image::gd_version() should not be cal ...

  10. clip属性

    clip:rect矩形剪裁功能及一些应用介绍. 其实是这样的,top right bottom left分别指最终剪裁可见区域的上边,右边,下边与左边.而所有的数值都表示位置,且是相对于原始元素的左上 ...