Ejemplo n.º 1
0
 public static FileMetadata FromCurrentSettings(FileType type)
 {
     FileMetadata fileMetadatum = new FileMetadata()
     {
         Type = type,
         Revision = 0,
     };
     return fileMetadatum;
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
 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;
 }