Exemplo n.º 1
0
        private void Button_genCirculation_Click(object sender, RoutedEventArgs e)
        {
            if (!int.TryParse(TextBox_FedModelID.Text, out fedID))
            {
                return;
            }

            GraphData graphData = new GraphData();

            //graphData.createCirculationGraph(fedID);
            graphData.createCirculationGraph(fedID);
            if (GraphData.refBimrlCommon.BIMRLErrorStackCount > 0)
            {
                TextBox_Output.Clear();
                string wholeStack = string.Empty;
                while (true)
                {
                    wholeStack += GraphData.refBimrlCommon.StackPopError() + "\n";
                    if (GraphData.refBimrlCommon.BIMRLErrorStackCount == 0)
                    {
                        break;
                    }
                }
                TextBox_Output.Text = wholeStack;
            }

            if (graph != null)
            {
                graph = null;
            }
        }
Exemplo n.º 2
0
        /*MaxLevel Click
         * On click displays the percentage of max level of players in a guild
         * */
        private void Button_MaxLevel_Click(object sender, EventArgs e)
        {
            //title and line
            TextBox_Output.Clear();
            TextBox_Output.AppendText("Percentage of Max Level Players in All Guilds\n" + LINE + "\n");
            //Go through each guild
            foreach (Guild maxGuild in dictGuilds.Values)
            {
                //get all player that are in the guild and are max level
                var PercentQuery =
                    from P in dictPlayers
                    where P.Value.GuildID == maxGuild.Id && P.Value.Level == MAX_LEVEL
                    select P;

                var NumQuery =
                    from P in dictPlayers
                    where P.Value.GuildID == maxGuild.Id
                    select P;

                //Number of max level players out of number of players in guild
                float percent = PercentQuery.Count() / (float)NumQuery.Count();

                //If it is not a number, do not show
                if (!float.IsNaN(percent))
                {
                    TextBox_Output.AppendText(String.Format("{0,-30}{1,8: 0.00%}\n\n", maxGuild, percent));
                }
            }
            //End line and message
            TextBox_Output.AppendText("\nEND RESULTS\n" + LINE);
        }
Exemplo n.º 3
0
        private void Button_GuildType_Click(object sender, EventArgs e)
        {
            //If nothing is selected
            if (ComboBox_GuildType.SelectedIndex == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must select a Guild type ");
                return;
            }
            else
            {
                //title and line
                TextBox_Output.Clear();
                TextBox_Output.AppendText("All " + arrayType[ComboBox_GuildType.SelectedIndex] + "-Type of Guilds\n" + LINE + "\n");

                //Get guilds grouped by
                var GuildTypeQuery =
                    from G in dictGuilds
                    where G.Value.Type == ComboBox_GuildType.SelectedIndex
                    group G by G.Value.Server;

                foreach (var server in GuildTypeQuery)
                {
                    TextBox_Output.AppendText(server.Key.ToString() + "\n");
                    foreach (var gYes in server)
                    {
                        TextBox_Output.AppendText("\t" + gYes.Value.ToString() + "\n");
                    }
                }
                //End line and message
                TextBox_Output.AppendText("\nEND RESULTS\n" + LINE);
            }
        }
