示例#1
0
        public void Execute()
        {
            if (_help)
            {
                _optionSet.WriteOptionDescriptions(Console.Out);
                return;
            }

            using (var fileStream = File.Open(_imagePath, FileMode.Open))
            {
                stenographer = new Stenographer(fileStream, Console.Out);
                if (!stenographer.Readable())
                {
                    Console.WriteLine("Error: image format not readable");
                    return;
                }
            }

            ICommand command = null;

            switch (_mode)
            {
            case Mode.Read:
                command = new Read(_imagePath, _outputPath, _secretKey, _ultraSecret);
                break;

            case Mode.Write:
                command = new Write(_imagePath, _outputPath, _secretDataPath, _secretKey, _ultraSecret);
                break;

            case Mode.Info:
                break;
            }
            command.Execute();
        }