Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8efa2725aa | ||
|
|
6fc1ccc9a2 | ||
|
|
04b551c3c0 | ||
|
|
ef9a2df02c | ||
|
|
c25cd37755 | ||
|
|
6536e99eec | ||
|
|
0ac791653e | ||
|
|
45ca7909fd | ||
|
|
60b459c74a | ||
|
|
295af72e4f | ||
|
|
474f3ecfbc | ||
|
|
ab37a33443 | ||
|
|
7f8a12c26a | ||
|
|
0f50193705 | ||
|
|
bc01dad692 | ||
|
|
0b58ee3f2e | ||
|
|
51974beaa8 | ||
|
|
9faa32e985 | ||
|
|
197f9ae76f | ||
|
|
7d11096f8a | ||
|
|
f8d02d44c1 | ||
|
|
c22b653ce0 | ||
|
|
4b27d2e1dc | ||
|
|
0f578d56d4 | ||
|
|
d36a367147 | ||
|
|
2c8ce29b3d | ||
|
|
efe7d16f96 |
38
.github/ISSUE_TEMPLATE/bug反馈.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug反馈
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: zs-yg
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
10
.github/ISSUE_TEMPLATE/功能建议.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: 功能建议
|
||||
about: 给我们一些修改建议
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
20
.github/ISSUE_TEMPLATE/新功能添加请求🥰🥰🥰.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "新功能添加请求\U0001F970\U0001F970\U0001F970"
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -50,7 +50,7 @@ namespace AppStore
|
||||
|
||||
// 初始化并添加应用信息
|
||||
infoLabel = new Label();
|
||||
infoLabel.Text = "kortapp-z\n版本: 1.0.0\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C++的软件";
|
||||
infoLabel.Text = "kortapp-z\n版本: 1.0.4\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C++的软件";
|
||||
infoLabel.Font = new Font("Microsoft YaHei", 12);
|
||||
infoLabel.AutoSize = false;
|
||||
infoLabel.Width = 300;
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace AppStore
|
||||
public string AppName { get; set; } = string.Empty;
|
||||
public Image AppIcon { get; set; } = SystemIcons.Application.ToBitmap();
|
||||
public string DownloadUrl { get; set; } = string.Empty;
|
||||
public bool ShowDownloadButton { get; set; } = true;
|
||||
|
||||
public AppCard()
|
||||
{
|
||||
@@ -88,6 +89,7 @@ namespace AppStore
|
||||
|
||||
downloadBtn.Click += DownloadBtn_Click;
|
||||
this.Controls.Add(downloadBtn);
|
||||
downloadBtn.Visible = ShowDownloadButton;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
<None Include="img\jpg\*.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="img\ico\icon.ico">
|
||||
<None Include="img\resource\png\*.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="img\ico\*.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
12
CONTRIBUTING.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# 贡献准则
|
||||
|
||||
你可以进行任何(确保安全的前提下)的修改
|
||||
我会对贡献进行审核,速度很快的
|
||||
我会定时查看PR
|
||||
你可以通过Fork到自己的仓库
|
||||
然后上传软件图标,修改代码
|
||||
然后提PR
|
||||
你就可以做出贡献了
|
||||
当然你也可以进行其他形式的修改
|
||||
|
||||
Remeber it!整个世界都在为你而闪耀
|
||||
BIN
ImageCompressor.png
Normal file
|
After Width: | Height: | Size: 704 KiB |
190
ImageCompressorForm.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AppStore
|
||||
{
|
||||
public class ImageCompressorForm : Form
|
||||
{
|
||||
private Button btnSelectInput = new Button();
|
||||
private Button btnSelectOutput = new Button();
|
||||
private Button btnCompress = new Button();
|
||||
private TextBox txtInput = new TextBox();
|
||||
private TextBox txtOutput = new TextBox();
|
||||
private RadioButton rbLossy = new RadioButton();
|
||||
private RadioButton rbLossless = new RadioButton();
|
||||
private TrackBar tbQuality = new TrackBar();
|
||||
private Label lblQuality = new Label();
|
||||
private CheckBox cbKeepExif = new CheckBox();
|
||||
private ProgressBar progressBar = new ProgressBar();
|
||||
|
||||
public ImageCompressorForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.Text = "图片压缩工具";
|
||||
this.Size = new Size(500, 350);
|
||||
this.StartPosition = FormStartPosition.CenterScreen;
|
||||
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
|
||||
// 输入文件选择
|
||||
btnSelectInput.Text = "选择...";
|
||||
btnSelectInput.Location = new Point(400, 20);
|
||||
btnSelectInput.Click += (s, e) => SelectFile(txtInput);
|
||||
this.Controls.Add(btnSelectInput);
|
||||
|
||||
txtInput.Location = new Point(20, 20);
|
||||
txtInput.Size = new Size(370, 20);
|
||||
txtInput.ReadOnly = true;
|
||||
this.Controls.Add(txtInput);
|
||||
|
||||
Label lblInput = new Label();
|
||||
lblInput.Text = "输入文件:";
|
||||
lblInput.Location = new Point(20, 0);
|
||||
this.Controls.Add(lblInput);
|
||||
|
||||
// 输出文件选择
|
||||
btnSelectOutput.Text = "选择...";
|
||||
btnSelectOutput.Location = new Point(400, 70);
|
||||
btnSelectOutput.Click += (s, e) => SelectFile(txtOutput, true);
|
||||
this.Controls.Add(btnSelectOutput);
|
||||
|
||||
txtOutput.Location = new Point(20, 70);
|
||||
txtOutput.Size = new Size(370, 20);
|
||||
this.Controls.Add(txtOutput);
|
||||
|
||||
Label lblOutput = new Label();
|
||||
lblOutput.Text = "输出文件:";
|
||||
lblOutput.Location = new Point(20, 50);
|
||||
this.Controls.Add(lblOutput);
|
||||
|
||||
// 压缩类型
|
||||
rbLossy.Text = "有损压缩 (JPEG)";
|
||||
rbLossy.Location = new Point(20, 110);
|
||||
rbLossy.Checked = true;
|
||||
this.Controls.Add(rbLossy);
|
||||
|
||||
rbLossless.Text = "无损压缩 (PNG)";
|
||||
rbLossless.Location = new Point(20, 135);
|
||||
this.Controls.Add(rbLossless);
|
||||
|
||||
// 质量设置
|
||||
tbQuality.Minimum = 1;
|
||||
tbQuality.Maximum = 1000;
|
||||
tbQuality.Value = 800;
|
||||
tbQuality.Location = new Point(20, 190);
|
||||
tbQuality.Size = new Size(300, 50);
|
||||
tbQuality.Scroll += (s, e) => lblQuality.Text = $"压缩质量: {tbQuality.Value}";
|
||||
this.Controls.Add(tbQuality);
|
||||
|
||||
lblQuality.Text = $"压缩质量: {tbQuality.Value}";
|
||||
lblQuality.Location = new Point(20, 170);
|
||||
this.Controls.Add(lblQuality);
|
||||
|
||||
// EXIF选项
|
||||
cbKeepExif.Text = "保留EXIF信息";
|
||||
cbKeepExif.Location = new Point(20, 240);
|
||||
this.Controls.Add(cbKeepExif);
|
||||
|
||||
// 压缩按钮
|
||||
btnCompress.Text = "开始压缩";
|
||||
btnCompress.Location = new Point(20, 280);
|
||||
btnCompress.Size = new Size(460, 30);
|
||||
btnCompress.Click += BtnCompress_Click;
|
||||
this.Controls.Add(btnCompress);
|
||||
|
||||
// 调整窗体大小
|
||||
this.Size = new Size(500, 370);
|
||||
}
|
||||
|
||||
private void SelectFile(TextBox target, bool isSave = false)
|
||||
{
|
||||
var dialog = isSave ? new SaveFileDialog() : new OpenFileDialog() as FileDialog;
|
||||
dialog.Filter = "图片文件|*.jpg;*.jpeg;*.png;*.bmp|所有文件|*.*";
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
target.Text = dialog.FileName;
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnCompress_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(txtInput.Text) || !File.Exists(txtInput.Text))
|
||||
{
|
||||
MessageBox.Show("请选择有效的输入文件", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(txtOutput.Text))
|
||||
{
|
||||
MessageBox.Show("请指定输出文件", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
btnCompress.Enabled = false;
|
||||
|
||||
try
|
||||
{
|
||||
string toolPath = Path.Combine(Application.StartupPath, "resource", "image_compressor.exe");
|
||||
if (!File.Exists(toolPath))
|
||||
{
|
||||
MessageBox.Show("图片压缩工具未找到", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
string args = $"\"{txtInput.Text}\" \"{txtOutput.Text}\"";
|
||||
args += $" -t {(rbLossy.Checked ? "lossy" : "lossless")}";
|
||||
args += $" -q {tbQuality.Value}";
|
||||
if (cbKeepExif.Checked) args += " -e";
|
||||
|
||||
var process = new Process();
|
||||
process.StartInfo.FileName = toolPath;
|
||||
process.StartInfo.Arguments = args;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.CreateNoWindow = true;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
|
||||
process.OutputDataReceived += (s, ev) => {
|
||||
if (!string.IsNullOrEmpty(ev.Data))
|
||||
Console.WriteLine(ev.Data);
|
||||
};
|
||||
|
||||
process.ErrorDataReceived += (s, ev) => {
|
||||
if (!string.IsNullOrEmpty(ev.Data))
|
||||
Console.Error.WriteLine(ev.Data);
|
||||
};
|
||||
|
||||
process.Start();
|
||||
process.BeginOutputReadLine();
|
||||
process.BeginErrorReadLine();
|
||||
process.WaitForExit();
|
||||
|
||||
if (process.ExitCode == 0)
|
||||
{
|
||||
MessageBox.Show("图片压缩完成", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("图片压缩失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"压缩过程中发生错误: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
btnCompress.Enabled = true;
|
||||
progressBar.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
193
MainForm.cs
@@ -6,6 +6,7 @@ using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Diagnostics;
|
||||
using AppStore;
|
||||
|
||||
namespace AppStore
|
||||
@@ -145,6 +146,9 @@ namespace AppStore
|
||||
buttonPanel.Height = 70;
|
||||
buttonPanel.BackColor = Color.FromArgb(240, 240, 240);
|
||||
buttonPanel.Padding = new Padding(10, 15, 10, 0);
|
||||
buttonPanel.AutoScroll = true;
|
||||
buttonPanel.AutoSize = true;
|
||||
buttonPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
|
||||
// 导航按钮样式
|
||||
Action<Button> styleButton = (Button btn) => {
|
||||
@@ -212,6 +216,17 @@ namespace AppStore
|
||||
};
|
||||
buttonPanel.Controls.Add(btnAbout);
|
||||
|
||||
// 内置工具按钮
|
||||
var btnTools = new Button();
|
||||
btnTools.Text = "内置工具";
|
||||
btnTools.Location = new Point(590, 0);
|
||||
styleButton(btnTools);
|
||||
btnTools.Click += (s, e) => {
|
||||
Logger.Log("用户点击了'内置工具'按钮");
|
||||
ShowToolsView();
|
||||
};
|
||||
buttonPanel.Controls.Add(btnTools);
|
||||
|
||||
// 现代化内容区域
|
||||
contentPanel = new Panel();
|
||||
contentPanel.Dock = DockStyle.Fill;
|
||||
@@ -243,6 +258,122 @@ namespace AppStore
|
||||
contentPanel.Controls.Add(settingsControl);
|
||||
}
|
||||
|
||||
private void ShowToolsView()
|
||||
{
|
||||
try
|
||||
{
|
||||
contentPanel.Controls.Clear();
|
||||
|
||||
var flowPanel = new FlowLayoutPanel();
|
||||
flowPanel.Dock = DockStyle.Fill;
|
||||
flowPanel.AutoScroll = true;
|
||||
flowPanel.WrapContents = false;
|
||||
flowPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
contentPanel.Controls.Add(flowPanel);
|
||||
|
||||
// 系统清理卡片
|
||||
var cleanerCard = new ToolCard();
|
||||
cleanerCard.ToolName = "系统清理";
|
||||
|
||||
try
|
||||
{
|
||||
cleanerCard.ToolIcon = Image.FromFile("img/resource/png/system_cleaner.png");
|
||||
}
|
||||
catch
|
||||
{
|
||||
cleanerCard.ToolIcon = SystemIcons.Shield.ToBitmap();
|
||||
}
|
||||
|
||||
cleanerCard.UpdateDisplay();
|
||||
cleanerCard.ToolCardClicked += (s, e) => {
|
||||
try {
|
||||
string toolPath = Path.Combine(Application.StartupPath, "resource", "system_cleaner.exe");
|
||||
if (File.Exists(toolPath)) {
|
||||
Process.Start(toolPath);
|
||||
} else {
|
||||
MessageBox.Show("系统清理工具未找到,请确保已正确安装", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
MessageBox.Show($"启动清理工具失败: {ex.Message}", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
};
|
||||
flowPanel.Controls.Add(cleanerCard);
|
||||
|
||||
// 二维码生成卡片
|
||||
var qrCard = new ToolCard();
|
||||
qrCard.ToolName = "二维码生成";
|
||||
|
||||
try
|
||||
{
|
||||
qrCard.ToolIcon = Image.FromFile("img/resource/png/QRcode.png");
|
||||
}
|
||||
catch
|
||||
{
|
||||
qrCard.ToolIcon = SystemIcons.Application.ToBitmap();
|
||||
}
|
||||
|
||||
qrCard.UpdateDisplay();
|
||||
qrCard.ToolCardClicked += (s, e) => {
|
||||
try {
|
||||
var qrForm = new QrCodeGeneratorForm();
|
||||
qrForm.ShowDialog();
|
||||
} catch (Exception ex) {
|
||||
MessageBox.Show($"启动二维码生成工具失败: {ex.Message}", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
};
|
||||
flowPanel.Controls.Add(qrCard);
|
||||
|
||||
// 图片压缩卡片
|
||||
var imageCompressorCard = new ToolCard();
|
||||
imageCompressorCard.ToolName = "图片压缩";
|
||||
|
||||
try
|
||||
{
|
||||
string iconPath = Path.Combine(Application.StartupPath, "img", "resource", "png","ImageCompressor.png");
|
||||
if (File.Exists(iconPath))
|
||||
{
|
||||
imageCompressorCard.ToolIcon = Image.FromFile(iconPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
imageCompressorCard.ToolIcon = SystemIcons.Application.ToBitmap();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
imageCompressorCard.ToolIcon = SystemIcons.Application.ToBitmap();
|
||||
}
|
||||
|
||||
imageCompressorCard.UpdateDisplay();
|
||||
imageCompressorCard.ToolCardClicked += (s, e) => {
|
||||
try {
|
||||
string toolPath = Path.Combine(Application.StartupPath, "resource", "image_compressor.exe");
|
||||
if (File.Exists(toolPath)) {
|
||||
var form = new ImageCompressorForm();
|
||||
form.ShowDialog();
|
||||
} else {
|
||||
MessageBox.Show("图片压缩工具未找到,请确保已正确安装", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
MessageBox.Show($"启动图片压缩工具失败: {ex.Message}", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
};
|
||||
flowPanel.Controls.Add(imageCompressorCard);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("显示内置工具视图时出错", ex);
|
||||
MessageBox.Show("加载内置工具时发生错误,请重试", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
ShowAppsView(); // 回退到默认视图
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowAboutView()
|
||||
{
|
||||
contentPanel.Controls.Clear();
|
||||
@@ -295,11 +426,43 @@ namespace AppStore
|
||||
{
|
||||
contentPanel.Controls.Clear();
|
||||
|
||||
// 同步创建并添加FlowLayoutPanel
|
||||
// 创建应用卡片面板
|
||||
FlowLayoutPanel flowPanel = new FlowLayoutPanel();
|
||||
flowPanel.Dock = DockStyle.Fill;
|
||||
flowPanel.AutoScroll = true;
|
||||
flowPanel.Padding = new Padding(15, 50, 15, 15);
|
||||
flowPanel.Padding = new Padding(15, 15, 15, 15);
|
||||
flowPanel.WrapContents = true;
|
||||
flowPanel.Margin = new Padding(0);
|
||||
flowPanel.AutoSize = true;
|
||||
flowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
flowPanel.AutoScrollMinSize = new Size(0, 3350);
|
||||
|
||||
// 创建搜索框
|
||||
TextBox searchBox = new TextBox();
|
||||
searchBox.Width = 300;
|
||||
searchBox.Height = 32;
|
||||
searchBox.Font = new Font("Microsoft YaHei", 10);
|
||||
searchBox.PlaceholderText = "搜索应用...";
|
||||
searchBox.BorderStyle = BorderStyle.FixedSingle;
|
||||
searchBox.BackColor = Color.White;
|
||||
searchBox.ForeColor = Color.FromArgb(64, 64, 64);
|
||||
searchBox.Location = new Point((contentPanel.Width - searchBox.Width) / 2, 20);
|
||||
|
||||
// 响应窗体大小变化
|
||||
contentPanel.Resize += (s, e) => {
|
||||
searchBox.Location = new Point((contentPanel.Width - searchBox.Width) / 2, 20);
|
||||
};
|
||||
|
||||
// 搜索框事件
|
||||
searchBox.TextChanged += (s, e) => {
|
||||
AppSearch.SearchApps(flowPanel, searchBox.Text);
|
||||
};
|
||||
|
||||
contentPanel.Controls.Add(searchBox);
|
||||
contentPanel.Controls.Add(flowPanel);
|
||||
flowPanel.Dock = DockStyle.Fill;
|
||||
flowPanel.AutoScroll = true;
|
||||
flowPanel.Padding = new Padding(15, 60, 15, 15);
|
||||
flowPanel.WrapContents = true;
|
||||
flowPanel.Margin = new Padding(0);
|
||||
flowPanel.AutoSize = true;
|
||||
@@ -493,11 +656,31 @@ namespace AppStore
|
||||
"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(
|
||||
"PCL2",
|
||||
"https://ghproxy.net/https://github.com/zs-yg/package/releases/download/v0.9/Plain.Craft.Launcher.2.exe",
|
||||
"img/jpg/pcl2.jpg"));
|
||||
|
||||
flowPanel.Controls.Add(CreateAppCard(
|
||||
"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",
|
||||
"img/png/greenshot-logo.png"));
|
||||
|
||||
flowPanel.Controls.Add(CreateAppCard(
|
||||
"DWMBlurGlass",
|
||||
"https://ghproxy.net/https://github.com/Maplespe/DWMBlurGlass/releases/download/2.3.1r/DWMBlurGlass_2.3.1_x64.zip",
|
||||
"img/png/DWMBlurGlass.png"));
|
||||
|
||||
flowPanel.Controls.Add(CreateAppCard(
|
||||
"Umi-OCR",
|
||||
"https://ghproxy.net/https://github.com/hiroi-sora/Umi-OCR/releases/download/v2.1.5/Umi-OCR_Paddle_v2.1.5.7z.exe",
|
||||
"img/png/Umi-OCR.png"));
|
||||
|
||||
flowPanel.Controls.Add(CreateAppCard(
|
||||
"frp",
|
||||
"https://github.com/fatedier/frp/releases/download/v0.62.1/frp_0.62.1_windows_amd64.zip",
|
||||
""));
|
||||
|
||||
flowPanel.Controls.Add(CreateAppCard(
|
||||
"VLC Media Player",
|
||||
"https://mirrors.ustc.edu.cn/videolan-ftp/vlc/3.0.21/win64/vlc-3.0.21-win64.exe",
|
||||
@@ -553,6 +736,12 @@ namespace AppStore
|
||||
"https://download-ssl.firefox.com.cn/releases-sha2/full/116.0/zh-CN/Firefox-full-latest-win64.exe",
|
||||
"img/jpg/firefox.jpg"));
|
||||
|
||||
//这应该是为数不多的国产软件了
|
||||
flowPanel.Controls.Add(CreateAppCard(
|
||||
"星愿浏览器",
|
||||
"https://d1.twinkstar.com/win/Twinkstar_v10.7.1000.2505_Release.exe",
|
||||
"img/jpg/Twinkstar.jpg"));
|
||||
|
||||
flowPanel.Controls.Add(CreateAppCard(
|
||||
"Mem Reduct",
|
||||
"https://memreduct.org/files/memreduct-3.5.2-setup.exe",
|
||||
|
||||
28
README.md
@@ -16,13 +16,8 @@
|
||||
|
||||
## 项目简介
|
||||
|
||||

|
||||
|
||||
这个图片可能有点问题,因为它是gitee仓库中的图片
|
||||
这是为了加快图片渲染速度,但是它好像只能渲染一半,在gitee是正常的
|
||||
这个我没什么办法了
|
||||
|
||||
一个简单的Windows应用商店应用,提供软件下载和管理功能。
|
||||
提供软件管理、下载管理、内置工具使用等功能
|
||||
|
||||
## 功能特点
|
||||
|
||||
@@ -30,6 +25,7 @@
|
||||
- 下载进度管理
|
||||
- 支持后台下载
|
||||
- 美观的应用卡片展示
|
||||
- 功能化、结构化的代码处理
|
||||
|
||||
## 构建与打包
|
||||
|
||||
@@ -61,7 +57,7 @@ bin\Release\net8.0-windows\[platform]\publish
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
AppStore/
|
||||
kortapp-z/
|
||||
├── MainForm.cs # 主窗体逻辑
|
||||
├── DownloadManager.cs # 下载管理
|
||||
├── AppCard.cs # 应用卡片控件
|
||||
@@ -82,16 +78,30 @@ AppStore/
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 kortapp-z项目组
|
||||
Copyright (c) 2025 zsyg
|
||||
|
||||
## 其他网站
|
||||
|
||||
gitee镜像仓库:https://gitee.com/chr_super/kortapp-z
|
||||
gitee镜像仓库:https://gitee.com/chr_super/kortapp-z(目前已经停止维护)
|
||||
|
||||
## 维护
|
||||
|
||||
由于gitee我没怎么用,而且操作麻烦,gitee镜像将不会继续同步,有懂得人可以帮我搞下镜像吗,qq: 3872006562,也可以b站直接私信,我会在readme中鸣谢的,谢谢各位
|
||||
|
||||
提示:由于github上传文件的限制,img/png/NET.png,请改名为.NET.png,否则程序可能出现无法预料的问题
|
||||
|
||||
每一个人都可以通过PR添加属于自己的合法软件
|
||||
|
||||
作者邮箱:
|
||||
```
|
||||
3872006562@qq.com
|
||||
```
|
||||
|
||||
作者qq号:
|
||||
```
|
||||
3872006562
|
||||
```
|
||||
|
||||
qq群:
|
||||
```
|
||||
1043867176
|
||||
|
||||
7
SECURITY.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# 安全准则
|
||||
|
||||
# 安全提醒
|
||||
|
||||
应用商店的软件我们无法保证绝对性的安全
|
||||
在下载和使用、安装之前请为该软件做足充足的功课
|
||||
如果出现系统无法打开,我们无法负责,只能悲哀
|
||||
77
ToolCard.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AppStore
|
||||
{
|
||||
public class ToolCard : UserControl
|
||||
{
|
||||
private PictureBox iconBox = new PictureBox();
|
||||
private Label nameLabel = new Label();
|
||||
|
||||
public string ToolName { get; set; } = string.Empty;
|
||||
public Image ToolIcon { get; set; } = SystemIcons.Shield.ToBitmap();
|
||||
|
||||
// 自定义点击事件初始化为空委托
|
||||
public event EventHandler ToolCardClicked = delegate {};
|
||||
|
||||
public ToolCard()
|
||||
{
|
||||
// 启用双缓冲
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer |
|
||||
ControlStyles.ResizeRedraw, true);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.Size = new Size(240, 220);
|
||||
this.BackColor = Color.White;
|
||||
this.Padding = new Padding(5);
|
||||
this.BorderStyle = BorderStyle.FixedSingle;
|
||||
|
||||
// 工具图标
|
||||
iconBox = new PictureBox();
|
||||
iconBox.Size = new Size(80, 80);
|
||||
iconBox.Location = new Point((Width - 80) / 2, 15);
|
||||
iconBox.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
this.Controls.Add(iconBox);
|
||||
|
||||
// 工具名称
|
||||
nameLabel = new Label();
|
||||
nameLabel.AutoSize = false;
|
||||
nameLabel.Size = new Size(Width - 20, 30);
|
||||
nameLabel.Location = new Point(10, 100);
|
||||
nameLabel.Font = new Font("Microsoft YaHei", 10, FontStyle.Bold);
|
||||
nameLabel.TextAlign = ContentAlignment.MiddleCenter;
|
||||
this.Controls.Add(nameLabel);
|
||||
|
||||
// 打开按钮
|
||||
var openButton = new Button();
|
||||
openButton.Text = "打开工具";
|
||||
openButton.Size = new Size(100, 30);
|
||||
openButton.Location = new Point((Width - 100) / 2, 140);
|
||||
openButton.BackColor = Color.FromArgb(0, 120, 215);
|
||||
openButton.ForeColor = Color.White;
|
||||
openButton.FlatStyle = FlatStyle.Flat;
|
||||
openButton.FlatAppearance.BorderSize = 0;
|
||||
openButton.Cursor = Cursors.Hand;
|
||||
// 按钮点击直接触发ToolCardClicked事件
|
||||
openButton.Click += (s, e) => {
|
||||
ToolCardClicked?.Invoke(this, e);
|
||||
};
|
||||
this.Controls.Add(openButton);
|
||||
|
||||
// 设置按钮悬停效果
|
||||
openButton.BackColor = Color.FromArgb(0, 120, 215);
|
||||
openButton.FlatAppearance.MouseOverBackColor = Color.FromArgb(0, 100, 180);
|
||||
openButton.FlatAppearance.MouseDownBackColor = Color.FromArgb(0, 80, 160);
|
||||
}
|
||||
|
||||
public void UpdateDisplay()
|
||||
{
|
||||
nameLabel.Text = ToolName;
|
||||
iconBox.Image = ToolIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
docs/about.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>关于kortapp-z</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>关于kortapp-z</h1>
|
||||
<p>了解我们的项目和团队</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section class="about-project">
|
||||
<h2>项目简介</h2>
|
||||
<p>kortapp-z是一个专为Windows系统设计的实用工具集合,旨在提供一站式的系统优化和管理解决方案。</p>
|
||||
<p>项目始于2025年,由热爱效率工具的开发者创建。</p>
|
||||
</section>
|
||||
|
||||
<section class="team">
|
||||
<h2>开发团队</h2>
|
||||
<p>我们的团队由经验丰富的开发人员组成,专注于创建高质量的系统工具。</p>
|
||||
<ul>
|
||||
<li>核心开发者: 1人</li>
|
||||
<li>UI设计师: 1人</li>
|
||||
<li>测试工程师: 1人</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="contact">
|
||||
<h2>联系我们</h2>
|
||||
<p>如有任何问题或建议,欢迎通过GitHub提交issue或pull request。</p>
|
||||
<a href="https://github.com/zs-yg/kortapp-z/issues" target="_blank">提交反馈</a>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="index.html">首页</a>
|
||||
<a href="features.html">功能</a>
|
||||
</nav>
|
||||
<p>© 2025 kortapp-z 团队</p>
|
||||
</footer>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
49
docs/features.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>kortapp-z功能详情</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>kortapp-z功能详情</h1>
|
||||
<p>探索我们强大的工具集</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section class="feature-list">
|
||||
<h2>核心功能</h2>
|
||||
|
||||
<article class="feature">
|
||||
<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>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="index.html">首页</a>
|
||||
<a href="about.html">关于</a>
|
||||
</nav>
|
||||
<p>© 2025 kortapp-z 团队</p>
|
||||
</footer>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
42
docs/index.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>kortapp-z - Windows实用工具</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>欢迎使用kortapp-z</h1>
|
||||
<p>您的一站式Windows实用工具</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section class="features">
|
||||
<h2>主要功能</h2>
|
||||
<ul>
|
||||
<li>内置工具</li>
|
||||
<li>应用程序下载</li>
|
||||
<li>更多实用功能</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="github">
|
||||
<h2>项目GitHub地址</h2>
|
||||
<p>查看源代码并参与贡献:</p>
|
||||
<a href="https://github.com/zs-yg/kortapp-z" target="_blank">GitHub仓库</a>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="about.html">关于</a>
|
||||
<a href="features.html">功能</a>
|
||||
</nav>
|
||||
<p>© 2025 zsyg</p>
|
||||
</footer>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
31
docs/script.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// 页面加载完成后执行
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 获取当前年份并更新页脚版权信息
|
||||
const yearElement = document.querySelector('footer p');
|
||||
if (yearElement) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
yearElement.textContent = yearElement.textContent.replace('2025', currentYear);
|
||||
}
|
||||
|
||||
// 为所有导航链接添加点击效果
|
||||
const navLinks = document.querySelectorAll('nav a');
|
||||
navLinks.forEach(link => {
|
||||
link.addEventListener('click', function(e) {
|
||||
// 可以在这里添加页面切换动画或其他效果
|
||||
console.log('导航到: ' + this.getAttribute('href'));
|
||||
});
|
||||
});
|
||||
|
||||
// 功能列表项悬停效果
|
||||
const featureItems = document.querySelectorAll('.features li');
|
||||
featureItems.forEach(item => {
|
||||
item.addEventListener('mouseover', function() {
|
||||
this.style.transform = 'translateX(5px)';
|
||||
this.style.transition = 'transform 0.3s ease';
|
||||
});
|
||||
|
||||
item.addEventListener('mouseout', function() {
|
||||
this.style.transform = '';
|
||||
});
|
||||
});
|
||||
});
|
||||
71
docs/style.css
Normal file
@@ -0,0 +1,71 @@
|
||||
/* 全局样式 */
|
||||
body {
|
||||
font-family: 'Microsoft YaHei', sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* 页眉样式 */
|
||||
header {
|
||||
background-color: #2c3e50;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 2rem 0;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
header p {
|
||||
margin: 0.5rem 0 0;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
/* 主体内容样式 */
|
||||
main {
|
||||
max-width: 1200px;
|
||||
margin: 2rem auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
section {
|
||||
background: white;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||
padding: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #2c3e50;
|
||||
border-bottom: 2px solid #eee;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
/* 链接样式 */
|
||||
a {
|
||||
color: #3498db;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* 页脚样式 */
|
||||
footer {
|
||||
text-align: center;
|
||||
padding: 1rem 0;
|
||||
background-color: #2c3e50;
|
||||
color: white;
|
||||
}
|
||||
|
||||
footer nav a {
|
||||
color: white;
|
||||
margin: 0 1rem;
|
||||
}
|
||||
BIN
img/jpg/Twinkstar.jpg
Normal file
|
After Width: | Height: | Size: 256 KiB |
BIN
img/jpg/pcl2.jpg
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
img/png/DWMBlurGlass.png
Normal file
|
After Width: | Height: | Size: 475 B |
BIN
img/png/NET.png
Normal file
|
After Width: | Height: | Size: 796 B |
BIN
img/png/Umi-OCR.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
img/resource/png/ImageCompressor.png
Normal file
|
After Width: | Height: | Size: 704 KiB |
BIN
img/resource/png/QRcode.png
Normal file
|
After Width: | Height: | Size: 989 KiB |
BIN
img/resource/png/system_cleaner.png
Normal file
|
After Width: | Height: | Size: 644 KiB |
BIN
resource/image_compressor.exe
Normal file
BIN
resource/system_cleaner.exe
Normal file
136
tools/QrCodeGenerator.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using ZXing;
|
||||
using ZXing.Common;
|
||||
using ZXing.QrCode;
|
||||
|
||||
namespace AppStore
|
||||
{
|
||||
public class QrCodeGeneratorForm : Form
|
||||
{
|
||||
private TextBox? inputTextBox;
|
||||
private PictureBox? qrCodePictureBox;
|
||||
private Button? generateButton;
|
||||
private Button? saveButton;
|
||||
|
||||
public QrCodeGeneratorForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = "二维码生成器";
|
||||
this.Size = new Size(500, 600);
|
||||
this.StartPosition = FormStartPosition.CenterScreen;
|
||||
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
// 输入文本框
|
||||
inputTextBox = new TextBox();
|
||||
inputTextBox.Multiline = true;
|
||||
inputTextBox.ScrollBars = ScrollBars.Vertical;
|
||||
inputTextBox.Size = new Size(400, 100);
|
||||
inputTextBox.Location = new Point(50, 30);
|
||||
inputTextBox.PlaceholderText = "请输入要生成二维码的文本内容...";
|
||||
this.Controls.Add(inputTextBox);
|
||||
|
||||
// 生成按钮
|
||||
generateButton = new Button();
|
||||
generateButton.Text = "生成二维码";
|
||||
generateButton.Size = new Size(150, 40);
|
||||
generateButton.Location = new Point(50, 150);
|
||||
generateButton.Click += GenerateButton_Click;
|
||||
this.Controls.Add(generateButton);
|
||||
|
||||
// 二维码显示区域
|
||||
qrCodePictureBox = new PictureBox();
|
||||
qrCodePictureBox.Size = new Size(300, 300);
|
||||
qrCodePictureBox.Location = new Point(100, 220);
|
||||
qrCodePictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
qrCodePictureBox.BorderStyle = BorderStyle.FixedSingle;
|
||||
this.Controls.Add(qrCodePictureBox);
|
||||
|
||||
// 保存按钮
|
||||
saveButton = new Button();
|
||||
saveButton.Text = "保存二维码";
|
||||
saveButton.Size = new Size(150, 40);
|
||||
saveButton.Location = new Point(300, 150);
|
||||
saveButton.Click += SaveButton_Click;
|
||||
this.Controls.Add(saveButton);
|
||||
}
|
||||
|
||||
private void GenerateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(inputTextBox?.Text))
|
||||
{
|
||||
MessageBox.Show("请输入要生成二维码的文本内容", "提示",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var writer = new BarcodeWriterPixelData
|
||||
{
|
||||
Format = BarcodeFormat.QR_CODE,
|
||||
Options = new QrCodeEncodingOptions
|
||||
{
|
||||
Width = 300,
|
||||
Height = 300,
|
||||
Margin = 1
|
||||
}
|
||||
};
|
||||
|
||||
var pixelData = writer.Write(inputTextBox.Text);
|
||||
var bitmap = new Bitmap(pixelData.Width, pixelData.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
|
||||
var bitmapData = bitmap.LockBits(new Rectangle(0, 0, pixelData.Width, pixelData.Height),
|
||||
System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
|
||||
try
|
||||
{
|
||||
System.Runtime.InteropServices.Marshal.Copy(pixelData.Pixels, 0, bitmapData.Scan0, pixelData.Pixels.Length);
|
||||
}
|
||||
finally
|
||||
{
|
||||
bitmap.UnlockBits(bitmapData);
|
||||
}
|
||||
qrCodePictureBox!.Image = bitmap;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"生成二维码失败: {ex.Message}", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (qrCodePictureBox?.Image == null)
|
||||
{
|
||||
MessageBox.Show("请先生成二维码", "提示",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var saveDialog = new SaveFileDialog())
|
||||
{
|
||||
saveDialog.Filter = "PNG 图片|*.png|JPEG 图片|*.jpg|BMP 图片|*.bmp";
|
||||
saveDialog.Title = "保存二维码图片";
|
||||
if (saveDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
qrCodePictureBox!.Image.Save(saveDialog.FileName);
|
||||
MessageBox.Show("二维码保存成功", "成功",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"保存二维码失败: {ex.Message}", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
103
tools/image_compressor.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <stb/stb_image.h>
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include <stb/stb_image_write.h>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
void ShowHelp() {
|
||||
std::cout << "图片压缩工具 v1.0\n";
|
||||
std::cout << "用法: image_compressor [选项] 输入文件 输出文件\n";
|
||||
std::cout << "选项:\n";
|
||||
std::cout << " -t <type> 压缩类型: lossy(有损)/lossless(无损) (默认: lossy)\n";
|
||||
std::cout << " -q <quality> 压缩质量 (1-1000) (默认: 80)\n";
|
||||
std::cout << " -e 保留EXIF信息 (默认: 不保留)\n";
|
||||
std::cout << " -h 显示帮助信息\n";
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// 默认参数
|
||||
std::string compressType = "lossy";
|
||||
int quality = 80;
|
||||
bool keepExif = false;
|
||||
std::string inputFile;
|
||||
std::string outputFile;
|
||||
|
||||
// 解析命令行参数
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string arg = argv[i];
|
||||
if (arg == "-h") {
|
||||
ShowHelp();
|
||||
return 0;
|
||||
} else if (arg == "-t" && i + 1 < argc) {
|
||||
compressType = argv[++i];
|
||||
} else if (arg == "-q" && i + 1 < argc) {
|
||||
quality = std::stoi(argv[++i]);
|
||||
} else if (arg == "-e") {
|
||||
keepExif = true;
|
||||
} else if (inputFile.empty()) {
|
||||
inputFile = arg;
|
||||
} else {
|
||||
outputFile = arg;
|
||||
}
|
||||
}
|
||||
|
||||
// 验证参数
|
||||
if (inputFile.empty() || outputFile.empty()) {
|
||||
std::cerr << "错误: 必须指定输入文件和输出文件\n";
|
||||
ShowHelp();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (quality < 1 || quality > 1000) {
|
||||
std::cerr << "错误: 压缩质量必须在1-1000之间\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
std::cout << "正在压缩: " << inputFile << " -> " << outputFile << std::endl;
|
||||
std::cout << "类型: " << compressType << std::endl;
|
||||
std::cout << "质量: " << quality << std::endl;
|
||||
std::cout << "保留EXIF: " << (keepExif ? "是" : "否") << std::endl;
|
||||
|
||||
// 加载图片
|
||||
int width, height, channels;
|
||||
unsigned char* image = stbi_load(inputFile.c_str(), &width, &height, &channels, 0);
|
||||
if (!image) {
|
||||
std::cerr << "错误: 无法加载图片 " << inputFile << " - " << stbi_failure_reason() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 压缩图片
|
||||
int result = 0;
|
||||
if (compressType == "lossy") {
|
||||
// 有损压缩 (JPEG)
|
||||
int jpeg_quality = quality / 10; // 将1-1000映射到1-100
|
||||
jpeg_quality = std::max(1, std::min(jpeg_quality, 100));
|
||||
result = stbi_write_jpg(outputFile.c_str(), width, height, channels, image, jpeg_quality);
|
||||
} else {
|
||||
// 无损压缩 (PNG)
|
||||
result = stbi_write_png(outputFile.c_str(), width, height, channels, image, width * channels);
|
||||
}
|
||||
|
||||
// 释放内存
|
||||
stbi_image_free(image);
|
||||
|
||||
if (!result) {
|
||||
std::cerr << "错误: 无法保存图片 " << outputFile << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "压缩完成\n";
|
||||
return 0;
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "发生错误: " << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
96
tools/system_cleaner.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <windows.h>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
bool IsAdmin() {
|
||||
BOOL isAdmin = FALSE;
|
||||
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
|
||||
PSID AdminGroup;
|
||||
|
||||
if (AllocateAndInitializeSid(&NtAuthority, 2,
|
||||
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS,
|
||||
0, 0, 0, 0, 0, 0, &AdminGroup)) {
|
||||
if (!CheckTokenMembership(NULL, AdminGroup, &isAdmin)) {
|
||||
isAdmin = FALSE;
|
||||
}
|
||||
FreeSid(AdminGroup);
|
||||
}
|
||||
return isAdmin == TRUE;
|
||||
}
|
||||
|
||||
void CleanDirectory(const fs::path& dir, size_t& deletedCount, size_t& errorCount) {
|
||||
if (!fs::exists(dir)) {
|
||||
std::cout << "目录不存在: " << dir << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& entry : fs::directory_iterator(dir)) {
|
||||
try {
|
||||
if (fs::is_regular_file(entry)) {
|
||||
fs::remove(entry);
|
||||
deletedCount++;
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "删除文件失败: " << entry.path() << " - " << e.what() << std::endl;
|
||||
errorCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
try {
|
||||
if (!IsAdmin()) {
|
||||
std::cerr << "请以管理员身份运行此程序以清理所有目录" << std::endl;
|
||||
}
|
||||
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
size_t totalDeleted = 0;
|
||||
size_t totalErrors = 0;
|
||||
|
||||
// 定义要清理的目录列表
|
||||
std::vector<fs::path> directories = {
|
||||
"C:\\Windows\\Temp",
|
||||
fs::path(std::getenv("USERPROFILE")) / "AppData" / "Local" / "Temp",
|
||||
"C:\\Windows\\SoftwareDistribution\\Download",
|
||||
"C:\\Windows\\Logs",
|
||||
"C:\\Windows\\Minidump"
|
||||
};
|
||||
|
||||
// 只有管理员才能清理Prefetch目录
|
||||
if (IsAdmin()) {
|
||||
directories.push_back("C:\\Windows\\Prefetch");
|
||||
}
|
||||
|
||||
// 清理每个目录
|
||||
for (const auto& dir : directories) {
|
||||
size_t dirDeleted = 0;
|
||||
size_t dirErrors = 0;
|
||||
|
||||
std::cout << "正在清理: " << dir << std::endl;
|
||||
CleanDirectory(dir, dirDeleted, dirErrors);
|
||||
|
||||
totalDeleted += dirDeleted;
|
||||
totalErrors += dirErrors;
|
||||
|
||||
std::cout << "已删除 " << dirDeleted << " 个文件" << std::endl;
|
||||
}
|
||||
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
|
||||
|
||||
std::cout << "\n清理完成:" << std::endl;
|
||||
std::cout << "总共删除文件数: " << totalDeleted << std::endl;
|
||||
std::cout << "总共错误数: " << totalErrors << std::endl;
|
||||
std::cout << "耗时: " << duration.count() << " 毫秒" << std::endl;
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "发生错误: " << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||