You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #rnx #ROBOMERGE-OWNER: ryan.gerleve #ROBOMERGE-AUTHOR: ben.marsh #ROBOMERGE-SOURCE: CL 4732764 in //UE4/Main/... #ROBOMERGE-BOT: ENGINE (Main -> Dev-Networking) [CL 4733960 by ben marsh in Dev-Networking branch]
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Microsoft.Deployment.WindowsInstaller;
|
|
using System.IO;
|
|
using Microsoft.Win32;
|
|
using System.Diagnostics;
|
|
using System.Windows.Forms;
|
|
|
|
namespace InstallerCustomAction
|
|
{
|
|
public class CustomActions
|
|
{
|
|
[CustomAction]
|
|
public static ActionResult RemoveClickOnceInstalls(Session Session)
|
|
{
|
|
string ShortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "UnrealGameSync", "UnrealGameSync.appref-ms");
|
|
if(!File.Exists(ShortcutPath))
|
|
{
|
|
Session.Log("Couldn't find {0} - skipping uninstall", ShortcutPath);
|
|
return ActionResult.Success;
|
|
}
|
|
|
|
Record Record = new Record(1);
|
|
Record.FormatString = "The previous version of UnrealGameSync cannot be removed automatically.\n\nPlease uninstall from the following window.";
|
|
MessageResult Result = Session.Message(InstallMessage.User | (InstallMessage)MessageBoxButtons.OKCancel, Record);
|
|
if(Result == MessageResult.Cancel)
|
|
{
|
|
return ActionResult.UserExit;
|
|
}
|
|
|
|
Process NewProcess = Process.Start("rundll32.exe", "dfshim.dll,ShArpMaintain UnrealGameSync.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil");
|
|
NewProcess.WaitForExit();
|
|
|
|
if(File.Exists(ShortcutPath))
|
|
{
|
|
Record IgnoreRecord = new Record(1);
|
|
IgnoreRecord.FormatString = "UnrealSync is still installed. Install newer version anyway?";
|
|
|
|
if(Session.Message(InstallMessage.User | (InstallMessage)MessageBoxButtons.YesNo, IgnoreRecord) == MessageResult.No)
|
|
{
|
|
return ActionResult.UserExit;
|
|
}
|
|
}
|
|
|
|
return ActionResult.Success;
|
|
}
|
|
}
|
|
}
|