Ali Bahaloo

Ali Bahaloo

  • NA
  • 1
  • 0

Comparing the contents of two different html files

Feb 11 2010 12:54 PM
Hello people...
This is my first post here and  i hope i get some pretty good help :)

I'm currently working on a windows form application that has a simple functionality, it should  work like this:
there are two .html files. these two files are selected using a openFileDialog. there is a button called "sync" in the form,
when this button is clicked, the contents of these two .html files should be compared and sync together, in this way; if one of the files contains some text more that the other file, then it should be added to the file... same goes the other way, so it should be this way for both files. in the end, i want both files to be the same (have the same content).
i've been thinking about this and came to this idea; i should first read the html content of the first file and then store it as a variable, then do the same scenario for the second html file. so now we have to string variables holding a line of text. then these two should be compared. if they are different; both lines should be written to a new file called "file.html", so a new file should be created containg two lines from those files. if after compare the lines are same, then it should be written to file.html.
how can i do this in C#?
i'm new to C# and learning it... quite nice :) so i would appreciate if some one could help me with my issue.

Thanking you in advance


Answers (2)