public static FileMetadata FromCurrentSettings(FileType type) { FileMetadata fileMetadatum = new FileMetadata() { Type = type, Revision = 0, }; return fileMetadatum; }
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; }
public static FileMetadata Read(BinaryReader reader, FileType expectedType) { FileMetadata fileMetadatum = new FileMetadata(); fileMetadatum.Read(reader); if (fileMetadatum.Type != expectedType) { string[] name = new string[] { "Expected type \"", Enum.GetName(typeof(FileType), expectedType), "\" but found \"", Enum.GetName(typeof(FileType), fileMetadatum.Type), "\"." }; throw new Exception("FileFormatException: " + string.Concat(name)); } return fileMetadatum; }