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