public void TestPlugins <T>(object sender) where T : IEncoderPlugin
        {
            PluginsManager <T> pluginManager = new PluginsManager <T>();

            pluginManager.LoadPlugins("D:\\OOPBasics");

            List <T> plugins = (List <T>)pluginManager.Plugins;

            int pluginIndex = 0;

            foreach (var currentPlugin in plugins)
            {
                Console.WriteLine(pluginIndex++ + ". " + currentPlugin.GetName());
            }

            string input = Console.ReadLine();

            if (Int32.TryParse(input, out int selectedEncoder) && selectedEncoder < plugins.Count)
            {
                IEncoder algorithmEncoder = null;

                IEnumerable <String> encoderParameters = plugins[selectedEncoder].GetRequiredArguments();
                if (encoderParameters != null)
                {
                    IDictionary <string, string> parametersDictionary = new Dictionary <string, string>();
                    foreach (var parameter in encoderParameters)
                    {
                        Console.WriteLine("Please insert value for " + parameter);
                        String parameterInput = Console.ReadLine();
                        parametersDictionary[parameter] = parameterInput;
                    }

                    plugins[selectedEncoder].SetArguments(parametersDictionary);
                    algorithmEncoder = plugins[selectedEncoder].GetEncoder();
                }
                else
                {
                    algorithmEncoder = plugins[selectedEncoder].GetEncoder();
                }

                TextEncoder textEncoder = new TextEncoder(algorithmEncoder);

                TextReader textReader = GetInputTextReader(pathToReadEncode);

                StreamEncoder streamEncoder = new StreamEncoder(textEncoder, textReader);

                BinaryWriter binaryWriter = GetOutputBinaryWriter(pathToWriteEncode);

                streamEncoder.Encode(binaryWriter);

                textReader.Close();
                binaryWriter.Close();

                Console.WriteLine("File modified.");
            }
            else
            {
                Console.WriteLine("Invalid algorithm index given.");
            }
        }
        public void EncodeAction(object sender, object contextObject)
        {
            IEncoderPlugin encoderPlugin = (IEncoderPlugin)contextObject;

            HandlePluginParameters(encoderPlugin);
            IEncoder encoder = encoderPlugin.GetEncoder();

            TextEncoder   textEncoder   = new TextEncoder(encoder);
            TextReader    textReader    = GetInputTextReader(pathToReadEncode);
            StreamEncoder streamEncoder = new StreamEncoder(textEncoder, textReader);
            BinaryWriter  binaryWriter  = GetOutputBinaryWriter(pathToWriteEncode);

            streamEncoder.Encode(binaryWriter);

            textReader.Close();
            binaryWriter.Close();

            Console.WriteLine("File modified. Press any key to continue.");
            Console.ReadLine();
        }