public static void Uninstall(Cancelable cancelable) { ExplorerContextMenuAdder.Unregister(); // -- var baseFolderPath = Installer.InstallationFolderPath; if (!Directory.Exists(baseFolderPath)) { return; } foreach (var directory in Directory.GetDirectories(baseFolderPath)) { CancelHelper.CheckThrowCancel(cancelable); Directory.Delete(directory, true); } foreach (var file in Directory.GetFiles(baseFolderPath)) { if (!string.Equals(Installer.InstallationExeFilePath, file, StringComparison.InvariantCultureIgnoreCase)) { CancelHelper.CheckThrowCancel(cancelable); File.Delete(file); } } // -- try { File.Delete(Installer.InstallationExeFilePath); } catch (Exception) { postPoneDeleteFile(Installer.InstallationExeFilePath); } try { Directory.Delete(Installer.InstallationFolderPath); } catch (Exception) { postPoneDeleteFile(Installer.InstallationFolderPath); } }
public static void Install( Cancelable cancelable) { if (IsInstalled) { return; } Directory.CreateDirectory(InstallationFolderPath); File.Copy( Assembly.GetEntryAssembly().Location, InstallationExeFilePath, true); ExplorerContextMenuAdder.Register(); }