--- copy of iftask.c_	Sun May 25 20:20:24 2003
+++ iftask.cs	Thu Sep 04 00:17:52 2003
@@ -105,6 +105,30 @@
     ///   </if>
     ///   ]]></code>
     /// </example>
+    /// 
+    /// 
+    /// <example>
+    ///   <para>
+    ///		Compares the contents of the source file with one or more target files,
+    ///		if different do something.
+    ///   </para>
+	///   <code>
+	///   <![CDATA[
+	///   <if difffile="myfile.cs" comparefile="shadow\myfile.cs">
+	///     <echo message="myfile.cs is different than shadow\myfile.cs" />
+	///   </if>
+	///   ]]></code>
+	///   or
+	///   <code>
+	///   <![CDATA[
+	///   <if difffile="myfile.cs">
+	///     <comparefiles>
+	///         <includes name="*.cs"/>
+	///     </comparefiles>
+	///     <echo message="myfile.cs is different than at least one of shadow\*.cs"/>
+	///   </if>
+	///   ]]></code>
+	/// </example>
     [TaskName("if")]
     public class IfTask : TaskContainer {
         #region Private Instance Fields
@@ -114,21 +138,34 @@
         private string _targetName = null;
         private string _uptodateFile = null;
         private FileSet _compareFiles = null;
+		private string _diffFile = null;
 
         #endregion Private Instance Fields
 
         #region Public Instance Properties
 
-        /// <summary>
-        /// The file to compare if uptodate
-        /// </summary>
-        [TaskAttribute("uptodatefile")]
-        public string PrimaryFile {
-            get { return _uptodateFile; }
-            set {_uptodateFile = Project.GetFullPath(value);}
-        }
+		/// <summary>
+		/// The file to compare if different contents;
+		/// requires that comparefile be set also.
+		/// </summary>
+		[TaskAttribute("difffile")]
+		public string DiffFile 
+		{
+			get { return _diffFile; }
+			set { _diffFile = Project.GetFullPath(value); }
+		}
+
+		/// <summary>
+		/// The file to compare if uptodate
+		/// </summary>
+		[TaskAttribute("uptodatefile")]
+		public string PrimaryFile 
+		{
+			get { return _uptodateFile; }
+			set {_uptodateFile = Project.GetFullPath(value);}
+		}
 
-        /// <summary>
+		/// <summary>
         /// The file to check against for the uptodate file.
         /// </summary>
         [TaskAttribute("comparefile")]
@@ -225,6 +262,45 @@
                     if (!ret) return false;
                 }
 
+				// Compare contents of difffile and comparefile(s).
+				if(_diffFile != null) {
+					FileInfo thisFile = new FileInfo(_diffFile);
+					FileInfo thatFile = null;
+					if(thisFile == null) 
+					{
+						ret = false;
+					}
+					else 
+					{
+						StreamReader thisSR = new StreamReader(_diffFile), thatSR = null;
+						string thisFileContents = thisSR.ReadToEnd(), thatFileContents = null;
+						bool isAMatch = false;
+						foreach( string fileName in _compareFiles.FileNames )
+						{
+							if(!isAMatch)
+							{
+								thatFile = new FileInfo(fileName);
+								thatSR = new StreamReader(fileName);
+								thatFileContents = thatSR.ReadToEnd();
+								isAMatch = (thisFileContents != thatFileContents);
+								if(isAMatch) 
+								{
+									Log(Level.Verbose, "{2}:{0} is different than {1}.", thatFile.Name, thisFile.Name, LogPrefix);
+								}
+								else 
+								{
+									Log(Level.Verbose, "{2}:{0} is the same as {1}.", thatFile.Name, thisFile.Name, LogPrefix);
+								}
+							}
+						}
+						// Don't forget to hang up when you're done -- the GAC is slow sometimes.
+						thisSR.Close();
+						thatSR.Close();
+						ret = ret && isAMatch;
+					}
+					if(!ret) return false;
+				}
+
                 return ret;
             }
         }
@@ -272,7 +348,31 @@
     ///   </if>
     ///   ]]></code>
     /// </example>
-    [TaskName("ifnot")]
+	/// 
+	/// 
+	/// <example>
+	///   <para>
+	///		Compares the contents of the source file with one or more target files,
+	///		if not different do something.
+	///   </para>
+	///   <code>
+	///   <![CDATA[
+	///   <ifnot difffile="myfile.cs" comparefile="shadow\myfile.cs">
+	///     <echo message="myfile.cs is not different than shadow\myfile.cs" />
+	///   </if>
+	///   ]]></code>
+	///   or
+	///   <code>
+	///   <![CDATA[
+	///   <ifnot difffile="myfile.cs">
+	///     <comparefiles>
+	///         <includes name="*.cs"/>
+	///     </comparefiles>
+	///     <echo message="myfile.cs is not different than any of shadow\*.cs"/>
+	///   </if>
+	///   ]]></code>
+	/// </example>
+	[TaskName("ifnot")]
     public class IfNotTask : IfTask {
         #region Override implementation of IfTask
 
