Wednesday, September 28, 2005

Using CompareHTML to compare postings

CompareHTML is a component which ships with MCMS which can be used to compare two postings. This blog explains how it can be used to compare two postings. It can be extended as needed.

Add a reference to CompareHTML.dll. Also your class must have reference to System.Net, System.IO, and COMPAREHTMLLib.

The code piece given below contains the part which can be used to compare two postings. As it is simple and self explanatory, I’m not going to walk through that.

//Web client is used to get the content from the server
using(WebClient webClient = new WebClient())
{
NetworkCredential networkCredential = new NetworkCredential("username","password","domain");
webClient.Credentials = networkCredential;
string firstPosting = "";
string secondPosting = "";
using(Stream networkStream = webClient.OpenRead("first posting's url"))
{
using(StreamReader streamReader = new StreamReader(networkStream))
{
firstPosting = streamReader.ReadToEnd();
}
}
using(Stream networkStream = webClient.OpenRead("second posting's url"))
{
using(StreamReader streamReader = new StreamReader(networkStream))
{
secondPosting = streamReader.ReadToEnd();
}
}
//This is from CompareHTML.dll, which will compare both the content.
Compare postingCompare = new CompareClass();
string comparedPosting = postingCompare.CompareBuffers(firstPosting,secondPosting,false);
string pathDiffFile = "a place to save the compared html file";
using(StreamWriter streamWriter = new StreamWriter(pathDiffFile))
{
streamWriter.Write(comparedPosting);
}
//This is to open the created html file.
System.Diagnostics.Process.Start(pathDiffFile);
}

Note : As CompareHTML.dll is not documented, take precautions before using it as it may change at any stage without any notification. Also reverse engineering CompareHTML is a license violation!

Labels: , ,

Friday, September 16, 2005

MCMS Manager 4.3

This version includes

1. Posting Revert.
2. Resource Replace.
3. Multiple posting Approve, Submit, decline etc...

Download the newer version of MCMS Manager from here. Please post your feedbacks.

Labels: , ,

Monday, September 05, 2005

MCMS Manager 4.2

I've got plenty of feedbacks on ‘slowness’ of the current version of MCMS Manager compared with old ones. So, in this version I’ve used zip-compression to reduce the time taken for response. I hope this will be faster than the old one.

Also with MCMS Manager 4.2, ‘Local MCMS API’ can be directly accessed by leaving the web service part in the login form blank. This will be surely faster than via web service. Go to MCMS Manager Site and download the new version. Please post your feedbacks!