Ejemplo n.º 1
0
            protected int OnExecute(CommandLineApplication app)
            {
                OutputImz = OutputImz ?? Path.GetFullPath(Path.GetFileName(Path.ChangeExtension(InputFile.First(), ".imz")));

                Directory.CreateDirectory(Path.GetDirectoryName(OutputImz));

                var prependImgdList = (Append && File.Exists(OutputImz))
                    ? File.OpenRead(OutputImz).Using(stream => Imgz.Read(stream).ToArray())
                    : new Imgd[0];

                var buffer = new MemoryStream();

                Imgz.Write(
                    buffer,
                    prependImgdList
                    .Concat(
                        InputFile
                        .SelectMany(imdFile => ImgdBitmapUtil.FromFileToImgdList(imdFile, BitsPerPixel, QuantizerFactory.MakeFrom(this)))
                        )
                    .ToArray()
                    );
                File.WriteAllBytes(OutputImz, buffer.ToArray());

                return(0);
            }