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

◆ CreatePacksFromWorkshopFolders()

static void Terraria.IO.ResourcePackList.CreatePacksFromWorkshopFolders ( IServiceProvider services,
List< ResourcePack > resourcePacks )
inlinestaticprivate

Definition at line 164 of file ResourcePackList.cs.

165 {
167 if (workshop == null)
168 {
169 return;
170 }
171 List<string> listOfSubscribedResourcePackPaths = workshop.GetListOfSubscribedResourcePackPaths();
172 ResourcePack.BrandingType resourcePackBrand = workshop.Branding.ResourcePackBrand;
173 foreach (string item in listOfSubscribedResourcePackPaths)
174 {
175 try
176 {
178 if (resourcePacks.All((ResourcePack pack) => pack.FileName != folderName))
179 {
180 resourcePacks.Add(new ResourcePack(services, item, resourcePackBrand));
181 }
182 }
183 catch (Exception arg)
184 {
185 Console.WriteLine("Failed to read resource pack {0}: {1}", item, arg);
186 }
187 }
188 }
void Add(TKey key, TValue value)
static void WriteLine()
Definition Console.cs:733
static ? string GetFileName(string? path)
Definition Path.cs:200
IEnumerable< ResourcePack > pack.pack.pack.FileName select pack
static Terraria.Social.Base.WorkshopSocialModule Workshop
Definition SocialAPI.cs:24

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.IO.Path.GetFileName(), System.item, Terraria.IO.ResourcePackList.pack, Terraria.Social.SocialAPI.Workshop, and System.Console.WriteLine().

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