diff --git a/YaeAchievement.csproj b/YaeAchievement.csproj
index db57be3..c3db0d7 100644
--- a/YaeAchievement.csproj
+++ b/YaeAchievement.csproj
@@ -13,6 +13,7 @@
+
diff --git a/src/Export.cs b/src/Export.cs
index c5e3b84..6e11e26 100644
--- a/src/Export.cs
+++ b/src/Export.cs
@@ -1,7 +1,124 @@
-namespace YaeAchievement;
+using Newtonsoft.Json;
+using static AchievementAllDataNotify.Types.Achievement.Types;
+
+namespace YaeAchievement;
public static class Export {
- public static void A() {}
+ public static void Choose(AchievementAllDataNotify data) {
+ Console.Write(@"导出至:
+ [0] 椰羊 (https://cocogoat.work/achievement)
+ [1] SnapGenshin
+ [2] Paimon.moe
+ [3] Seelie.me
+ [4] 表格文件 (默认)
+ 输入一个数字(0-4): ".Split("\n").Select(s => s.Trim()).JoinToString("\n") + " ");
+ if (!int.TryParse(Console.ReadLine(), out var num)) num = 4;
+ Action act = num switch {
+ 0 => ToCocogoat,
+ 1 => ToSnapGenshin,
+ 2 => ToPaimon,
+ 3 => ToSeelie,
+ 7 => ToRawJson,
+ _ => ToCSV
+ };
+ act(data);
+ }
+
+ private static void ToCocogoat(AchievementAllDataNotify data) {
+ throw new NotImplementedException();
+ }
+
+ private static void ToSnapGenshin(AchievementAllDataNotify data) {
+ throw new NotImplementedException();
+ }
+
+ private static void ToPaimon(AchievementAllDataNotify data) {
+ var info = LoadAchievementInfo();
+ var output = new Dictionary>();
+ var path = Path.GetFullPath($"export-{DateTime.Now:yyyyMMddHHmmss}-paimon.json");
+ foreach (var ach in data.List.Where(a => a.Status is Status.Finished or Status.RewardTaken)) {
+ if (!info.Items.TryGetValue(ach.Id, out var achInfo) || achInfo == null) {
+ Console.WriteLine($"Unable to find {ach.Id} in metadata.");
+ continue;
+ }
+ var map = output.GetValueOrDefault(achInfo.Group, new Dictionary());
+ map[ach.Id == 81222 ? 81219 : ach.Id] = true;
+ output[achInfo.Group] = map;
+ }
+ var final = new Dictionary>> {
+ ["achievement"] = output.OrderBy(pair => pair.Key).ToDictionary(pair => pair.Key, pair => pair.Value)
+ };
+ File.WriteAllText(path, JsonConvert.SerializeObject(final));
+ Console.WriteLine($"成就数据已导出至 {path}");
+ }
+
+ private static void ToSeelie(AchievementAllDataNotify data) {
+ var path = Path.GetFullPath($"export-{DateTime.Now:yyyyMMddHHmmss}-seelie.json");
+ Console.WriteLine($"成就数据已导出至 {path}");
+ }
+
+ // ReSharper disable once InconsistentNaming
+ private static void ToCSV(AchievementAllDataNotify data) {
+ var info = LoadAchievementInfo();
+ var path = Path.GetFullPath($"achievement-{DateTime.Now:yyyyMMddHHmmss}.csv");
+ var outList = new List>();
+ foreach (var ach in data.List.OrderBy(a => a.Id)) {
+ if (UnusedAchievement.Contains(ach.Id)) continue;
+ if (!info.Items.TryGetValue(ach.Id, out var achInfo) || achInfo == null) {
+ Console.WriteLine($"Unable to find {ach.Id} in metadata.");
+ continue;
+ }
+ var finishAt = "";
+ if (ach.Timestamp != 0) {
+ var ts = Convert.ToInt64(ach.Timestamp);
+ finishAt = DateTimeOffset.FromUnixTimeSeconds(ts).ToString("yyyy/MM/dd HH:mm:ss");
+ }
+ var current = ach.Status != Status.Unfinished ? ach.Current == 0 ? ach.Total : ach.Current : ach.Current;
+ outList.Add(new List