Terraria.IO.FileMetadata.Read C# (CSharp) Method

Read() public static method

public static Read ( BinaryReader reader, System.IO.FileType expectedType ) : FileMetadata
reader System.IO.BinaryReader
expectedType System.IO.FileType
return FileMetadata
        public static FileMetadata Read(BinaryReader reader, FileType expectedType)
        {
            FileMetadata fileMetadata = new FileMetadata();
            fileMetadata.Read(reader);
            if (fileMetadata.Type != expectedType)
                throw new Exception("Expected type \"" + Enum.GetName(typeof(FileType), expectedType) + "\" but found \"" + Enum.GetName(typeof(FileType), fileMetadata.Type) + "\".");

            return fileMetadata;
        }

Same methods

FileMetadata::Read ( BinaryReader reader ) : void

Usage Example

Ejemplo n.º 1
0
 public static FileMetadata Read(BinaryReader reader, FileType expectedType)
 {
   FileMetadata fileMetadata = new FileMetadata();
   fileMetadata.Read(reader);
   if (fileMetadata.Type != expectedType)
     throw new FileFormatException("Expected type \"" + Enum.GetName(typeof (FileType), (object) expectedType) + "\" but found \"" + Enum.GetName(typeof (FileType), (object) fileMetadata.Type) + "\".");
   return fileMetadata;
 }
All Usage Examples Of Terraria.IO.FileMetadata::Read