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

◆ GetFileMetadata()

static FileMetadata Terraria.IO.WorldFile.GetFileMetadata ( string file,
bool cloudSave )
inlinestatic

Definition at line 3064 of file WorldFile.cs.

3065 {
3066 if (file == null)
3067 {
3068 return null;
3069 }
3070 try
3071 {
3072 byte[] buffer = null;
3073 int num;
3074 if (cloudSave)
3075 {
3076 num = ((SocialAPI.Cloud != null) ? 1 : 0);
3077 if (num != 0)
3078 {
3079 int num2 = 24;
3080 buffer = new byte[num2];
3081 SocialAPI.Cloud.Read(file, buffer, num2);
3082 }
3083 }
3084 else
3085 {
3086 num = 0;
3087 }
3088 using Stream input = ((num != 0) ? ((Stream)new MemoryStream(buffer)) : ((Stream)new FileStream(file, FileMode.Open)));
3090 if (binaryReader.ReadInt32() >= 135)
3091 {
3092 return FileMetadata.Read(binaryReader, FileType.World);
3093 }
3094 return FileMetadata.FromCurrentSettings(FileType.World);
3095 }
3096 catch
3097 {
3098 }
3099 return null;
3100 }
static Terraria.Social.Base.CloudSocialModule Cloud
Definition SocialAPI.cs:18

References System.buffer, Terraria.Social.SocialAPI.Cloud, Terraria.IO.FileMetadata.FromCurrentSettings(), System.input, and Terraria.IO.FileMetadata.Read().

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