|
A couple of comments and
suggestions:
- Check the coding guidelines
for the coding style:
- use spaces
- opening curly braces go on the same line with the if (), else, or while
()
- By using StreamReader, aren't
you taking on on the cost of decoding the bytestream into a character stream
?
- How do you deal with binary
files?
- What happens if
comparefile is ANSI while difffile is UNICODE
? I'm guessing that your comparison of thisFileContents !=
thatFileContents StreamReader may say that they are the same, even though
the files are physically different.
- What happens when you are
comparing two 20 MB files? Will there be enough memory to hold these two
strings?
- the variable named "isAMatch"
seems to be a misnomer. As I read the code, it seems to say that the files are a
match when the contents are not equal.
- the if statement clauses seem
backwards based on "isAMatch". It says that the files are different if isAMatch
is true.
- thatSR.Close() is outside the
foreach loop. I think it should be inside.
- constructing a FileInfo to be
used just in verbose logging seems like a waste.
[There's also the corner case
of alternate streams on Win32. Do you need to compare those streams as
well. I think most people just ignore this.]
- May I suggest using the
Stream class and just computing the MD5 hash of each of the files you are
comparing. A quick shortcut maybe inspecting the filesizes first before
investing into actual computing the hash.
-
Ants
|
Title: Message
- [nant-dev] Who's the happy moderator who ate my <... David Reed
- RE: [nant-dev] Who's the happy moderator who at... Anthony LoveFrancisco
- RE: [nant-dev] Who's the happy moderator who at... David Reed
- Re: [nant-dev] Who's the happy moderator wh... Ian MacLean
- RE: [nant-dev] Who's the happy moderator who at... Anthony LoveFrancisco
