Compare commits

..

13 Commits

Author SHA1 Message Date
zsyg
9269032315 修改freemove描述 2025-07-22 17:28:56 +08:00
zsyg
3c6117933c 修改描述 2025-07-22 15:23:29 +08:00
zsyg
59c6ae623e Add files via upload 2025-07-22 13:59:26 +08:00
zsyg
6ff1506bc2 Add files via upload 2025-07-22 13:57:52 +08:00
zsyg
b8b8b03713 修改cmake配置 2025-07-21 20:54:14 +08:00
zsyg
104aba01da Add files via upload 2025-07-20 13:25:35 +08:00
zsyg
a93e4d67f4 Add files via upload 2025-07-20 13:24:20 +08:00
zsyg
d1c62f4488 Add files via upload 2025-07-20 13:22:11 +08:00
zsyg
f4f4d86faa Add files via upload 2025-07-20 13:21:19 +08:00
zsyg
4c13fe0008 修改版本号 2025-07-20 13:16:24 +08:00
zsyg
6a931e9a85 添加部分软件注释 2025-07-20 10:34:37 +08:00
zsyg
916c944a90 Update README.md 2025-07-20 09:08:15 +08:00
zsyg
996d73f9fe 提供部分软件描述 2025-07-20 08:58:28 +08:00
23 changed files with 2182 additions and 2032 deletions

View File

@@ -51,7 +51,7 @@ namespace AppStore
// 初始化并添加应用信息 // 初始化并添加应用信息
infoLabel = new Label(); infoLabel = new Label();
infoLabel.Text = "kortapp-z\n版本: 1.3.3\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C/C++的软件"; infoLabel.Text = "kortapp-z\n版本: 1.3.4\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C/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;

View File

