public abstract override void InstallPackage(InstallPackage action);
public virtual void InstallPackage(InstallPackage action) { }
public override void InstallPackage(InstallPackage action) { string packageFolder = Runner.Environment.Config.PackageFolder; string toolsFolder = Path.Combine(packageFolder, Constants.ToolsFolder); string targetPath = Runner.Variables.GetRequired<string>( Constants.ScriptVariables.TargetPath ); AddToInstallLog(new InstallLogCreateDirectory { Path = targetPath, Force = false }); if (!action.IntoRoot) targetPath = Path.Combine(targetPath, Constants.BinFolder); string tempPath = null; try { if (Runner.Mode == ScriptRunnerMode.Update) tempPath = RemoveCurrentTargetPath(targetPath); AddToInstallLog(new InstallLogCreateDirectory { Path = targetPath, Force = true }); string startMenuPath = Runner.Variables.GetOptional<string>( Constants.ScriptVariables.StartMenuPath ); if (!String.IsNullOrEmpty(startMenuPath)) { string startMenuBase = NativeMethods.SHGetFolderPath( IntPtr.Zero, NativeMethods.SpecialFolderCSIDL.CSIDL_STARTMENU, IntPtr.Zero, 0 ); startMenuPath = Path.Combine(startMenuBase, startMenuPath); AddToInstallLog(new InstallLogCreateDirectory { Path = startMenuPath, Force = false }); } int fileCount = Directory.GetFiles(toolsFolder, "*", SearchOption.AllDirectories).Length; if (fileCount == 0) return; int currentFile = 0; CopyDirectory(toolsFolder, targetPath, null, action.Overwrite, fileCount, ref currentFile); CreateUninstallShortCut(targetPath); } finally { if (tempPath != null) SEH.SinkExceptions(() => Directory.Delete(tempPath, true)); } }