public static OutputResponse CreateOutPut(AnalysisRequest request, RootNode rootNode)
        {
            if (request == null) throw new ArgumentNullException("request");
            if (rootNode == null) throw new ArgumentNullException("rootNode");

            IOutputProvider outputProvider = OutputFactory.CreateProvider(request.OutPutType);
            return outputProvider.Create(rootNode, request.OutPutFolder);
        }
Пример #2
0
        public static void SetupLogger(AnalysisRequest request)
        {
            SetLogLevel(request.LogLevel);
            SetLogType(request.LogType);

            SetOutputFolderLocation(!string.IsNullOrWhiteSpace(request.LogOutputFolderLocation) ? request.LogOutputFolderLocation : request.OutPutFolder);
            if (!string.IsNullOrWhiteSpace(request.LogOutputFileLocation))
            {
                SetOutputFileLocation(request.LogOutputFileLocation);
            }
        }
        public static void SetupLogger(AnalysisRequest request)
        {
            SetLogLevel(request.LogLevel);
            SetLogType(request.LogType);

            SetOutputFolderLocation(!string.IsNullOrWhiteSpace(request.LogOutputFolderLocation) ? request.LogOutputFolderLocation : request.OutPutFolder);
            if (!string.IsNullOrWhiteSpace(request.LogOutputFileLocation))
            {
                SetOutputFileLocation(request.LogOutputFileLocation);
            }
        }
        /// <summary>
        /// Creates the rootNode collection from the analysisRequest.  Will interigate the solution and proejcts to find all other projects and their relationships.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static RootNode CreateRootNode(AnalysisRequest request)
        {
            if (!File.Exists(request.RootFile))
            {
                throw new FileNotFoundException(request.RootFile);
            }

            var rootFileInfo = new FileInfo(request.RootFile);

            var rootNode = new RootNode
                {
                    Directory = rootFileInfo.Directory,
                    File = rootFileInfo,
                    Name = rootFileInfo.Name,
                    NodeType = DetermineRootNodeType(rootFileInfo.FullName),
                    SearchDepth = request.NumberOfLevelsToDig
                };

            return rootNode;
        }
        private static AnalysisRequest GetAppSettingValues()
        {
            var request = new AnalysisRequest();

            var outputFolder = ConfigurationManager.AppSettings["OutputFolder"];
            if (!string.IsNullOrWhiteSpace(outputFolder))
            {
                request.LogOutputFolderLocation = outputFolder;
            }

            var outputFile = ConfigurationManager.AppSettings["OutputFile"];
            if (!string.IsNullOrWhiteSpace(outputFile))
            {
                request.LogOutputFileLocation = outputFile;
            }

            var loggerType = ConfigurationManager.AppSettings["LoggerType"];
            if (!string.IsNullOrWhiteSpace(loggerType))
            {
                if (Enum.IsDefined(typeof(LogType), loggerType))
                {
                    request.LogType = (LogType)Enum.Parse(typeof(LogType), loggerType, true);
                }
            }

            var loggerLevel = ConfigurationManager.AppSettings["LoggerLevel"];
            if (!string.IsNullOrWhiteSpace(loggerLevel))
            {
                if (Enum.IsDefined(typeof(LogLevel), loggerLevel))
                {
                    request.LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), loggerLevel, true);
                }
            }

            return request;
        }
        public AnalysisRequest Process(AnalysisRequest request, string[] args)
        {
            if (args.Length == 0)
            {
                return request;
            }

            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i].Trim().ToLower())
                {
                    case "-leveltodig":
                        if (args.Length > i + 1)
                        {
                            request.NumberOfLevelsToDig = int.Parse(args[i + 1]);
                        }
                        break;

                    case "-outputfolder":
                        if (args.Length > i + 1)
                        {
                            if (!string.IsNullOrWhiteSpace(args[i + 1]))
                            {
                                request.OutPutFolder = args[i + 1];
                            }
                        }
                        break;

                    case "-rootfile":
                        if (args.Length > i + 1)
                        {
                            if (!string.IsNullOrWhiteSpace(args[i + 1]))
                            {
                                request.RootFile = args[i + 1];
                            }
                        }
                        break;

                    case "-outputeachitem":
                        if (args.Length > i + 1)
                        {
                            request.CreateOutputForEachItem = bool.Parse(args[i + 1]);
                        }
                        break;

                    case "-outputtype":
                        if (args.Length > i + 1)
                        {
                            if (Enum.IsDefined(typeof (OutPutType), args[i +1]))
                            {
                                request.OutPutType = (OutPutType)Enum.Parse(typeof(OutPutType), args[i + 1], true);
                            }
                        }
                        break;
                    case "-loglevel":
                        if (args.Length > i + 1)
                        {
                            if (Enum.IsDefined(typeof (LogLevel), args[i +1]))
                            {
                                request.LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), args[i + 1], true);
                            }
                        }
                        break;
                    case "-logfolder":
                        if (args.Length > i + 1)
                        {
                            if (!string.IsNullOrWhiteSpace(args[i + 1]))
                            {
                                request.LogOutputFolderLocation = args[i + 1];
                            }
                        }
                        break;
                    case "-logfile":
                        if (args.Length > i + 1)
                        {
                            if (!string.IsNullOrWhiteSpace(args[i + 1]))
                            {
                                request.LogOutputFileLocation= args[i + 1];
                            }
                        }
                        break;
                    case "-logtype":
                        if (args.Length > i + 1)
                        {
                            if (Enum.IsDefined(typeof(LogType), args[i + 1]))
                            {
                                request.LogType = (LogType)Enum.Parse(typeof(LogType), args[i + 1], true);
                            }
                        }
                        break;
                }
            }

            //if the output type is OutPutType.HtmlDocument then it needs to produce png's for each item so set the output each item flag to true, regardless of params
            if (request.OutPutType == OutPutType.HtmlDocument)
            {
                request.CreateOutputForEachItem = true;
            }

            return request;
        }
 public AnalysisRequest Process(string[] args)
 {
     var request = new AnalysisRequest();
     return Process(request, args);
 }