Skip to content

Commit

Permalink
v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdThunder11 committed Mar 22, 2020
1 parent 1d10de2 commit e170313
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
33 changes: 27 additions & 6 deletions AdnmbBackup-gui/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<JObject>(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<JArray>();
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)
{
Expand Down Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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为易读的文件

0 comments on commit e170313

Please sign in to comment.