#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