예제 #1
0
 public abstract override void InstallPackage(InstallPackage action);
예제 #2
0
 public abstract override void InstallPackage(InstallPackage action);
예제 #3
0
 public virtual void InstallPackage(InstallPackage action)
 {
 }
예제 #4
0
 public virtual void InstallPackage(InstallPackage action)
 {
 }
예제 #5
0
            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));
                }
            }