class IEUtil {
public static void openIE(string url) {
try {
//(url);
p = new ();
= "";
= url;
();
} catch(Exception ex) {
("openIE" + url + "----------" + );
}
}
public static void closeAllIEProcess() {
string defaultBrowserName = GetDefaultBrowerName();
[] procs = ("IEXPLORE");
foreach( proc in procs) {
();
}
}
public static void CleanCookie() {
try {
string[] theFiles = ((), "*", );
foreach(string s in theFiles) FileDelete(s);
} catch(Exception e) {
("Delete cookie error" + );
}
}
static bool FileDelete(string path) {
//first set the File's ReadOnly to 0
//if EXP, restore its Attributes
file = new (path);
att = 0;
bool attModified = false;
try {
//### ATT_GETnSET
att = ;
&= (~);
attModified = true;
();
} catch(Exception e) {
if (attModified) = att;
return false;
}
return true;
}
public static string GetDefaultBrowerName() {
string mainKey = @"http\shell\open\command";
string nameKey = @"http\shell\open\ddeexec\Application";
string strRet = ;
try {
RegistryKey regKey = (nameKey);
strRet = ("").ToString();
} catch {
strRet = "";
}
return strRet;
}
/// <summary>
/// Clear folder
/// </summary>
/// <param name="path">Folder path</param>
static void FolderClear(string path) {
diPath = new (path);
if () {
foreach( fiCurrFile in ()) {
FileDelete();
}
foreach( diSubFolder in ()) {
FolderClear();
// Call recursively for all subfolders
}
}
}
/// <summary>
/// Execute the command line
/// </summary>
/// <param name="cmd"></param>
static void RunCmd(string cmd) {
ProcessStartInfo p = new ProcessStartInfo();
= "";
= "/c " + cmd;
= ; // Use a hidden window
(p);
}
/// <summary>
/// Delete temporary files
/// </summary>
public static void CleanTempFiles() {
FolderClear(());
RunCmd(" ,ClearMyTracksByProcess 8");
}
}