Read() public method

public Read ( ) : Resource
return Resource
Ejemplo n.º 1
0
        public static Resource LoadResource(string inputPath, ResourceFormat format)
        {
            var file = new FileStream(inputPath, FileMode.Open, FileAccess.Read);

            switch (format)
            {
            case ResourceFormat.LSX:
            {
                using (var reader = new LSXReader(file))
                {
                    return(reader.Read());
                }
            }

            case ResourceFormat.LSB:
            {
                using (var reader = new LSBReader(file))
                {
                    return(reader.Read());
                }
            }

            case ResourceFormat.LSF:
            {
                using (var reader = new LSFReader(file))
                {
                    return(reader.Read());
                }
            }

            default:
                throw new ArgumentException("Invalid resource format");
            }
        }
Ejemplo n.º 2
0
        public static Resource LoadResource(Stream stream, ResourceFormat format)
        {
            switch (format)
            {
            case ResourceFormat.LSX:
            {
                using (var reader = new LSXReader(stream))
                {
                    return(reader.Read());
                }
            }

            case ResourceFormat.LSB:
            {
                using (var reader = new LSBReader(stream))
                {
                    return(reader.Read());
                }
            }

            case ResourceFormat.LSF:
            {
                using (var reader = new LSFReader(stream))
                {
                    return(reader.Read());
                }
            }

            case ResourceFormat.LSJ:
            {
                using (var reader = new LSJReader(stream))
                {
                    return(reader.Read());
                }
            }

            default:
                throw new ArgumentException("Invalid resource format");
            }
        }