public void TestMethod1()
 {
     List<ISolutionInfo> solutions = new List<ISolutionInfo>();
     solutions.Add(new Solution(new FileInfo(@"C:\dev\Projects\Faces\Faces.Wpf.sln")));
     solutions.Add(new Solution(new FileInfo(@"C:\dev\Projects\Faces\Faces.Www.sln")));
     solutions.Add(new Solution(new FileInfo(@"C:\dev\Projects\SAPLogonPadUpdater\SAPLogonPadUpdater.sln")));
     ProductSourceStructure structure = new ProductSourceStructure(solutions);
     IList<string> liste = structure.UniqueDirectoryListe;
     List<string> sorted = new List<string>(structure.RootDirectoryListe);
     sorted.Sort();
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            FileInfo[] fis = (new DirectoryInfo("c:\\dev")).GetFiles("*.sln", SearchOption.AllDirectories);

            List<string> configFileNames = new List<string>();
            foreach (var item in fis)
            {
                try
                {
                    List<ISolutionInfo> solutions = new List<ISolutionInfo>();
                    solutions.Add(new Solution(item));
                    ProductSourceStructure structure = new ProductSourceStructure(solutions);

                    IList<string> liste = structure.UniqueDirectoryListe;
                    List<string> sorted = new List<string>(structure.RootDirectoryListe);
                    sorted.Sort();

                    string error = string.Empty;
                    foreach (var item2 in sorted)
                    {
                        if (!item2.StartsWith("c:\\dev\\"))
                        {
                            error += item2 + Environment.NewLine;
                        }
                    }
                    if (!string.IsNullOrEmpty(error))
                    {
                        Console.WriteLine("there were items referenced that where outside of c:\\dev in " + item.FullName);
                        Console.WriteLine(error);
                    }
                    else
                    {
                        string name = solutions[0].SolutionFile.FullName.Replace('\\', '_').Replace(' ', '_').Remove(0, 3);
                        name = name.Remove(name.Length - 4, 4);

                        string configname = WriteSolutionConfig(solutions, sorted, name);
                        configFileNames.Add(configname);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error parsing " + item.FullName);
                    Console.WriteLine(ex.GetType().ToString() + ": " + ex.Message);
                    //Console.WriteLine(ex.StackTrace);
                }
            }
            WriteGlobalConfig(configFileNames);
            Console.WriteLine("Done");
            Console.Read();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            FileInfo[] fis = (new DirectoryInfo("c:\\dev")).GetFiles("*.sln", SearchOption.AllDirectories);

            FileInfo logfile = new FileInfo("c:\\output2.txt");
            if (logfile.Exists)
            {
                logfile.Delete();
            }

            using (StreamWriter sw = new StreamWriter(logfile.FullName, false))
            {
                foreach (var item in fis)
                {
                    try
                    {
                        List<ISolutionInfo> solutions = new List<ISolutionInfo>();
                        solutions.Add(new Solution(item));
                        ProductSourceStructure structure = new ProductSourceStructure(solutions);

                        IList<string> liste = structure.UniqueDirectoryListe;
                        List<string> sorted = new List<string>(structure.RootDirectoryListe);
                        sorted.Sort();

                        string error = string.Empty;
                        foreach (var item2 in sorted)
                        {
                            if (!item2.StartsWith("c:\\dev\\"))
                            {
                                error += item2 + Environment.NewLine;
                            }
                        }
                        if (!string.IsNullOrEmpty(error))
                        {
                            Console.WriteLine("there were items referenced that where outside of c:\\dev in " + item.FullName);
                            Console.WriteLine(error);
                        }
                        else
                        {
                            string solutionName = solutions[0].SolutionFile.FullName;
                            Console.WriteLine(solutionName);

                            sw.WriteLine(solutionName + ";;;");

                            foreach (var project in solutions[0].ProjectListe)
                            {
                                Project p = new Project(new FileInfo(Path.Combine(solutions[0].SolutionFile.DirectoryName, project.RawProjectPath)));
                                sw.WriteLine(solutionName + ";" + p.ProjectFile.FullName + ";;");

                                foreach (var assembly in p.AssemblyReferenceListe)
                                {
                                    FileInfo fi = new FileInfo(Path.Combine(p.ProjectFile.DirectoryName, assembly.RawHintPath));

                                    sw.WriteLine(solutionName + ";" + p.ProjectFile.FullName + ";" + fi.FullName + ";\"" + assembly.RawInclude + "\"");
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error parsing " + item.FullName);
                        Console.WriteLine(ex.GetType().ToString() + ": " + ex.Message);
                        //Console.WriteLine(ex.StackTrace);
                    }
                }
                sw.Flush();
                sw.Close();
            }
            Console.WriteLine("Done");
            Console.Read();
        }