Inheritance: IDisposable
コード例 #1
0
ファイル: ResourceUtils.cs プロジェクト: Rykarix/lslib
        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");
            }
        }