Esempio n. 1
0
 private void buttonCalculated_Click(object sender, EventArgs e)
 {
     labelPredictionResult.Text = "Результат: " + GlobalVariables.Prediction((string)comboBoxPredictionSelectTeam.SelectedItem, (string)comboBoxPredictionSelectTeam2.SelectedItem);
 }
Esempio n. 2
0
        public static Player CreateObjectPlayer(string[] LinesFile, int IndexStart, int IndexEnd, string discypline)
        {
            string[] NameField = new string[]
            {
                "Name",
                "Nickname",
                "Surname",
                "Team",
                "Country",
                "City",
                "Nationality",
                "DateBirth",
                "Role",
                "Signature",
                "NumberGames",
                "ProcentWinGames",
                "MMR",
                "Pentagon",
                "PhotoProfile",
                "Edit",
            };
            object[] ValueFild = new object[NameField.Length];
            string   tempString;

            string[] tempStringArray;
            int[]    tempIntArray;
            int      templastIndex;
            int      tempIndexNameField = 0;

            for (int i = IndexStart; i < IndexEnd; i++)
            {
                switch (NameField[tempIndexNameField])
                {
                case "Signature":
                    tempString = LinesFile[i].Substring(LinesFile[i].IndexOf(NameField[tempIndexNameField]) + NameField[tempIndexNameField].Length + 3);
                    if (tempString == "" || tempString[0] != '[' || tempString[tempString.Length - 1] != ']')
                    {
                        return((Player)GlobalVariables.MessageErrorData());
                    }
                    tempStringArray = tempString.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
                    try
                    {
                        tempStringArray[0] = tempStringArray[0].Substring(1);
                    }
                    catch (IndexOutOfRangeException e)
                    {
                        return((Player)GlobalVariables.MessageErrorData());
                    }
                    templastIndex = tempStringArray.Length - 1;
                    tempStringArray[templastIndex] = tempStringArray[templastIndex].Substring(0, tempStringArray[templastIndex].Length - 1);
                    ValueFild[tempIndexNameField]  = tempStringArray;
                    break;

                case "Pentagon":
                    tempString                     = LinesFile[i].Substring(LinesFile[i].IndexOf(NameField[tempIndexNameField]) + NameField[tempIndexNameField].Length + 3);
                    tempStringArray                = tempString.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
                    tempStringArray[0]             = tempStringArray[0].Substring(1);
                    templastIndex                  = tempStringArray.Length - 1;
                    tempStringArray[templastIndex] = tempStringArray[templastIndex].Substring(0, tempStringArray[templastIndex].Length - 1);
                    tempIntArray                   = new int[tempStringArray.Length];
                    int j = 0;
                    foreach (string element in tempStringArray)
                    {
                        tempIntArray[j] = Convert.ToInt32(element);
                        j++;
                    }
                    ValueFild[tempIndexNameField] = tempIntArray;
                    break;

                default:
                    ValueFild[tempIndexNameField] = LinesFile[i].Substring(LinesFile[i].IndexOf(NameField[tempIndexNameField]) + NameField[tempIndexNameField].Length + 3);
                    break;
                }
                tempIndexNameField++;
            }
            Player tempPlayer;

            if (discypline == "Dota2")
            {
                tempPlayer = new Dota2Player(ValueFild);
            }
            else
            {
                tempPlayer = new CSGOPlayer(ValueFild);
            }

            return(tempPlayer);
        }