Ejemplo n.º 1
0
 public void Run(string[] args)
 {
     _argumentsResolver.ResolveArgs(args);
     _uncompressedFileReader.ReadFile(_argumentsResolver.InputFile, _argumentsResolver.JobType);
     _blockCompressor.Compress(_argumentsResolver.JobType);
     _fileWriter.WriteFile(_argumentsResolver.OutputFile);
 }
Ejemplo n.º 2
0
        public void Run(CommandLineArguments args)
        {
            switch (args.Operation)
            {
            case ImageOperation.Compress:
            {
                CheckIfFilesExist(args.BMPFileName, args.DDSFileName, args.Overwrite);

                var inputImage  = _fileSystem.LoadBitmap(args.BMPFileName);
                var outputImage = _blockCompressor.Compress(inputImage, args.Format);

                outputImage.Save(args.DDSFileName);
                break;
            }

            case ImageOperation.Decompress:
            {
                CheckIfFilesExist(args.DDSFileName, args.BMPFileName, args.Overwrite);

                var inputImage  = _fileSystem.LoadDDS(args.DDSFileName);
                var outputImage = _blockCompressor.Decompress(inputImage);

                outputImage.Save(args.BMPFileName);
                break;
            }

            default:
                throw new ArgumentException($"Unsupported command line action: {args.Operation}");
            }
        }