Author: ankit
Date: 2007-02-19 06:11:21 -0500 (Mon, 19 Feb 2007)
New Revision: 73104

Modified:
   trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
   trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
   trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
   trunk/monodevelop/Extras/prj2make-sharp-lib/VS2003ProjectFileFormat.cs
Log:
* SlnFileFormat.cs (WriteFile): Use File.Delete for deleting temporary
files.
* MSBuildFileFormat.cs (WriteFile): Likewise.
(CanReadFile): Use XmlReader.MoveToContent to get to the content nodes.
(LoadProject): Skip non-element (eg. comment) nodes when looking for
root.
* VS2003ProjectFileFormat.cs (CanReadFile): Use XmlReader.MoveToContent to 
get to the content nodes.


Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog       2007-02-19 
10:46:46 UTC (rev 73103)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog       2007-02-19 
11:11:21 UTC (rev 73104)
@@ -1,3 +1,14 @@
+2007-02-19  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * SlnFileFormat.cs (WriteFile): Use File.Delete for deleting temporary
+       files.
+       * MSBuildFileFormat.cs (WriteFile): Likewise.
+       (CanReadFile): Use XmlReader.MoveToContent to get to the content nodes.
+       (LoadProject): Skip non-element (eg. comment) nodes when looking for
+       root.
+       * VS2003ProjectFileFormat.cs (CanReadFile): Use XmlReader.MoveToContent 
to 
+       get to the content nodes.
+
 2007-02-16  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * prj2make-sharp-lib.addin.xml: Change add-in versions to 0.13.

Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs    
2007-02-19 10:46:46 UTC (rev 73103)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs    
2007-02-19 11:11:21 UTC (rev 73104)
@@ -82,11 +82,13 @@
                        //FIXME: Need a better way to check the rootelement
                        try {
                                XmlReader xr = XmlReader.Create (file);
-                               xr.Read ();
+                               xr.MoveToContent ();
+
                                if (xr.NodeType == XmlNodeType.Element && 
String.Compare (xr.LocalName, "Project") == 0 &&
                                        String.Compare (xr.NamespaceURI, ns) == 
0)
                                        return true;
-                       } catch {
+                       } catch (Exception e) {
+                               Console.WriteLine (GettextCatalog.GetString 
("Error reading file {0} : ", e.ToString ()));
                                return false;
                        }
 
@@ -132,7 +134,7 @@
                                        WriteFileInternal (file, project, 
monitor);
                                } else {
                                        WriteFileInternal (tmpfilename, 
project, monitor);
-                                       Runtime.FileService.DeleteFile (file);
+                                       File.Delete (file);
                                        Runtime.FileService.MoveFile 
(tmpfilename, file);
                                }
                        } catch (Exception ex) {
@@ -140,7 +142,7 @@
                                Console.WriteLine ("Could not save project: 
{0}, {1}", file, ex);
 
                                if (tmpfilename != String.Empty)
-                                       Runtime.FileService.DeleteFile 
(tmpfilename);
+                                       File.Delete (tmpfilename);
                                throw;
                        } finally {
                                monitor.EndTask ();
@@ -392,6 +394,9 @@
                        XPathNavigator nav = doc.CreateNavigator ();
                        nav.MoveToFirstChild ();
 
+                       while (! (nav.UnderlyingObject is XmlElement))
+                               nav.MoveToNext ();
+
                        if (nav.NamespaceURI != ns)
                                throw new UnknownProjectVersionException 
(fname, nav.NamespaceURI);
 

Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs        
2007-02-19 10:46:46 UTC (rev 73103)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs        
2007-02-19 11:11:21 UTC (rev 73104)
@@ -95,7 +95,7 @@
                                        WriteFileInternal (file, c, monitor);
                                } else {
                                        WriteFileInternal (tmpfilename, c, 
monitor);
-                                       Runtime.FileService.DeleteFile (file);
+                                       File.Delete (file);
                                        Runtime.FileService.MoveFile 
(tmpfilename, file);
                                }
                        } catch (Exception ex) {
@@ -103,7 +103,7 @@
                                Console.WriteLine ("Could not save solution: 
{0}, {1}", file, ex);
 
                                if (tmpfilename != String.Empty)
-                                       Runtime.FileService.DeleteFile 
(tmpfilename);
+                                       File.Delete (tmpfilename);
                                throw;
                        } finally {
                                monitor.EndTask ();

Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/VS2003ProjectFileFormat.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/VS2003ProjectFileFormat.cs      
2007-02-19 10:46:46 UTC (rev 73103)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/VS2003ProjectFileFormat.cs      
2007-02-19 11:11:21 UTC (rev 73104)
@@ -33,7 +33,7 @@
                        //FIXME: Need a better way to check the rootelement
                        try {
                                using (XmlReader xr = XmlReader.Create (file)) {
-                                       xr.Read ();
+                                       xr.MoveToContent ();
                                        if (xr.NodeType == XmlNodeType.Element 
&& String.Compare (xr.LocalName, "VisualStudioProject") == 0)
                                                return true;
                                }

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

Reply via email to