Created unity project
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Codice.Client.Common;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal static class AuthToken
|
||||
{
|
||||
internal static string GetForServer(string server)
|
||||
{
|
||||
ServerProfile serverProfile = CmConnection.Get().
|
||||
GetProfileManager().GetProfileForServer(server);
|
||||
|
||||
string authToken = serverProfile != null ?
|
||||
CmConnection.Get().
|
||||
BuildWebApiTokenForCloudEditionForUser(
|
||||
serverProfile.Server,
|
||||
serverProfile.GetSEIDWorkingMode(),
|
||||
serverProfile.SecurityConfig):
|
||||
CmConnection.Get().
|
||||
BuildWebApiTokenForCloudEditionForUser(
|
||||
server,
|
||||
ClientConfig.Get().GetSEIDWorkingMode(),
|
||||
ClientConfig.Get().GetSecurityConfig());
|
||||
|
||||
if (string.IsNullOrEmpty(authToken))
|
||||
{
|
||||
authToken = CmConnection.Get().
|
||||
BuildWebApiTokenForCloudEditionDefaultUser();
|
||||
}
|
||||
|
||||
return authToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 537d6b35c9cc8bd42a656dfc8cb64948
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal static class BringWindowToFront
|
||||
{
|
||||
internal static void ForWindowsProcess(int processId)
|
||||
{
|
||||
IntPtr handle = FindMainWindowForProcess(processId);
|
||||
|
||||
if (IsIconic(handle))
|
||||
ShowWindow(handle, SW_RESTORE);
|
||||
|
||||
SetForegroundWindow(handle);
|
||||
}
|
||||
|
||||
static IntPtr FindMainWindowForProcess(int processId)
|
||||
{
|
||||
IntPtr result = IntPtr.Zero;
|
||||
|
||||
EnumWindows(delegate (IntPtr wnd, IntPtr param)
|
||||
{
|
||||
uint windowProcessId = 0;
|
||||
GetWindowThreadProcessId(wnd, out windowProcessId);
|
||||
|
||||
if (windowProcessId == processId &&
|
||||
IsMainWindow(wnd))
|
||||
{
|
||||
result = wnd;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}, IntPtr.Zero);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool IsMainWindow(IntPtr handle)
|
||||
{
|
||||
return GetWindow(new HandleRef(null, handle), GW_OWNER) == IntPtr.Zero
|
||||
&& IsWindowVisible(new HandleRef(null, handle));
|
||||
}
|
||||
|
||||
// Delegate to filter which windows to include
|
||||
delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||||
static extern IntPtr GetWindow(HandleRef hWnd, int uCmd);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
static extern bool IsWindowVisible(HandleRef hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool ShowWindow(IntPtr handle, int nCmdShow);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool SetForegroundWindow(IntPtr handle);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool IsIconic(IntPtr handle);
|
||||
|
||||
const int GW_OWNER = 4;
|
||||
const int SW_RESTORE = 9;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc5c1fa3d4519114cb21f3fedfe6039d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal static class FindTool
|
||||
{
|
||||
internal static string ObtainToolCommand(
|
||||
string toolName, List<string> installationPaths)
|
||||
{
|
||||
List<string> processPaths = GetPathsFromEnvVariable(
|
||||
PATH_ENVIRONMENT_VARIABLE,
|
||||
EnvironmentVariableTarget.Process);
|
||||
|
||||
List<string> machinePaths = GetPathsFromEnvVariable(
|
||||
PATH_ENVIRONMENT_VARIABLE,
|
||||
EnvironmentVariableTarget.Machine);
|
||||
|
||||
List<string> pathsToLookup = new List<string>();
|
||||
pathsToLookup.AddRange(processPaths);
|
||||
pathsToLookup.AddRange(machinePaths);
|
||||
pathsToLookup.AddRange(installationPaths);
|
||||
|
||||
string toolPath = FindToolInPaths(toolName, pathsToLookup);
|
||||
|
||||
if (string.IsNullOrEmpty(toolPath))
|
||||
return null;
|
||||
|
||||
EnsureIsInProcessPathEnvVariable(toolPath, processPaths);
|
||||
|
||||
return toolPath;
|
||||
}
|
||||
|
||||
static string FindToolInPaths(
|
||||
string toolName,
|
||||
List<string> paths)
|
||||
{
|
||||
foreach (string path in paths)
|
||||
{
|
||||
if (path == null)
|
||||
continue;
|
||||
|
||||
if (path.Trim() == string.Empty)
|
||||
continue;
|
||||
|
||||
string filePath = CleanFolderPath(path);
|
||||
|
||||
filePath = Path.Combine(filePath, toolName);
|
||||
|
||||
if (File.Exists(filePath))
|
||||
return Path.GetFullPath(filePath);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static string CleanFolderPath(string folderPath)
|
||||
{
|
||||
foreach (char c in Path.GetInvalidPathChars())
|
||||
folderPath = folderPath.Replace(c.ToString(), string.Empty);
|
||||
|
||||
return folderPath;
|
||||
}
|
||||
|
||||
static List<string> GetPathsFromEnvVariable(
|
||||
string variableName,
|
||||
EnvironmentVariableTarget target)
|
||||
{
|
||||
string value = Environment.GetEnvironmentVariable(variableName, target);
|
||||
return new List<string>(value.Split(Path.PathSeparator));
|
||||
}
|
||||
|
||||
static void EnsureIsInProcessPathEnvVariable(
|
||||
string toolPath,
|
||||
List<string> processPaths)
|
||||
{
|
||||
string plasticInstallDir = Path.GetDirectoryName(toolPath);
|
||||
|
||||
if (processPaths.Contains(plasticInstallDir, StringComparer.OrdinalIgnoreCase))
|
||||
return;
|
||||
|
||||
Environment.SetEnvironmentVariable(
|
||||
PATH_ENVIRONMENT_VARIABLE,
|
||||
string.Concat(plasticInstallDir, Path.PathSeparator, processPaths),
|
||||
EnvironmentVariableTarget.Process);
|
||||
}
|
||||
|
||||
const string PATH_ENVIRONMENT_VARIABLE = "PATH";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e0d1d689c88f76448cad390443d7ba3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using Codice.Client.Common;
|
||||
using Codice.LogWrapper;
|
||||
using Codice.Utils;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal static class IsExeAvailable
|
||||
{
|
||||
internal static bool ForMode(bool isGluonMode)
|
||||
{
|
||||
string toolPath = isGluonMode ?
|
||||
PlasticInstallPath.GetGluonExePath() :
|
||||
PlasticInstallPath.GetPlasticExePath();
|
||||
|
||||
return !string.IsNullOrEmpty(toolPath);
|
||||
}
|
||||
|
||||
internal static bool ForLocalServer()
|
||||
{
|
||||
return !string.IsNullOrEmpty(PlasticInstallPath.GetLocalPlasticServerExePath());
|
||||
}
|
||||
}
|
||||
|
||||
internal static class PlasticInstallPath
|
||||
{
|
||||
internal static string GetClientBinDir()
|
||||
{
|
||||
if (PlatformIdentifier.IsWindows())
|
||||
{
|
||||
string plasticExePath = GetPlasticExePath();
|
||||
|
||||
if (plasticExePath == null)
|
||||
return null;
|
||||
|
||||
return Path.GetDirectoryName(plasticExePath);
|
||||
}
|
||||
|
||||
if (PlatformIdentifier.IsMac())
|
||||
{
|
||||
string path = GetToolCommand(Plastic.NEW_GUI_MACOS);
|
||||
if (path != null)
|
||||
return GetExistingDir(ToolConstants.NEW_MACOS_BINDIR);
|
||||
|
||||
return GetExistingDir(ToolConstants.LEGACY_MACOS_BINDIR);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static string GetPlasticExePath()
|
||||
{
|
||||
if (PlatformIdentifier.IsWindows())
|
||||
return FindTool.ObtainToolCommand(
|
||||
Plastic.GUI_WINDOWS,
|
||||
new List<String>() { GetWindowsClientInstallationFolder() });
|
||||
|
||||
if (PlatformIdentifier.IsMac())
|
||||
{
|
||||
string path = GetToolCommand(Plastic.NEW_GUI_MACOS);
|
||||
if(path != null)
|
||||
return path;
|
||||
|
||||
return GetToolCommand(Plastic.LEGACY_GUI_MACOS);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static string GetGluonExePath()
|
||||
{
|
||||
if (PlatformIdentifier.IsWindows())
|
||||
return FindTool.ObtainToolCommand(
|
||||
Gluon.GUI_WINDOWS,
|
||||
new List<String>() { GetWindowsClientInstallationFolder() });
|
||||
|
||||
if (PlatformIdentifier.IsMac())
|
||||
{
|
||||
string path = GetToolCommand(Gluon.NEW_GUI_MACOS);
|
||||
if (path != null)
|
||||
return path;
|
||||
|
||||
return GetToolCommand(Gluon.LEGACY_GUI_MACOS);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static string GetLocalPlasticServerExePath()
|
||||
{
|
||||
if (PlatformIdentifier.IsWindows())
|
||||
{
|
||||
return FindTool.ObtainToolCommand(
|
||||
Plastic.LOCAL_SERVER_WINDOWS,
|
||||
new List<String>() { GetWindowsServerInstallationFolder() });
|
||||
}
|
||||
|
||||
if (PlatformIdentifier.IsMac())
|
||||
{
|
||||
return GetToolCommand(Plastic.LOCAL_SERVER_MACOS);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static void LogInstallationInfo()
|
||||
{
|
||||
string plasticClientBinDir = GetClientBinDir();
|
||||
|
||||
if (string.IsNullOrEmpty(plasticClientBinDir))
|
||||
{
|
||||
mLog.DebugFormat("No installation found, behaving as {0} Edition",
|
||||
EditionToken.IsCloudEdition() ? "Cloud" : "Enterprise");
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isCloudPlasticInstall = File.Exists(Path.Combine(plasticClientBinDir, EditionToken.CLOUD_EDITION_FILE_NAME));
|
||||
|
||||
mLog.DebugFormat("{0} Edition detected - installation directory: {1}",
|
||||
isCloudPlasticInstall ? "Cloud" : "Enterprise",
|
||||
plasticClientBinDir);
|
||||
mLog.DebugFormat("Local token: {0} Edition",
|
||||
EditionToken.IsCloudEdition() ? "Cloud" : "Enterprise");
|
||||
}
|
||||
}
|
||||
|
||||
static string GetToolCommand(string tool)
|
||||
{
|
||||
return File.Exists(tool) ? tool : null;
|
||||
}
|
||||
|
||||
static string GetExistingDir(string directory)
|
||||
{
|
||||
return Directory.Exists(directory) ? directory : null;
|
||||
}
|
||||
|
||||
static string GetWindowsClientInstallationFolder()
|
||||
{
|
||||
string programFilesFolder = Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.ProgramFiles);
|
||||
|
||||
return Path.Combine(Path.Combine(programFilesFolder,
|
||||
PLASTICSCM_FOLDER), PLASTICSCM_CLIENT_SUBFOLDER);
|
||||
}
|
||||
|
||||
static string GetWindowsServerInstallationFolder()
|
||||
{
|
||||
string programFilesFolder = Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.ProgramFiles);
|
||||
|
||||
return Path.Combine(Path.Combine(programFilesFolder,
|
||||
PLASTICSCM_FOLDER), PLASTICSCM_SERVER_SUBFOLDER);
|
||||
}
|
||||
|
||||
const string PLASTICSCM_FOLDER = "PlasticSCM5";
|
||||
const string PLASTICSCM_CLIENT_SUBFOLDER = "client";
|
||||
const string PLASTICSCM_SERVER_SUBFOLDER = "server";
|
||||
|
||||
static readonly ILog mLog = PlasticApp.GetLogger("PlasticInstallPath");
|
||||
|
||||
class Plastic
|
||||
{
|
||||
internal const string GUI_WINDOWS = "plastic.exe";
|
||||
internal const string LOCAL_SERVER_WINDOWS = "plasticd.exe";
|
||||
internal const string LEGACY_GUI_MACOS = "/Applications/PlasticSCM.app/Contents/MacOS/PlasticSCM";
|
||||
internal const string NEW_GUI_MACOS = "/Applications/PlasticSCM.app/Contents/MacOS/macplasticx";
|
||||
internal const string LOCAL_SERVER_MACOS = "/Applications/PlasticSCMServer.app/Contents/MacOS/plasticd";
|
||||
}
|
||||
|
||||
class Gluon
|
||||
{
|
||||
internal const string GUI_WINDOWS = "gluon.exe";
|
||||
internal const string LEGACY_GUI_MACOS = "/Applications/Gluon.app/Contents/MacOS/Gluon";
|
||||
internal const string NEW_GUI_MACOS = "/Applications/Gluon.app/Contents/MacOS/macgluonx";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f25df29da91c45449ada5f3da8cf20ea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
using Codice.Utils;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal static class LaunchInstaller
|
||||
{
|
||||
internal static Process ForPlatform(string installerPath)
|
||||
{
|
||||
if (PlatformIdentifier.IsMac())
|
||||
{
|
||||
return Process.Start(
|
||||
ToolConstants.Installer.INSTALLER_MACOS_OPEN,
|
||||
string.Format(ToolConstants.Installer.INSTALLER_MACOS_OPEN_ARGS, installerPath));
|
||||
}
|
||||
|
||||
return Process.Start(
|
||||
installerPath,
|
||||
ToolConstants.Installer.INSTALLER_WINDOWS_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b405b01c6be83742bc000fb416b4dbf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,463 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
using Codice.Client.Common.EventTracking;
|
||||
using Codice.CM.Common;
|
||||
using Codice.LogWrapper;
|
||||
using Codice.Utils;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.Views;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal static class LaunchTool
|
||||
{
|
||||
public interface IShowDownloadPlasticExeWindow
|
||||
{
|
||||
bool Show(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
string installCloudFrom,
|
||||
string installEnterpriseFrom,
|
||||
string cancelInstallFrom);
|
||||
bool Show(
|
||||
RepositorySpec repSpec,
|
||||
bool isGluonMode,
|
||||
string installCloudFrom,
|
||||
string installEnterpriseFrom,
|
||||
string cancelInstallFrom);
|
||||
}
|
||||
|
||||
public interface IProcessExecutor
|
||||
{
|
||||
Process ExecuteGUI(
|
||||
string program,
|
||||
string args,
|
||||
string commandFileArg,
|
||||
string commandFileName,
|
||||
int processId);
|
||||
Process ExecuteWindowsGUI(
|
||||
string program,
|
||||
string args,
|
||||
int processId);
|
||||
Process ExecuteProcess(string program, string args);
|
||||
}
|
||||
|
||||
internal static void OpenGUIForMode(
|
||||
IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
IProcessExecutor processExecutor,
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode)
|
||||
{
|
||||
if (showDownloadPlasticExeWindow.Show(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromOpenGUI,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromOpenGUI,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromOpenGUI))
|
||||
return;
|
||||
|
||||
mLog.DebugFormat(
|
||||
"Opening GUI on wkPath '{0}'.",
|
||||
wkInfo.ClientPath);
|
||||
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
isGluonMode ?
|
||||
TrackFeatureUseEvent.Features.LaunchGluonTool :
|
||||
TrackFeatureUseEvent.Features.LaunchPlasticTool);
|
||||
|
||||
if (isGluonMode)
|
||||
{
|
||||
Process gluonProcess = processExecutor.ExecuteGUI(
|
||||
PlasticInstallPath.GetGluonExePath(),
|
||||
string.Format(
|
||||
ToolConstants.Gluon.GUI_WK_EXPLORER_ARG,
|
||||
wkInfo.ClientPath),
|
||||
ToolConstants.Gluon.GUI_COMMAND_FILE_ARG,
|
||||
ToolConstants.Gluon.GUI_COMMAND_FILE,
|
||||
mGluonProcessId);
|
||||
|
||||
if (gluonProcess != null)
|
||||
mGluonProcessId = gluonProcess.Id;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlatformIdentifier.IsMac())
|
||||
{
|
||||
Process plasticProcess = processExecutor.ExecuteGUI(
|
||||
PlasticInstallPath.GetPlasticExePath(),
|
||||
string.Format(
|
||||
ToolConstants.Plastic.GUI_MACOS_WK_EXPLORER_ARG,
|
||||
wkInfo.ClientPath),
|
||||
ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE_ARG,
|
||||
ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE,
|
||||
mPlasticProcessId);
|
||||
|
||||
if (plasticProcess != null)
|
||||
mPlasticProcessId = plasticProcess.Id;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
processExecutor.ExecuteProcess(
|
||||
PlasticInstallPath.GetPlasticExePath(),
|
||||
string.Format(
|
||||
ToolConstants.Plastic.GUI_WINDOWS_WK_ARG,
|
||||
wkInfo.ClientPath));
|
||||
}
|
||||
|
||||
internal static void OpenBranchExplorer(
|
||||
IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
IProcessExecutor processExecutor,
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode)
|
||||
{
|
||||
if (showDownloadPlasticExeWindow.Show(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromOpenBranchExplorer,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromOpenBranchExplorer,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromOpenBranchExplorer))
|
||||
return;
|
||||
|
||||
mLog.DebugFormat(
|
||||
"Opening Branch Explorer on wkPath '{0}'.",
|
||||
wkInfo.ClientPath);
|
||||
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
TrackFeatureUseEvent.Features.LaunchBranchExplorer);
|
||||
|
||||
if (PlatformIdentifier.IsMac())
|
||||
{
|
||||
Process plasticProcess = processExecutor.ExecuteGUI(
|
||||
PlasticInstallPath.GetPlasticExePath(),
|
||||
string.Format(
|
||||
ToolConstants.Plastic.GUI_MACOS_BREX_ARG,
|
||||
wkInfo.ClientPath),
|
||||
ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE_ARG,
|
||||
ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE,
|
||||
mPlasticProcessId);
|
||||
|
||||
if (plasticProcess != null)
|
||||
mPlasticProcessId = plasticProcess.Id;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Process brexProcess = processExecutor.ExecuteWindowsGUI(
|
||||
PlasticInstallPath.GetPlasticExePath(),
|
||||
string.Format(
|
||||
ToolConstants.Plastic.GUI_WINDOWS_BREX_ARG,
|
||||
wkInfo.ClientPath),
|
||||
mBrexProcessId);
|
||||
|
||||
if (brexProcess != null)
|
||||
mBrexProcessId = brexProcess.Id;
|
||||
}
|
||||
|
||||
internal static void OpenChangesetDiffs(
|
||||
IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
IProcessExecutor processExecutor,
|
||||
RepositorySpec repSpec,
|
||||
string fullChangesetSpec,
|
||||
bool isGluonMode)
|
||||
{
|
||||
if (showDownloadPlasticExeWindow.Show(
|
||||
repSpec,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromOpenChangesetDiffs,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromOpenChangesetDiffs,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromOpenChangesetDiffs))
|
||||
return;
|
||||
|
||||
mLog.DebugFormat(
|
||||
"Launching changeset diffs for '{0}'",
|
||||
fullChangesetSpec);
|
||||
|
||||
string exePath = (isGluonMode) ?
|
||||
PlasticInstallPath.GetGluonExePath() :
|
||||
PlasticInstallPath.GetPlasticExePath();
|
||||
|
||||
string changesetDiffArg = (isGluonMode) ?
|
||||
ToolConstants.Gluon.GUI_CHANGESET_DIFF_ARG :
|
||||
ToolConstants.Plastic.GUI_CHANGESET_DIFF_ARG;
|
||||
|
||||
processExecutor.ExecuteProcess(exePath,
|
||||
string.Format(
|
||||
changesetDiffArg, fullChangesetSpec));
|
||||
}
|
||||
|
||||
internal static void OpenSelectedChangesetsDiffs(
|
||||
IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
IProcessExecutor processExecutor,
|
||||
RepositorySpec repSpec,
|
||||
string srcFullChangesetSpec,
|
||||
string dstFullChangesetSpec,
|
||||
bool isGluonMode)
|
||||
{
|
||||
if (showDownloadPlasticExeWindow.Show(
|
||||
repSpec,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromOpenSelectedChangesetsDiffs,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromOpenSelectedChangesetsDiffs,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromOpenSelectedChangesetsDiffs))
|
||||
return;
|
||||
|
||||
mLog.DebugFormat(
|
||||
"Launching selected changesets diffs for '{0}' and '{1}'",
|
||||
srcFullChangesetSpec,
|
||||
dstFullChangesetSpec);
|
||||
|
||||
string exePath = (isGluonMode) ?
|
||||
PlasticInstallPath.GetGluonExePath() :
|
||||
PlasticInstallPath.GetPlasticExePath();
|
||||
|
||||
string selectedChangesetsDiffArgs = (isGluonMode) ?
|
||||
ToolConstants.Gluon.GUI_SELECTED_CHANGESETS_DIFF_ARGS :
|
||||
ToolConstants.Plastic.GUI_SELECTED_CHANGESETS_DIFF_ARGS;
|
||||
|
||||
processExecutor.ExecuteProcess(exePath,
|
||||
string.Format(
|
||||
selectedChangesetsDiffArgs,
|
||||
srcFullChangesetSpec,
|
||||
dstFullChangesetSpec));
|
||||
}
|
||||
|
||||
internal static void OpenBranchDiffs(
|
||||
IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
IProcessExecutor processExecutor,
|
||||
RepositorySpec repSpec,
|
||||
string fullBranchSpec,
|
||||
bool isGluonMode)
|
||||
{
|
||||
if (showDownloadPlasticExeWindow.Show(
|
||||
repSpec,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromOpenBranchDiff,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromOpenBranchDiff,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromOpenBranchDiff))
|
||||
return;
|
||||
|
||||
mLog.DebugFormat(
|
||||
"Launching branch diffs for '{0}'",
|
||||
fullBranchSpec);
|
||||
|
||||
string exePath = (isGluonMode) ?
|
||||
PlasticInstallPath.GetGluonExePath() :
|
||||
PlasticInstallPath.GetPlasticExePath();
|
||||
|
||||
string branchDiffArg = (isGluonMode) ?
|
||||
ToolConstants.Gluon.GUI_BRANCH_DIFF_ARG :
|
||||
ToolConstants.Plastic.GUI_BRANCH_DIFF_ARG;
|
||||
|
||||
processExecutor.ExecuteProcess(exePath,
|
||||
string.Format(
|
||||
branchDiffArg, fullBranchSpec));
|
||||
}
|
||||
|
||||
internal static void OpenWorkspaceConfiguration(
|
||||
IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
IProcessExecutor processExecutor,
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode)
|
||||
{
|
||||
if (showDownloadPlasticExeWindow.Show(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromOpenWorkspaceConfiguration,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromOpenWorkspaceConfiguration,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromOpenWorkspaceConfiguration))
|
||||
return;
|
||||
|
||||
mLog.DebugFormat(
|
||||
"Opening Workspace Configuration on wkPath '{0}'.",
|
||||
wkInfo.ClientPath);
|
||||
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
TrackFeatureUseEvent.Features.LaunchPartialConfigure);
|
||||
|
||||
Process gluonProcess = processExecutor.ExecuteGUI(
|
||||
PlasticInstallPath.GetGluonExePath(),
|
||||
string.Format(
|
||||
ToolConstants.Gluon.GUI_WK_CONFIGURATION_ARG,
|
||||
wkInfo.ClientPath),
|
||||
ToolConstants.Gluon.GUI_COMMAND_FILE_ARG,
|
||||
ToolConstants.Gluon.GUI_COMMAND_FILE,
|
||||
mGluonProcessId);
|
||||
|
||||
if (gluonProcess == null)
|
||||
return;
|
||||
|
||||
mGluonProcessId = gluonProcess.Id;
|
||||
}
|
||||
|
||||
static int mPlasticProcessId = -1;
|
||||
static int mGluonProcessId = -1;
|
||||
static int mBrexProcessId = -1;
|
||||
|
||||
static readonly ILog mLog = PlasticApp.GetLogger("LaunchTool");
|
||||
|
||||
internal class ShowDownloadPlasticExeWindow : LaunchTool.IShowDownloadPlasticExeWindow
|
||||
{
|
||||
bool LaunchTool.IShowDownloadPlasticExeWindow.Show(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
string installCloudFrom,
|
||||
string installEnterpriseFrom,
|
||||
string cancelInstallFrom)
|
||||
{
|
||||
RepositorySpec repSpec = PlasticGui.Plastic.API.GetRepositorySpec(wkInfo);
|
||||
|
||||
return ((LaunchTool.IShowDownloadPlasticExeWindow)this).Show(
|
||||
repSpec,
|
||||
isGluonMode,
|
||||
installCloudFrom,
|
||||
installEnterpriseFrom,
|
||||
cancelInstallFrom);
|
||||
}
|
||||
|
||||
bool LaunchTool.IShowDownloadPlasticExeWindow.Show(
|
||||
RepositorySpec repSpec,
|
||||
bool isGluonMode,
|
||||
string installCloudFrom,
|
||||
string installEnterpriseFrom,
|
||||
string cancelInstallFrom)
|
||||
{
|
||||
if (IsExeAvailable.ForMode(isGluonMode))
|
||||
return false;
|
||||
|
||||
GUIActionRunner.RunGUIAction(() =>
|
||||
{
|
||||
mData = DownloadPlasticExeDialog.Show(
|
||||
repSpec,
|
||||
isGluonMode,
|
||||
installCloudFrom,
|
||||
installEnterpriseFrom,
|
||||
cancelInstallFrom,
|
||||
mData != null && !string.IsNullOrEmpty(mData.ProgressMessage) ? mData : null);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
UI.UIElements.ProgressControlsForDialogs.Data mData;
|
||||
}
|
||||
|
||||
internal class ProcessExecutor : LaunchTool.IProcessExecutor
|
||||
{
|
||||
Process LaunchTool.IProcessExecutor.ExecuteGUI(
|
||||
string program,
|
||||
string args,
|
||||
string commandFileArg,
|
||||
string commandFileName,
|
||||
int processId)
|
||||
{
|
||||
string commandFile = Path.Combine(
|
||||
Path.GetTempPath(), commandFileName);
|
||||
|
||||
Process process = GetGUIProcess(program, processId);
|
||||
|
||||
if (process == null)
|
||||
{
|
||||
mLog.DebugFormat("Executing {0} (new process).", program);
|
||||
|
||||
return ((LaunchTool.IProcessExecutor)this).ExecuteProcess(
|
||||
program, args + string.Format(commandFileArg, commandFile));
|
||||
}
|
||||
|
||||
mLog.DebugFormat("Executing {0} (reuse process pid:{1}).", program, processId);
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(new FileStream(
|
||||
commandFile, FileMode.Append, FileAccess.Write, FileShare.Read)))
|
||||
{
|
||||
writer.WriteLine(args);
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
|
||||
Process LaunchTool.IProcessExecutor.ExecuteWindowsGUI(
|
||||
string program,
|
||||
string args,
|
||||
int processId)
|
||||
{
|
||||
Process process = GetGUIProcess(program, processId);
|
||||
|
||||
if (process == null)
|
||||
{
|
||||
mLog.DebugFormat("Executing {0} (new process).", program);
|
||||
|
||||
return ((LaunchTool.IProcessExecutor)this).ExecuteProcess(program, args);
|
||||
}
|
||||
|
||||
mLog.DebugFormat("Not executing {0} (existing process pid:{1}).", program, processId);
|
||||
|
||||
BringWindowToFront.ForWindowsProcess(process.Id);
|
||||
|
||||
return process;
|
||||
}
|
||||
|
||||
Process LaunchTool.IProcessExecutor.ExecuteProcess(string program, string args)
|
||||
{
|
||||
mLog.DebugFormat("Execute process: '{0} {1}'", program, args);
|
||||
|
||||
Process process = BuildProcess(program, args);
|
||||
|
||||
try
|
||||
{
|
||||
process.Start();
|
||||
|
||||
return process;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mLog.ErrorFormat("Couldn't execute the program {0}: {1}",
|
||||
program, ex.Message);
|
||||
mLog.DebugFormat("Stack trace: {0}",
|
||||
ex.StackTrace);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Process BuildProcess(string program, string args)
|
||||
{
|
||||
Process result = new Process();
|
||||
result.StartInfo.FileName = program;
|
||||
result.StartInfo.Arguments = args;
|
||||
result.StartInfo.CreateNoWindow = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
Process GetGUIProcess(string program, int processId)
|
||||
{
|
||||
if (processId == -1)
|
||||
return null;
|
||||
|
||||
mLog.DebugFormat("Checking {0} process [pid:{1}].", program, processId);
|
||||
|
||||
try
|
||||
{
|
||||
Process process = Process.GetProcessById(processId);
|
||||
|
||||
if (process == null)
|
||||
return null;
|
||||
|
||||
return process.HasExited ? null : process;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// process is not running
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
readonly ILog mLog = PlasticApp.GetLogger("ProcessExecutor");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6d05b29e607e62478df26227566e1b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,269 @@
|
||||
using Codice.Client.Commands;
|
||||
using Codice.Client.Common.EventTracking;
|
||||
using Codice.CM.Common;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal class PlasticExeLauncher : IToolLauncher
|
||||
{
|
||||
internal interface ICheckIsExeAvailable
|
||||
{
|
||||
bool ForMode(bool isGluonMode);
|
||||
}
|
||||
|
||||
internal interface IProcessExecutor
|
||||
{
|
||||
bool Execute(string tool, string arguments, bool bWait);
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForDiffContributors(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffContributors,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffContributors,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffContributors,
|
||||
false,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForDiffWorkspaceContent(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffWorkspaceContent,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffWorkspaceContent,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffWorkspaceContent,
|
||||
false,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForShowDiff(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromShowDiff,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromFromShowDiff,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromFromShowDiff,
|
||||
false,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForDiffRevision(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffRevision,
|
||||
false,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForDiffRevision(
|
||||
RepositorySpec repSpec,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
repSpec,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffRevision,
|
||||
false,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForDiffSelectedRevisions(
|
||||
RepositorySpec repSpec,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
repSpec,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffRevision,
|
||||
false,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForResolveConflicts(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromResolveConflicts,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromResolveConflicts,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromResolveConflicts,
|
||||
true,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
internal static PlasticExeLauncher BuildForMergeSelectedFiles(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable = null,
|
||||
IProcessExecutor processExecutor = null)
|
||||
{
|
||||
return new PlasticExeLauncher(
|
||||
wkInfo,
|
||||
isGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromMergeSelectedFiles,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromMergeSelectedFiles,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromMergeSelectedFiles,
|
||||
true,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable ?? new CheckIsExeAvailable(),
|
||||
processExecutor ?? new ProcessExecutor());
|
||||
}
|
||||
|
||||
PlasticExeLauncher(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
string installCloudFrom,
|
||||
string installEnterpriseFrom,
|
||||
string cancelInstallFrom,
|
||||
bool bWait,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable,
|
||||
IProcessExecutor processExecutor)
|
||||
: this(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
isGluonMode,
|
||||
installCloudFrom,
|
||||
installEnterpriseFrom,
|
||||
cancelInstallFrom,
|
||||
bWait,
|
||||
showDownloadPlasticExeWindow,
|
||||
checkIsExeAvailable,
|
||||
processExecutor)
|
||||
{
|
||||
}
|
||||
|
||||
PlasticExeLauncher(
|
||||
RepositorySpec repSpec,
|
||||
bool isGluonMode,
|
||||
string installCloudFrom,
|
||||
string installEnterpriseFrom,
|
||||
string cancelInstallFrom,
|
||||
bool bWait,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
ICheckIsExeAvailable checkIsExeAvailable,
|
||||
IProcessExecutor processExecutor)
|
||||
{
|
||||
mRepSpec = repSpec;
|
||||
mIsGluonMode = isGluonMode;
|
||||
mInstallCloudFrom = installCloudFrom;
|
||||
mInstallEnterpriseFrom = installEnterpriseFrom;
|
||||
mCancelInstallFrom = cancelInstallFrom;
|
||||
mbWait = bWait;
|
||||
mShowDownloadPlasticExeWindow = showDownloadPlasticExeWindow;
|
||||
mCheckIsExeAvailable = checkIsExeAvailable;
|
||||
mProcessExecutor = processExecutor;
|
||||
}
|
||||
|
||||
bool IToolLauncher.Launch(
|
||||
string tool, string arguments, string fileExtensions)
|
||||
{
|
||||
if (mAskedUser)
|
||||
return false;
|
||||
|
||||
if (mCheckIsExeAvailable.ForMode(mIsGluonMode))
|
||||
return mProcessExecutor.Execute(tool, arguments, mbWait);
|
||||
|
||||
mShowDownloadPlasticExeWindow.Show(
|
||||
mRepSpec,
|
||||
mIsGluonMode,
|
||||
mInstallCloudFrom,
|
||||
mInstallEnterpriseFrom,
|
||||
mCancelInstallFrom);
|
||||
|
||||
mAskedUser = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool mAskedUser = false;
|
||||
|
||||
readonly RepositorySpec mRepSpec;
|
||||
readonly bool mIsGluonMode;
|
||||
readonly string mInstallCloudFrom;
|
||||
readonly string mInstallEnterpriseFrom;
|
||||
readonly string mCancelInstallFrom;
|
||||
readonly bool mbWait;
|
||||
|
||||
readonly LaunchTool.IShowDownloadPlasticExeWindow mShowDownloadPlasticExeWindow;
|
||||
readonly ICheckIsExeAvailable mCheckIsExeAvailable;
|
||||
readonly IProcessExecutor mProcessExecutor;
|
||||
|
||||
internal class CheckIsExeAvailable : ICheckIsExeAvailable
|
||||
{
|
||||
bool ICheckIsExeAvailable.ForMode(bool isGluonMode)
|
||||
{
|
||||
return IsExeAvailable.ForMode(isGluonMode);
|
||||
}
|
||||
}
|
||||
|
||||
internal class ProcessExecutor : IProcessExecutor
|
||||
{
|
||||
bool IProcessExecutor.Execute(string tool, string arguments, bool bWait)
|
||||
{
|
||||
return Codice.Client.BaseCommands.ProcessExecutor.Execute(
|
||||
tool,
|
||||
arguments,
|
||||
bWait,
|
||||
bNoWindow: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8b61564d80f4d16b3bf68e8dfe87c89
|
||||
timeCreated: 1728895834
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace Unity.PlasticSCM.Editor.Tool
|
||||
{
|
||||
internal static class ToolConstants
|
||||
{
|
||||
internal static class Plastic
|
||||
{
|
||||
internal const string GUI_WINDOWS_WK_ARG = "--wk=\"{0}\"";
|
||||
internal const string GUI_WINDOWS_BREX_ARG = "--branchexplorer=\"{0}\"";
|
||||
|
||||
internal const string GUI_MACOS_WK_EXPLORER_ARG = "--wk=\"{0}\" --view=ItemsView";
|
||||
internal const string GUI_MACOS_BREX_ARG = "--wk=\"{0}\" --view=BranchExplorerView";
|
||||
internal const string GUI_MACOS_COMMAND_FILE_ARG = " --command-file=\"{0}\"";
|
||||
internal const string GUI_MACOS_COMMAND_FILE = "macplastic-command-file.txt";
|
||||
|
||||
internal const string GUI_CHANGESET_DIFF_ARG = "--diffchangeset=\"{0}\"";
|
||||
internal const string GUI_SELECTED_CHANGESETS_DIFF_ARGS = "--diffchangesetsrc=\"{0}\" --diffchangesetdst=\"{1}\"";
|
||||
internal const string GUI_BRANCH_DIFF_ARG = "--diffbranch=\"{0}\"";
|
||||
}
|
||||
|
||||
internal static class Gluon
|
||||
{
|
||||
internal const string GUI_WK_EXPLORER_ARG = "--wk=\"{0}\" --view=WorkspaceExplorerView";
|
||||
internal const string GUI_WK_CONFIGURATION_ARG = "--wk=\"{0}\" --view=WorkspaceConfigurationView";
|
||||
internal const string GUI_COMMAND_FILE_ARG = " --command-file=\"{0}\"";
|
||||
internal const string GUI_COMMAND_FILE = "gluon-command-file.txt";
|
||||
|
||||
internal const string GUI_CHANGESET_DIFF_ARG = "--diffchangeset=\"{0}\"";
|
||||
internal const string GUI_SELECTED_CHANGESETS_DIFF_ARGS = "--diffchangesetsrc=\"{0}\" --diffchangesetdst=\"{1}\"";
|
||||
internal const string GUI_BRANCH_DIFF_ARG = "--diffbranch=\"{0}\"";
|
||||
}
|
||||
|
||||
internal static class Installer
|
||||
{
|
||||
internal const string INSTALLER_WINDOWS_ARGS = "--mode unattended --unattendedmodeui minimal";
|
||||
internal const string INSTALLER_MACOS_OPEN = "open";
|
||||
internal const string INSTALLER_MACOS_OPEN_ARGS = "-W -n {0}";
|
||||
}
|
||||
|
||||
internal const string LEGACY_MACOS_BINDIR = "/Applications/PlasticSCM.app/Contents/MonoBundle";
|
||||
internal const string NEW_MACOS_BINDIR = "/Applications/PlasticSCM.app/Contents/MacOS";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de6e8913aefd69d4ca90a7216d225d3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user