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

◆ CreatePacksFromSavedJson()

static void Terraria.IO.ResourcePackList.CreatePacksFromSavedJson ( JArray serializedState,
IServiceProvider services,
string searchPath,
List< ResourcePack > resourcePacks )
inlinestaticprivate

Definition at line 88 of file ResourcePackList.cs.

89 {
90 foreach (ResourcePackEntry item2 in CreatePackEntryListFromJson(serializedState))
91 {
92 if (item2.FileName == null)
93 {
94 continue;
95 }
96 string text = Path.Combine(searchPath, item2.FileName);
97 try
98 {
99 bool flag = File.Exists(text) || Directory.Exists(text);
100 ResourcePack.BrandingType branding = ResourcePack.BrandingType.None;
101 if (!flag && SocialAPI.Workshop != null && SocialAPI.Workshop.TryGetPath(item2.FileName, out var fullPathFound))
102 {
104 flag = true;
105 branding = SocialAPI.Workshop.Branding.ResourcePackBrand;
106 }
107 if (flag)
108 {
109 ResourcePack item = new ResourcePack(services, text, branding)
110 {
111 IsEnabled = item2.Enabled,
112 SortingOrder = item2.SortingOrder
113 };
115 }
116 }
117 catch (Exception arg)
118 {
119 Console.WriteLine("Failed to read resource pack {0}: {1}", text, arg);
120 }
121 }
122 }
void Add(TKey key, TValue value)
static void WriteLine()
Definition Console.cs:733
static bool Exists([NotNullWhen(true)] string? path)
Definition Directory.cs:43
static bool Exists([NotNullWhen(true)] string? path)
Definition File.cs:97
static string Combine(string path1, string path2)
Definition Path.cs:304
static IEnumerable< ResourcePackEntry > CreatePackEntryListFromJson(JArray serializedState)
static Terraria.Social.Base.WorkshopSocialModule Workshop
Definition SocialAPI.cs:24

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.IO.Path.Combine(), Terraria.IO.ResourcePackList.CreatePackEntryListFromJson(), System.IO.Directory.Exists(), System.IO.File.Exists(), System.item, System.text, Terraria.Social.SocialAPI.Workshop, and System.Console.WriteLine().

Referenced by Terraria.IO.ResourcePackList.FromJson().