Author: ankit
Date: 2007-02-11 18:49:51 -0500 (Sun, 11 Feb 2007)
New Revision: 72634

Modified:
   trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
   trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
   trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
Log:
* SlnFileFormat.cs (CanReadFile): Check sln version.
(LoadSolution): Likewise. Handle invalid project paths.
(GetSlnFileVersion): Fix.
* MSBuildFileFormat.cs (WriteFile): Throw if @node is not a
DotNetProject.
(FileToXmlElement): Set DependentUpon only if required.


Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog       2007-02-11 
23:25:22 UTC (rev 72633)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog       2007-02-11 
23:49:51 UTC (rev 72634)
@@ -1,3 +1,12 @@
+2007-02-12  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * SlnFileFormat.cs (CanReadFile): Check sln version.
+       (LoadSolution): Likewise. Handle invalid project paths.
+       (GetSlnFileVersion): Fix.
+       * MSBuildFileFormat.cs (WriteFile): Throw if @node is not a
+       DotNetProject.
+       (FileToXmlElement): Set DependentUpon only if required.
+
 2007-02-07  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * MsPrjHelper.cs: Use a TextFileReader to open the VS file, since it

Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs    
2007-02-11 23:25:22 UTC (rev 72633)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs    
2007-02-11 23:49:51 UTC (rev 72634)
@@ -102,8 +102,7 @@
 
                        DotNetProject project = node as DotNetProject;
                        if (project == null)
-                               //FIXME: Argument exception?
-                               return;
+                               throw new InvalidOperationException ("The 
provided object is not a DotNetProject");
                        
                        string tmpfilename = String.Empty;
                        try {
@@ -671,7 +670,8 @@
                                        EnsureChildValue (elem, "LogicalName", 
ns, projectFile.ResourceId);
                                
                                //DependentUpon is relative to the basedir of 
the 'pf' (resource file)
-                               EnsureChildValue (d.ProjectFileElements 
[projectFile], "DependentUpon", ns,
+                               if (!String.IsNullOrEmpty 
(projectFile.DependsOn))
+                                       EnsureChildValue (elem, 
"DependentUpon", ns,
                                                
Runtime.FileService.AbsoluteToRelativePath (
                                                        Path.GetDirectoryName 
(projectFile.Name), projectFile.DependsOn));
                        }

Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs        
2007-02-11 23:25:22 UTC (rev 72633)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs        
2007-02-11 23:49:51 UTC (rev 72634)
@@ -60,7 +60,8 @@
                
                public bool CanReadFile (string file)
                {
-                       return String.Compare (Path.GetExtension (file), 
".sln", true) == 0;
+                       return (String.Compare (Path.GetExtension (file), 
".sln", true) == 0 &&
+                               GetSlnFileVersion (file) == "9.00");
                }
                
                public bool CanWriteFile (object obj)
@@ -339,9 +340,9 @@
                //
                Combine LoadSolution (string fileName, IProgressMonitor monitor)
                {
-                       //string version = GetSlnFileVersion (fileName);
-                       //if (version != "9.00")
-                       //      throw new UnknownProjectVersionException 
(fileName, version);
+                       string version = GetSlnFileVersion (fileName);
+                       if (version != "9.00")
+                               throw new UnknownProjectVersionException 
(fileName, version);
 
                        ListDictionary globals = null;
                        MSBuildSolution combine = null;
@@ -443,7 +444,17 @@
                                        (projectPath.EndsWith (".csproj") || 
projectPath.EndsWith (".vbproj")))
                                {
                                        MSBuildProject project = null;
-                                       projectPath = Path.GetFullPath (MapPath 
(Path.GetDirectoryName (fileName), projectPath));
+                                       string path = MapPath 
(Path.GetDirectoryName (fileName), projectPath);
+                                       if (String.IsNullOrEmpty (path)) {
+                                               monitor.ReportWarning 
(GettextCatalog.GetString (
+                                                       "Invalid project path 
found in {0} : {1}", fileName, projectPath));
+                                               Console.WriteLine 
(GettextCatalog.GetString (
+                                                       "Invalid project path 
found in {0} : {1}", fileName, projectPath));
+
+                                               continue;
+                                       }
+
+                                       projectPath = Path.GetFullPath (path);
                                        try {
                                                project = 
Services.ProjectService.ReadCombineEntry (projectPath, monitor) as 
MSBuildProject;
                                                entries [projectGuid] = project;
@@ -775,6 +786,9 @@
                        strInput = reader.ReadLine();
 
                        match = regex.Match(strInput);
+                       if (!match.Success)
+                               match = regex.Match (reader.ReadLine ());
+
                        if (match.Success)
                        {
                                strVersion = match.Groups[1].Value;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to