@@ -15,6 +15,7 @@ namespace AppStore
private Label nameLabel; private Label nameLabel;
private Panel namePanel; private Panel namePanel;
private Button downloadBtn; private Button downloadBtn;
private ToolTip? toolTip;
private Color borderColor = SystemColors.ControlDark; private Color borderColor = SystemColors.ControlDark;
private static readonly ConcurrentDictionary<string, System.Drawing.Drawing2D.GraphicsPath> PathCache = private static readonly ConcurrentDictionary<string, System.Drawing.Drawing2D.GraphicsPath> PathCache =
new ConcurrentDictionary<string, System.Drawing.Drawing2D.GraphicsPath>(); new ConcurrentDictionary<string, System.Drawing.Drawing2D.GraphicsPath>();
@@ -22,6 +23,7 @@ namespace AppStore
public string AppName { get; set; } = string.Empty; public string AppName { get; set; } = string.Empty;
public Image AppIcon { get; set; } = SystemIcons.Application.ToBitmap(); public Image AppIcon { get; set; } = SystemIcons.Application.ToBitmap();
public string DownloadUrl { get; set; } = string.Empty; public string DownloadUrl { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool ShowDownloadButton { get; set; } = true; public bool ShowDownloadButton { get; set; } = true;
public AppCard() public AppCard()
@@ -126,6 +128,13 @@ namespace AppStore
this.Controls.Add(namePanel); this.Controls.Add(namePanel);
} }
// 初始化ToolTip控件
toolTip = new ToolTip();
toolTip.AutoPopDelay = 5000;
toolTip.InitialDelay = 500;
toolTip.ReshowDelay = 500;
toolTip.ShowAlways = true;
// 下载按钮 - 添加null检查 // 下载按钮 - 添加null检查
if (downloadBtn != null) if (downloadBtn != null)
{ {
@@ -144,6 +153,10 @@ namespace AppStore
if (downloadBtn != null) if (downloadBtn != null)
{ {
downloadBtn.BackColor = Color.FromArgb(0, 150, 255); downloadBtn.BackColor = Color.FromArgb(0, 150, 255);
if (!string.IsNullOrEmpty(Description))
{
toolTip.SetToolTip(downloadBtn, Description);
}
} }
}; };
@@ -373,7 +386,7 @@ namespace AppStore
try try
{ {
var safePath = path ?? CalculatePathFallback(Width, Height, 10); var safePath = path ?? CalculatePathFallback(Width, Height, 10);
// 更严格的null检查包括路径和控件状态 // 更严格的null检查,包括路径和控件状态
if (safePath != null && if (safePath != null &&
safePath.PointCount > 0 && safePath.PointCount > 0 &&
this.IsHandleCreated && this.IsHandleCreated &&
@@ -450,7 +463,7 @@ namespace AppStore
try try
{ {
// 更严格的null检查 // 更严格的null检查
// 更严格的null检查包括DownloadManager.Instance和其方法 // 更严格的null检查,包括DownloadManager.Instance和其方法
// 全面的null和状态检查 // 全面的null和状态检查
var downloadManager = DownloadManager.Instance; var downloadManager = DownloadManager.Instance;
if (sender == null || e == null || if (sender == null || e == null ||

View File

@@ -59,7 +59,7 @@ namespace AppStore
} }
catch catch
{ {
// 忽略所有异常使用默认值 // 忽略所有异常,使用默认值
} }
return result; return result;
@@ -115,7 +115,7 @@ namespace AppStore
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
"Downloads"); "Downloads");
Logger.LogError($"下载路径{downloadsDir}不可用将使用默认路径: {defaultPath}", ex); Logger.LogError($"下载路径{downloadsDir}不可用,将使用默认路径: {defaultPath}", ex);
downloadsDir = defaultPath; downloadsDir = defaultPath;
Directory.CreateDirectory(downloadsDir); Directory.CreateDirectory(downloadsDir);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1,20 @@
# Kortapp-z - Windows应用商店 --主张软件开源、免费拒绝广告 # Kortapp-z - Windows应用商店 --主张软件开源、免费,拒绝广告
小立一个flag从不接受广告不停更新 小立一个flag从不接受广告,不停更新
## 项目开源行为 ## 项目开源行为
1. 项目代码开源允许任何人使用、修改、分发、商用但必须注明原作者。 1. 项目代码开源,允许任何人使用、修改、分发、商用,但必须注明原作者。
2. 项目图标、截图等资源开源允许任何人使用、修改、分发、商用但必须注明原作者。 2. 项目图标、截图等资源开源,允许任何人使用、修改、分发、商用,但必须注明原作者。
3. 项目的任何衍生品包括但不限于网站、APP、插件等必须遵循以上开源协议。 3. 项目的任何衍生品包括但不限于网站、APP、插件等必须遵循以上开源协议。
4. 项目不接受任何形式的广告不得在任何地方投放广告。 4. 项目不接受任何形式的广告,不得在任何地方投放广告。
5. 项目不接受任何形式的捐赠、赞助 5. 项目不接受任何形式的捐赠、赞助
6. 项目可以进行PR欢迎任何形式的PR不提交issue也可以 6. 项目可以进行PR,欢迎任何形式的PR,不提交issue也可以
7. 本项目可以PR一些你自己的项目如果star数量不到1k都会被删除 7. 本项目可以PR一些你自己的项目,如果star数量不到1k,都会被删除
## 项目简介 ## 项目简介
一个简单的Windows应用商店应用提供软件下载和管理功能。 一个简单的Windows应用商店应用,提供软件下载和管理功能。
提供软件管理、下载管理、内置工具使用等功能 提供软件管理、下载管理、内置工具使用等功能
## 功能特点 ## 功能特点
@@ -44,7 +44,7 @@ dotnet publish AppStore.csproj -c Release -r win-x86 --self-contained false /p:O
dotnet publish AppStore.csproj -c Release -r win-x64 --self-contained false /p:Optimize=true /p:DebugType=None dotnet publish AppStore.csproj -c Release -r win-x64 --self-contained false /p:Optimize=true /p:DebugType=None
``` ```
打包后的可执行文件将包含指定的应用程序图标输出路径为: 打包后的可执行文件将包含指定的应用程序图标,输出路径为:
``` ```
bin\Release\net8.0-windows\[platform]\publish bin\Release\net8.0-windows\[platform]\publish
``` ```
@@ -87,9 +87,9 @@ gitee镜像仓库:https://gitee.com/chr_super/kortapp-z (目前已经停止维
## 维护 ## 维护
由于gitee我没怎么用而且操作麻烦gitee镜像将不会继续同步有懂得人可以帮我搞下镜像吗qq 3872006562也可以b站直接私信我会在readme中鸣谢的谢谢各位 由于gitee我没怎么用,而且操作麻烦,gitee镜像将不会继续同步,有懂得人可以帮我搞下镜像吗,qq 3872006562,也可以b站直接私信,我会在readme中鸣谢的,谢谢各位
由于和Daye发生了矛盾所以windowscleaner将永远不上架我要自己努力 由于和Daye发生了矛盾,所以windowscleaner将永远不上架,我要自己努力
提示由于github上传文件的限制img/png/NET.png请改名为.NET.png否则程序可能出现无法预料的问题 提示由于github上传文件的限制,img/png/NET.png,请改名为.NET.png,否则程序可能出现无法预料的问题
每一个人都可以通过PR添加属于自己的合法软件 每一个人都可以通过PR添加属于自己的合法软件

View File

@@ -205,7 +205,7 @@ namespace AppStore
var jsonData = JsonSerializer.Deserialize<JsonElement>(jsonString); var jsonData = JsonSerializer.Deserialize<JsonElement>(jsonString);
string customPath = jsonData.GetProperty("DownloadPath").GetString() ?? ""; string customPath = jsonData.GetProperty("DownloadPath").GetString() ?? "";
// 如果自定义路径有效则显示否则显示默认路径 // 如果自定义路径有效则显示,否则显示默认路径
txtBox.Text = !string.IsNullOrWhiteSpace(customPath) ? customPath : defaultPath; txtBox.Text = !string.IsNullOrWhiteSpace(customPath) ? customPath : defaultPath;
} }
else else

View File

@@ -1,4 +1,4 @@
首先如果希望编译程序那么必须安装.NET8.0 SDK 首先,如果希望编译程序,那么必须安装.NET8.0 SDK
下载链接https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/sdk-8.0.411-windows-x64-installer 下载链接https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/sdk-8.0.411-windows-x64-installer
使用一下指令编译 使用一下指令编译

View File

@@ -1,4 +1,4 @@
如果希望运行那么必须安装.NET8.0 SDK 如果希望运行,那么必须安装.NET8.0 SDK
下载链接https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/sdk-8.0.411-windows-x64-installer 下载链接https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/sdk-8.0.411-windows-x64-installer

View File

@@ -32,7 +32,7 @@ namespace AppStore
} }
catch catch
{ {
// 忽略错误使用默认主题 // 忽略错误,使用默认主题
} }
return ThemeMode.Light; return ThemeMode.Light;
} }

