Handle windows paths in ResXFileRef, for conversion to string case
[mono.git] / mcs / class / System.Windows.Forms / System.Resources / ResXFileRef.cs
index 5200d86426a514927bce318bda44ae3d77d0c7c4..308c92c115df4ee93de946617c2f570f32863d22 100644 (file)
@@ -68,6 +68,10 @@ namespace System.Resources {
                                if (parts.Length == 1)
                                        throw new ArgumentException ("value");
 
+                               string filename = parts [0];
+                               if (Path.DirectorySeparatorChar == '/')
+                                       filename = filename.Replace ("\\", "/");
+
                                Type type = Type.GetType (parts [1]);
                                if (type == typeof(string)) {
                                        Encoding encoding;
@@ -77,15 +81,11 @@ namespace System.Resources {
                                                encoding = Encoding.Default;
                                        }
 
-                                       using (TextReader reader = new StreamReader(parts [0], encoding)) {
+                                       using (TextReader reader = new StreamReader(filename, encoding)) {
                                                return reader.ReadToEnd();
                                        }
                                }
 
-                               string filename = parts [0];
-                               if (Path.DirectorySeparatorChar == '/')
-                                       filename = filename.Replace ("\\", "/");
-
                                using (FileStream file = new FileStream (filename, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                                        buffer = new byte [file.Length];
                                        file.Read(buffer, 0, (int) file.Length);