Handle fault messages in duplex callback channel.
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / Utilities.cs
index c92e14fb1cc488bbe4f3c335dbf80324fd32fd6c..235dd2eda238838aa2fc84a6c64b2fdfe7570e7c 100644 (file)
@@ -3,8 +3,11 @@
 //
 // Author:
 //   Marek Sieradzki (marek.sieradzki@gmail.com)
+//   Lluis Sanchez Gual <lluis@novell.com>
+//   Michael Hutchinson <mhutchinson@novell.com>
 //
 // (C) 2005 Marek Sieradzki
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 
 #if NET_2_0
 
-using System;
-using System.Collections;
-using System.Text;
+using Mono.XBuild.Utilities;
 
 namespace Microsoft.Build.BuildEngine {
        public static class Utilities {
-       
-               static Hashtable charsToEscape;
-       
-               static Utilities ()
+
+               public static string Escape (string unescapedExpression)
                {
-                       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);
+                       return MSBuildUtils.Escape (unescapedExpression);
                }
-       
-               public static string Escape (string unescapedExpression)
+
+               internal static string FromMSBuildPath (string relPath)
                {
-                       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 ();
+                       return MSBuildUtils.FromMSBuildPath (relPath);
                }
        }
+
 }
 
 #endif