Support for .sln files generated by non-standard tools

Jun 28, 2014 at 2:15 PM

I've been using the CWDev.SLNTools.Core.dll for parsing some Unity ( .sln files, and these files have small quirks in them which causes SLNTools to throw an exception.

To get it running under Mono on OS X I also removed the reference to System.Windows.Forms, and removed the usage of the MessageBox winforms function.

1) In the global section, for some reason, the Unity .sln files has a duplicate entry of
$0.TextStylePolicy = $1 
This would cause the PropertyLineHashList to throw an exception inside InsertItem. I Simply removed the exception and inserted the following code on Line 59:
existingItem.Value = item.Value;
I understand that this overrides the first value with the second value, but this is acceptable for me.

2) In SolutionFileReader inside the ReadGlobal function the lines are iterated through, at the end of the .sln file Unity inserts a couple of blank rows between some of the EndGlobalSection and EndGlobal, this would cause ReadGlobalSection to throw an exception, I simply added the following code to strip out empty lines before ReadGlobalSection gets called inside ReadGlobal Line166-170:
line = line.Trim();
    if (line.Length > 0)
Figured I would let you know about these quirks, with the following fixes the library works wonders, amazing job!