一段软件更新程序(使用WinRar压缩包)
2008-06-02 11:52
337 查看
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Diagnostics;
namespace UpDate
{
public partial class Form1 : Form
{
private WebClient update = new WebClient();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string URL = @"http://www.cnblogs.com/Files/mossan/Zhongwen.rar";
int n = URL.LastIndexOf('/');
string fileName = URL.Substring(n + 1, URL.Length - n - 1);
if (!(Directory.Exists(Application.StartupPath + "//update")))
{
Directory.CreateDirectory(Application.StartupPath + "//update");
}
try { update.DownloadFile(URL, Application.StartupPath + "//update//" + fileName); }
catch (WebException ex) { MessageBox.Show(ex.Message, "Error"); }
try
{
Process UnWinrar = new Process();
UnWinrar.StartInfo.FileName = "WinRAR.exe";
UnWinrar.StartInfo.Arguments = "e -o+ /"" + Application.StartupPath + "//update//" + fileName + "/"" + " /"" + Application.StartupPath + "//update" + "/"";
UnWinrar.Start();
MessageBox.Show("解压缩完成!");
File.Copy(Application.StartupPath + "//update//" + "Zhongwen.exe", Application.StartupPath + "//Zhongwen.exe", true);
Process ProZhongwen = new Process();
ProZhongwen.StartInfo.FileName = Application.StartupPath + "//Zhongwen.exe";
ProZhongwen.Start();
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
this.Close();
}
}
}
备注:本文引用自/article/4842353.html
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Diagnostics;
namespace UpDate
{
public partial class Form1 : Form
{
private WebClient update = new WebClient();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string URL = @"http://www.cnblogs.com/Files/mossan/Zhongwen.rar";
int n = URL.LastIndexOf('/');
string fileName = URL.Substring(n + 1, URL.Length - n - 1);
if (!(Directory.Exists(Application.StartupPath + "//update")))
{
Directory.CreateDirectory(Application.StartupPath + "//update");
}
try { update.DownloadFile(URL, Application.StartupPath + "//update//" + fileName); }
catch (WebException ex) { MessageBox.Show(ex.Message, "Error"); }
try
{
Process UnWinrar = new Process();
UnWinrar.StartInfo.FileName = "WinRAR.exe";
UnWinrar.StartInfo.Arguments = "e -o+ /"" + Application.StartupPath + "//update//" + fileName + "/"" + " /"" + Application.StartupPath + "//update" + "/"";
UnWinrar.Start();
MessageBox.Show("解压缩完成!");
File.Copy(Application.StartupPath + "//update//" + "Zhongwen.exe", Application.StartupPath + "//Zhongwen.exe", true);
Process ProZhongwen = new Process();
ProZhongwen.StartInfo.FileName = Application.StartupPath + "//Zhongwen.exe";
ProZhongwen.Start();
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
this.Close();
}
}
}
备注:本文引用自/article/4842353.html
相关文章推荐
- 一段软件更新程序(使用WinRar压缩包)
- 一段软件更新程序(使用WinRar压缩包) - C#探索者 - 博客园
- 一段软件更新程序(使用WinRar压缩包) (转)
- 更新机器 后,软件的安装和程序的使用问题总结
- 实用程序软件包(关于使用静态函数报错问题“Static function declared but not defined in C+++ "eh.h is only for C++!"报错问题)
- 软件动态更新技术总结之1 CIL:程序分析与变换的中间语言工具(sec0-sec3)
- MongoDB_Java连接mongo 使用Java程序更新集合中的文档
- Android 软件开发之如何使用Eclipse Debug调试程序详解(十二)
- Android服务器——使用TomCat实现软件的版本检测,升级,以及下载更新进度!
- 构建新的 App 和 App 更新时,必须使用公共(GM)版 Xcode 6 或更高版本、OS X 以及 iOS SDK。请勿提交使用 Beta 版软件,包括 Beta 版 OS X 构建的 App。
- 使用天乐软件加密狗(JDProtect)保护您的软件,防止程序被跟踪/逆向/反编译/破解
- 笔记2-从毕业生到程序员:使用C#开发商业软件
- 使用WinRar软件制作程序安装包
- Windows软件使用Q&A集锦【持续更新】
- 使用ClickOnce发布自动更新C#程序的一些注意点
- EXTJS4如何使用单个app程序来进行大型软件开发
- Android 软件开发之如何使用Eclipse Debug调试程序详解
- Linux使用yum进行软件安装和更新
- 0830-0914 开源项目/app通信/mac软件收集/Reveal软件调试程序/APP监测更新
- Android 软件开发之如何使用Eclipse Debug调试程序详解