From c6ab4e6a0f3d9d9b3a8486a03d4857c19d31e9fe Mon Sep 17 00:00:00 2001 From: rampaa Date: Sat, 12 Oct 2024 06:13:59 +0300 Subject: [PATCH] Minor --- .../EPWING/Nazeka/EpwingNazekaDBManager.cs | 14 ++++++------ .../Yomichan/EpwingYomichanDBManager.cs | 14 ++++++------ JL.Core/Dicts/JMdict/JmdictDBManager.cs | 22 +++++++++---------- JL.Core/Dicts/JMnedict/JmnedictDBManager.cs | 16 +++++++------- JL.Core/Dicts/JMnedict/JmnedictRecord.cs | 4 ++-- JL.Core/Dicts/KANJIDIC/KanjidicDBManager.cs | 20 ++++++++--------- .../Dicts/KanjiDict/YomichanKanjiDBManager.cs | 16 +++++++------- .../YomichanPitchAccentDBManager.cs | 2 +- JL.Core/Freqs/FreqDBManager.cs | 2 +- 9 files changed, 55 insertions(+), 55 deletions(-) diff --git a/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaDBManager.cs b/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaDBManager.cs index 80be4708..0809d50f 100644 --- a/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaDBManager.cs +++ b/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaDBManager.cs @@ -95,8 +95,8 @@ INSERT INTO record_search_key(record_id, search_key) _ = insertRecordCommand.Parameters["@id"].Value = id; _ = insertRecordCommand.Parameters["@primary_spelling"].Value = record.PrimarySpelling; _ = insertRecordCommand.Parameters["@reading"].Value = record.Reading is not null ? record.Reading : DBNull.Value; - _ = insertRecordCommand.Parameters["@alternative_spellings"].Value = record.AlternativeSpellings is not null ? JsonSerializer.Serialize(record.AlternativeSpellings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_jsoNotIgnoringNull); + _ = insertRecordCommand.Parameters["@alternative_spellings"].Value = record.AlternativeSpellings is not null ? JsonSerializer.Serialize(record.AlternativeSpellings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_defaultJso); _ = insertRecordCommand.ExecuteNonQuery(); _ = insertSearchKeyCommand.Parameters["@record_id"].Value = id; @@ -170,10 +170,10 @@ INSERT INTO record_search_key(record_id, search_key) string[]? alternativeSpellings = null; if (dataReader[nameof(alternativeSpellings)] is string alternativeSpellingsFromDB) { - alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_jsoNotIgnoringNull); + alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_defaultJso); } - string[] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_jsoNotIgnoringNull)!; + string[] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_defaultJso)!; if (results.TryGetValue(searchKey, out IList? result)) { @@ -234,7 +234,7 @@ FROM record r while (dataReader.Read()) { EpwingNazekaRecord record = GetRecord(dataReader); - string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_jsoNotIgnoringNull)!; + string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_defaultJso)!; for (int i = 0; i < searchKeys.Length; i++) { string searchKey = searchKeys[i]; @@ -270,10 +270,10 @@ private static EpwingNazekaRecord GetRecord(SqliteDataReader dataReader) string[]? alternativeSpellings = null; if (dataReader[nameof(alternativeSpellings)] is string alternativeSpellingsFromDB) { - alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_jsoNotIgnoringNull); + alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_defaultJso); } - string[] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_jsoNotIgnoringNull)!; + string[] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_defaultJso)!; return new EpwingNazekaRecord(primarySpelling, reading, alternativeSpellings, definitions); } diff --git a/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanDBManager.cs b/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanDBManager.cs index 3639d38c..c381f801 100644 --- a/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanDBManager.cs +++ b/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanDBManager.cs @@ -98,9 +98,9 @@ INSERT INTO record_search_key(record_id, search_key) _ = insertRecordCommand.Parameters["@id"].Value = id; _ = insertRecordCommand.Parameters["@primary_spelling"].Value = record.PrimarySpelling; _ = insertRecordCommand.Parameters["@reading"].Value = record.Reading is not null ? record.Reading : DBNull.Value; - _ = insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_jsoNotIgnoringNull); - _ = insertRecordCommand.Parameters["@part_of_speech"].Value = record.WordClasses is not null ? JsonSerializer.Serialize(record.WordClasses, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@glossary_tags"].Value = record.DefinitionTags is not null ? JsonSerializer.Serialize(record.DefinitionTags, Utils.s_jsoNotIgnoringNull) : DBNull.Value; + _ = insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_defaultJso); + _ = insertRecordCommand.Parameters["@part_of_speech"].Value = record.WordClasses is not null ? JsonSerializer.Serialize(record.WordClasses, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@glossary_tags"].Value = record.DefinitionTags is not null ? JsonSerializer.Serialize(record.DefinitionTags, Utils.s_defaultJso) : DBNull.Value; _ = insertRecordCommand.ExecuteNonQuery(); _ = insertSearchKeyCommand.Parameters["@record_id"].Value = id; @@ -221,7 +221,7 @@ FROM record r while (dataReader.Read()) { EpwingYomichanRecord record = GetRecord(dataReader); - string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_jsoNotIgnoringNull)!; + string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_defaultJso)!; for (int i = 0; i < searchKeys.Length; i++) { string searchKey = searchKeys[i]; @@ -255,18 +255,18 @@ private static EpwingYomichanRecord GetRecord(SqliteDataReader dataReader) reading = readingFromDB; } - string[] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_jsoNotIgnoringNull)!; + string[] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_defaultJso)!; string[]? wordClasses = null; if (dataReader[nameof(wordClasses)] is string wordClassesFromDB) { - wordClasses = JsonSerializer.Deserialize(wordClassesFromDB, Utils.s_jsoNotIgnoringNull); + wordClasses = JsonSerializer.Deserialize(wordClassesFromDB, Utils.s_defaultJso); } string[]? definitionTags = null; if (dataReader[nameof(definitionTags)] is string definitionTagsFromDB) { - definitionTags = JsonSerializer.Deserialize(definitionTagsFromDB, Utils.s_jsoNotIgnoringNull); + definitionTags = JsonSerializer.Deserialize(definitionTagsFromDB, Utils.s_defaultJso); } return new EpwingYomichanRecord(primarySpelling, reading, definitions, wordClasses, definitionTags); diff --git a/JL.Core/Dicts/JMdict/JmdictDBManager.cs b/JL.Core/Dicts/JMdict/JmdictDBManager.cs index ca3b92ab..ea4a556b 100644 --- a/JL.Core/Dicts/JMdict/JmdictDBManager.cs +++ b/JL.Core/Dicts/JMdict/JmdictDBManager.cs @@ -127,15 +127,15 @@ INSERT INTO record_search_key(record_id, search_key) insertRecordCommand.Parameters["@id"].Value = id; insertRecordCommand.Parameters["@edict_id"].Value = record.Id; insertRecordCommand.Parameters["@primary_spelling"].Value = record.PrimarySpelling; - insertRecordCommand.Parameters["@primary_spelling_orthography_info"].Value = record.PrimarySpellingOrthographyInfo is not null ? JsonSerializer.Serialize(record.PrimarySpellingOrthographyInfo, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - insertRecordCommand.Parameters["@alternative_spellings"].Value = record.AlternativeSpellings is not null ? JsonSerializer.Serialize(record.AlternativeSpellings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; + insertRecordCommand.Parameters["@primary_spelling_orthography_info"].Value = record.PrimarySpellingOrthographyInfo is not null ? JsonSerializer.Serialize(record.PrimarySpellingOrthographyInfo, Utils.s_defaultJso) : DBNull.Value; + insertRecordCommand.Parameters["@alternative_spellings"].Value = record.AlternativeSpellings is not null ? JsonSerializer.Serialize(record.AlternativeSpellings, Utils.s_defaultJso) : DBNull.Value; insertRecordCommand.Parameters["@alternative_spellings_orthography_info"].Value = record.AlternativeSpellingsOrthographyInfo is not null ? JsonSerializer.Serialize(record.AlternativeSpellingsOrthographyInfo, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - insertRecordCommand.Parameters["@readings"].Value = record.Readings is not null ? JsonSerializer.Serialize(record.Readings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; + insertRecordCommand.Parameters["@readings"].Value = record.Readings is not null ? JsonSerializer.Serialize(record.Readings, Utils.s_defaultJso) : DBNull.Value; insertRecordCommand.Parameters["@readings_orthography_info"].Value = record.ReadingsOrthographyInfo is not null ? JsonSerializer.Serialize(record.ReadingsOrthographyInfo, Utils.s_jsoNotIgnoringNull) : DBNull.Value; insertRecordCommand.Parameters["@reading_restrictions"].Value = record.ReadingRestrictions is not null ? JsonSerializer.Serialize(record.ReadingRestrictions, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_jsoNotIgnoringNull); + insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_defaultJso); insertRecordCommand.Parameters["@glossary_info"].Value = record.DefinitionInfo is not null ? JsonSerializer.Serialize(record.DefinitionInfo, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - insertRecordCommand.Parameters["@part_of_speech"].Value = JsonSerializer.Serialize(record.WordClasses, Utils.s_jsoNotIgnoringNull); + insertRecordCommand.Parameters["@part_of_speech"].Value = JsonSerializer.Serialize(record.WordClasses, Utils.s_defaultJso); insertRecordCommand.Parameters["@spelling_restrictions"].Value = record.SpellingRestrictions is not null ? JsonSerializer.Serialize(record.SpellingRestrictions, Utils.s_jsoNotIgnoringNull) : DBNull.Value; insertRecordCommand.Parameters["@fields"].Value = record.Fields is not null ? JsonSerializer.Serialize(record.Fields, Utils.s_jsoNotIgnoringNull) : DBNull.Value; insertRecordCommand.Parameters["@misc"].Value = record.Misc is not null ? JsonSerializer.Serialize(record.Misc, Utils.s_jsoNotIgnoringNull) : DBNull.Value; @@ -272,7 +272,7 @@ FROM record r { JmdictRecord record = GetRecord(dataReader); - string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_jsoNotIgnoringNull)!; + string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_defaultJso)!; for (int i = 0; i < searchKeys.Length; i++) { string searchKey = searchKeys[i]; @@ -303,7 +303,7 @@ private static JmdictRecord GetRecord(SqliteDataReader dataReader) string[]? primarySpellingOrthographyInfo = null; if (dataReader[nameof(primarySpellingOrthographyInfo)] is string primarySpellingOrthographyInfoFromDB) { - primarySpellingOrthographyInfo = JsonSerializer.Deserialize(primarySpellingOrthographyInfoFromDB, Utils.s_jsoNotIgnoringNull); + primarySpellingOrthographyInfo = JsonSerializer.Deserialize(primarySpellingOrthographyInfoFromDB, Utils.s_defaultJso); } string[]?[]? spellingRestrictions = null; @@ -315,7 +315,7 @@ private static JmdictRecord GetRecord(SqliteDataReader dataReader) string[]? alternativeSpellings = null; if (dataReader[nameof(alternativeSpellings)] is string alternativeSpellingsFromDB) { - alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_jsoNotIgnoringNull); + alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_defaultJso); } string[]?[]? alternativeSpellingsOrthographyInfo = null; @@ -327,7 +327,7 @@ private static JmdictRecord GetRecord(SqliteDataReader dataReader) string[]? readings = null; if (dataReader[nameof(readings)] is string readingsFromDB) { - readings = JsonSerializer.Deserialize(readingsFromDB, Utils.s_jsoNotIgnoringNull); + readings = JsonSerializer.Deserialize(readingsFromDB, Utils.s_defaultJso); } string[]?[]? readingRestrictions = null; @@ -342,8 +342,8 @@ private static JmdictRecord GetRecord(SqliteDataReader dataReader) readingsOrthographyInfo = JsonSerializer.Deserialize(readingsOrthographyInfoFromDB, Utils.s_jsoNotIgnoringNull); } - string[][] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_jsoNotIgnoringNull)!; - string[][] wordClasses = JsonSerializer.Deserialize(dataReader.GetString(nameof(wordClasses)), Utils.s_jsoNotIgnoringNull)!; + string[][] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_defaultJso)!; + string[][] wordClasses = JsonSerializer.Deserialize(dataReader.GetString(nameof(wordClasses)), Utils.s_defaultJso)!; string[]?[]? fields = null; if (dataReader[nameof(fields)] is string fieldsFromDB) diff --git a/JL.Core/Dicts/JMnedict/JmnedictDBManager.cs b/JL.Core/Dicts/JMnedict/JmnedictDBManager.cs index 040bab63..4761465d 100644 --- a/JL.Core/Dicts/JMnedict/JmnedictDBManager.cs +++ b/JL.Core/Dicts/JMnedict/JmnedictDBManager.cs @@ -70,10 +70,10 @@ INSERT INTO record (id, jmnedict_id, primary_spelling, primary_spelling_in_hirag _ = insertRecordCommand.Parameters["@jmnedict_id"].Value = record.Id; _ = insertRecordCommand.Parameters["@primary_spelling"].Value = record.PrimarySpelling; _ = insertRecordCommand.Parameters["@primary_spelling_in_hiragana"].Value = JapaneseUtils.KatakanaToHiragana(record.PrimarySpelling); - _ = insertRecordCommand.Parameters["@readings"].Value = record.Readings is not null ? JsonSerializer.Serialize(record.Readings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@alternative_spellings"].Value = record.AlternativeSpellings is not null ? JsonSerializer.Serialize(record.AlternativeSpellings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_jsoNotIgnoringNull); - _ = insertRecordCommand.Parameters["@name_types"].Value = JsonSerializer.Serialize(record.NameTypes, Utils.s_jsoNotIgnoringNull); + _ = insertRecordCommand.Parameters["@readings"].Value = record.Readings is not null ? JsonSerializer.Serialize(record.Readings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@alternative_spellings"].Value = record.AlternativeSpellings is not null ? JsonSerializer.Serialize(record.AlternativeSpellings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@glossary"].Value = JsonSerializer.Serialize(record.Definitions, Utils.s_defaultJso); + _ = insertRecordCommand.Parameters["@name_types"].Value = JsonSerializer.Serialize(record.NameTypes, Utils.s_defaultJso); _ = insertRecordCommand.ExecuteNonQuery(); ++id; @@ -194,17 +194,17 @@ private static JmnedictRecord GetRecord(SqliteDataReader dataReader) string[]? readings = null; if (dataReader[nameof(readings)] is string readingsFromDB) { - readings = JsonSerializer.Deserialize(readingsFromDB, Utils.s_jsoNotIgnoringNull); + readings = JsonSerializer.Deserialize(readingsFromDB, Utils.s_defaultJso); } string[]? alternativeSpellings = null; if (dataReader[nameof(alternativeSpellings)] is string alternativeSpellingsFromDB) { - alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_jsoNotIgnoringNull); + alternativeSpellings = JsonSerializer.Deserialize(alternativeSpellingsFromDB, Utils.s_defaultJso); } - string[][] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_jsoNotIgnoringNull)!; - string[][] nameTypes = JsonSerializer.Deserialize(dataReader.GetString(nameof(nameTypes)), Utils.s_jsoNotIgnoringNull)!; + string[][] definitions = JsonSerializer.Deserialize(dataReader.GetString(nameof(definitions)), Utils.s_defaultJso)!; + string[][] nameTypes = JsonSerializer.Deserialize(dataReader.GetString(nameof(nameTypes)), Utils.s_defaultJso)!; return new JmnedictRecord(id, primarySpelling, alternativeSpellings, readings, definitions, nameTypes); } diff --git a/JL.Core/Dicts/JMnedict/JmnedictRecord.cs b/JL.Core/Dicts/JMnedict/JmnedictRecord.cs index 6e529217..e7ef108d 100644 --- a/JL.Core/Dicts/JMnedict/JmnedictRecord.cs +++ b/JL.Core/Dicts/JMnedict/JmnedictRecord.cs @@ -22,7 +22,7 @@ public JmnedictRecord(int id, string primarySpelling, string[]? alternativeSpell Readings = readings; Definitions = definitions; NameTypes = nameTypes; - //RelatedTerms = new List?>(); + //RelatedTerms = relatedTerms; } public string BuildFormattedDefinition(DictOptions options) @@ -65,7 +65,7 @@ public string BuildFormattedDefinition(DictOptions options) _ = defResult.Append(CultureInfo.InvariantCulture, $"({i + 1}) "); } - // if (options.RelatedTerm!.Value) + // if (showRelatedTerms) // { // string[]? relatedTerms = RelatedTerms?[i]; // if (relatedTerms?.Length > 0) diff --git a/JL.Core/Dicts/KANJIDIC/KanjidicDBManager.cs b/JL.Core/Dicts/KANJIDIC/KanjidicDBManager.cs index 4209544b..0c683962 100644 --- a/JL.Core/Dicts/KANJIDIC/KanjidicDBManager.cs +++ b/JL.Core/Dicts/KANJIDIC/KanjidicDBManager.cs @@ -83,11 +83,11 @@ INSERT INTO record (kanji, on_readings, kun_readings, nanori_readings, radical_n { KanjidicRecord kanjidicRecord = (KanjidicRecord)record; _ = insertRecordCommand.Parameters["@kanji"].Value = kanji; - _ = insertRecordCommand.Parameters["@on_readings"].Value = kanjidicRecord.OnReadings is not null ? JsonSerializer.Serialize(kanjidicRecord.OnReadings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@kun_readings"].Value = kanjidicRecord.KunReadings is not null ? JsonSerializer.Serialize(kanjidicRecord.KunReadings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@nanori_readings"].Value = kanjidicRecord.NanoriReadings is not null ? JsonSerializer.Serialize(kanjidicRecord.NanoriReadings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@radical_names"].Value = kanjidicRecord.RadicalNames is not null ? JsonSerializer.Serialize(kanjidicRecord.RadicalNames, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@glossary"].Value = kanjidicRecord.Definitions is not null ? JsonSerializer.Serialize(kanjidicRecord.Definitions, Utils.s_jsoNotIgnoringNull) : DBNull.Value; + _ = insertRecordCommand.Parameters["@on_readings"].Value = kanjidicRecord.OnReadings is not null ? JsonSerializer.Serialize(kanjidicRecord.OnReadings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@kun_readings"].Value = kanjidicRecord.KunReadings is not null ? JsonSerializer.Serialize(kanjidicRecord.KunReadings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@nanori_readings"].Value = kanjidicRecord.NanoriReadings is not null ? JsonSerializer.Serialize(kanjidicRecord.NanoriReadings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@radical_names"].Value = kanjidicRecord.RadicalNames is not null ? JsonSerializer.Serialize(kanjidicRecord.RadicalNames, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@glossary"].Value = kanjidicRecord.Definitions is not null ? JsonSerializer.Serialize(kanjidicRecord.Definitions, Utils.s_defaultJso) : DBNull.Value; _ = insertRecordCommand.Parameters["@stroke_count"].Value = kanjidicRecord.StrokeCount; _ = insertRecordCommand.Parameters["@grade"].Value = kanjidicRecord.Grade; _ = insertRecordCommand.Parameters["@frequency"].Value = kanjidicRecord.Frequency; @@ -164,31 +164,31 @@ private static KanjidicRecord GetRecord(SqliteDataReader dataReader) string[]? onReadings = null; if (dataReader[nameof(onReadings)] is string onReadingsFromDB) { - onReadings = JsonSerializer.Deserialize(onReadingsFromDB, Utils.s_jsoNotIgnoringNull); + onReadings = JsonSerializer.Deserialize(onReadingsFromDB, Utils.s_defaultJso); } string[]? kunReadings = null; if (dataReader[nameof(kunReadings)] is string kunReadingsFromDB) { - kunReadings = JsonSerializer.Deserialize(kunReadingsFromDB, Utils.s_jsoNotIgnoringNull); + kunReadings = JsonSerializer.Deserialize(kunReadingsFromDB, Utils.s_defaultJso); } string[]? nanoriReadings = null; if (dataReader[nameof(nanoriReadings)] is string nanoriReadingsFromDB) { - nanoriReadings = JsonSerializer.Deserialize(nanoriReadingsFromDB, Utils.s_jsoNotIgnoringNull); + nanoriReadings = JsonSerializer.Deserialize(nanoriReadingsFromDB, Utils.s_defaultJso); } string[]? radicalNames = null; if (dataReader[nameof(radicalNames)] is string radicalNamesFromDB) { - radicalNames = JsonSerializer.Deserialize(radicalNamesFromDB, Utils.s_jsoNotIgnoringNull); + radicalNames = JsonSerializer.Deserialize(radicalNamesFromDB, Utils.s_defaultJso); } string[]? definitions = null; if (dataReader[nameof(definitions)] is string definitionsFromDB) { - definitions = JsonSerializer.Deserialize(definitionsFromDB, Utils.s_jsoNotIgnoringNull); + definitions = JsonSerializer.Deserialize(definitionsFromDB, Utils.s_defaultJso); } byte strokeCount = dataReader.GetByte(nameof(strokeCount)); diff --git a/JL.Core/Dicts/KanjiDict/YomichanKanjiDBManager.cs b/JL.Core/Dicts/KanjiDict/YomichanKanjiDBManager.cs index ab99a9fa..bd40d651 100644 --- a/JL.Core/Dicts/KanjiDict/YomichanKanjiDBManager.cs +++ b/JL.Core/Dicts/KanjiDict/YomichanKanjiDBManager.cs @@ -76,10 +76,10 @@ INSERT INTO record (id, kanji, on_readings, kun_readings, glossary, stats) YomichanKanjiRecord yomichanKanjiRecord = (YomichanKanjiRecord)record; _ = insertRecordCommand.Parameters["@id"].Value = id; _ = insertRecordCommand.Parameters["@kanji"].Value = kanji; - _ = insertRecordCommand.Parameters["@on_readings"].Value = yomichanKanjiRecord.OnReadings is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.OnReadings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@kun_readings"].Value = yomichanKanjiRecord.KunReadings is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.KunReadings, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@glossary"].Value = yomichanKanjiRecord.Definitions is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.Definitions, Utils.s_jsoNotIgnoringNull) : DBNull.Value; - _ = insertRecordCommand.Parameters["@stats"].Value = yomichanKanjiRecord.Stats is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.Stats, Utils.s_jsoNotIgnoringNull) : DBNull.Value; + _ = insertRecordCommand.Parameters["@on_readings"].Value = yomichanKanjiRecord.OnReadings is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.OnReadings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@kun_readings"].Value = yomichanKanjiRecord.KunReadings is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.KunReadings, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@glossary"].Value = yomichanKanjiRecord.Definitions is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.Definitions, Utils.s_defaultJso) : DBNull.Value; + _ = insertRecordCommand.Parameters["@stats"].Value = yomichanKanjiRecord.Stats is not null ? JsonSerializer.Serialize(yomichanKanjiRecord.Stats, Utils.s_defaultJso) : DBNull.Value; _ = insertRecordCommand.ExecuteNonQuery(); ++id; @@ -168,25 +168,25 @@ private static YomichanKanjiRecord GetRecord(SqliteDataReader dataReader) string[]? onReadings = null; if (dataReader[nameof(onReadings)] is string onReadingsFromDB) { - onReadings = JsonSerializer.Deserialize(onReadingsFromDB, Utils.s_jsoNotIgnoringNull); + onReadings = JsonSerializer.Deserialize(onReadingsFromDB, Utils.s_defaultJso); } string[]? kunReadings = null; if (dataReader[nameof(kunReadings)] is string kunReadingsFromDB) { - kunReadings = JsonSerializer.Deserialize(kunReadingsFromDB, Utils.s_jsoNotIgnoringNull); + kunReadings = JsonSerializer.Deserialize(kunReadingsFromDB, Utils.s_defaultJso); } string[]? definitions = null; if (dataReader[nameof(definitions)] is string definitionsFromDB) { - definitions = JsonSerializer.Deserialize(definitionsFromDB, Utils.s_jsoNotIgnoringNull); + definitions = JsonSerializer.Deserialize(definitionsFromDB, Utils.s_defaultJso); } string[]? stats = null; if (dataReader[nameof(stats)] is string statsFromDB) { - stats = JsonSerializer.Deserialize(statsFromDB, Utils.s_jsoNotIgnoringNull); + stats = JsonSerializer.Deserialize(statsFromDB, Utils.s_defaultJso); } return new YomichanKanjiRecord(onReadings, kunReadings, definitions, stats); diff --git a/JL.Core/Dicts/PitchAccent/YomichanPitchAccentDBManager.cs b/JL.Core/Dicts/PitchAccent/YomichanPitchAccentDBManager.cs index 03aa58ed..adb49cc4 100644 --- a/JL.Core/Dicts/PitchAccent/YomichanPitchAccentDBManager.cs +++ b/JL.Core/Dicts/PitchAccent/YomichanPitchAccentDBManager.cs @@ -241,7 +241,7 @@ FROM record r while (dataReader.Read()) { PitchAccentRecord record = GetRecord(dataReader); - string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_jsoNotIgnoringNull)!; + string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_defaultJso)!; for (int i = 0; i < searchKeys.Length; i++) { string searchKey = searchKeys[i]; diff --git a/JL.Core/Freqs/FreqDBManager.cs b/JL.Core/Freqs/FreqDBManager.cs index 2e0276d3..94be20d1 100644 --- a/JL.Core/Freqs/FreqDBManager.cs +++ b/JL.Core/Freqs/FreqDBManager.cs @@ -227,7 +227,7 @@ FROM record r { FrequencyRecord record = GetRecord(dataReader); - string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_jsoNotIgnoringNull)!; + string[] searchKeys = JsonSerializer.Deserialize(dataReader.GetString(nameof(searchKeys)), Utils.s_defaultJso)!; for (int i = 0; i < searchKeys.Length; i++) { string searchKey = searchKeys[i];