public bool install() { if (this.isInstalled().isFalse()) { "[API_Fiddler] Starting Fiddler installation process".info(); var fiddlerInstaller = this.installerFile(); var guiAutomation = new API_GuiAutomation(); guiAutomation.launch(fiddlerInstaller); var installWindow = guiAutomation.window("Fiddler2 Setup: License Agreement"); installWindow.button("I Agree").click(); var installTextBox = installWindow.textBox(@"C:\Program Files\Fiddler2"); installTextBox.set_Text(this.Install_Dir); if (installTextBox.get_Text() == this.Install_Dir) { installWindow.button("Install").click(); } else { "[API_Fiddler] in install automation, rrror setting the target directory".error(); } installWindow.button("Close").click(); "[API_Fiddler] Fiddler installation complete".info(); } if (this.isInstalled()) { "[API_Fiddler] Fiddler is installed in folder:{0}".info(this.Install_Dir); return(true); } "[API_Fiddler] Counld NOT find Fiddler installation in folder:{0}".info(this.Install_Dir); return(false); }
public override bool unInstall() { if (this.isInstalled() && this.Uninstall_Exe.fileExists()) { "[API_Fiddler] Starting Fiddler UnInstall process".info(); var guiAutomation = new API_GuiAutomation(); guiAutomation.launch(this.Uninstall_Exe); var processID = guiAutomation.TargetProcess.Id; //var finder = new AutomationElementFinder(AutomationElement.RootElement); var uninstallWindow = guiAutomation.desktopWindow("Fiddler2 Uninstall: Confirmation"); uninstallWindow.button("Uninstall").click(); uninstallWindow.button("Close").click(); "[API_Fiddler] Fiddler UnInstall complete".info(); if (this.isInstalled().isFalse()) { return(true); } "[API_Fiddler] There was an error in the UnInstall process (since fiddler is still installed)".info(); return(false); } "[API_Fiddler] in unInstall, Fiddler is not installed, so nothing to do".debug(); return(false); }