diff --git a/AdnmbBackup-gui/Form1.cs b/AdnmbBackup-gui/Form1.cs index b073b61..80a9e3e 100644 --- a/AdnmbBackup-gui/Form1.cs +++ b/AdnmbBackup-gui/Form1.cs @@ -103,6 +103,7 @@ private void button1_Click(object sender, EventArgs e) return; } ConvertToText(path); + ConvertToTextPoOnly(path); } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -129,12 +130,31 @@ static void ConvertToText(string path) sb.Append(ContentProcess(ja[i]["content"].ToString())); sb.Append(Environment.NewLine); } File.WriteAllText(path.Replace("json", "txt"), sb.ToString()); - var lines = File.ReadAllLines(path.Replace("json", "txt")); - //for (var i = 0; i < lines.Length; i++) - //{ - // lines[i] = lines[i].Trim(); - //} - File.WriteAllLines(path.Replace("json", "txt"), lines); + } + static void ConvertToTextPoOnly(string path) + { + var jo = JsonConvert.DeserializeObject(File.ReadAllText(path)); + var sb = new StringBuilder(); + sb.Append(jo["userid"].ToString()); sb.Append(" "); sb.Append(jo["now"].ToString()); + sb.Append(" No."); sb.Append(jo["id"].ToString()); sb.Append(Environment.NewLine); + if (jo["title"].ToString() != "无标题") + { + sb.Append("标题:"); sb.Append(jo["title"].ToString()); sb.Append(Environment.NewLine); + } + sb.Append(ContentProcess(jo["content"].ToString())); sb.Append(Environment.NewLine); + var ja = jo["replys"].ToObject(); + var poid = jo["userid"].ToString(); + for (int i = 0; i < ja.Count; i++) + { + if (ja[i]["userid"].ToString() == poid) + { + sb.Append("----------------------------------------"); sb.Append(Environment.NewLine); + sb.Append(ja[i]["userid"].ToString()); sb.Append(" "); sb.Append(ja[i]["now"].ToString()); + sb.Append(" No."); sb.Append(ja[i]["id"].ToString()); sb.Append(Environment.NewLine); + sb.Append(ContentProcess(ja[i]["content"].ToString())); sb.Append(Environment.NewLine); + } + } + File.WriteAllText(path.Replace(".json", "_po_only.txt"), sb.ToString()); } static string ContentProcess(string content) { @@ -230,6 +250,7 @@ private void Form1_Shown(object sender, EventArgs e) var fjsonstr = JsonConvert.SerializeObject(fpjson, Formatting.Indented); File.WriteAllText(path, fjsonstr); ConvertToText(path); + ConvertToTextPoOnly(path); } catch { diff --git a/README.md b/README.md index d5d79d4..4636ef8 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,5 @@ 一个让你本地备份A岛串的小程序 [饼干获取教程](https://www.coldthunder11.com/artical/%e6%95%99%e7%a8%8b/%e5%a6%82%e4%bd%95%e8%8e%b7%e5%8f%96a%e5%b2%9b%e7%9a%84%e9%a5%bc%e5%b9%b2/) 支持批量自动备份,在程序目录下新建AtuobBackupList.txt将需要自动备份的串号填入(一行一个),每天第一次打开会自动备份 -需要.net framework4.8 +需要 .net framework4.8 +json文件为完整数据文件,txt为易读的文件