예제 #1
0
        private static int Main(string[] args)
        {
            int num;

            try
            {
                RoslynMetricsOptions roslynMetricsOption = new RoslynMetricsOptions(args);
                if (!string.IsNullOrWhiteSpace(roslynMetricsOption.File) && !string.IsNullOrWhiteSpace(roslynMetricsOption.Output))
                {
                    FileInfo fileInfo = new FileInfo(roslynMetricsOption.File);
                    if (fileInfo.Exists)
                    {
                        string lower = fileInfo.Extension.ToLower();
                        string str   = lower;
                        if (lower != null)
                        {
                            if (str == ".sln")
                            {
                                RoslynMetricsExe.BuildReportFromSolution(roslynMetricsOption.File, roslynMetricsOption.Output, roslynMetricsOption.IgnoreGeneratedCode);
                            }
                            else if (str == ".csproj")
                            {
                                RoslynMetricsExe.BuildReportFromStandAloneProject(roslynMetricsOption.File, roslynMetricsOption.Output, false);
                            }
                        }
                    }
                }
                num = 0;
            }
            catch (FileNotFoundException fileNotFoundException)
            {
                Console.Error.Write(fileNotFoundException.Message);
                num = 4098;
            }
            catch (Exception exception)
            {
                Console.Error.Write(exception.Message);
                num = 1;
            }
            return(num);
        }
예제 #2
0
 public RoslynMetricsOptions(IEnumerable <string> args)
 {
     this.options = RoslynMetricsOptions.ParseOptions(args);
 }