示例#1
0
 public ServiceInterfaceInjectorFactory(
     IStringUtilService stringUtilService,
     ICSharpParserService cSharpParserService,
     IServiceCommandParserService serviceCommandParserService)
 {
     _stringUtilService           = stringUtilService;
     _cSharpParserService         = cSharpParserService;
     _serviceCommandParserService = serviceCommandParserService;
 }
        public ServiceClassInjector(
            IStringUtilService stringUtilService,
            ICSharpParserService cSharpParserService,
            IServiceCommandParserService serviceCommandParserService,
            BufferedTokenStream tokenStream,
            string serviceClassInterfaceName,
            ServiceFile serviceFile,
            string tabString = null)
        {
            _stringUtilService           = stringUtilService;
            _cSharpParserService         = cSharpParserService;
            _serviceCommandParserService = serviceCommandParserService;
            Tokens   = tokenStream;
            Rewriter = new TokenStreamRewriter(tokenStream);
            _serviceClassInterfaceName = serviceClassInterfaceName;
            _serviceFile      = serviceFile;
            _tabString        = tabString;
            _currentNamespace = new Stack <string>();
            _currentClass     = new Stack <string>();
            _isCorrectClass   = new Stack <bool>();
            _isCorrectClass.Push(false);
            _hasServiceNamespace   = false;
            _hasServiceClass       = false;
            _hasServiceConstructor = false;
            IsModified             = false;

            _usingSet = _serviceFile.UsingDirectives.ToHashSet();

            _ctorParamDict = new Dictionary <string, FixedParameter>();
            foreach (var fixedParam in
                     _serviceFile.ServiceDeclaration.Body.ConstructorDeclaration.FormalParameterList.FixedParameters)
            {
                _ctorParamDict.Add($"{fixedParam.Type} {fixedParam.Identifier}", fixedParam);
            }

            _fieldDict = new Dictionary <string, FieldDeclaration>();
            foreach (var fieldDec in _serviceFile.ServiceDeclaration.Body.FieldDeclarations)
            {
                _fieldDict.Add($"{fieldDec.Type} {fieldDec?.VariableDeclarator?.Identifier}", fieldDec);
            }

            _ctorAssignmentDict = new Dictionary <string, SimpleAssignment>();
            var statements = _serviceFile.ServiceDeclaration?.Body?.ConstructorDeclaration?.Body?.Statements;

            if (statements != null)
            {
                foreach (var statement in statements)
                {
                    if (statement.SimpleAssignment != null)
                    {
                        var sa = statement.SimpleAssignment;
                        _ctorAssignmentDict.Add($"{sa.LeftHandSide}={sa.RightHandSide};", sa);
                    }
                }
            }
        }
 public ServiceCommandController(
     ILogger <MvcPodiumController> logger,
     IOptions <ProjectEnvironment> projectEnvironment,
     IOptions <UserSettings> userSettings,
     IIoUtilService ioUtilService,
     IServiceCommandService serviceCommandService,
     ICSharpCommonStgService cSharpCommonStgService,
     IServiceCommandStgService serviceCommandStgService,
     IServiceCommandParserService serviceCommandParserService)
 {
     _logger                      = logger;
     _projectEnvironment          = projectEnvironment;
     _userSettings                = userSettings;
     _ioUtilService               = ioUtilService;
     _serviceCommandService       = serviceCommandService;
     _cSharpCommonStgService      = cSharpCommonStgService;
     _serviceCommandStgService    = serviceCommandStgService;
     _serviceCommandParserService = serviceCommandParserService;
 }
 public ServiceCommandService(
     IServiceCommandStgService serviceCommandStgService,
     IServiceCommandParserService serviceCommandParserService,
     IServiceInterfaceScraperFactory serviceInterfaceScraperFactory,
     IServiceClassScraperFactory serviceClassScraperFactory,
     IServiceInterfaceInjectorFactory serviceInterfaceInjectorFactory,
     IServiceClassInjectorFactory serviceClassInjectorFactory,
     IServiceStartupRegistrationFactory serviceStartupRegistrationFactory,
     IServiceConstructorInjectorFactory serviceConstructorInjectorFactory)
 {
     _serviceCommandStgService          = serviceCommandStgService;
     _serviceCommandParserService       = serviceCommandParserService;
     _serviceInterfaceScraperFactory    = serviceInterfaceScraperFactory;
     _serviceClassScraperFactory        = serviceClassScraperFactory;
     _serviceInterfaceInjectorFactory   = serviceInterfaceInjectorFactory;
     _serviceClassInjectorFactory       = serviceClassInjectorFactory;
     _serviceStartupRegistrationFactory = serviceStartupRegistrationFactory;
     _serviceConstructorInjectorFactory = serviceConstructorInjectorFactory;
 }
        public ServiceInterfaceInjector(
            IStringUtilService stringUtilService,
            ICSharpParserService cSharpParserService,
            IServiceCommandParserService serviceCommandParserService,
            BufferedTokenStream tokenStream,
            string serviceClassInterfaceName,
            ServiceFile serviceFile,
            string tabString = null)
        {
            _stringUtilService           = stringUtilService;
            _cSharpParserService         = cSharpParserService;
            _serviceCommandParserService = serviceCommandParserService;
            Tokens   = tokenStream;
            Rewriter = new TokenStreamRewriter(tokenStream);
            _serviceClassInterfaceName = serviceClassInterfaceName;
            _serviceFile         = serviceFile;
            _tabString           = tabString;
            _currentNamespace    = new Stack <string>();
            _hasServiceNamespace = false;
            _hasServiceInterface = false;
            IsModified           = false;

            _usingSet = _serviceFile.UsingDirectives.ToHashSet();
        }