예제 #1
0
        internal static void FromUnityAccessToken(
            string unityAccessToken,
            RepositorySpec repSpec,
            string projectPath)
        {
            CredentialsResponse response = PlasticScmRestApiClient.GetCredentials(
                PlasticWebApiUris.GetBaseUri(),
                unityAccessToken);

            if (response.Error != null)
            {
                UnityEngine.Debug.LogErrorFormat(
                    "Error getting credentials to download Cloud Project: {0} ({1})",
                    response.Error.Message,
                    response.Error.ErrorCode);

                return;
            }

            ClientConfigData configData = BuildClientConfigData(
                repSpec,
                projectPath,
                response);

            ClientConfig.Get().Save(configData);
        }
예제 #2
0
        void OnEnable()
        {
            if (mException != null)
            {
                return;
            }

            GuiMessage.Initialize(new UnityPlasticGuiMessage(this));

            ConfigureLogging();

            RegisterExceptionHandlers();
            RegisterApplicationFocusHandlers(this);

            InitLocalization();

            ThreadWaiter.Initialize(new UnityThreadWaiterBuilder());
            ServicePointConfigurator.ConfigureServicePoint();
            CertificateUi.RegisterHandler(new ChannelCertificateUiImpl());
            CredentialsUIRegistrar.RegisterCredentialsUI(
                new CredentialsUiImpl(this));
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler(this));
            DisableFsWatcherIfNeeded();
            EditionManager.Get().DisableCapability(
                EnumEditionCapabilities.Extensions);

            mPlasticAPI = new PlasticAPI();
            ClientHandlers.Register();

            PlasticGuiConfig.SetConfigFile(PLASTIC_GUI_CONFIG_FILE);

            mPingEventLoop      = new PingEventLoop();
            mEventSenderRestApi = new SimpleEventSenderRestApi(
                PlasticWebApiUris.GetBaseUri());
            mEventSenderScheduler = EventTracking.Configure(
                mEventSenderRestApi,
                ApplicationIdentifier.UnityPackage,
                IdentifyEventPlatform.Get());

            if (mEventSenderScheduler != null)
            {
                mPingEventLoop.Start();
            }

            InitializePlastic();
        }
예제 #3
0
        void OnEnable()
        {
            wantsMouseMove = true;

            if (mException != null)
            {
                return;
            }

            GuiMessage.Initialize(new UnityPlasticGuiMessage(this));

            PlasticApp.Initialize();

            RegisterApplicationFocusHandlers(this);

            CredentialsUIRegistrar.RegisterCredentialsUI(
                new CredentialsUiImpl(this));
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler(this));

            mPlasticAPI = new PlasticAPI();

            mPingEventLoop      = new PingEventLoop();
            mEventSenderRestApi = new SimpleEventSenderRestApi(
                PlasticWebApiUris.GetBaseUri());
            mEventSenderScheduler = EventTracking.Configure(
                mEventSenderRestApi,
                ApplicationIdentifier.UnityPackage,
                IdentifyEventPlatform.Get());

            if (mEventSenderScheduler != null)
            {
                mPingEventLoop.Start();
            }

            InitializePlastic();

            EditorApplication.update += AutoCommitOperation.AutoCommit;
        }
예제 #4
0
        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);
            });
        }