public object Post()
        {
            var list = new List<MooData>();

            var scanner = new ProjectScanner();
            var projects = scanner.Scan(@"d:\Projects\easyjet").OrderBy(x=> x.Name);

            foreach (var project in projects)
            {

                if (project.Packages.Any())
                {
                    var data = list.FirstOrDefault(x => x.Id == project.Name);

                    if (data == null)
                    {
                        data = new MooData();
                        data.Id = project.Name;
                        data.Text = project.Name;
                        list.Add(data);
                    }

                    data.Connections.AddRange(project.Packages.Select(x => x.Id).OrderBy(x=> x));
                }

            }

            var packageNames =
                (from project in projects from package in project.Packages where project.Name != package.Id select package.Id).Distinct().OrderBy(x => x).ToList();

             var packageData = packageNames.Select(
                                                                                                     id =>
                                                                                                     new MooData()
                                                                                                     {
                                                                                                         Id = id,
                                                                                                         Text =
                                                                                                             id
                                                                                                     });

            list.AddRange(packageData);

            return list.OrderBy(x => x.Id);
        }
Esempio n. 2
0
 public void ScanSource(string sourcePath)
 {
     var scanner = new ProjectScanner();
     ScanReports.Add(scanner.Scan(sourcePath));
 }
Esempio n. 3
0
        private int main(string[] args)
        {
            string outputFile = DEFAULT_OUTPUTFILE;
            bool verbose = false;

            var options = args.Switches();
            var parameters = args.Parameters();

            #region Parse Options

            foreach (var arg in options.Keys)
            {
                var argumentParameters = options[arg];

                switch (arg)
                {
                    /* options  */

                    case "output-file":
                        //
                        outputFile = argumentParameters.FirstOrDefault();
                        break;

                    case "verbose":
                        verbose = true;
                        break;

                    /* global switches */
                    case "load-config":
                        // all ready done, but don't get too picky.
                        break;

                    case "nologo":
                        this.Assembly().SetLogo("");
                        break;

                    case "help":
                        return Help();

                    default:
                        return Fail("Unknown parameter [--{0}]", arg);
                }
            }
            Logo();

            #endregion

            if (parameters.Count() != 1)
            {
                return Fail("Missing source code root path. \r\n\r\n    Use --help for command line help.");
            }

            try
            {
                ProjectScanner scanner = new ProjectScanner();
                scanner.Verbose = verbose;

                ScanReport report = scanner.Scan(parameters.FirstOrDefault());

                string xml = report.Serialize();

                if (outputFile == "-")
                {
                    Console.WriteLine(xml);
                }
                else
                {
                    StreamWriter writer = new StreamWriter(outputFile, false, Encoding.Unicode);
                    writer.WriteLine(xml);
                    writer.Close();
                }
            }
            catch (Exception ex)
            {
                return Fail(string.Format("{0}\n{1}", ex.Message, ex.StackTrace));

            }

            return 0;
        }