基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
/******************************
|
||||
* 说明:公共类
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2018-02-09
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
******************************/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.AutoUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// 公共类
|
||||
/// </summary>
|
||||
public class CommonUnitity
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序启动目录
|
||||
/// </summary>
|
||||
public static string SystemBinUrl = AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:重启应用</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
public static void RestartApplication()
|
||||
{
|
||||
Process.Start(Path.Combine(Application.ExecutablePath, ConstModel.LS_ERP_EXE));
|
||||
Environment.Exit(0);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取文件夹路径</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="file">The file.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string GetFolderUrl(DownloadFileInfo file)
|
||||
{
|
||||
try
|
||||
{
|
||||
string folderPathUrl = string.Empty;
|
||||
int folderPathPoint = file.DownloadUrl.IndexOf("/", 15) + 1;
|
||||
string filepathstring = file.DownloadUrl.Substring(folderPathPoint);
|
||||
if (filepathstring.IndexOf("/") != -1)
|
||||
{
|
||||
string[] ExeGroup = filepathstring.Split('/');
|
||||
for (int i = 0; i < ExeGroup.Length - 1; i++)
|
||||
{
|
||||
folderPathUrl += "\\" + ExeGroup[i];
|
||||
}
|
||||
if (!Directory.Exists(SystemBinUrl + ConstModel.TEMP_FOLDER_NAME + folderPathUrl))
|
||||
{
|
||||
Directory.CreateDirectory(SystemBinUrl + ConstModel.TEMP_FOLDER_NAME + folderPathUrl);
|
||||
}
|
||||
if (!Directory.Exists(SystemBinUrl + ConstModel.Batch_FOLDER_NAME))
|
||||
{
|
||||
Directory.CreateDirectory(SystemBinUrl + ConstModel.Batch_FOLDER_NAME);
|
||||
}
|
||||
}
|
||||
return folderPathUrl;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("获取文件夹路径失败:"+ file.DownloadUrl + "\r\n" + ex.Message);
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user