コード例 #1
0
        public PostfixCalculatorCreator(IRecognizer recognizer,
                                        WayToGetOperation wayToGet,
                                        IPluginReader pluginReader = null)
        {
            this.recognizer   = recognizer;
            this.pluginReader = pluginReader;
            if (pluginReader != null)
            {
                this.pluginReader = pluginReader;
            }

            operations = new List <IOperation>();

            GetOperationsFromWay(wayToGet);
        }
コード例 #2
0
        private void GetOperationsFromWay(WayToGetOperation wayToGetOperation)
        {
            switch (wayToGetOperation)
            {
            case WayToGetOperation.Internal:
                operations = GetAllOperations();
                break;

            case WayToGetOperation.External:
                if (pluginReader != null)
                {
                    operations = pluginReader
                                 .ReadPluginsFrom(Environment.CurrentDirectory + "\\Plugins");
                }
                else
                {
                    throw new ArgumentNullException("PluginReader instance is null");
                }
                break;
            }
        }