View File

@@ -15,13 +15,13 @@
<main> <main>
<section class="about-project"> <section class="about-project">
<h2>项目简介</h2> <h2>项目简介</h2>
<p>kortapp-z是一个专为Windows系统设计的实用工具集合旨在提供一站式的系统优化和管理解决方案。</p> <p>kortapp-z是一个专为Windows系统设计的实用工具集合,旨在提供一站式的系统优化和管理解决方案。</p>
<p>项目始于2025年由热爱效率工具的开发者创建。</p> <p>项目始于2025年,由热爱效率工具的开发者创建。</p>
</section> </section>
<section class="team"> <section class="team">
<h2>开发团队</h2> <h2>开发团队</h2>
<p>我们的团队由经验丰富的开发人员组成专注于创建高质量的系统工具。</p> <p>我们的团队由经验丰富的开发人员组成,专注于创建高质量的系统工具。</p>
<ul> <ul>
<li>核心开发者: 1人</li> <li>核心开发者: 1人</li>
<li>UI设计师: 1人</li> <li>UI设计师: 1人</li>
@@ -31,7 +31,7 @@
<section class="contact"> <section class="contact">
<h2>联系我们</h2> <h2>联系我们</h2>
<p>如有任何问题或建议欢迎通过GitHub提交issue或pull request。</p> <p>如有任何问题或建议,欢迎通过GitHub提交issue或pull request。</p>
<a href="https://github.com/zs-yg/kortapp-z/issues" target="_blank">提交反馈</a> <a href="https://github.com/zs-yg/kortapp-z/issues" target="_blank">提交反馈</a>
</section> </section>
</main> </main>

