Example #1
0
        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));
        }
Example #2
0
        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));
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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");
        }
Example #7
0
        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");
        }
Example #9
0
        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));
        }
Example #10
0
        static void SetupFsWatcher()
        {
            if (!PlatformIdentifier.IsMac())
            {
                return;
            }

            WorkspaceWatcherFsNodeReadersCache.Get().SetMacFsWatcherBuilder(
                new MacFsWatcherBuilder());
        }
Example #11
0
        static string GetFsWatcherEnabledExplanation()
        {
            if (PlatformIdentifier.IsWindows() || PlatformIdentifier.IsMac())
            {
                return(PlasticLocalization.GetString(
                           PlasticLocalization.Name.PendingChangesFilesystemWatcherEnabledExplanation));
            }

            return(PlasticLocalization.GetString(
                       PlasticLocalization.Name.PendingChangesINotifyEnabledExplanation));
        }
Example #12
0
        static string GetFsWatcherDisabledMessage()
        {
            if (PlatformIdentifier.IsWindows() || PlatformIdentifier.IsMac())
            {
                return(PlasticLocalization.GetString(
                           PlasticLocalization.Name.PendingChangesFilesystemWatcherDisabled));
            }

            return(PlasticLocalization.GetString(
                       PlasticLocalization.Name.PendingChangesINotifyDisabled));
        }
Example #13
0
        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));
        }
Example #14
0
        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));
        }
Example #15
0
        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;
            }
        }
Example #16
0
        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));
        }
Example #18
0
        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));
        }
        /* 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;
        }
Example #20
0
        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);
        }
Example #21
0
        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));
        }
Example #22
0
        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 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);
            });
        }