Author: toshok
Date: 2005-07-01 15:21:35 -0400 (Fri, 01 Jul 2005)
New Revision: 46856

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backends/classes/Utils.cs
Log:
2005-07-01  Chris Toshok  <[EMAIL PROTECTED]>

        * backends/classes/Utils.cs: rewrite this to remove the dep on
        g_file_get_contents.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2005-07-01 18:52:17 UTC (rev 46855)
+++ trunk/debugger/ChangeLog    2005-07-01 19:21:35 UTC (rev 46856)
@@ -1,3 +1,8 @@
+2005-07-01  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * backends/classes/Utils.cs: rewrite this to remove the dep on
+       g_file_get_contents.
+
 2005-06-28  Chris Toshok  <[EMAIL PROTECTED]>
 
        * backends/mono/MonoFundamentalObjectBase.cs

Modified: trunk/debugger/backends/classes/Utils.cs
===================================================================
--- trunk/debugger/backends/classes/Utils.cs    2005-07-01 18:52:17 UTC (rev 
46855)
+++ trunk/debugger/backends/classes/Utils.cs    2005-07-01 19:21:35 UTC (rev 
46856)
@@ -1,23 +1,23 @@
 using System;
-using System.Text;
-using System.Runtime.InteropServices;
+using System.IO;
 
 namespace Mono.Debugger.Backends
 {
        internal abstract class Utils
        {
-               [DllImport("glib-2.0")]
-               extern static bool g_file_get_contents (string filename, out 
IntPtr contents, out int length, out IntPtr error);
-
                public static string GetFileContents (string filename)
                {
-                       int length;
-                       IntPtr contents, error;
+                       try {
+                               StreamReader sr = File.OpenText (filename);
+                               string contents = sr.ReadToEnd ();
 
-                       if (!g_file_get_contents (filename, out contents, out 
length, out error))
+                               sr.Close();
+
+                               return contents;
+                       }
+                       catch {
                                return null;
-
-                       return Marshal.PtrToStringAnsi (contents, length);
+                       }
                }
                
        }

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

Reply via email to