View File

@@ -17,7 +17,21 @@
<h2>核心功能</h2> <h2>核心功能</h2>
<article class="feature"> <article class="feature">
<h3>目前没有什么东西,别看了,害羞(✿◡‿◡) <h3>应用程序管理</h3>
<p>批量安装、卸载(目前没有)和更新应用程序(目前没有),管理启动项(目前没有)。</p>
<p>优势:集中管理所有应用,节省时间,避免系统臃肿。</p>
</article>
<article class="feature">
<h3>资源监控(之后可能在内置工具里有)</h3>
<p>实时监控CPU、内存、磁盘和网络使用情况。</p>
<p>优势:直观的图表展示,及时发现资源瓶颈。</p>
</article>
<article class="feature">
<h3>文件管理(之后可能在内置工具里有)</h3>
<p>高级文件搜索、批量重命名和快速文件分类。</p>
<p>优势:提升文件管理效率,支持正则表达式搜索。</p>
</article> </article>
</section> </section>
</main> </main>

BIN
img/png/FreeMove.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -1,8 +1,8 @@
; 脚本由 Inno Setup 脚本向导生成。 ; 脚本由 Inno Setup 脚本向导生成。
; 有关创建 Inno Setup 脚本文件的详细信息请参阅帮助文档! ; 有关创建 Inno Setup 脚本文件的详细信息,请参阅帮助文档!
#define MyAppName "kortapp-z" #define MyAppName "kortapp-z"
#define MyAppVersion "1.3.3" #define MyAppVersion "1.3.4"
#define MyAppPublisher "zsyg" #define MyAppPublisher "zsyg"
#define MyAppURL "https://github.com/zs-yg/kortapp-z" #define MyAppURL "https://github.com/zs-yg/kortapp-z"
#define MyAppExeName "kortapp-z.exe" #define MyAppExeName "kortapp-z.exe"
@@ -12,7 +12,7 @@
[Setup] [Setup]
; 注意AppId 的值唯一标识此应用程序。不要在其他应用程序的安装程序中使用相同的 AppId 值。 ; 注意AppId 的值唯一标识此应用程序。不要在其他应用程序的安装程序中使用相同的 AppId 值。
; (若要生成新的 GUID请在 IDE 中单击 "工具|生成 GUID"。) ; (若要生成新的 GUID,请在 IDE 中单击 "工具|生成 GUID"。)
AppId={{8020EC01-6133-40BB-8B8B-0EB71E49696C} AppId={{8020EC01-6133-40BB-8B8B-0EB71E49696C}
AppName={#MyAppName} AppName={#MyAppName}
AppVersion={#MyAppVersion} AppVersion={#MyAppVersion}
@@ -27,7 +27,7 @@ UninstallDisplayIcon={app}\{#MyAppExeName}
; 除 Arm 上的 x64 和 Windows 11 之外的任何平台上。 ; 除 Arm 上的 x64 和 Windows 11 之外的任何平台上。
ArchitecturesAllowed=x64compatible ArchitecturesAllowed=x64compatible
; "ArchitecturesInstallIn64BitMode=x64compatible" 要求 ; "ArchitecturesInstallIn64BitMode=x64compatible" 要求
; 安装可以在 x64 或 Arm 上的 Windows 11 上以“64 位模式”完成 ; 安装可以在 x64 或 Arm 上的 Windows 11 上以“64 位模式”完成,
; 这意味着它应该使用本机 64 位 Program Files 目录和 ; 这意味着它应该使用本机 64 位 Program Files 目录和
; 注册表的 64 位视图。 ; 注册表的 64 位视图。
ArchitecturesInstallIn64BitMode=x64compatible ArchitecturesInstallIn64BitMode=x64compatible

View File

@@ -1,8 +1,8 @@
; 脚本由 Inno Setup 脚本向导生成。 ; 脚本由 Inno Setup 脚本向导生成。
; 有关创建 Inno Setup 脚本文件的详细信息请参阅帮助文档! ; 有关创建 Inno Setup 脚本文件的详细信息,请参阅帮助文档!
#define MyAppName "kortapp-z" #define MyAppName "kortapp-z"
#define MyAppVersion "1.3.3" #define MyAppVersion "1.3.4"
#define MyAppPublisher "zsyg" #define MyAppPublisher "zsyg"
#define MyAppURL "https://github.com/zs-yg/kortapp-z" #define MyAppURL "https://github.com/zs-yg/kortapp-z"
#define MyAppExeName "kortapp-z.exe" #define MyAppExeName "kortapp-z.exe"
@@ -12,7 +12,7 @@
[Setup] [Setup]
; 注意AppId 的值唯一标识此应用程序。不要在其他应用程序的安装程序中使用相同的 AppId 值。 ; 注意AppId 的值唯一标识此应用程序。不要在其他应用程序的安装程序中使用相同的 AppId 值。
; (若要生成新的 GUID请在 IDE 中单击 "工具|生成 GUID"。) ; (若要生成新的 GUID,请在 IDE 中单击 "工具|生成 GUID"。)
AppId={{BF1944C3-CD0C-4119-A340-49C54961D48B} AppId={{BF1944C3-CD0C-4119-A340-49C54961D48B}
AppName={#MyAppName} AppName={#MyAppName}
AppVersion={#MyAppVersion} AppVersion={#MyAppVersion}

View File

@@ -44,7 +44,7 @@ int main() {
} }
} }
} else { } else {
std::cout << "日志目录不存在无需清理" << std::endl; std::cout << "日志目录不存在,无需清理" << std::endl;
return 0; return 0;
} }

View File

@@ -28,6 +28,9 @@ find_library(AVIF_STATIC_LIB NAMES libavif.a PATHS ${AVIF_LIBRARY_DIRS})
find_package(FLTK REQUIRED) find_package(FLTK REQUIRED)
find_library(FLTK_STATIC_LIB NAMES libfltk.a PATHS ${FLTK_LIBRARY_DIRS}) find_library(FLTK_STATIC_LIB NAMES libfltk.a PATHS ${FLTK_LIBRARY_DIRS})
# 查找cairo导入库
find_library(CAIRO_IMPORT_LIB NAMES libcairo.dll.a PATHS "C:/msys64/ucrt64/lib")
# 查找其他依赖库 # 查找其他依赖库
find_library(JPEG_STATIC_LIB NAMES libjpeg.a PATHS ${MSYS2_LIB_DIR}) find_library(JPEG_STATIC_LIB NAMES libjpeg.a PATHS ${MSYS2_LIB_DIR})
find_library(ZLIB_STATIC_LIB NAMES libz.a PATHS ${MSYS2_LIB_DIR}) find_library(ZLIB_STATIC_LIB NAMES libz.a PATHS ${MSYS2_LIB_DIR})
@@ -44,7 +47,7 @@ find_library(RAV1E_STATIC_LIB NAMES librav1e.a PATHS ${MSYS2_LIB_DIR})
find_library(DAV1D_STATIC_LIB NAMES libdav1d.a PATHS ${MSYS2_LIB_DIR}) find_library(DAV1D_STATIC_LIB NAMES libdav1d.a PATHS ${MSYS2_LIB_DIR})
# 包含头文件目录 # 包含头文件目录
include_directories(include ${TIFF_INCLUDE_DIRS} ${WEBP_INCLUDE_DIRS} ${FLTK_INCLUDE_DIRS} ${AVIF_INCLUDE_DIRS}) include_directories(include ${TIFF_INCLUDE_DIRS} ${WEBP_INCLUDE_DIRS} ${FLTK_INCLUDE_DIRS} ${AVIF_INCLUDE_DIRS} "C:/msys64/ucrt64/include/cairo")
# 收集所有源文件 # 收集所有源文件
file(GLOB SOURCES "src/*.cpp") file(GLOB SOURCES "src/*.cpp")
@@ -71,6 +74,9 @@ target_link_libraries(ImageFormatConverter
${SVTAV1_ENC_STATIC_LIB} ${SVTAV1_ENC_STATIC_LIB}
${RAV1E_STATIC_LIB} ${RAV1E_STATIC_LIB}
${DAV1D_STATIC_LIB} ${DAV1D_STATIC_LIB}
${CAIRO_IMPORT_LIB}
"C:/msys64/ucrt64/lib/libcairo.a"
-lgdi32 -lmsimg32 # 添加Windows图形库
-lstdc++ -lgcc -lwinpthread -lcomctl32 -lole32 -luuid -lws2_32 -lntdll) -lstdc++ -lgcc -lwinpthread -lcomctl32 -lole32 -luuid -lws2_32 -lntdll)
# 设置输出目录 # 设置输出目录

View File

@@ -272,6 +272,6 @@ void MainWindow::convert_cb(Fl_Widget* w, void* data) {
if (success) { if (success) {
fl_message("转换成功!"); fl_message("转换成功!");
} else { } else {
fl_alert("转换失败请检查输入文件!"); fl_alert("转换失败,请检查输入文件!");
} }
} }

View File

@@ -130,7 +130,7 @@ ImageData ImageLoader::load(const std::string& path) {
throw std::runtime_error("无法解码WebP图像"); throw std::runtime_error("无法解码WebP图像");
} }
// 如果没有alpha通道转换为RGB格式 // 如果没有alpha通道,转换为RGB格式
if (data.channels == 3) { if (data.channels == 3) {
uint8_t* rgb_pixels = new uint8_t[data.width * data.height * 3]; uint8_t* rgb_pixels = new uint8_t[data.width * data.height * 3];
for (int i = 0; i < data.width * data.height; ++i) { for (int i = 0; i < data.width * data.height; ++i) {

View File

@@ -9,7 +9,7 @@ public:
static std::string getVersion() { return "1.0.0"; } static std::string getVersion() { return "1.0.0"; }
static std::string getAuthor() { return "zsyg"; } static std::string getAuthor() { return "zsyg"; }
static std::string getDescription() { static std::string getDescription() {
return "一个简单的文本转换工具支持文本转换"; return "一个简单的文本转换工具,支持文本转换";
} }
}; };

View File

@@ -5,18 +5,6 @@
#include "Converter.hpp" #include "Converter.hpp"
#include "BinaryConverter.hpp" #include "BinaryConverter.hpp"
#include "HexConverter.hpp" #include "HexConverter.hpp"
#include "ROT13Converter.hpp"
#include "MD5Converter.hpp"
#include "SHA1Converter.hpp"
#include "SHA256Converter.hpp"
#include "SHA224Converter.hpp"
#include "SHA384Converter.hpp"
#include "SHA512Converter.hpp"
#include "SHA3Converter.hpp"
#include "Base64Converter.hpp"
#include "Base32Converter.hpp"
#include "Ascii85Converter.hpp"
#include "CRC32Converter.hpp"
class Utils { class Utils {
public: public:

View File

@@ -11,7 +11,7 @@ std::string BinaryConverter::convert(const std::string& input) {
std::stringstream result; std::stringstream result;
for (char c : input) { for (char c : input) {
std::string binary = std::bitset<8>(c).to_string(); std::string binary = std::bitset<8>(c).to_string();
// 去除前导0保留后6位 // 去除前导0,保留后6位
size_t firstOne = binary.find('1'); size_t firstOne = binary.find('1');
if (firstOne != std::string::npos) { if (firstOne != std::string::npos) {
binary = binary.substr(firstOne); binary = binary.substr(firstOne);

View File

@@ -22,10 +22,6 @@ MainWindow::MainWindow(int w, int h, const char* title) : Fl_Window(w, h, title)
conversionType->add("MD5"); conversionType->add("MD5");
conversionType->add("SHA1"); conversionType->add("SHA1");
conversionType->add("SHA256"); conversionType->add("SHA256");
conversionType->add("SHA224");
conversionType->add("SHA384");
conversionType->add("SHA512");
conversionType->add("SHA3");
conversionType->add("Base64"); conversionType->add("Base64");
conversionType->add("Base32"); conversionType->add("Base32");
conversionType->add("Ascii85"); conversionType->add("Ascii85");
@@ -52,25 +48,19 @@ void MainWindow::ConvertCallback(Fl_Widget* widget, void* data) {
} }
void MainWindow::ConvertText() { void MainWindow::ConvertText() {
try { const char* input = inputText->value();
const char* input = inputText->value(); if (!input || strlen(input) == 0) {
if (!input || strlen(input) == 0) { fl_alert("请输入要转换的文本");
fl_alert("请输入要转换的文本"); return;
return;
}
int type = conversionType->value();
auto converter = Utils::createConverter(type);
if (!converter) {
fl_alert("不支持的转换类型");
return;
}
std::string result = converter->convert(input);
outputText->value(result.c_str());
} catch (const std::exception& e) {
fl_alert(("转换失败: " + std::string(e.what())).c_str());
} catch (...) {
fl_alert("未知错误: 转换失败");
} }
int type = conversionType->value();
auto converter = Utils::createConverter(type);
if (!converter) {
fl_alert("不支持的转换类型");
return;
}
std::string result = converter->convert(input);
outputText->value(result.c_str());
} }

View File

@@ -3,10 +3,6 @@
#include "../include/MD5Converter.hpp" #include "../include/MD5Converter.hpp"
#include "../include/SHA1Converter.hpp" #include "../include/SHA1Converter.hpp"
#include "../include/SHA256Converter.hpp" #include "../include/SHA256Converter.hpp"
#include "../include/SHA224Converter.hpp"
#include "../include/SHA384Converter.hpp"
#include "../include/SHA512Converter.hpp"
#include "../include/SHA3Converter.hpp"
#include "../include/Base64Converter.hpp" #include "../include/Base64Converter.hpp"
#include "../include/Base32Converter.hpp" #include "../include/Base32Converter.hpp"
#include "../include/Ascii85Converter.hpp" #include "../include/Ascii85Converter.hpp"
@@ -24,10 +20,6 @@ std::unique_ptr<Converter> Utils::createConverter(int type) {
case 7: return std::unique_ptr<Converter>(new Base32Converter()); case 7: return std::unique_ptr<Converter>(new Base32Converter());
case 8: return std::unique_ptr<Converter>(new Ascii85Converter()); case 8: return std::unique_ptr<Converter>(new Ascii85Converter());
case 9: return std::unique_ptr<Converter>(new CRC32Converter()); case 9: return std::unique_ptr<Converter>(new CRC32Converter());
case 10: return std::unique_ptr<Converter>(new SHA224Converter());
case 11: return std::unique_ptr<Converter>(new SHA384Converter());
case 12: return std::unique_ptr<Converter>(new SHA512Converter());
case 13: return std::unique_ptr<Converter>(new SHA3Converter());
default: return nullptr; default: return nullptr;
} }
} }