Exemplo n.º 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.Font:
         return(FontIO.Load(reader));
     }
     throw new ArgumentException($"Given content type {type} cannot be loaded; no loader is specified. Is the archive corrupted?");
 }
Exemplo n.º 2
0
 public static void Save(IContent content, BinaryWriter writer)
 {
     switch (content.ContentType)
     {
     case ContentType.Font:
         FontIO.Save((FontContent)content, writer);
         return;
     }
     throw new ArgumentException("Given content type cannot be saved; no archiver is specified.");
 }
Exemplo n.º 3
0
        public static void Save(IContent content, BinaryWriter writer)
        {
            switch (content.ContentType)
            {
            case ContentType.Font:
                FontIO.Save((FontContent)content, writer);
                return;

            case ContentType.Mesh:
                MeshIO.Save((MeshContent)content, writer);
                return;

            case ContentType.Image:
                Texture2DIO.Save((Texture2DContent)content, writer);
                return;

            case ContentType.GLSL:
                GLSLIO.Save((GLSLContent)content, writer);
                return;
            }
            throw new ArgumentException("Given content type cannot be saved; no archiver is specified.");
        }