AppExportForm.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using AppManager.Pojo;
using AppManager.Utils;
using Newtonsoft.Json;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AppManager {
public partial class AppExportForm : Form {
private const string EXPORT = "export_";
public AppExportForm() {
InitializeComponent();
}
private void AppExportForm_Load(object sender, EventArgs e) {
ExportAppFlowLayoutPanel.Controls.Clear();
SelectAllCheckBox.Checked = true;
//加载项目到面板中
AppSections.GetAllSectionDic().ToList().ForEach(dic => {
var checkBox = new CheckBox {
Checked = true,
Name = EXPORT + dic.Value.Section,
Text = dic.Value.Title,
Tag = dic.Value.Section
};
ExportAppFlowLayoutPanel.Controls.Add(checkBox);
});
}
private void SelectAllCheckBox_CheckedChanged(object sender, EventArgs e) {
foreach (CheckBox cb in ExportAppFlowLayoutPanel.Controls) {
cb.Checked = SelectAllCheckBox.Checked;
}
}
private void ExportAppButton_Click(object sender, EventArgs e) {
var checkedExportList = (from CheckBox cb in ExportAppFlowLayoutPanel.Controls where cb.Checked select (string)cb.Tag).ToList();
if (checkedExportList.Count == 0) {
MessageBox.Show("未选择导出数据!");
} else {
var exportAppDic = new LinkedHashMap<string, AppSections.AppSection>();
checkedExportList.ForEach(section => {
if (AppSections.GetAllSectionDic().ContainsKey(section)) {
exportAppDic.Add(section, AppSections.GetAllSectionDic()[section]);
} else {
MessageBox.Show("数据已变更,请重新后再试!");
}
});
// 导出
var content = JsonConvert.SerializeObject(exportAppDic);
var saveFileDialog = new SaveFileDialog {
Filter = "Amp Files(*.amp)|*.amp",
FileName = "AppConfig"
};
if (DialogResult.OK != saveFileDialog.ShowDialog()) return;
File.WriteAllText(saveFileDialog.FileName, AesUtils.EntryptContent(content), new UTF8Encoding(false));
MessageBox.Show("导出成功!");
后面还有 9 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。