コード例 #1
0
 //We have a very limited set of content types. This isn't a general purpose engine. Rather than having a dictionary of type->loader or something, we can do a quick hack.
 public static IContent Load(ContentType type, BinaryReader reader)
 {
     switch (type)
     {
     case ContentType.Mesh:
         return(MeshIO.Load(reader));
     }
     throw new ArgumentException($"Given content type {type} cannot be loaded; no loader is specified. Is the archive corrupted?");
 }
コード例 #2
0
 public static void Save(IContent content, BinaryWriter writer)
 {
     switch (content.ContentType)
     {
     case ContentType.Mesh:
         MeshIO.Save((MeshContent)content, writer);
         return;
     }
     throw new ArgumentException("Given content type cannot be saved; no archiver is specified.");
 }