/// <summary>
    /// Method that gets invoked when the Bootstrapper DetectPackageComplete event is fired.
    /// Checks the PackageId and sets the installation scenario. The PackageId is the ID
    /// specified in one of the package elements (msipackage, exepackage, msppackage,
    /// msupackage) in the WiX bundle.
    /// </summary>
    void OnDetectPackageComplete(object sender, DetectPackageCompleteEventArgs e)
    {
        if (e.PackageId == "SonarQubePackage")
        {
            if (e.State == PackageState.Absent)
            {
                this.LaunchAction = LaunchAction.Install;
            }

            else if (e.State == PackageState.Present)
            {
                this.LaunchAction = LaunchAction.Uninstall;
            }

            else if (e.State == PackageState.Obsolete)
            {
                this.SetupState = SetupState.FailedOnDowngrade;
            }

            autoEvent.Set();
        }
    }
コード例 #2
0
        //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
        #region --Set-, Get- Methods--


        #endregion
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--
        public void Dispose()
        {
            state = SetupState.CANCELED;
        }
コード例 #3
0
ファイル: SetupCube.cs プロジェクト: fletcher-berry/Cubing
        // During orientation phase, user clicks a sticker to color it yellow.  During permutation phase, user clicks a sticker to select it
        public void Click(MouseEventArgs e)
        {
            ListNode <CubeColor> node = GetClickedSticker(e.X, e.Y);

            if (node == null)
            {
                return;
            }
            switch (State)
            {
            case SetupState.Orienatation:                                                   // place yellow on clicked piece if possible
                Action action = new Action();
                if (node.Right.Right == node)                                               // edge piece
                {
                    if (node.Value == CubeColor.None && node.Right.Value == CubeColor.None) // make sure piece is not colored
                    {
                        node.Value = CubeColor.Yellow;
                        action.Pieces.Add(node);
                    }
                    // if only one uncolored edge, its orientation can be determined.  An even number of edges must be correctly oriented
                    if (_edges.Count(edge => edge.Head.Value == CubeColor.None && edge.Head.Right.Value == CubeColor.None) == 1)
                    {
                        var unorientedEdge = _edges.First(edge => edge.Head.Value == CubeColor.None && edge.Head.Right.Value == CubeColor.None);
                        int numOriented    = _edges.Count(edge => edge.Head.Value == CubeColor.Yellow);
                        if (numOriented % 2 == 0)
                        {
                            unorientedEdge.Head.Right.Value = CubeColor.Yellow;
                            action.Pieces.Add(unorientedEdge.Head.Right);
                        }
                        else
                        {
                            unorientedEdge.Head.Value = CubeColor.Yellow;
                            action.Pieces.Add(unorientedEdge.Head);
                        }
                        // if all corners have been colored, orientation step is complete
                        if (_corners.Count(corner => corner.Head.Value == CubeColor.None && corner.Head.Right.Value == CubeColor.None && corner.Head.Left.Value == CubeColor.None) == 0)
                        {
                            State = SetupState.CP;
                        }
                    }
                }
                else                                                                                                             // corner piece
                {
                    if (node.Value == CubeColor.None && node.Right.Value == CubeColor.None && node.Left.Value == CubeColor.None) // check to make sure corner has not veen colored
                    {
                        node.Value = CubeColor.Yellow;
                        action.Pieces.Add(node);
                    }
                    // if all but 1 corner have been colored, the orientation of the last corner can be determined
                    if (_corners.Count(corner => corner.Head.Value == CubeColor.None && corner.Head.Right.Value == CubeColor.None && corner.Head.Left.Value == CubeColor.None) == 1)
                    {
                        var unorientedCorner = _corners.First(corner => corner.Head.Value == CubeColor.None && corner.Head.Right.Value == CubeColor.None && corner.Head.Left.Value == CubeColor.None);
                        int orientationNum   = _corners.Count(corner => corner.Head.Right.Value == CubeColor.Yellow)
                                               - _corners.Count(corner => corner.Head.Left.Value == CubeColor.Yellow);
                        int num = orientationNum % 3;
                        // for corner orientation the difference in the number of clockwise twisted corners and counter-clockwise twisted corners must be a multiple of 3
                        if ((orientationNum + 3) % 3 == 0)
                        {
                            unorientedCorner.Head.Value = CubeColor.Yellow;
                            action.Pieces.Add(unorientedCorner.Head);
                        }
                        else if ((orientationNum + 3) % 3 == 1)
                        {
                            unorientedCorner.Head.Left.Value = CubeColor.Yellow;
                            action.Pieces.Add(unorientedCorner.Head.Left);
                        }
                        else
                        {
                            unorientedCorner.Head.Right.Value = CubeColor.Yellow;
                            action.Pieces.Add(unorientedCorner.Head.Right);
                        }
                        // if all edges have been colored, orientation step is complete
                        if (_edges.Count(edge => edge.Head.Value == CubeColor.None && edge.Head.Right.Value == CubeColor.None) == 0)
                        {
                            State = SetupState.CP;
                        }
                    }
                }
                if (action.Pieces.Count > 0)
                {
                    _actions.Push(action);
                }
                break;

            case SetupState.CP:
                if (node.Right.Right == node)            // edge
                {
                    break;
                }
                if (node.Value != CubeColor.None)       // piece already colored
                {
                    break;
                }
                SelectedNode = node;
                break;

            case SetupState.EP:
                if (node.Right.Right != node)           // corner
                {
                    break;
                }
                if (node.Value != CubeColor.None)       // pieca already colored
                {
                    break;
                }
                SelectedNode = node;
                break;
            }
        }
