3F / MvsSln

🧩 Customizable VisualStudio .sln parser with project support (.vcxproj, .csproj., …). Pluggable lightweight r/w handlers at runtime, and more …
MIT License
135 stars 27 forks source link

More simplified work with solution folders #8

Closed 3F closed 5 years ago

3F commented 5 years ago
new SolutionFolder
(
    new ProjectItem()
    {
        pType = Guids.SLN_FOLDER,
        name = "MyFolder1",
        path = "MyFolder1", // recommended to be same
        pGuid = Guid.NewGuid().ToString()
    },
    new List<RawText>()
    {
        ".gnt\\gnt.core",
        ".gnt\\packages.config",
        // ...
    }
),
...

too verbose ...

Related issue: #6

3F commented 5 years ago

Fully updated constructors and implemented native object comparison for ProjectItem + SolutionFolder + RawText. Polynom function: extracted as HashPolynom + CalculateHashCode

Now it should be really easy to create/modify/or just use parsed folders, projects, and other.

Safely compare anything:

if(new ProjectItem(...) == new ProjectItem(...)) { ... }
if(new SolutionFolder(...) == new SolutionFolder(...)) { ... }
if(new RawText(...) == new RawText(...)) { ... }
if(new ConfigItem(...) == new ConfigItem(...)) { ... }
if((RawText)"data" == (RawText)"data") { ... }

Use Subdirectories:

new SolutionFolder("dir1", 
    new SolutionFolder("dir2", 
        new SolutionFolder("dir3", "hMSBuild.bat", "DllExport.bat")
    )
);
...
new SolutionFolder("{EE7DD6B7-56F4-478D-8745-3D204D915473}", "MyFolder2", dir1, ".gnt\\gnt.core");
...

Projects and Folders:

new ProjectItem("Project1", ProjectType.Cs);
new ProjectItem("Project1", ProjectType.Cs, new SolutionFolder("dir1"));
new ProjectItem("Project2", ProjectType.Vc, "path 1");
new ProjectItem("{EE7DD6B7-56F4-478D-8745-3D204D915473}", "Project1", ProjectType.Cs, dir2);
...

See related unit tests!