/// <summary> /// Gets if the given files have equivalent contents. /// </summary> public static bool EqualContent(File A, File B) { if (A._Subfiles != null) { if (B._Subfiles != null) { if (A._Subfiles.Length != B._Subfiles.Length) { return false; } for (int t = 0; t < A._Subfiles.Length; t++) { // Compare names of subfiles first to put off costly content checking if (A._Subfiles[t].Name != B._Subfiles[t].Name) { return false; } } for (int t = 0; t < A._Subfiles.Length; t++) { if (!EqualContent(A._Subfiles[t], B._Subfiles[t])) { return false; } } return true; } return false; } if (A._Data != null) { if (B._Data != null) { return Data.Equal(A._Data, B._Data); } return false; } // Hopefully, this will never be happen return false; }
/// <summary> /// Gets if the given files have equivalent names and contents. /// </summary> public static bool Equal(File A, File B) { return A.Name == B.Name && EqualContent(A, B); }