vs2013附件 :http://download.csdn.net/detail/u012663700/7427461
C# WPF 解压缩7zip文件 带进度条 sevenzipsharp
WPF PNG实现的图形进度条
.NET 3.5
MainWindow.xaml
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SevenZipSharp WPF Demo" Height="157" Width="479" WindowStartupLocation="CenterScreen" >
Name="progressBar1" VerticalAlignment="Top" Width="355" />
MainWindow.xaml.cs
using System;
using System.Windows;
using SevenZip;
namespace SevenZipTestWPF
{
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Check7zAndSevenZipSharpDll();
}
private string fileName = @"D:\Administrator\wwwroot\CPW\wmgjUpdate.7z";
private string directory = @"D:\Administrator\Desktop\完美世界国际版";
private string dll7z = AppDomain.CurrentDomain.BaseDirectory + "7z.dll";
private string dllSevenZipSharp = AppDomain.CurrentDomain.BaseDirectory + "SevenZipSharp.dll";
private int MaxValue = 0;
private int CurrentValue = 0;
private void b_Extract_Click(object sender, RoutedEventArgs e)
{
if (System.IO.File.Exists(fileName) && System.IO.Directory.Exists(directory))
{
SevenZipExtractor.SetLibraryPath(dll7z);
label1.Content = "开始更新客户端文件";
var extractor = new SevenZipExtractor(fileName);
progressBar1.Maximum = extractor.ArchiveFileData.Count;
MaxValue = extractor.ArchiveFileData.Count;
extractor.FileExtractionStarted += new EventHandler(extr_FileExtractionStarted);
extractor.BeginExtractArchive(directory);
}
}
void extr_FileExtractionStarted(object sender, FileInfoEventArgs e)
{
label1.Content = String.Format("更新文件 {0}", e.FileInfo.FileName);
progressBar1.Value += 1;
CurrentValue += 1;
ImageProgressBar(CurrentValue, MaxValue, 193, image1);
if (progressBar1.Maximum == progressBar1.Value)
label1.Content = "游戏更新完成";
}
private void Check7zAndSevenZipSharpDll()
{
bool b1 = System.IO.File.Exists(dll7z);
bool b2 = System.IO.File.Exists(dllSevenZipSharp);
if (!b1)
{
MessageBox.Show("7z.dll 不存在!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
Close();
}
if (!b2)
{
MessageBox.Show("SevenZipSharp.dll 不存在!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
Close();
}
}
///
/// 图片进度条
///
///
///
/// 图片的实际宽度
///
private static void ImageProgressBar(double current, double max, double imageWidth, System.Windows.Controls.Image image1)
{
if (max != 0)
image1.Width = System.Math.Round((current / max) * imageWidth);
}
}
}
WPF 下载网络文件 带进度条
附件:http://files.cnblogs.com/xe2011/WpfApplication3_downloadFile.rar 使用 private void Button ...
Asp.Net上传大文件带进度条swfupload
Asp.Net基于swfupload上传大文件带进度条百分比显示,漂亮大气上档次,大文件无压力,先看效果 一.上传效果图 1.上传前界面:图片不喜欢可以自己换 2.上传中界面:百分比显示 3.上传后返 ...
Extjs 使用fileupload插件上传文件 带进度条显示
一.首先我们看看官方给出的插件的解释: 一个文件上传表单项具有自定义的样式,并且可以控制按钮的文本和 像文本表单的空文本类似的其他特性. 它使用一个隐藏的文件输入元素,并在用户选择文件后 在form提 ...
ASP.NET Jquery+ajax上传文件(带进度条)
效果图 支持ie6+,chrome,ie6中文文件名会显示乱码. 上传时候会显示进度条. 需要jquery.uploadify.js插件,稍后会给出下载 前台代码
Springmvc+uploadify实现文件带进度条批量上传
网上看了很多关于文件上传的帖子,众口不一,感觉有点乱,最近正好公司的项目里用到JQuery的uploadify控件做文件上传,所以整理下头绪,搞篇文档出来,供亲们分享. Uploadify控件的主要优 ...
webclient下载文件 带进度条
private void button1_Click(object sender, EventArgs e) { doDownload(textBox1.Text.Trim()); } private ...
asp.net mvc 实现上传文件带进度条
本文乃是博主早期写的,此种思路虽然实现了,但固然不是最好的,仅做参考学习. 可以用js onprogress .fileinput .webuploader.jq ajaxsubmit等实现 思路:a ...
UrlDownloadFile, 线程下载文件, 带进度条
unit FileDownLoadThread; interface uses Classes, SysUtils, Windows, ActiveX, UrlMon; const S_ABORT = ...
java进行文件上传,带进度条
网上看到别人发过的一个java上传的代码,自己写了个完整的,附带源码 项目环境:jkd7.tomcat7. jar包:commons-fileupload-1.2.1.jar.commons-io-1 ...
随机推荐
不带缓存的I/O和标准(带缓存的)I/O
首先,先稍微了解系统调用的概念: 系统调用,英文名system call,每个操作系统都在内核里有一些内建的函数库,这些函数可以用来完成一些系统系统调用把应用程序的请求传给内核,调用相应的 ...
设置Tomcat的UTF-8编码
利用request.setCharacterEncoding("UTF-8");来设置Tomcat接收请求的编码格式,只对POST方式提交的数据有效,对GET方式提交的数据无效! ...
seajs的spm使用
压缩JS文件 只需要执行这个命令即可 spm build xxx.js 这时候你将得到一个压缩过的__build/xxx.js文件 合并JS文件 如果希望将JS文件中require的其他模块都合并到这 ...
团队项目个人进展——Day07
一.昨天工作总结 冲刺第七天,学习了微信小程序中WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接. 二.遇到的问题 对 ...
Visual Studio 2017 远程调试(Remote Debugger)应用
I.远程调试情景 项目部署在远程服务器或非本地环境中,需要 处理应用中遇到的一些错误时 (不能直接附加进程或F5调试应用). II. 远程调试准备 1.远程服务器--操作系统和硬件要求 MSDN 操作 ...
MySQL数据库篇之多表查询
主要内容: 一.多表连接查询 二.复合条件连接查询 三.子查询 1️⃣ 多表连接查询 一.准备表 #建表 create table department( id int, name varchar( ...
mysql字符类型
字符类型 #官网:https://dev.mysql.com/doc/refman/5.7/en/char.html #注意:char和varchar括号内的参数指的都是字符的长度 #char类型:定 ...
CodeForces Round #515 Div.3 C. Books Queries
http://codeforces.com/contest/1066/problem/C You have got a shelf and want to put some books on it. ...
iOS UINavgationController、 UINavigationBar、 UINavigationItem关系分析
一般导航控制器含有4个对象,UINavigationController.UINavigationBar.UIViewController.UINavigationItem. 1:UINavigati ...