Exemplo n.º 4
0
        }//readPlayers

        #endregion//end of Guild, ReadGuilds, Player, ReadPlayers


        public Form1()
        {
            InitializeComponent();
            try
            {
                ReadPlayers(PLAYERS_FILE);
                ReadGuilds(GUILDS_FILE);
            }
            catch (ArgumentException readException)
            {
                TextBox_Output.AppendText("error:" + readException);
            }

            //ComboBox_Guild_Server.DataSource = listServers;
            //ComboBox_Player_Race.DataSource = Enum.GetValues(typeof(Race));
            //fill comboboxes
            ComboBox_Class_ClassType.DataSource  = Enum.GetValues(typeof(Class));
            ComboBox_Server_ClassType.DataSource = listServers;
            //Create a new context so that it can be selected independlty of other comboboxes also  using listServers
            ComboBox_Server_PercentRace.BindingContext = new BindingContext();
            ComboBox_Server_PercentRace.DataSource     = listServers;
            ComboBox_Role_RoleTypes.DataSource         = Enum.GetValues(typeof(Role));
            //Create a new context so that it can be selected independlty of other comboboxes also  using listServers
            ComboBox_Server_RoleTypes.BindingContext = new BindingContext();
            ComboBox_Server_RoleTypes.DataSource     = listServers;
            ComboBox_GuildType.DataSource            = arrayType;

            //Set start value to be nothing
            ComboBox_Class_ClassType.SelectedIndex    = -1;
            ComboBox_Server_ClassType.SelectedIndex   = -1;
            ComboBox_Server_PercentRace.SelectedIndex = -1;
            ComboBox_Role_RoleTypes.SelectedIndex     = -1;
            ComboBox_Server_RoleTypes.SelectedIndex   = -1;
            ComboBox_GuildType.SelectedIndex          = -1;
        }
Exemplo n.º 5
0
        /*Percent Race button
         * On click of percent race button, find the percent of a race selected by the user on the server
         * chosen by the user and display the percentage using LINQ
         * */
        private void Button_PercentRace_Click(object sender, EventArgs e)
        {
            if (ComboBox_Server_PercentRace.SelectedIndex == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must choose a server inorder to search for the percentage of races in a server.");
                return;
            }
            else
            {
                //Count();
                //LINQ
                var PercentQuery =
                    from S in dictGuilds
                    where S.Value.Server == (String)ComboBox_Server_RoleTypes.SelectedItem
                    from P in dictPlayers
                    where P.Value.GuildID == S.Value.Id
                    orderby P.Value.Level
                    select P.Key;

                //Title and line
                TextBox_Output.Clear();
                TextBox_Output.AppendText("All Players with the Role " + ComboBox_Role_RoleTypes.SelectedItem + " in the " + ComboBox_Server_RoleTypes.SelectedItem + " Server.\n" + LINE + "\n");

                //Print players
                foreach (uint player in PercentQuery)
                {
                    TextBox_Output.AppendText(dictPlayers[player] + "\n");
                }

                //End line and message
                TextBox_Output.AppendText("\nEND RESULTS\n" + LINE);
            }
        }
Exemplo n.º 6
0
        private void UpdateOutput()
        {
            printToConsole(delegate()
            {
                dictionary.print();
            }, "[\u2193] print()");

            TextBox_Output.ScrollToEnd();
        }
Exemplo n.º 7
0
        /*Role Types button
         * On click of role types button, find all players of a user specified race from a user specified
         * server and display them using LINQ
         * */
        private void Button_RoleTypes_Click(object sender, EventArgs e)
        {
            if (ComboBox_Role_RoleTypes.SelectedIndex == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must choose a role inorder to search for all classes of that type in a server.");
                return;
            }
            else if (ComboBox_Server_RoleTypes.SelectedIndex == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must choose a server inorder to search for all classes of a class type in a server.");
                return;
            }
            else
            {
                //Gets all players of the selected role on the server
                var RoleQuery =
                    from S in dictGuilds
                    where S.Value.Server == (String)ComboBox_Server_RoleTypes.SelectedItem
                    from P in dictPlayers
                    where P.Value.PlayerRole == (Role)ComboBox_Role_RoleTypes.SelectedIndex && P.Value.GuildID == S.Value.Id

                    select P;

                //Gets all players of the selected role within the selected level
                var LevelQuery =
                    from P in RoleQuery
                    where P.Value.Level >= NumUpDown_Min_RoleTypes.Value && P.Value.Level <= NumUpDown_Max_RoleTypes.Value
                    orderby P.Value.Level
                    select P.Key;

                //Title and line
                TextBox_Output.Clear();
                TextBox_Output.AppendText("All Players with the Role " + ComboBox_Role_RoleTypes.SelectedItem + " in the " + ComboBox_Server_RoleTypes.SelectedItem + " Server.\n" + LINE + "\n");

                if (RoleQuery.Equals(null))
                {
                    TextBox_Output.AppendText("No results for current search.\n");
                }
                else
                {
                    //Print players
                    foreach (uint player in LevelQuery)
                    {
                        TextBox_Output.AppendText(dictPlayers[player] + "\n");
                    }
                }

                //End line and message
                TextBox_Output.AppendText("\nEND RESULTS\n" + LINE);
            }
        }
