zoukankan
html css js c++ java
一段软件更新程序(使用WinRar压缩包) (转)
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
=
@"
https://files.cnblogs.com/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();
}
}
}
查看全文
相关阅读:
把一列数据分割成两列
数据校验,轴的概念
叠加折线图
饼图
柱状图、水平柱状图
柱状图
数据筛选过滤
余数
输出进度条
生成器-文件内容
原文地址:https://www.cnblogs.com/xlfj521/p/890762.html
最新文章
ubuntu18.04中文输入问题
Python编码与解码
Python集合常用的操作
Python字典常用的操作
Python元组常用的操作
python列表常用的操作
Python常用的字符串操作
PySimpleGUI 踩坑记
django 将原本数据库中的表导入models中
js之数据类型(1)
热门文章
js笔记之switch-case
js笔记之while循环
js学习笔记之for循环
js学习笔记之if
js之条件语句、循环语句听课笔记
js的运算符学习笔记
js变量
读取CSV、TSV、TXT中的数据
旋转数据表(行/转转换)
求和,求平均,统计导引
Copyright © 2011-2022 走看看