diff --git a/GameDatabase/Context/TaikoDbContext.cs b/GameDatabase/Context/TaikoDbContext.cs index 9502758..423c7c7 100644 --- a/GameDatabase/Context/TaikoDbContext.cs +++ b/GameDatabase/Context/TaikoDbContext.cs @@ -26,6 +26,7 @@ namespace GameDatabase.Context { return; } + var path = Path.Combine(PathHelper.GetRootPath(), "taiko.db3"); optionsBuilder.UseSqlite($"Data Source={path}"); } @@ -54,10 +55,10 @@ namespace GameDatabase.Context entity.Property(e => e.Difficulty) .HasConversion(); - + entity.Property(e => e.BestCrown) .HasConversion(); - + entity.Property(e => e.BestScoreRank) .HasConversion(); }); @@ -75,13 +76,13 @@ namespace GameDatabase.Context .HasPrincipalKey(p => p.Baid) .HasForeignKey(d => d.Baid) .OnDelete(DeleteBehavior.Cascade); - + entity.Property(e => e.Difficulty) .HasConversion(); - + entity.Property(e => e.ScoreRank) .HasConversion(); - + entity.Property(e => e.Crown) .HasConversion(); }); @@ -97,7 +98,7 @@ namespace GameDatabase.Context .HasPrincipalKey(p => p.Baid) .HasForeignKey(d => d.Baid) .OnDelete(DeleteBehavior.Cascade); - + entity.Property(e => e.AchievementDisplayDifficulty) .HasConversion(); }); @@ -107,4 +108,4 @@ namespace GameDatabase.Context partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } -} +} \ No newline at end of file diff --git a/GameDatabase/Context/TaikoDbContextPartial.cs b/GameDatabase/Context/TaikoDbContextPartial.cs index ffa2440..e8e1620 100644 --- a/GameDatabase/Context/TaikoDbContextPartial.cs +++ b/GameDatabase/Context/TaikoDbContextPartial.cs @@ -32,8 +32,8 @@ public partial class TaikoDbContext entity.HasOne(d => d.Parent) .WithMany(p => p.DanStageScoreData) - .HasPrincipalKey(p => new {p.Baid, p.DanId}) - .HasForeignKey(d => new {d.Baid, d.DanId}) + .HasPrincipalKey(p => new { p.Baid, p.DanId }) + .HasForeignKey(d => new { d.Baid, d.DanId }) .OnDelete(DeleteBehavior.Cascade); }); @@ -47,16 +47,16 @@ public partial class TaikoDbContext .HasForeignKey(d => d.Baid) .OnDelete(DeleteBehavior.Cascade); }); - - + + modelBuilder.Entity(entity => { entity.HasKey(e => new { e.Baid, e.SongId, e.Difficulty, e.SectionIndex }); entity.HasOne(d => d.Parent) .WithMany(p => p.AiSectionScoreData) - .HasPrincipalKey(p => new {p.Baid, p.SongId, p.Difficulty }) - .HasForeignKey(d => new {d.Baid, d.SongId, d.Difficulty }) + .HasPrincipalKey(p => new { p.Baid, p.SongId, p.Difficulty }) + .HasForeignKey(d => new { d.Baid, d.SongId, d.Difficulty }) .OnDelete(DeleteBehavior.Cascade); }); } diff --git a/GameDatabase/Entities/AiScoreDatum.cs b/GameDatabase/Entities/AiScoreDatum.cs index 9d47200..071afc3 100644 --- a/GameDatabase/Entities/AiScoreDatum.cs +++ b/GameDatabase/Entities/AiScoreDatum.cs @@ -5,14 +5,14 @@ namespace GameDatabase.Entities; public class AiScoreDatum { public uint Baid { get; set; } - + public uint SongId { get; set; } - + public Difficulty Difficulty { get; set; } - + public bool IsWin { get; set; } public List AiSectionScoreData { get; set; } = new(); - + public virtual Card? Ba { get; set; } } \ No newline at end of file diff --git a/GameDatabase/Entities/AiSectionScoreDatum.cs b/GameDatabase/Entities/AiSectionScoreDatum.cs index 6293375..4113e98 100644 --- a/GameDatabase/Entities/AiSectionScoreDatum.cs +++ b/GameDatabase/Entities/AiSectionScoreDatum.cs @@ -5,23 +5,23 @@ namespace GameDatabase.Entities; public class AiSectionScoreDatum { public uint Baid { get; set; } - + public uint SongId { get; set; } - + public Difficulty Difficulty { get; set; } - + public int SectionIndex { get; set; } - + public CrownType Crown { get; set; } public bool IsWin { get; set; } - + public uint Score { get; set; } - + public uint GoodCount { get; set; } - + public uint OkCount { get; set; } - + public uint MissCount { get; set; } public uint DrumrollCount { get; set; } diff --git a/GameDatabase/Entities/Card.cs b/GameDatabase/Entities/Card.cs index c0c77c8..97538ee 100644 --- a/GameDatabase/Entities/Card.cs +++ b/GameDatabase/Entities/Card.cs @@ -5,4 +5,4 @@ public string AccessCode { get; set; } = null!; public uint Baid { get; set; } } -} +} \ No newline at end of file diff --git a/GameDatabase/Entities/DanScoreDatum.cs b/GameDatabase/Entities/DanScoreDatum.cs index 8884766..d50a443 100644 --- a/GameDatabase/Entities/DanScoreDatum.cs +++ b/GameDatabase/Entities/DanScoreDatum.cs @@ -11,6 +11,6 @@ public class DanScoreDatum public uint ComboCountTotal { get; set; } public DanClearState ClearState { get; set; } public List DanStageScoreData { get; set; } = new(); - + public virtual Card? Ba { get; set; } } \ No newline at end of file diff --git a/GameDatabase/Entities/DanStageScoreDatum.cs b/GameDatabase/Entities/DanStageScoreDatum.cs index 3fa4412..5f134ba 100644 --- a/GameDatabase/Entities/DanStageScoreDatum.cs +++ b/GameDatabase/Entities/DanStageScoreDatum.cs @@ -3,25 +3,25 @@ public class DanStageScoreDatum { public uint Baid { get; set; } - + public uint DanId { get; set; } public uint SongNumber { get; set; } - + public uint PlayScore { get; set; } public uint GoodCount { get; set; } - + public uint OkCount { get; set; } - + public uint BadCount { get; set; } - + public uint DrumrollCount { get; set; } - + public uint TotalHitCount { get; set; } - + public uint ComboCount { get; set; } - + public uint HighScore { get; set; } public DanScoreDatum Parent { get; set; } = null!; diff --git a/GameDatabase/Entities/SongBestDatum.cs b/GameDatabase/Entities/SongBestDatum.cs index dce4198..214ba21 100644 --- a/GameDatabase/Entities/SongBestDatum.cs +++ b/GameDatabase/Entities/SongBestDatum.cs @@ -14,4 +14,4 @@ namespace GameDatabase.Entities public virtual Card? Ba { get; set; } } -} +} \ No newline at end of file diff --git a/GameDatabase/Entities/SongBestDatumMethods.cs b/GameDatabase/Entities/SongBestDatumMethods.cs index 05d9bea..1b4c8f1 100644 --- a/GameDatabase/Entities/SongBestDatumMethods.cs +++ b/GameDatabase/Entities/SongBestDatumMethods.cs @@ -10,17 +10,17 @@ public partial class SongBestDatum { BestCrown = crown; } - + if ((uint)BestScoreRank < scoreRank) { - BestScoreRank = (ScoreRank)scoreRank; + BestScoreRank = (ScoreRank)scoreRank; } - + if (BestScore < playScore) { BestScore = playScore; } - + if (BestRate < scoreRate) { BestRate = scoreRate; diff --git a/GameDatabase/Entities/SongPlayDatum.cs b/GameDatabase/Entities/SongPlayDatum.cs index 1ac004b..173e4c1 100644 --- a/GameDatabase/Entities/SongPlayDatum.cs +++ b/GameDatabase/Entities/SongPlayDatum.cs @@ -6,9 +6,9 @@ namespace GameDatabase.Entities { public long Id { get; set; } public uint Baid { get; set; } - + public uint SongNumber { get; set; } - + public uint SongId { get; set; } public Difficulty Difficulty { get; set; } public CrownType Crown { get; set; } @@ -26,4 +26,4 @@ namespace GameDatabase.Entities public virtual Card? Ba { get; set; } } -} +} \ No newline at end of file diff --git a/GameDatabase/Entities/UserDatum.cs b/GameDatabase/Entities/UserDatum.cs index 1b493d4..246b70c 100644 --- a/GameDatabase/Entities/UserDatum.cs +++ b/GameDatabase/Entities/UserDatum.cs @@ -31,4 +31,4 @@ namespace GameDatabase.Entities public int AiWinCount { get; set; } public virtual Card? Ba { get; set; } } -} +} \ No newline at end of file diff --git a/LocalSaveModScoreMigrator/DateTimeConverter.cs b/LocalSaveModScoreMigrator/DateTimeConverter.cs index 870bdd9..6cf4cf5 100644 --- a/LocalSaveModScoreMigrator/DateTimeConverter.cs +++ b/LocalSaveModScoreMigrator/DateTimeConverter.cs @@ -10,7 +10,8 @@ public class DateTimeConverter : JsonConverter public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { Debug.Assert(typeToConvert == typeof(DateTime)); - var dateTime = DateTime.ParseExact(reader.GetString() ?? string.Empty, "dd_MM_yy-HH_mm_ss", CultureInfo.InvariantCulture); + var dateTime = DateTime.ParseExact(reader.GetString() ?? string.Empty, "dd_MM_yy-HH_mm_ss", + CultureInfo.InvariantCulture); return dateTime; } diff --git a/LocalSaveModScoreMigrator/MusicInfo.cs b/LocalSaveModScoreMigrator/MusicInfo.cs index 657ae09..2230f85 100644 --- a/LocalSaveModScoreMigrator/MusicInfo.cs +++ b/LocalSaveModScoreMigrator/MusicInfo.cs @@ -4,6 +4,5 @@ namespace LocalSaveModScoreMigrator; public class MusicInfo { - [JsonPropertyName("items")] - public List Items { get; set; } = new(); + [JsonPropertyName("items")] public List Items { get; set; } = new(); } \ No newline at end of file diff --git a/LocalSaveModScoreMigrator/MusicInfoEntry.cs b/LocalSaveModScoreMigrator/MusicInfoEntry.cs index 9c881ed..23f98fb 100644 --- a/LocalSaveModScoreMigrator/MusicInfoEntry.cs +++ b/LocalSaveModScoreMigrator/MusicInfoEntry.cs @@ -4,9 +4,7 @@ namespace LocalSaveModScoreMigrator; public class MusicInfoEntry { - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; - [JsonPropertyName("uniqueId")] - public uint SongId { get; set; } + [JsonPropertyName("uniqueId")] public uint SongId { get; set; } } \ No newline at end of file diff --git a/LocalSaveModScoreMigrator/PlayRecordJson.cs b/LocalSaveModScoreMigrator/PlayRecordJson.cs index 866d127..a788ba4 100644 --- a/LocalSaveModScoreMigrator/PlayRecordJson.cs +++ b/LocalSaveModScoreMigrator/PlayRecordJson.cs @@ -7,14 +7,12 @@ public class PlayRecordJson { public string SongId { get; set; } = "tmap4"; public Difficulty Difficulty { get; set; } - - [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + + [JsonPropertyName("dateTime")] public DateTime DateTime { get; set; } public uint Score { set; get; } public CrownType Crown { get; set; } - - [JsonPropertyName("scorerank")] - public ScoreRank Scorerank { get; set; } + + [JsonPropertyName("scorerank")] public ScoreRank Scorerank { get; set; } public uint Good { get; set; } public uint Ok { get; set; } public uint Bad { get; set; } diff --git a/LocalSaveModScoreMigrator/Program.cs b/LocalSaveModScoreMigrator/Program.cs index d45069e..58bae2b 100644 --- a/LocalSaveModScoreMigrator/Program.cs +++ b/LocalSaveModScoreMigrator/Program.cs @@ -61,8 +61,8 @@ foreach (var playRecord in playRecordJson) SongId = songId }; db.SongPlayData.Add(playLog); - - + + var best = new SongBestDatum { Baid = user.Baid,