public BreadcrumbControllerInjector(
     IStringUtilService stringUtilService,
     ICSharpParserService cSharpParserService,
     IBreadcrumbCommandParserService breadcrumbCommandParserService,
     ICSharpCommonStgService cSharpCommonStgService,
     BufferedTokenStream tokenStream,
     ControllerDictionary controllerDictionary,
     string breadcrumbServiceNamespace,
     string controllerRootNamespace,
     string defaultAreaBreadcrumbServiceRootName,
     string tabString)
 {
     _stringUtilService              = stringUtilService;
     _cSharpParserService            = cSharpParserService;
     _breadcrumbCommandParserService = breadcrumbCommandParserService;
     _cSharpCommonStgService         = cSharpCommonStgService;
     Tokens         = tokenStream;
     Rewriter       = new TokenStreamRewriter(tokenStream);
     ControllerDict = controllerDictionary;
     _breadcrumbServiceNamespace           = breadcrumbServiceNamespace;
     _controllerRootNamespace              = controllerRootNamespace;
     _defaultAreaBreadcrumbServiceRootName = defaultAreaBreadcrumbServiceRootName;
     _tabString         = tabString;
     _currentNamespace  = new Stack <string>();
     _currentClass      = new Stack <string>();
     _isControllerClass = new Stack <bool>();
     _isControllerClass.Push(false);
     _isClassModified = new Stack <bool>();
     _isClassModified.Push(false);
     IsModified = false;
 }
 public BreadcrumbClassInjectorFactory(
     IStringUtilService stringUtilService,
     ICSharpParserService cSharpParserService,
     IBreadcrumbCommandParserService breadcrumbCommandParserService)
 {
     _stringUtilService              = stringUtilService;
     _cSharpParserService            = cSharpParserService;
     _breadcrumbCommandParserService = breadcrumbCommandParserService;
 }
 public BreadcrumbControllerInjectorFactory(
     IStringUtilService stringUtilService,
     ICSharpParserService cSharpParserService,
     IBreadcrumbCommandParserService breadcrumbCommandParserService,
     ICSharpCommonStgService cSharpCommonStgService)
 {
     _stringUtilService              = stringUtilService;
     _cSharpParserService            = cSharpParserService;
     _breadcrumbCommandParserService = breadcrumbCommandParserService;
     _cSharpCommonStgService         = cSharpCommonStgService;
 }
Пример #4
0
        public BreadcrumbClassInjector(
            IStringUtilService stringUtilService,
            ICSharpParserService cSharpParserService,
            IBreadcrumbCommandParserService breadcrumbCommandParserService,
            BufferedTokenStream tokenStream,
            List <string> usingDirectives,
            string breadcrumbNamespace,
            BreadcrumbServiceDeclaration breadcrumbDeclaration,
            string tabString)
        {
            _stringUtilService              = stringUtilService;
            _cSharpParserService            = cSharpParserService;
            _breadcrumbCommandParserService = breadcrumbCommandParserService;
            Tokens                    = tokenStream;
            Rewriter                  = new TokenStreamRewriter(tokenStream);
            _breadcrumbNamespace      = breadcrumbNamespace;
            _breadcrumbDeclaration    = breadcrumbDeclaration;
            _tabString                = tabString;
            _currentNamespace         = new Stack <string>();
            _currentClass             = new Stack <string>();
            _hasBreadcrumbNamespace   = false;
            _hasBreadcrumbClass       = false;
            _hasBreadcrumbConstructor = false;
            IsModified                = false;

            _methodDictionary = new Dictionary <string, BreadcrumbMethodDeclaration>();
            foreach (var method in breadcrumbDeclaration.Body.MethodDeclarations)
            {
                _methodDictionary.Add(GetActionMethodName(method.ControllerRoot, method.Action), method);
            }

            _usingSet = usingDirectives.ToHashSet();

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

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

            _ctorAssignmentDict = new Dictionary <string, SimpleAssignment>();
            var statements = _breadcrumbDeclaration?.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);
                    }
                }
            }
        }