mirror of
https://github.com/zs-yg/kortapp-z.git
synced 2025-12-07 00:20:43 +08:00
Compare commits
4 Commits
v0.9.8-bet
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5b60d7079 | ||
|
|
f8192063a4 | ||
|
|
cd1abd3e33 | ||
|
|
cc577948b7 |
63
AboutForm.cs
63
AboutForm.cs
@@ -50,16 +50,75 @@ namespace AppStore
|
|||||||
|
|
||||||
// 初始化并添加应用信息
|
// 初始化并添加应用信息
|
||||||
infoLabel = new Label();
|
infoLabel = new Label();
|
||||||
infoLabel.Text = "kortapp-z\n版本: 0.9.8\n一个简单、开源的应用商店\nkortapp-z是完全免费的基于.NET8和C++的软件";
|
infoLabel.Text = "kortapp-z\n版本: 1.0.0\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C++的软件";
|
||||||
infoLabel.Font = new Font("Microsoft YaHei", 12);
|
infoLabel.Font = new Font("Microsoft YaHei", 12);
|
||||||
infoLabel.AutoSize = false;
|
infoLabel.AutoSize = false;
|
||||||
infoLabel.Width = 300;
|
infoLabel.Width = 300;
|
||||||
infoLabel.Height = 100;
|
infoLabel.Height = 130; // 增加高度确保文字完整显示
|
||||||
infoLabel.TextAlign = ContentAlignment.MiddleCenter;
|
infoLabel.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
infoLabel.Anchor = AnchorStyles.None;
|
infoLabel.Anchor = AnchorStyles.None;
|
||||||
mainLayout.Controls.Add(infoLabel, 0, 1);
|
mainLayout.Controls.Add(infoLabel, 0, 1);
|
||||||
|
|
||||||
|
// 调整主布局为3行
|
||||||
|
mainLayout.RowCount = 3;
|
||||||
|
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||||
|
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||||
|
mainLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||||
|
|
||||||
|
// 在底部添加GitHub链接区域
|
||||||
|
TableLayoutPanel githubPanel = new TableLayoutPanel();
|
||||||
|
githubPanel.Dock = DockStyle.Bottom;
|
||||||
|
githubPanel.Height = 60;
|
||||||
|
githubPanel.ColumnCount = 3;
|
||||||
|
githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||||
|
githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
|
||||||
|
githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||||
|
githubPanel.RowCount = 1;
|
||||||
|
githubPanel.Padding = new Padding(10);
|
||||||
|
|
||||||
|
// 添加GitHub图标
|
||||||
|
PictureBox githubIcon = new PictureBox();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
githubIcon.Image = Image.FromFile("img/jpg/github.jpg");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError($"无法加载GitHub图标: {ex.Message}");
|
||||||
|
githubIcon.Image = SystemIcons.Application.ToBitmap();
|
||||||
|
}
|
||||||
|
githubIcon.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
|
githubIcon.Width = 30;
|
||||||
|
githubIcon.Height = 30;
|
||||||
|
githubIcon.Cursor = Cursors.Hand;
|
||||||
|
githubIcon.Click += (s, e) => {
|
||||||
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://github.com/zs-yg/kortapp-z",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加文字说明
|
||||||
|
Label githubLabel = new Label();
|
||||||
|
githubLabel.Text = "🤗🤗🤗开源地址 🌟 欢迎点star和提交pr 🚀";
|
||||||
|
githubLabel.Font = new Font("Microsoft YaHei", 10);
|
||||||
|
githubLabel.AutoSize = true;
|
||||||
|
githubLabel.Margin = new Padding(10, 0, 0, 0);
|
||||||
|
|
||||||
|
// 创建包含图标和文字的面板
|
||||||
|
Panel linkPanel = new Panel();
|
||||||
|
linkPanel.AutoSize = true;
|
||||||
|
linkPanel.Controls.Add(githubIcon);
|
||||||
|
linkPanel.Controls.Add(githubLabel);
|
||||||
|
githubIcon.Location = new Point(0, 0);
|
||||||
|
githubLabel.Location = new Point(githubIcon.Width + 10, 5);
|
||||||
|
|
||||||
|
// 将链接面板添加到中间列
|
||||||
|
githubPanel.Controls.Add(linkPanel, 1, 0);
|
||||||
|
|
||||||
this.Controls.Add(mainLayout);
|
this.Controls.Add(mainLayout);
|
||||||
|
this.Controls.Add(githubPanel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
173
MainForm.cs
173
MainForm.cs
@@ -2,6 +2,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.IO;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
using AppStore;
|
using AppStore;
|
||||||
|
|
||||||
namespace AppStore
|
namespace AppStore
|
||||||
@@ -11,6 +15,106 @@ namespace AppStore
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MainForm : Form
|
public class MainForm : Form
|
||||||
{
|
{
|
||||||
|
private static readonly string CacheDir = Path.Combine(
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||||
|
"zsyg", "kortapp-z", ".cache");
|
||||||
|
|
||||||
|
private class AppPositionCache
|
||||||
|
{
|
||||||
|
public string AppName { get; set; } = string.Empty;
|
||||||
|
public int X { get; set; }
|
||||||
|
public int Y { get; set; }
|
||||||
|
public DateTime LastUpdated { get; set; } = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetPositionCacheFilePath(string appName)
|
||||||
|
{
|
||||||
|
using var md5 = MD5.Create();
|
||||||
|
var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(appName));
|
||||||
|
var fileName = BitConverter.ToString(hash).Replace("-", "").ToLower() + ".json";
|
||||||
|
return Path.Combine(CacheDir, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void EnsureCacheDirectory()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(CacheDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(CacheDir);
|
||||||
|
Logger.Log($"已创建缓存目录: {CacheDir}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError($"创建缓存目录失败: {CacheDir}", ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool TryReadPositionCache(string appName, out AppPositionCache? cacheData)
|
||||||
|
{
|
||||||
|
cacheData = null;
|
||||||
|
var cacheFile = GetPositionCacheFilePath(appName);
|
||||||
|
|
||||||
|
if (!File.Exists(cacheFile))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var json = File.ReadAllText(cacheFile);
|
||||||
|
cacheData = JsonSerializer.Deserialize<AppPositionCache>(json);
|
||||||
|
return cacheData != null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WritePositionCache(string appName, Point position)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EnsureCacheDirectory();
|
||||||
|
var cacheFile = GetPositionCacheFilePath(appName);
|
||||||
|
|
||||||
|
var cacheData = new AppPositionCache
|
||||||
|
{
|
||||||
|
AppName = appName,
|
||||||
|
X = position.X,
|
||||||
|
Y = position.Y,
|
||||||
|
LastUpdated = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
var json = JsonSerializer.Serialize(cacheData);
|
||||||
|
File.WriteAllText(cacheFile, json);
|
||||||
|
Logger.Log($"已保存位置缓存: {appName} ({position.X}, {position.Y})");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError($"保存位置缓存失败: {appName}", ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsPositionCacheValid(AppPositionCache cacheData)
|
||||||
|
{
|
||||||
|
// 缓存有效期设为7天
|
||||||
|
return (DateTime.Now - cacheData.LastUpdated).TotalDays <= 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SaveAllCardPositions(FlowLayoutPanel flowPanel)
|
||||||
|
{
|
||||||
|
foreach (Control control in flowPanel.Controls)
|
||||||
|
{
|
||||||
|
if (control is AppCard card)
|
||||||
|
{
|
||||||
|
WritePositionCache(card.AppName, control.Location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 软件下载按钮
|
// 软件下载按钮
|
||||||
private Button btnApps = null!;
|
private Button btnApps = null!;
|
||||||
// 下载进度按钮
|
// 下载进度按钮
|
||||||
@@ -164,10 +268,8 @@ namespace AppStore
|
|||||||
{
|
{
|
||||||
// 创建新的应用卡片实例
|
// 创建新的应用卡片实例
|
||||||
AppCard card = new AppCard();
|
AppCard card = new AppCard();
|
||||||
|
card.AppName = appName;
|
||||||
// 设置卡片基本属性
|
card.DownloadUrl = downloadUrl;
|
||||||
card.AppName = appName; // 设置显示的应用名称
|
|
||||||
card.DownloadUrl = downloadUrl; // 设置下载链接地址
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -189,23 +291,61 @@ namespace AppStore
|
|||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowAppsView()
|
private async void ShowAppsView()
|
||||||
{
|
{
|
||||||
contentPanel.Controls.Clear();
|
contentPanel.Controls.Clear();
|
||||||
|
|
||||||
// 使用FlowLayoutPanel来组织应用卡片
|
// 同步创建并添加FlowLayoutPanel
|
||||||
FlowLayoutPanel flowPanel = new FlowLayoutPanel();
|
FlowLayoutPanel flowPanel = new FlowLayoutPanel();
|
||||||
flowPanel.Dock = DockStyle.Fill;
|
flowPanel.Dock = DockStyle.Fill;
|
||||||
flowPanel.AutoScroll = true;
|
flowPanel.AutoScroll = true;
|
||||||
flowPanel.Padding = new Padding(15, 50, 15, 15); // 恢复原有内边距
|
flowPanel.Padding = new Padding(15, 50, 15, 15);
|
||||||
flowPanel.WrapContents = true;
|
flowPanel.WrapContents = true;
|
||||||
flowPanel.Margin = new Padding(0);
|
flowPanel.Margin = new Padding(0);
|
||||||
flowPanel.AutoSize = true;
|
flowPanel.AutoSize = true;
|
||||||
flowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
flowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
flowPanel.AutoScrollMinSize = new Size(0, 999999); // 增加滑动距离
|
flowPanel.AutoScrollMinSize = new Size(0, 3350);
|
||||||
contentPanel.Controls.Add(flowPanel);
|
contentPanel.Controls.Add(flowPanel);
|
||||||
|
|
||||||
// 添加所有应用卡片
|
// 添加窗体关闭事件处理
|
||||||
|
this.FormClosing += (sender, e) => {
|
||||||
|
SaveAllCardPositions(flowPanel);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 确保控件已创建
|
||||||
|
await Task.Delay(100);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 异步添加卡片
|
||||||
|
await Task.Run(() => {
|
||||||
|
if (flowPanel.IsHandleCreated)
|
||||||
|
{
|
||||||
|
flowPanel.Invoke((MethodInvoker)delegate {
|
||||||
|
AddAllAppCards(flowPanel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError("渲染应用卡片时出错", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddAllAppCards(FlowLayoutPanel flowPanel)
|
||||||
|
{
|
||||||
|
flowPanel.Dock = DockStyle.Fill;
|
||||||
|
flowPanel.AutoScroll = true;
|
||||||
|
flowPanel.Padding = new Padding(15, 50, 15, 15);
|
||||||
|
flowPanel.WrapContents = true;
|
||||||
|
flowPanel.Margin = new Padding(0);
|
||||||
|
flowPanel.AutoSize = true;
|
||||||
|
flowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
|
flowPanel.AutoScrollMinSize = new Size(0, 3350);
|
||||||
|
contentPanel.Controls.Add(flowPanel);
|
||||||
|
|
||||||
|
// 添加所有应用卡片并恢复位置
|
||||||
|
|
||||||
|
|
||||||
flowPanel.Controls.Add(CreateAppCard(
|
flowPanel.Controls.Add(CreateAppCard(
|
||||||
@@ -228,6 +368,11 @@ namespace AppStore
|
|||||||
"https://ghproxy.net/https://github.com/zs-yg/package/releases/download/v0.7/NeatDM_setup.exe",
|
"https://ghproxy.net/https://github.com/zs-yg/package/releases/download/v0.7/NeatDM_setup.exe",
|
||||||
"img/jpg/NDM.jpg"));
|
"img/jpg/NDM.jpg"));
|
||||||
|
|
||||||
|
flowPanel.Controls.Add(CreateAppCard(
|
||||||
|
"youtube-dl",
|
||||||
|
"https://ghproxy.net/https://github.com/ytdl-org/youtube-dl/releases/download/2021.12.17/youtube-dl.exe",
|
||||||
|
""));
|
||||||
|
|
||||||
flowPanel.Controls.Add(CreateAppCard(
|
flowPanel.Controls.Add(CreateAppCard(
|
||||||
"python3.8",
|
"python3.8",
|
||||||
"https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe",
|
"https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe",
|
||||||
@@ -298,6 +443,11 @@ namespace AppStore
|
|||||||
"https://ghproxy.net/https://github.com/OpenListTeam/OpenList/releases/download/beta/openlist-windows-amd64.zip",
|
"https://ghproxy.net/https://github.com/OpenListTeam/OpenList/releases/download/beta/openlist-windows-amd64.zip",
|
||||||
"img/png/openlist.png"));
|
"img/png/openlist.png"));
|
||||||
|
|
||||||
|
flowPanel.Controls.Add(CreateAppCard(
|
||||||
|
"SpaceSniffer",
|
||||||
|
"https://ghproxy.net/https://github.com/zs-yg/package/releases/download/v0.8/SpaceSniffer.exe",
|
||||||
|
"img/png/SpaceSniffer.png"));
|
||||||
|
|
||||||
flowPanel.Controls.Add(CreateAppCard(
|
flowPanel.Controls.Add(CreateAppCard(
|
||||||
"OpenSpeedy",
|
"OpenSpeedy",
|
||||||
"https://ghproxy.net/https://github.com/game1024/OpenSpeedy/releases/download/v1.7.1/OpenSpeedy-v1.7.1.zip",
|
"https://ghproxy.net/https://github.com/game1024/OpenSpeedy/releases/download/v1.7.1/OpenSpeedy-v1.7.1.zip",
|
||||||
@@ -338,6 +488,11 @@ namespace AppStore
|
|||||||
"https://ghproxy.net/https://github.com/peazip/PeaZip/releases/download/10.4.0/peazip-10.4.0.WIN64.exe",
|
"https://ghproxy.net/https://github.com/peazip/PeaZip/releases/download/10.4.0/peazip-10.4.0.WIN64.exe",
|
||||||
"img/jpg/peazip.jpg"));
|
"img/jpg/peazip.jpg"));
|
||||||
|
|
||||||
|
flowPanel.Controls.Add(CreateAppCard(
|
||||||
|
"nanazip",
|
||||||
|
"https://ghproxy.net/https://github.com/M2Team/NanaZip/releases/download/5.0.1263.0/NanaZip_5.0.1263.0_DebugSymbols.zip",
|
||||||
|
"img/png/nanazip.png"));
|
||||||
|
|
||||||
flowPanel.Controls.Add(CreateAppCard(
|
flowPanel.Controls.Add(CreateAppCard(
|
||||||
"GreenShot",
|
"GreenShot",
|
||||||
"https://objects.githubusercontent.com/github-production-release-asset-2e65be/36756917/239aedb0-7d29-11e7-9f9c-d36ec4466ade?X-Amz-Algorithm=AWS4-HMAC-SSHA256&X-Amz-Credential=releaseassetproduction%2F20250613%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250613T041723Z&X-Amz-Expires=300&X-Amz-Signature=be1ef88a68bbc7065af5111809d11de881022933b44f6d961eb6bd6e6b7e60a8&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3DGreenshot-INSTALLER-1.2.10.6-RELEASE.exe&response-content-type=application%2Foctet-stream",
|
"https://objects.githubusercontent.com/github-production-release-asset-2e65be/36756917/239aedb0-7d29-11e7-9f9c-d36ec4466ade?X-Amz-Algorithm=AWS4-HMAC-SSHA256&X-Amz-Credential=releaseassetproduction%2F20250613%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250613T041723Z&X-Amz-Expires=300&X-Amz-Signature=be1ef88a68bbc7065af5111809d11de881022933b44f6d961eb6bd6e6b7e60a8&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3DGreenshot-INSTALLER-1.2.10.6-RELEASE.exe&response-content-type=application%2Foctet-stream",
|
||||||
|
|||||||
2
del.bat
2
del.bat
@@ -1,4 +1,2 @@
|
|||||||
rmdir bin /s /q
|
rmdir bin /s /q
|
||||||
rmdir obj /s /q
|
rmdir obj /s /q
|
||||||
rmdir logs /s /q
|
|
||||||
mkdir logs
|
|
||||||
BIN
img/jpg/github.jpg
Normal file
BIN
img/jpg/github.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
BIN
img/png/SpaceSniffer.png
Normal file
BIN
img/png/SpaceSniffer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
img/png/nanazip.png
Normal file
BIN
img/png/nanazip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -9,7 +9,23 @@ int main() {
|
|||||||
auto start = std::chrono::high_resolution_clock::now();
|
auto start = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
// 定义日志目录路径
|
// 定义日志目录路径
|
||||||
fs::path logDir = "logs";
|
fs::path logDir;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Windows系统获取AppData路径
|
||||||
|
char* appData = nullptr;
|
||||||
|
size_t len = 0;
|
||||||
|
if (_dupenv_s(&appData, &len, "APPDATA") == 0 && appData != nullptr) {
|
||||||
|
logDir = fs::path(appData) / "zsyg" / "kortapp-z" / ".logs";
|
||||||
|
free(appData);
|
||||||
|
} else {
|
||||||
|
std::cerr << "无法获取APPDATA环境变量" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// 非Windows系统使用默认路径
|
||||||
|
logDir = fs::path(getenv("HOME")) / ".zsyg" / "kortapp-z" / ".logs";
|
||||||
|
#endif
|
||||||
size_t deletedCount = 0;
|
size_t deletedCount = 0;
|
||||||
size_t errorCount = 0;
|
size_t errorCount = 0;
|
||||||
|
|
||||||
|
|||||||
23
logger.cs
23
logger.cs
@@ -1,20 +1,33 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace AppStore
|
namespace AppStore
|
||||||
{
|
{
|
||||||
public static class Logger
|
public static class Logger
|
||||||
{
|
{
|
||||||
private static readonly string LogsDirectory = "logs";
|
private static readonly string LogsDirectory = Path.Combine(
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||||
|
"zsyg", "kortapp-z", ".logs");
|
||||||
private static readonly object LockObject = new object();
|
private static readonly object LockObject = new object();
|
||||||
|
|
||||||
static Logger()
|
static Logger()
|
||||||
{
|
{
|
||||||
// 确保logs目录存在
|
try
|
||||||
if (!Directory.Exists(LogsDirectory))
|
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(LogsDirectory);
|
// 确保logs目录存在
|
||||||
|
if (!Directory.Exists(LogsDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(LogsDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"无法创建日志目录: {LogsDirectory}, 错误: {ex.Message}");
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Log(string message)
|
public static void Log(string message)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
@@ -23,6 +36,7 @@ namespace AppStore
|
|||||||
{
|
{
|
||||||
string fileName = $"{DateTime.Now:yyyyMMddHHmmss}.log";
|
string fileName = $"{DateTime.Now:yyyyMMddHHmmss}.log";
|
||||||
string filePath = Path.Combine(LogsDirectory, fileName);
|
string filePath = Path.Combine(LogsDirectory, fileName);
|
||||||
|
|
||||||
using (StreamWriter writer = new StreamWriter(filePath, true, Encoding.UTF8))
|
using (StreamWriter writer = new StreamWriter(filePath, true, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
writer.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {message}");
|
writer.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {message}");
|
||||||
@@ -35,6 +49,7 @@ namespace AppStore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogError(string message, Exception? ex = null)
|
public static void LogError(string message, Exception? ex = null)
|
||||||
{
|
{
|
||||||
string errorMessage = $"ERROR: {message}";
|
string errorMessage = $"ERROR: {message}";
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user