准备做控件序列化工作

This commit is contained in:
2025-09-03 16:16:00 +08:00
parent 31d3517ecb
commit e773052a85
365 changed files with 3078 additions and 374 deletions

View File

@@ -1,7 +1,9 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Ramitta;
using System.Data.Common;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@@ -122,6 +124,11 @@ namespace template
private void (object sender, RoutedEventArgs e)
{
string outputPath = @"C:\Users\Xeroly\Desktop\sieghail.json";
// 方法1使用File.ReadAllText推荐
string jsonContent = File.ReadAllText(outputPath);
TreeList.JsonParse(jsonContent);
}
@@ -132,15 +139,24 @@ namespace template
private void (object sender, RoutedEventArgs e)
{
var sukablayt = TreeList.FindArgvNode(null, ["GroupF"]);
foreach (var arg in sukablayt.Children) {
var suka = arg as CheckboxTreeNode;
Debug.WriteLine($"{arg.Text}:{suka.IsChecked}");
string outputPath = @"C:\Users\Xeroly\Desktop\sieghail.json"; // 修改为你想要保存的路径
// 获取要输出的文本
string outputText = TreeList.JsonPrint().ToString();
// 使用StreamWriter将文本写入文件
try
{
using (StreamWriter writer = new StreamWriter(outputPath, false)) // 'true'表示以追加模式写入文件
{
writer.WriteLine(outputText); // 写入文本
}
}
catch (Exception ex)
{
MessageBox.Show("错误: " + ex.Message); // 如果写入过程中出现异常,弹出错误信息
}
if (sukablayt == null)DebugBar(Debugtag, $"没找到", );
}
}
}
}