Exemple #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");
            }
        }
Exemple #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");
            }
        }