public static SettingInfo SetOption() { var setting = new SettingInfo(); Console.WriteLine("�g�p���郂�[�h����͂��Ă�������"); Console.WriteLine(" -txt\t\t�w�肳�ꂽ�摜��HTML�ŕ\�����܂��B\r\n -aa\t\t�w�肳�ꂽ�摜����AA�����܂��B\r\n -movie\t\t�w�肳�ꂽ�摜����AA��������܂��B"); switch (ExRead("^(-txt|-aa|-movie)$")) { case "-txt": setting.Mode = SettingInfo.ConvertMode.HtmlArt; break; case "-aa": setting.Mode = SettingInfo.ConvertMode.AsciiArt; break; case "-movie": setting.Mode = SettingInfo.ConvertMode.Movie; break; } Console.WriteLine("���摜�̃T�C�Y��k�����܂��B�k���x���𐮐��œ��͂��Ă��������B"); setting.Size = int.Parse(ExRead("^[0-9]+$")); Console.WriteLine("�ۑ����w�肵�Ă��������B"); Console.WriteLine(" ���܂�:-desktop�Ɠ��͂��Ă����ƃf�X�N�g�b�v�ɕۑ�����܂��B"); string input = ExRead(@"^[a-z]:\\.+|-desktop"); setting.Path = new System.IO.DirectoryInfo( input == "-desktop" ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : input ); switch (setting.Mode) { case ConvertMode.HtmlArt: Console.WriteLine("�摜�̕\���Ɏg�p���镶����w�肵�Ă��������B"); setting.Chars = ExRead(".+"); break; case ConvertMode.AsciiArt | ConvertMode.Movie: Console.WriteLine("�K����\�����镶����w�肵�Ă��������B"); Console.WriteLine(" (-default�Ɠ��͂���Ƃ��炩���ߗp�ӂ��ꂽ�����g���܂��B)"); string AA_String = ExRead(".*|-default"); setting.Chars = AA_String == "-default" ? null : AA_String; break; } return setting; }
public void ConvertAsciiArt(string[] CommandLine, SettingInfo setting) { IOutput output; for (int i = 0; i < CommandLine.Length; i++) { Console.WriteLine("\r\n" + System.IO.Path.GetFileName(CommandLine[i])); var imageNameWithoutEx = System.IO.Path.GetFileNameWithoutExtension(CommandLine[i]); var outputFileInfo = new System.IO.FileInfo(setting.Path.FullName + "\\" + imageNameWithoutEx + ".htm"); Bitmap bmp;//����������ʓ|�Ȃ̂œ������B switch (setting.Mode) { case SettingInfo.ConvertMode.HtmlArt: if (!System.IO.File.Exists(CommandLine[i])) { Console.WriteLine("�w�肳�ꂽ�t�@�C�������݂��܂���ł����B\r\n" + CommandLine[i]); continue; } bmp = new Bitmap(CommandLine[i]); output = new Output_txt(bmp, setting.Chars); break; case SettingInfo.ConvertMode.AsciiArt: if (!System.IO.File.Exists(CommandLine[i])) { Console.WriteLine("�w�肳�ꂽ�t�@�C�������݂��܂���ł����B\r\n" + CommandLine[i]); continue; } bmp = new Bitmap(CommandLine[i]); output = new Output_aa(bmp, setting.Chars); break; case SettingInfo.ConvertMode.Movie: if (!System.IO.Directory.Exists(CommandLine[i])) { Console.WriteLine("�w�肳�ꂽ�p�X�̓t�H���_�Ƃ��ĔF������܂���ł����B\r\n" + CommandLine[i]); continue; } output = new Output_movie(new System.IO.DirectoryInfo(CommandLine[i]), setting.Chars); break; default: Console.WriteLine("�\�z�O�̏�Ԃ��������܂����B�摜�̏�����X�L�b�v���܂��B"); continue; } output.ReducingImage += output_Reducting; output.CreatingHtml += output_CreateHtml; output.Convert(outputFileInfo, setting.Size); Console.WriteLine("[�������� : {0}]", imageNameWithoutEx + ".htm"); } }