TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ AddEntryToHJSON()

static void Terraria.ModLoader.LocalizationLoader.AddEntryToHJSON ( LocalizationFile file,
string key,
string value,
string comment = null )
inlinestaticpackage

Definition at line 756 of file LocalizationLoader.cs.

757 {
758 int index = 0;
759 string[] splitKey = key.Split(".");
760 for (int i = 0; i < splitKey.Length - 1; i++)
761 {
762 _ = splitKey[i];
763 string partialKey = string.Join(".", splitKey.Take(i + 1));
764 int newIndex = file.Entries.FindLastIndex((LocalizationEntry x) => x.key.StartsWith(partialKey));
765 if (newIndex != -1)
766 {
767 index = newIndex;
768 }
769 }
770 int placementIndex = ((file.Entries.Count > 0) ? (index + 1) : 0);
771 file.Entries.Insert(placementIndex, new LocalizationEntry(key, value, comment, (JsonType)0));
772 }
record LocalizationEntry(string key, string value, string comment, JsonType type=0)

References Terraria.ModLoader.LocalizationLoader.LocalizationEntry().

Referenced by Terraria.ModLoader.LocalizationLoader.UpdateLocalizationFilesForMod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: