public void AllMethods( Program.Method method, string sourceFileSuffix, string destinationFileSuffix, bool crop = false, Program.Method?decodeMethod = null, Program.LZCompressionDictionary?compDic = null, GrayScaleColors?colors = null) { var sourcePath = Common.GetSourcePath(); var destinationPath = Common.GetDestinationPath(); _allMethods(method, sourcePath, sourceFileSuffix, destinationPath, destinationFileSuffix, crop, compDic, colors); if (decodeMethod.HasValue) { _allMethods(decodeMethod.Value, destinationPath, destinationFileSuffix, destinationPath, destinationFileSuffix + "-decoded.bmp", false, compDic, colors); } }
private void _allMethods( Program.Method method, string sourcePath, string sourceFileSuffix, string destinationPath, string destinationFileSuffix, bool crop = false, Program.LZCompressionDictionary?compDic = null, GrayScaleColors?colors = null ) { var args = new List <string> { "--source-path", sourcePath, "--source-file-suffix", sourceFileSuffix, "--destination-path", destinationPath, "--destination-file-suffix", destinationFileSuffix, "--start-index", "1", "--count", "1", "--method", method.ToString() }; if (compDic.HasValue) { args.AddRange(new[] { "--lz-compression-dictionary", compDic.Value.ToString() }); switch (compDic.Value) { case Program.LZCompressionDictionary.HashTable: args.AddRange(new[] { "--lz-compression-hash-table-prime", "12289" }); break; case Program.LZCompressionDictionary.Trie: args.AddRange(new[] { "--lz-compression-trie-initial-capacity", "1" }); break; case Program.LZCompressionDictionary.Trie256: break; default: throw new ArgumentException(); } } if (colors.HasValue) { args.AddRange(new[] { "--gray-scale-colors", colors.Value.ToString() }); } switch (method) { case Program.Method.AsGrayScale: case Program.Method.AsGrayScaleAsHuffmanEncoded: case Program.Method.AsLZ78Encoded: case Program.Method.AsGrayScaleAsLZ78Encoded: case Program.Method.AsGZipEncoded: case Program.Method.AsGrayScaleAsGZipEncoded: if (crop) { args.AddRange(new string[] { "--crop-left-px", _cropSetupCorrect.LeftPx.ToString(), "--crop-right-px", _cropSetupCorrect.RightPx.ToString(), "--crop-top-px", _cropSetupCorrect.TopPx.ToString(), "--crop-bottom-px", _cropSetupCorrect.BottomPx.ToString() }); } break; case Program.Method.AsGrayScaleAsHuffmanDecoded: case Program.Method.AsLZ78Decoded: case Program.Method.AsGZipDecoded: case Program.Method.AsGrayScaleAsLZ78Decoded: break; default: throw new ArgumentException(); } var ret = Program.Main(args.ToArray()); Assert.True(ret == 0); }