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

◆ ReadWorldHeader()

static void Terraria.ModLoader.IO.WorldIO.ReadWorldHeader ( WorldFileData data)
inlinestaticpackage

Definition at line 733 of file WorldIO.cs.

734 {
735 string path = Path.ChangeExtension(data.Path, ".twld");
736 bool isCloudSave = data.IsCloudSave;
737 if (!FileUtilities.Exists(path, isCloudSave))
738 {
739 return;
740 }
741 try
742 {
743 using Stream stream = (isCloudSave ? ((Stream)new MemoryStream(SocialAPI.Cloud.Read(path))) : ((Stream)new FileStream(path, FileMode.Open)));
744 using BinaryReader reader = new BigEndianReader(new GZipStream(stream, CompressionMode.Decompress));
745 if (reader.ReadByte() != 10)
746 {
747 throw new IOException("Root tag not a TagCompound");
748 }
749 TagIO.ReadTagImpl(8, reader);
750 if (reader.ReadByte() == 10 && !((string)TagIO.ReadTagImpl(8, reader) != "0header"))
751 {
752 LoadWorldHeader(data, (TagCompound)TagIO.ReadTagImpl(10, reader));
753 }
754 }
755 catch (Exception ex)
756 {
757 Logging.tML.Warn((object)$"Error reading .twld header from: {path} (IsCloudSave={isCloudSave})", ex);
758 }
759 }
static void LoadWorldHeader(WorldFileData data, TagCompound tag)
Definition WorldIO.cs:761
static Terraria.Social.Base.CloudSocialModule Cloud
Definition SocialAPI.cs:20
static bool Exists(string path, bool cloud)

References Terraria.Social.SocialAPI.Cloud, Terraria.Utilities.FileUtilities.Exists(), Terraria.IO.FileData.IsCloudSave, Terraria.ModLoader.IO.WorldIO.LoadWorldHeader(), Terraria.IO.FileData.Path, Terraria.ModLoader.IO.TagIO.ReadTagImpl(), and Terraria.ModLoader.Logging.tML.

Referenced by Terraria.IO.WorldFile.GetAllMetadata().

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