mirror of
https://github.com/zs-yg/kortapp-z.git
synced 2025-12-06 16:10:42 +08:00
提供代码质量
This commit is contained in:
@@ -346,10 +346,16 @@ namespace AppStore
|
||||
}
|
||||
|
||||
public void UpdateDisplay()
|
||||
{
|
||||
if (nameLabel != null)
|
||||
{
|
||||
nameLabel.Text = AppName;
|
||||
}
|
||||
if (iconBox != null && AppIcon != null)
|
||||
{
|
||||
iconBox.Image = AppIcon;
|
||||
}
|
||||
}
|
||||
|
||||
private void DownloadBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -101,11 +101,12 @@ namespace AppStore
|
||||
throw new Exception("无法获取下载文件夹路径");
|
||||
}
|
||||
|
||||
downloadsDir = Marshal.PtrToStringUni(pathPtr);
|
||||
downloadsDir = Marshal.PtrToStringUni(pathPtr) ??
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new Exception("无法确定下载文件夹位置,请手动指定下载路径");
|
||||
downloadsDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -114,7 +115,15 @@ namespace AppStore
|
||||
Marshal.FreeCoTaskMem(pathPtr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(downloadsDir))
|
||||
{
|
||||
Directory.CreateDirectory(downloadsDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("无法确定下载文件夹位置");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -322,7 +331,7 @@ namespace AppStore
|
||||
try
|
||||
{
|
||||
var process = currentProcess;
|
||||
if (process == null || process.HasExited || process.StartInfo == null)
|
||||
if (process?.StartInfo == null || process.HasExited)
|
||||
{
|
||||
item.Status = "已取消";
|
||||
DownloadProgressChanged?.Invoke(item);
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace AppStore
|
||||
try
|
||||
{
|
||||
var dir = Path.GetDirectoryName(ThemeConfigPath);
|
||||
if (dir == null) return;
|
||||
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
Reference in New Issue
Block a user