コード例 #4
0
        private void DrawSetupPhoton()
        {
            this.DrawInputWithLabel("Photon Cloud Setup", () =>
            {
                GUILayout.BeginVertical();
                GUILayout.Space(5);
                GUILayout.Label(WizardText.PHOTON, this.textLabelStyle);
                GUILayout.EndVertical();

                GUILayout.Space(5);
                GUILayout.BeginHorizontal();
                GUILayout.Label(WizardText.PHOTON_DASH, this.textLabelStyle);
                if (GUILayout.Button("Visit Dashboard", this.minimalButtonStyle))
                {
                    string mail = (this.inputState == InputState.Email) ? appIdOrEmail : string.Empty;
                    this.OpenURL(EditorIntegration.UrlCloudDashboard + mail)();
                }

                GUILayout.EndHorizontal();
            }, false);
            GUILayout.Space(15);

            this.DrawInputWithLabel("Photon AppID or Email", () =>
            {
                GUILayout.BeginVertical();

                appIdOrEmail = EditorGUILayout.TextField(appIdOrEmail, this.centerInputTextStyle).Trim();   // trimming all input in/of this field

                GUILayout.EndVertical();
            }, false, true, 300);


            // input state check to show dependent info / buttons
            if (AccountService.IsValidEmail(appIdOrEmail))
            {
                this.inputState = InputState.Email;
            }
            else
            {
                this.inputState = AppSettings.IsAppId(appIdOrEmail) ? InputState.Appid : InputState.NotFinished;
            }

            // button to skip setup
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Skip", GUILayout.Width(100)))
            {
                this.requestHighlighSettings = true;
                this.setupState = SetupState.Skip;
            }

            // SETUP button
            EditorGUI.BeginDisabledGroup(this.inputState == InputState.NotFinished || requestingAppId);
            if (GUILayout.Button("Setup", GUILayout.Width(100)))
            {
                this.requestHighlighSettings = true;
                GUIUtility.keyboardControl   = 0;
                if (this.inputState == InputState.Email && !requestingAppId)
                {
                    requestingAppId = new AccountService().RegisterByEmail(appIdOrEmail, new List <ServiceTypes>()
                    {
                        ServiceTypes.Realtime
                    }, SuccessCallback, ErrorCallback);
                    if (requestingAppId)
                    {
                        EditorUtility.DisplayProgressBar(WizardText.CONNECTION_TITLE, WizardText.CONNECTION_INFO, 0.5f);
                        this.setupState = SetupState.SendingEmail;
                    }
                }
                else if (this.inputState == InputState.Appid)
                {
                    this.setupState = SetupState.AppIdApplied;

                    // Save App ID
                    AppSettingsInstance.AppIdRealtime = appIdOrEmail;
                }
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            switch (this.setupState)
            {
            case SetupState.RegisteredSuccessful:
                GUILayout.Label(WizardText.RegisteredNewAccountInfo, this.textLabelStyle);
                GUILayout.Label(WizardText.SetupCompleteInfo, this.textLabelStyle);
                this.HighlightSettings();
                break;

            case SetupState.AppIdApplied:
                GUILayout.Label(WizardText.AppliedToSettingsInfo, this.textLabelStyle);
                GUILayout.Label(WizardText.SetupCompleteInfo, this.textLabelStyle);
                this.HighlightSettings();
                break;

            case SetupState.AlreadyRegistered:
                GUILayout.Label(WizardText.AlreadyRegisteredInfo, this.textLabelStyle);
                this.HighlightSettings();
                break;

            case SetupState.RegistrationError:
                GUILayout.Label(WizardText.RegistrationError, this.textLabelStyle);
                this.HighlightSettings();
                break;

            case SetupState.Skip:
                GUILayout.Label(WizardText.SkipRegistrationInfo, this.textLabelStyle);
                this.HighlightSettings();
                break;
            }
        }
コード例 #5
0
        private async Task RequestMamAsync()
        {
            state = SetupState.REQUESTING_MAM;

            // Skip MAM retrieval in case it has been disabled in the settings:
            if (Settings.GetSettingBoolean(SettingsConsts.DISABLE_MAM))
            {
                Logger.Info("MAM request disabled. Skipping.");
                Continue();
            }

            if (!ccHandler.client.xmppClient.connection.DISCO_HELPER.HasFeature(Consts.XML_XEP_0313_NAMESPACE, ccHandler.client.dbAccount.bareJid))
            {
                Logger.Info("No need to request MAM for " + ccHandler.client.dbAccount.bareJid + " - not supported.");
                Continue();
                return;
            }

            bool extendedMamSupport = ccHandler.client.xmppClient.connection.DISCO_HELPER.HasFeature(Consts.XML_XEP_0313_EXTENDED_NAMESPACE, ccHandler.client.dbAccount.bareJid);

            Logger.Info("Extended MAM support for " + ccHandler.client.dbAccount.bareJid + ": " + extendedMamSupport);

            // Check for how many days into the past we should request the MAM:
            int      maxMamBacklogDays = Settings.GetSettingInt(SettingsConsts.MAM_REQUEST_DAYS);
            DateTime maxMamBackglogDate;

            if (maxMamBacklogDays < 0)
            {
                maxMamBackglogDate = DateTime.MinValue;
            }
            else
            {
                maxMamBackglogDate = DateTime.Now.AddDays(-maxMamBacklogDays);
            }

            // Get the oldest message we have received:
            DateTime lastMsgDate = ccHandler.client.dbAccount.mamRequest.lastMsgDate;

            if (lastMsgDate != DateTime.MaxValue && lastMsgDate <= maxMamBackglogDate)
            {
                Logger.Info($"No need to request MAM since we already requested the maximum backlog of {maxMamBacklogDays} days.");
                return;
            }

            // Request only 30 messages at the time:
            Set rsm = new Set
            {
                max = 30
            };
            QueryFilter filter = new QueryFilter();

            if (extendedMamSupport)
            {
                // Only extended MAM supports setting the 'after-id' property.
                // Reference: https://xmpp.org/extensions/xep-0313.html#support
                if (!(ccHandler.client.dbAccount.mamRequest.lastMsgId is null))
                {
                    filter.AfterId(ccHandler.client.dbAccount.mamRequest.lastMsgId);
                }
            }
            else
            {
                // Fallback for servers not supporting 'urn:xmpp:mam:2#extended'.
                if (lastMsgDate != DateTime.MaxValue)
                {
                    filter.End(lastMsgDate);
                }
            }
            if (maxMamBackglogDate != DateTime.MinValue)
            {
                filter.Start(maxMamBackglogDate);
            }

            // Request MAM:
            bool done      = false;
            int  iteration = 1;

            while (!done)
            {
                MessageResponseHelperResult <MamResult> result = await RequestMamWithRetry(filter, rsm, 2);

                if (result.STATE == MessageResponseHelperResultState.SUCCESS)
                {
                    if (result.RESULT.RESULTS.Count > 0)
                    {
                        HandleMamMessages(result.RESULT);

                        // Update the MAM request entry:
                        lastMsgDate = GetLastMessageDate(result.RESULT);
                        if (ccHandler.client.dbAccount.mamRequest.lastMsgDate > lastMsgDate)
                        {
                            ccHandler.client.dbAccount.mamRequest.lastMsgId   = result.RESULT.FIRST;
                            ccHandler.client.dbAccount.mamRequest.lastMsgDate = lastMsgDate;
                        }

                        // Request the next page:
                        rsm.after = result.RESULT.LAST;

                        Logger.Info("MAM request for " + ccHandler.client.dbAccount.bareJid + " received " + result.RESULT.RESULTS.Count + " messages in iteration " + iteration + '.');
                        Logger.Debug("First: " + result.RESULT.RESULTS[result.RESULT.RESULTS.Count - 1].QUERY_ID + " Last: " + result.RESULT.RESULTS[0].QUERY_ID);
                    }
                    if (result.RESULT.COMPLETE || result.RESULT.RESULTS.Count <= 0)
                    {
                        done = true;
                        Logger.Info("MAM requested for " + ccHandler.client.dbAccount.bareJid);
                    }
                    ++iteration;
                }
                else if (state == SetupState.REQUESTING_MAM)
                {
                    done = true;
                    Logger.Warn("Failed to request MAM archive for " + ccHandler.client.dbAccount.bareJid + " with: " + result.STATE);
                }
                else
                {
                    Logger.Error($"Failed to request MAM in iteration {iteration} for '{ccHandler.client.dbAccount.bareJid}' with {result.STATE}.");
                    Continue();
                    return;
                }
            }

            ccHandler.client.dbAccount.mamRequest.lastUpdate = DateTime.Now;
            ccHandler.client.dbAccount.mamRequest.Update();
            Continue();
        }
コード例 #6
0
		private void OnGUI() {
			if ( !hasClosedConsole ) {
				hasClosedConsole = true;
				cns.Close();
				cns = null;
			}

			if ( wordWrapLabelStyle == null ) {
				wordWrapLabelStyle = new GUIStyle( GUI.skin.label );
				textAreaStyle = new GUIStyle( GUI.skin.textArea );
				wordWrapLabelStyle.wordWrap = true;
			}

			switch ( setupState ) {
				case SetupState.nothing:
					GUILayout.Label( "This Unity project is not currently under version control." );
					GUILayout.Label( "" );
					GUILayout.Label( "Would you like to 'Clone' a remote repository, or 'Initialize' your current project for Git version control?" );
					GUILayout.Label( "" );

					GUILayout.BeginHorizontal();

					GUI.enabled = !( setupState == SetupState.clone );
					if ( GUILayout.Button( "Clone" ) ) {
						setupState = SetupState.clone;
					}

					GUI.enabled = false;
					if ( GUILayout.Button( "Initialize [NOT YET IMPLEMENTED]" ) ) {
						setupState = SetupState.initialize;
					}

					GUI.enabled = true;
					GUILayout.EndHorizontal();
					break;
				case SetupState.clone:
					drawGetRemoteCredentials();
					GUILayout.Label( "" );
					GUILayout.Label( "WARNING!" );
					GUILayout.Label( "1 ) Any conflicting files in this project directory [" + tempDir + "] will be OVERWRITTEN by the ones one the server. " +
					                 "Back them up if you value them.", wordWrapLabelStyle, GUILayout.Width( 400 ) );
					GUILayout.Label( "" );
					GUILayout.Label( "2 ) If the remote repository has 'Git UniTEAM' under version control, the clone will fail since the .dll " +
					                 "files are currently in use by Unity; you'll have to close Unity, and clone the repository using another tool, " +
					                 "such as TortoiseGit. Data loss may occur if you do not heed / investigate this warning!", wordWrapLabelStyle, GUILayout.Width( 400 ) );
					GUILayout.Label( "" );
					if ( GUILayout.Button( "I understand; Start Clone" ) ) {
						setupState = SetupState.working;
						EditorApplication.LockReloadAssemblies();
						clone();
					}
					if ( GUILayout.Button( "Cancel" ) ) {
						setupState = SetupState.nothing;
					}
					break;
				case SetupState.initialize:
					break;
				case SetupState.working:
					GUILayout.Label( "Work log:" );

					try {
						scroll = GUILayout.BeginScrollView( ( hasWorkError ) ? scroll : new Vector2( 0, int.MaxValue ), textAreaStyle, GUILayout.Height( 200 ) );

						EditorGUILayout.TextArea( string.Join( "\r\n", progressInfo.ToArray() ) );
					}catch{}
					
					GUILayout.EndScrollView();

					if ( hasWorkError ) {
						if ( GUILayout.Button( "Retry failed operation." ) ) {
							progressInfo.Clear();
							hasWorkError = false;
							Directory.Delete( tempDir, true );
							EditorApplication.LockReloadAssemblies();
							clone();
						}
					}
					break;
				case SetupState.complete:
					EditorApplication.UnlockReloadAssemblies();

					GUILayout.Label( "All work complete. Please click the close button." );
					if ( GUILayout.Button( "Close, and restart console." ) ) {
						Console.init();
						this.Close();
					}
					break;
			}
		}
コード例 #7
0
		private void clone(int attempt = 0) {
			progressInfo.Add( "Standby; negotiating connection to remote repository..." );
			scroll.y = int.MaxValue;

			UnityThreadHelper.CreateThread( () => {
				Credentials credentials = new Credentials();
				credentials.Username = username;
				credentials.Password = password;

				try {
					using ( var repo = Repository.Clone(
						gitURL,
						tempDir,
						false, true,
						onTransferProgress, onCheckoutProgress,
						null, credentials ) ) {

						progressInfo.Add( "Clone complete!" );
					}

					moveFiles();
					setupState = SetupState.complete;
				}
				catch ( LibGit2SharpException e ) {
					progressInfo.Add( "Clone failed [PLUGIN] ==> " + e );
					scroll.y = int.MaxValue;

					if ( attempt == 0 ) {
						clone(1);
					}

					hasWorkError = true;
				}
				catch ( System.Exception e ) {
					progressInfo.Add( "Clone Failed [OTHER] ==> " + e );
					scroll.y = int.MaxValue;
					hasWorkError = true;
				}
				finally {
					try {
						Directory.Delete( tempDir, true );
					}
					catch {}
				}
			} );
		}
コード例 #8
0
 protected void SaveData(SetupState setupState)
 {
     Assetsetupinfo SetupInfo = null;
     if (!string.IsNullOrEmpty(PageUtility.GetQueryStringValue("Setupid"))) //修改
     {
         SetupInfo = AssetsetupinfoService.RetrieveAssetsetupinfoBySetupid(Setupid);
         if (SetupInfo==null){return;}
         ExtractData(SetupInfo);
         SetupInfo.Approveresult = setupState;
         AssetsetupinfoService.UpdateAssetsetupinfoBySetupid(SetupInfo);
         foreach (Assetsetupdetail assetsetupdetail in SetupDetail)
         {
             assetsetupdetail.Setupid = SetupInfo.Setupid;
             if (AssetsetupdetailService.RetrieveAssetsetupdetailByDetailid(assetsetupdetail.Detailid) == null)
             {
                 AssetsetupdetailService.CreateAssetsetupdetail(assetsetupdetail);
             }
             else
             {
                 AssetsetupdetailService.UpdateAssetsetupdetailByDetailid(assetsetupdetail);
             }
         }
     }
     else //新增
     {
         SetupInfo=new Assetsetupinfo();
         ExtractData(SetupInfo);
         SetupInfo.Approveresult = setupState;
         AssetsetupinfoService.CreateAssetsetupinfo(SetupInfo);
         foreach (Assetsetupdetail assetsetupdetail in SetupDetail)
         {
             assetsetupdetail.Setupid = SetupInfo.Setupid;
             AssetsetupdetailService.CreateAssetsetupdetail(assetsetupdetail);
         }
     }
 }
コード例 #9
0
ファイル: Setup.cs プロジェクト: Sharkful/Maker-Space-AR-Tour
 public void SetStatePlaceMenu()
 {
     currentState = SetupState.PlaceMenu;
 }
コード例 #10
0
ファイル: Setup.cs プロジェクト: Sharkful/Maker-Space-AR-Tour
 public void SetStateDone()
 {
     currentState = SetupState.Done;
 }