internal static void OpenGUIForMode(string wkPath, bool isGluonMode) { mLog.DebugFormat("Opening GUI on wkPath '{0}'.", wkPath); if (isGluonMode) { mGluonProcessId = ExecuteGUI( PlasticInstallPath.GetGluonExePath(), string.Format(ToolConstants.Gluon.GUI_WK_EXPLORER_ARG, wkPath), ToolConstants.Gluon.GUI_COMMAND_FILE_ARG, ToolConstants.Gluon.GUI_COMMAND_FILE, mGluonProcessId); return; } if (PlatformIdentifier.IsMac()) { mPlasticProcessId = ExecuteGUI( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_MACOS_WK_EXPLORER_ARG, wkPath), ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE_ARG, ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE, mPlasticProcessId); return; } ExecuteProcess( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_WINDOWS_WK_ARG, wkPath)); }
internal static string GetGluonExePath() { if (PlatformIdentifier.IsWindows()) { return(FindTool.ObtainToolCommand( Gluon.GUI_WINDOWS, new List <String>() { GetWindowsInstallationFolder() })); } 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 void OpenMerge(string wkPath, bool isGluonMode) { if (ShowDownloadPlasticExeWindow(isGluonMode)) { return; } mLog.DebugFormat( "Opening Merge on wkPath '{0}'.", wkPath); if (PlatformIdentifier.IsMac()) { Process plasticProcess = ExecuteGUI( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_MACOS_MERGE_ARG, wkPath), ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE_ARG, ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE, mPlasticProcessId); if (plasticProcess != null) { mPlasticProcessId = plasticProcess.Id; } return; } ExecuteProcess( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_WINDOWS_MERGE_ARG, wkPath)); }
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); }
/// <inheritdoc /> public void Read(BinaryReader r) { PlatformId = (PlatformIdentifier)r.ReadUInt16(); PlatformSpecificId = r.ReadUInt16(); LanguageId = r.ReadUInt16(); NameId = r.ReadUInt16(); Length = r.ReadUInt16(); Offset = r.ReadUInt16(); }
static string GetHelpLink() { if (PlatformIdentifier.IsWindows() || PlatformIdentifier.IsMac()) { return(FS_WATCHER_HELP_URL); } return(INOTIFY_HELP_URL); }
internal static string GetPlasticConfigFileToSaveOrganization() { if (PlatformIdentifier.IsMac()) { return("macgui.conf"); } return("plasticgui.conf"); }
internal static bool IsControlOrCommandKeyPressed(Event e) { if (PlatformIdentifier.IsMac()) { return(e.type == EventType.KeyDown && e.command); } return(e.type == EventType.KeyDown && e.control); }
internal static string GetGluonConfigFileToSaveOrganization() { if (PlatformIdentifier.IsMac()) { return("gluon.conf"); } return("gameui.conf"); }
internal static void OpenGUIForMode(WorkspaceInfo wkInfo, bool isGluonMode) { mLog.DebugFormat( "Opening GUI on wkPath '{0}'.", wkInfo.ClientPath); TrackFeatureUseEvent.For( Plastic.API.GetRepositorySpec(wkInfo), isGluonMode ? TrackFeatureUseEvent.Features.LaunchGluonTool : TrackFeatureUseEvent.Features.LaunchPlasticTool); if (isGluonMode) { Process gluonProcess = 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 = 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; } ExecuteProcess( PlasticInstallPath.GetPlasticExePath(), string.Format( ToolConstants.Plastic.GUI_WINDOWS_WK_ARG, wkInfo.ClientPath)); }
internal static Dictionary <string, T> ForPlatform <T>() { if (PlatformIdentifier.IsWindows()) { return(new Dictionary <string, T>( StringComparer.OrdinalIgnoreCase)); } return(new Dictionary <string, T>()); }
static void SetupFsWatcher() { if (!PlatformIdentifier.IsMac()) { return; } WorkspaceWatcherFsNodeReadersCache.Get().SetMacFsWatcherBuilder( new MacFsWatcherBuilder()); }
static string GetFsWatcherEnabledExplanation() { if (PlatformIdentifier.IsWindows() || PlatformIdentifier.IsMac()) { return(PlasticLocalization.GetString( PlasticLocalization.Name.PendingChangesFilesystemWatcherEnabledExplanation)); } return(PlasticLocalization.GetString( PlasticLocalization.Name.PendingChangesINotifyEnabledExplanation)); }
static string GetFsWatcherDisabledMessage() { if (PlatformIdentifier.IsWindows() || PlatformIdentifier.IsMac()) { return(PlasticLocalization.GetString( PlasticLocalization.Name.PendingChangesFilesystemWatcherDisabled)); } return(PlasticLocalization.GetString( PlasticLocalization.Name.PendingChangesINotifyDisabled)); }
static string GetFsWatcherDisabledExplanation() { if (PlatformIdentifier.IsWindows() || PlatformIdentifier.IsMac()) { return(PlasticLocalization.GetString( PlasticLocalization.Name.PendingChangesFilesystemWatcherDisabledExplanation) .Replace("[[HELP_URL|{0}]]", "{0}")); } return(PlasticLocalization.GetString( PlasticLocalization.Name.PendingChangesINotifyDisabledExplanation)); }
async Task TestCustomInstalls(CancellationToken cancellationToken) { var byondInstaller = new PlatformIdentifier().IsWindows ? (IByondInstaller) new WindowsByondInstaller( Mock.Of <IProcessExecutor>(), new DefaultIOManager(), Mock.Of <ILogger <WindowsByondInstaller> >()) : new PosixByondInstaller( Mock.Of <IPostWriteHandler>(), new DefaultIOManager(), Mock.Of <ILogger <PosixByondInstaller> >()); // get the bytes for stable using var stableBytesMs = new MemoryStream( await byondInstaller.DownloadVersion(TestVersion, cancellationToken)); var test = await byondClient.SetActiveVersion( new ByondVersionRequest { Version = TestVersion, UploadCustomZip = true }, stableBytesMs, cancellationToken) .ConfigureAwait(false); Assert.IsNotNull(test.InstallJob); await WaitForJob(test.InstallJob, 60, false, null, cancellationToken).ConfigureAwait(false); var newSettings = await byondClient.ActiveVersion(cancellationToken); Assert.AreEqual(new Version(TestVersion.Major, TestVersion.Minor, 1), newSettings.Version); // test a few switches var installResponse = await byondClient.SetActiveVersion(new ByondVersionRequest { Version = TestVersion }, null, cancellationToken); Assert.IsNull(installResponse.InstallJob); await ApiAssert.ThrowsException <ApiConflictException>(() => byondClient.SetActiveVersion(new ByondVersionRequest { Version = new Version(TestVersion.Major, TestVersion.Minor, 2) }, null, cancellationToken), ErrorCode.ByondNonExistentCustomVersion); installResponse = await byondClient.SetActiveVersion(new ByondVersionRequest { Version = new Version(TestVersion.Major, TestVersion.Minor, 1) }, null, cancellationToken); Assert.IsNull(installResponse.InstallJob); }
public void TestCorrectPlatform() { var identifier = new PlatformIdentifier(); var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); const string WindowsScriptExtension = "bat"; const string PosixScriptExtension = "sh"; Assert.AreEqual(isWindows, identifier.IsWindows); Assert.AreEqual(isWindows ? WindowsScriptExtension : PosixScriptExtension, identifier.ScriptFileExtension); }
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)); }
internal static void OpenBranchExplorer(WorkspaceInfo wkInfo, bool isGluonMode) { if (ShowDownloadPlasticExeWindow( 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 = 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 = ExecuteWindowsGUI( PlasticInstallPath.GetPlasticExePath(), string.Format( ToolConstants.Plastic.GUI_WINDOWS_BREX_ARG, wkInfo.ClientPath), mBrexProcessId); if (brexProcess != null) { mBrexProcessId = brexProcess.Id; } }
internal static string ForHistory() { if (PlatformIdentifier.IsWindows()) { return(PlasticLocalization.GetString( PlasticLocalization.Name.UnityHistoryShortcutForWindows)); } if (PlatformIdentifier.IsMac()) { return(PlasticLocalization.GetString( PlasticLocalization.Name.UnityHistoryShortcutForMacOS)); } return(string.Empty); }
static string GetInstallerUrl( string version, bool isCloudEdition) { string edition = isCloudEdition ? "cloudedition" : "full"; string platform = PlatformIdentifier.IsMac() ? "macosx" : "windows"; return(string.Format( @"https://www.plasticscm.com/download/downloadinstaller/{0}/plasticscm/{1}/{2}", version, platform, edition)); }
/* In macOS there is no way to pass a parameter * to the PKG installer to avoid launching * Plastic at the end of the installation process. * * As a workaround, we can create an empty client.conf in * the user config folder. This way the installer skips * launching Plastic at the end of the installation process. * * see /01plastic/install/mac/macplastic/Scripts/postinstall * * Then, we delete the client.conf file if we created it */ internal void CreateClientConfigIfNeeded() { if (!PlatformIdentifier.IsMac()) { return; } string clientConfFile = ConfigFileLocation.GetConfigFilePath( ClientConfig.CLIENT_CONFIG_FILE_NAME); if (File.Exists(clientConfFile)) { return; } File.Create(clientConfFile).Close(); mClientConfigCreated = true; }
internal static string ForPlatform() { string fileName = Guid.NewGuid().ToString(); if (PlatformIdentifier.IsWindows()) { fileName += ".exe"; } if (PlatformIdentifier.IsMac()) { fileName += ".pkg.zip"; } return(Path.Combine( Path.GetTempPath(), fileName)); }
internal static string GetPlasticExePath() { if (PlatformIdentifier.IsWindows()) { return(FindTool.ObtainToolCommand( Plastic.GUI_WINDOWS, new List <String>() { GetWindowsInstallationFolder() })); } if (PlatformIdentifier.IsMac()) { return(GetToolCommand(Plastic.GUI_MACOS)); } return(null); }
internal static void OpenMerge(string wkPath) { mLog.DebugFormat("Opening Merge on wkPath '{0}'.", wkPath); if (PlatformIdentifier.IsMac()) { mPlasticProcessId = ExecuteGUI( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_MACOS_MERGE_ARG, wkPath), ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE_ARG, ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE, mPlasticProcessId); return; } ExecuteProcess( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_WINDOWS_MERGE_ARG, wkPath)); }
public static async Task<string> FormatSaclopediaEntry(string body, PlatformIdentifier platformIdentifier) { string html = await PathIO.ReadTextAsync("ms-appx:///Assets/Website/saclopedia.html"); var doc2 = new HtmlDocument(); doc2.LoadHtml(html); HtmlNode head = doc2.DocumentNode.Descendants("head").FirstOrDefault(); switch (platformIdentifier) { case PlatformIdentifier.WindowsPhone: head.InnerHtml += "<link href=\"ms-appx-web:///Assets/Website/CSS/WindowsPhone-Default.css\" type=\"text/css\" media=\"all\" rel=\"stylesheet\">"; break; } HtmlNode bodyNode = doc2.DocumentNode.Descendants("body").FirstOrDefault(); bodyNode.InnerHtml = WebUtility.HtmlDecode(body); return doc2.DocumentNode.OuterHtml; }
public static async Task <string> FormatSaclopediaEntry(string body, PlatformIdentifier platformIdentifier) { string html = await PathIO.ReadTextAsync("ms-appx:///Assets/Website/saclopedia.html"); var doc2 = new HtmlDocument(); doc2.LoadHtml(html); HtmlNode head = doc2.DocumentNode.Descendants("head").FirstOrDefault(); switch (platformIdentifier) { case PlatformIdentifier.WindowsPhone: head.InnerHtml += "<link href=\"ms-appx-web:///Assets/Website/CSS/WindowsPhone-Default.css\" type=\"text/css\" media=\"all\" rel=\"stylesheet\">"; break; } HtmlNode bodyNode = doc2.DocumentNode.Descendants("body").FirstOrDefault(); bodyNode.InnerHtml = WebUtility.HtmlDecode(body); return(doc2.DocumentNode.OuterHtml); }
internal static void OpenMerge(WorkspaceInfo wkInfo, bool isGluonMode) { if (ShowDownloadPlasticExeWindow( wkInfo, isGluonMode, TrackFeatureUseEvent.Features.InstallPlasticCloudFromOpenMerge, TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromOpenMerge, TrackFeatureUseEvent.Features.CancelPlasticInstallationFromOpenMerge)) { return; } mLog.DebugFormat( "Opening Merge on wkPath '{0}'.", wkInfo.ClientPath); if (PlatformIdentifier.IsMac()) { Process plasticProcess = ExecuteGUI( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_MACOS_MERGE_ARG, wkInfo.ClientPath), ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE_ARG, ToolConstants.Plastic.GUI_MACOS_COMMAND_FILE, mPlasticProcessId); if (plasticProcess != null) { mPlasticProcessId = plasticProcess.Id; } return; } ExecuteProcess( PlasticInstallPath.GetPlasticExePath(), string.Format(ToolConstants.Plastic.GUI_WINDOWS_MERGE_ARG, wkInfo.ClientPath)); }
internal static bool MustDisableFsWatcher() { return(PlatformIdentifier.IsWindows() && MonoRuntime.IsRunningUnder35RuntimeOrOlder()); }
internal static void Run( Edition plasticEdition, string installerDestinationPath, ProgressControlsForViews progressControls) { ((IProgressControls)progressControls).ShowProgress("Downloading"); NewVersion plasticVersion = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(); waiter.Execute( /*threadOperationDelegate*/ delegate { plasticVersion = PlasticScmRestApiClient.GetLastVersion( PlasticWebApiUris.GetBaseUri(), plasticEdition); if (plasticVersion == null) { return; } string installerUrl = GetInstallerUrl( plasticVersion.Version, plasticEdition == Edition.Cloud); DownloadInstaller( installerUrl, installerDestinationPath, progressControls); if (!PlatformIdentifier.IsMac()) { return; } installerDestinationPath = UnZipMacOsPackage( installerDestinationPath); }, /*afterOperationDelegate*/ delegate { ((IProgressControls)progressControls).HideProgress(); if (waiter.Exception != null) { ((IProgressControls)progressControls).ShowError( waiter.Exception.Message); return; } if (plasticVersion == null) { ((IProgressControls)progressControls).ShowError( "There was an error connecting. Please check your internet."); return; } if (!File.Exists(installerDestinationPath)) { return; } RunInstaller( installerDestinationPath, progressControls); }); }
internal static void Run( Edition plasticEdition, string installerDestinationPath, ProgressControlsForDialogs progressControls, INotify notify) { ((IProgressControls)progressControls).ShowProgress( PlasticLocalization.GetString(PlasticLocalization.Name.DownloadingProgress)); NewVersionResponse plasticVersion = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(); waiter.Execute( /*threadOperationDelegate*/ delegate { plasticVersion = WebRestApiClient.PlasticScm. GetLastVersion(plasticEdition); if (plasticVersion == null) { return; } string installerUrl = GetInstallerUrl( plasticVersion.Version, plasticEdition == Edition.Cloud); DownloadInstaller( installerUrl, installerDestinationPath, progressControls); if (!PlatformIdentifier.IsMac()) { return; } installerDestinationPath = UnZipMacOsPackage( installerDestinationPath); }, /*afterOperationDelegate*/ delegate { ((IProgressControls)progressControls).HideProgress(); if (waiter.Exception != null) { ((IProgressControls)progressControls).ShowError( waiter.Exception.Message); return; } if (plasticVersion == null) { ((IProgressControls)progressControls).ShowError( PlasticLocalization.GetString(PlasticLocalization.Name.ConnectingError)); return; } if (!File.Exists(installerDestinationPath)) { return; } RunInstaller( installerDestinationPath, progressControls, notify); }); }