Exemplo n.º 8
0
        private void RnderingOutputTextbox()
        {
            TextBox_Output.SelectAll();
            TextBox_Output.SelectionFont  = new Font("Microsoft Sans Serif", 8F, FontStyle.Regular, GraphicsUnit.Point);
            TextBox_Output.SelectionColor = System.Drawing.Color.Black;

            TextBox_Output.SelectionStart  = 0;
            TextBox_Output.SelectionLength = 0;

            ColorText(0);

            TextBox_Output.Select(0, 0);
            TextBox_Output.ScrollToCaret();
        }
Exemplo n.º 9
0
        //void TextBox_DataPane_TextChanged(object sender, EventArgs e)
        //{
        //    TextBox_DataPane.Font = new Font(TextBox_DataPane.Font.FontFamily, 8, FontStyle.Regular);
        //    TextBox_DataPane.SelectAll();
        //    TextBox_DataPane.SelectionFont = TextBox_DataPane.Font;
        //    TextBox_DataPane.SelectionStart = 0;
        //    TextBox_DataPane.SelectionLength = 0;
        //}


        protected virtual void Verification_Cancelled(object sender, EventArgs e)
        {
            try
            {
                //cancel the verification
                if (Assertion.VerificationMode)
                {
                    Assertion.Clear();

                    //remove the events
                    Assertion.Action            -= OnAction;
                    Assertion.ReturnResult      -= VerificationFinished;
                    Assertion.Cancelled         -= Verification_Cancelled;
                    Assertion.Failed            -= MC_Failed;
                    Assertion.VerificationOutput = null;
                    Assertion = null;


                    StatusLabel_Text.Text = Resources.Verification_Cancelled;

                    //set the verification result to be unknow.
                    ListView_Assertions.SelectedItems[VerificationIndex].ImageIndex = UNKNOWN_ICON;
                }
                //cancel the result generation
                else
                {
                    Assertion.VerificationOutput = null;

                    TextBox_Output.Text = Assertion.VerificationOutput.ResultString + TextBox_Output.Text;

                    StatusLabel_Text.Text = Resources.Result_Generation_Cancelled;
                    ColorText(0);
                    TextBox_Output.Select(0, 0);
                    TextBox_Output.ScrollToCaret();
                }

                TextBox_Output.Text = StatusLabel_Text.Text + "\r\n\r\n" + TextBox_Output.Text;

                EnableAllControls();
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Common.Ultility.Ultility.LogException(ex, Spec);
                //MessageBox.Show("Exception happened: " + ex.Message + "\r\n" + ex.StackTrace,"PAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 10
0
 private void WriteOutput(string output)
 {
     if (TextBox_Output.Dispatcher.CheckAccess())
     {
         TextBox_Output.Text += output + "\r\n";
         TextBox_Output.UpdateLayout();
         TextBox_Output.ScrollToEnd();
     }
     else
     {
         Dispatcher.Invoke((() =>
         {
             TextBox_Output.Text += output + "\r\n";
             TextBox_Output.UpdateLayout();
             TextBox_Output.ScrollToEnd();
         }));
     }
 }
Exemplo n.º 11
0
        protected virtual void VerificationResult()
        {
            try
            {
                TextBox_Output.Text = Assertion.VerificationOutput.ResultString + TextBox_Output.Text;

                StatusLabel_Text.Text = Resources.Verification_Completed;
                //Resources.ModelCheckingForm_VerificationResult_Verification_Completed;

                TextBox_Output.SelectAll();
                TextBox_Output.SelectionFont   = new Font("Microsoft Sans Serif", 8F, FontStyle.Regular, GraphicsUnit.Point);
                TextBox_Output.SelectionStart  = 0;
                TextBox_Output.SelectionLength = 0;

                ColorText(0);

                TextBox_Output.Select(0, 0);
                TextBox_Output.ScrollToCaret();

                EnableAllControls();
            }
            catch (Exception ex)
            {
                Common.Ultility.Ultility.LogException(ex, Spec);
                //MessageBox.Show("Exception happened during verification: " + ex.Message + "\r\n" + ex.StackTrace, "PAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Assertion.Clear();

                //remove the events
                Assertion.Action       -= OnAction;
                Assertion.Cancelled    -= Verification_Cancelled;
                Assertion.ReturnResult -= VerificationResult;
                Assertion.Failed       -= MC_Failed;
                Spec.AssertionDatabase[Label_SelectedAssertion.Text] = Assertion;

                VerificationIndex++;
                if (VerificationIndex < this.ListView_Assertions.SelectedItems.Count)
                {
                    StartVerification(this.ListView_Assertions.SelectedItems[VerificationIndex]);
                }
            }
        }
Exemplo n.º 12
0
        /*Class Type button
         * On click of class type button, find all players of a user defined class type on a server
         * selected by the user and display them using LINQ
         * */
        private void Button_ClassType_Click(object sender, EventArgs e)
        {
            if (ComboBox_Class_ClassType.SelectedIndex == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must choose a class inorder to search for all classes of that type in a server.");
                return;
            }
            else if (ComboBox_Server_ClassType.SelectedIndex == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must choose a server inorder to search for all classes of a class type in a server.");
                return;
            }
            else
            {
                //Gets all players on the server of the selected class
                var ClassTypeQuery =
                    from S in dictGuilds
                    where S.Value.Server == (String)ComboBox_Server_ClassType.SelectedItem
                    from P in dictPlayers
                    where P.Value.PlayerClass == (Class)ComboBox_Class_ClassType.SelectedIndex && P.Value.GuildID == S.Value.Id
                    orderby P.Value.Level
                    select P.Key;

                //Title and line
                TextBox_Output.Clear();
                TextBox_Output.AppendText("All Players of the Class " + ComboBox_Class_ClassType.SelectedItem + " in the " + ComboBox_Server_ClassType.SelectedItem + " Server.\n" + LINE + "\n");

                //Print players
                foreach (uint player in ClassTypeQuery)
                {
                    TextBox_Output.AppendText(dictPlayers[player] + "\n");
                }

                //End line and message
                TextBox_Output.AppendText("\nEND RESULTS\n" + LINE);
            }
        }
Exemplo n.º 13
0
        private void ColorText(int start)
        {
            int index     = int.MaxValue;
            int indexCase = 0;
            int index1    = TextBox_Output.Find(mystring, start, -1, RichTextBoxFinds.WholeWord);

            if (index1 > 0 && index1 < index)
            {
                index     = index1;
                indexCase = 0;
            }

            index1 = TextBox_Output.Find("-> (", start, -1, RichTextBoxFinds.None);
            if (index1 > 0 && index1 < index)
            {
                index     = index1;
                indexCase = 1;
            }

            index1 = TextBox_Output.Find(ValidString, start, -1, RichTextBoxFinds.WholeWord | RichTextBoxFinds.MatchCase);
            if (index1 > 0 && index1 < index)
            {
                index     = index1;
                indexCase = 2;
            }

            index1 = TextBox_Output.Find(NotValidString, start, -1, RichTextBoxFinds.WholeWord | RichTextBoxFinds.MatchCase);
            if (index1 > 0 && index1 < index)
            {
                index     = index1;
                indexCase = 3;
            }

            index1 = TextBox_Output.Find(Common.Classes.Ultility.Constants.VERFICATION_RESULT_STRING, start, -1, RichTextBoxFinds.WholeWord | RichTextBoxFinds.MatchCase);
            if (index1 >= 0 && index1 < index)
            {
                index     = index1;
                indexCase = 4;
            }

            if (index != int.MaxValue)
            {
                switch (indexCase)
                {
                case 0:
                    TextBox_Output.SelectionStart     = index;
                    TextBox_Output.SelectionLength    = mystring.Length;
                    TextBox_Output.SelectionFont      = fnt;
                    TextBox_Output.SelectionColor     = System.Drawing.Color.Red;
                    TextBox_Output.SelectionBackColor = System.Drawing.Color.Yellow;
                    ColorText(index + mystring.Length);
                    return;

                case 1:
                    int endIndex = TextBox_Output.Find(")*", start, -1, RichTextBoxFinds.None);
                    if (endIndex > 0)
                    {
                        index = index + 3;
                        if (endIndex - index + 2 > 0)
                        {
                            TextBox_Output.SelectionStart = index;

                            TextBox_Output.SelectionLength    = endIndex - index + 2;
                            TextBox_Output.SelectionFont      = fnt;
                            TextBox_Output.SelectionColor     = System.Drawing.Color.Red;
                            TextBox_Output.SelectionBackColor = System.Drawing.Color.Yellow;
                        }
                        ColorText(endIndex + 2);
                    }
                    return;

                case 2:
                    TextBox_Output.SelectionStart  = index;
                    TextBox_Output.SelectionLength = ValidString.Length;
                    TextBox_Output.SelectionFont   = fntBold;
                    TextBox_Output.SelectionColor  = System.Drawing.Color.Green;
                    ColorText(index + 2);
                    return;

                case 3:
                    TextBox_Output.SelectionStart  = index;
                    TextBox_Output.SelectionLength = NotValidString.Length;
                    TextBox_Output.SelectionFont   = fntBold;
                    TextBox_Output.SelectionColor  = System.Drawing.Color.Red;
                    ColorText(index + 2);
                    return;

                case 4:
                    TextBox_Output.SelectionStart  = index;
                    TextBox_Output.SelectionLength = Common.Classes.Ultility.Constants.VERFICATION_RESULT_STRING.Length;
                    TextBox_Output.SelectionFont   = fntBold;
                    TextBox_Output.SelectionColor  = System.Drawing.Color.Blue;
                    ColorText(index + Common.Classes.Ultility.Constants.VERFICATION_RESULT_STRING.Length);
                    return;
                }
            }
        }
Exemplo n.º 14
0
        /*Fill Role button
         * On click of fill role button, find players that could fill chosen role but do not and display them using LINQ
         * */
        private void Button_FillRole_Click(object sender, EventArgs e)
        {
            //if no radiobutton have been selected inform user and exit
            if (CheckRadio() == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must choose a Role to find out which Role could be filled");
                return;
            }
            else
            {
                //get radio button that was checked
                int radio = CheckRadio();

                //gets all the player not in the selected role
                var NotRoleQuery =
                    from P in dictPlayers
                    where P.Value.PlayerRole != (Role)radio
                    orderby P.Value.Level, P.Value.Name
                select P;

                //Gets Players that can fill tank role
                var TankQuery =
                    from P in NotRoleQuery
                    where P.Value.PlayerClass == (Class)0 || P.Value.PlayerClass == (Class)2 || P.Value.PlayerClass == (Class)6
                    select P.Key;
                //Gets players that can fill healer role
                var HealerQuery =
                    from P in NotRoleQuery
                    where P.Value.PlayerClass == (Class)2 || P.Value.PlayerClass == (Class)3 || P.Value.PlayerClass == (Class)6 || P.Value.PlayerClass == (Class)8
                    select P.Key;
                //Gets players that can fill damage roll
                var DamageQuery =
                    from P in NotRoleQuery
                    where P.Value.PlayerClass == (Class)0 || P.Value.PlayerClass == (Class)6 || P.Value.PlayerClass == (Class)8
                    select P.Key;

                //Title and line
                TextBox_Output.Clear();
                TextBox_Output.AppendText("All Eligible Players Not Fulfilling the " + (Role)CheckRadio() + " Role\n" + LINE + "\n");

                switch (CheckRadio())
                {
                case 0:    //if tank button is selected
                    foreach (uint play in TankQuery)
                    {
                        TextBox_Output.AppendText(dictPlayers[play] + "\n");
                    }
                    break;

                case 1:    //if healer button is selected
                    foreach (uint play in HealerQuery)
                    {
                        TextBox_Output.AppendText(dictPlayers[play] + "\n");
                    }
                    break;

                case 2:    //if damage button is selected
                    foreach (uint play in DamageQuery)
                    {
                        TextBox_Output.AppendText(dictPlayers[play] + "\n");
                    }
                    break;

                default:
                    TextBox_Output.AppendText("No Players can currently fill the " + (Role)CheckRadio() + " role");
                    break;
                }
                //End line and message
                TextBox_Output.AppendText("\nEND RESULTS\n" + LINE);
            }
        }
Exemplo n.º 15
0
        /*Percent Race button
         * On click of percent race button, find the percent of a race selected by the user on the server
         * chosen by the user and display the percentage using LINQ
         * */
        private void Button_PercentRace_Click(object sender, EventArgs e)
        {
            if (ComboBox_Server_PercentRace.SelectedIndex == -1)
            {
                TextBox_Output.Clear();
                TextBox_Output.AppendText("You must choose a server inorder to search for the percentage of races in a server.");
                return;
            }
            else
            {   //Declare variables
                int   playerNum = 1;
                int[] raceNum   = { 0, 0, 0, 0 };

                //Gets all players on the server
                var PlayerQuery =
                    from S in dictGuilds
                    where S.Value.Server == (String)ComboBox_Server_PercentRace.SelectedItem
                    from P in dictPlayers
                    where P.Value.GuildID == S.Value.Id
                    select P;

                //Gets the number of players
                playerNum = PlayerQuery.Count();

                //Gets the players with race == 0
                var Race0Query =
                    from P in PlayerQuery
                    where P.Value.PlayerRace == (Race)0
                    select P;

                //Gets the number of players with the race
                raceNum[0] = Race0Query.Count();

                //Gets the players with race == 1
                var Race1Query =
                    from P in PlayerQuery
                    where P.Value.PlayerRace == (Race)1
                    select P;

                //Gets the number of players with the race
                raceNum[1] = Race1Query.Count();

                //Gets the players with race == 2
                var Race2Query =
                    from P in PlayerQuery
                    where P.Value.PlayerRace == (Race)2
                    select P;

                //Gets the number of players with the race
                raceNum[2] = Race2Query.Count();

                //Gets the players with race == 3
                var Race3Query =
                    from P in PlayerQuery
                    where P.Value.PlayerRace == (Race)3
                    select P;

                //Gets the number of players with the race
                raceNum[3] = Race3Query.Count();

                //Check for divide by zero error
                if (playerNum == 0)
                {
                    playerNum = 1;
                }

                //Title and line
                TextBox_Output.Clear();
                TextBox_Output.AppendText("Percentage of Races in the " + ComboBox_Server_PercentRace.SelectedItem + " Server.\n" + LINE + "\n");

                //Print players
                for (int r = 0; r < raceNum.Length; r++)
                {
                    //TextBox_Output.AppendText((Race)r + ": " + ((float)raceNum[r] / playerNum * 100) + "%\n");
                    TextBox_Output.AppendText(String.Format("{0,-10} {1,8: 0.00%}\n", (Race)r + ":", ((float)raceNum[r] / playerNum)));
                }

                //End line and message
                TextBox_Output.AppendText("\nEND RESULTS\n" + LINE);
            }
        }
Exemplo n.º 16
0
 // UI
 private void ClearOutput()
 {
     TextBox_Output.Clear();
 }