Merge pull request #4444 from lateralusX/jlorenss/windows-unwind-info
[mono.git] / mcs / tools / resx2sr / resx2sr.cs
index c6051ba217ef855fada71623332b1688b8c4fcc1..935a31ecc323b492256337f89b269b6d5b5a3cee 100644 (file)
@@ -66,7 +66,7 @@ public class Program
                        return 0;
                }
 
-               if (extra.Count != 1) {
+               if (extra.Count < 1) {
                        ShowHelp (p);
                        return 2;
                }
@@ -101,14 +101,28 @@ public class Program
 
                        str.WriteLine ("partial class SR");
                        str.WriteLine ("{");
+
+                       var dict = new Dictionary<string, string> ();
+
                        foreach (var entry in txtStrings) {
-                               str.Write ($"\tpublic const string {entry.Item1} = \"{ToCSharpString (entry.Item2)}\";");
+
+                               var value = ToCSharpString (entry.Item2);
+                               string found;
+                               if (dict.TryGetValue (entry.Item1, out found)) {
+                                       if (found == value)
+                                               continue;
+
+                                       str.WriteLine ($"\t// Constant value mismatch");
+                               } else {
+                                       dict.Add (entry.Item1, value);
+                               }
+
+                               str.Write ($"\tpublic const string {entry.Item1} = \"{value}\";");
 
                                if (!string.IsNullOrEmpty (entry.Item3))
                                        str.Write (" // {entry.Item3}");
 
                                str.WriteLine ();
-
                        }
                        str.WriteLine ("}");
                }