Forgot this in changelog
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / Utilities.cs
index ca3fb4a6dd535c06818204f5b9a899a3032f26cc..ac2a622bc47fd6cab395f56309e805bd432adbc2 100644 (file)
 
 #if NET_2_0
 
-namespace Microsoft.Build.BuildEngine {
-       public class Utilities : ILangSecurityLevelChecker, ICultureStringUtilities {
-               public Utilities ()
-               {
-               }
-
-               public bool CheckPath (string path, int zone)
-               {
-                       return true;
-               }
+using System;
+using System.Collections;
+using System.Text;
 
-               public string[] GetSupportedCultures ()
+namespace Microsoft.Build.BuildEngine {
+       public static class Utilities {
+       
+               static Hashtable charsToEscape;
+       
+               static Utilities ()
                {
-                       return null;
+                       charsToEscape = new Hashtable ();
+                       
+                       charsToEscape.Add ('$', null);
+                       charsToEscape.Add ('%', null);
+                       charsToEscape.Add ('\'', null);
+                       charsToEscape.Add ('(', null);
+                       charsToEscape.Add (')', null);
+                       charsToEscape.Add ('*', null);
+                       charsToEscape.Add (';', null);
+                       charsToEscape.Add ('?', null);
+                       charsToEscape.Add ('@', null);
                }
-
-               public bool ValidateCulture (string culture)
+       
+               public static string Escape (string unescapedExpression)
                {
-                       return true;
+                       StringBuilder sb = new StringBuilder ();
+                       
+                       foreach (char c in unescapedExpression) {
+                               if (charsToEscape.Contains (c))
+                                       sb.AppendFormat ("%{0:x2}", (int) c);
+                               else
+                                       sb.Append (c);
+                       }
+                       
+                       return sb.ToString ();
                }
        }
 }
 
-#endif
\ No newline at end of file
+#endif