Ejemplo n.º 1
0
        private void replaceStringToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string searchStr  = StringInputDlg.GetString("Enter Search String", "");
            string replaceStr = StringInputDlg.GetString("Enter String to replace it with", "");

            if (replaceStr.Length > searchStr.Length)
            {
                MessageBox.Show("Error, cannot replace a string with a longer string");
                return;
            }
            while (replaceStr.Length < searchStr.Length)
            {
                replaceStr = replaceStr + " ";
            }

            List <long> locs = StaticUtils.FindStringInFile(searchStr, SaveFile, 0, SaveFile.Length);

            for (int i = 0; i < locs.Count; i++)
            {
                int stringLoc = (int)locs[i];
                for (int j = 0; j < replaceStr.Length; j++)
                {
                    Tool.SetByte(stringLoc, (byte)replaceStr[j]);
                    Tool.SetByte(stringLoc + 1, 0);
                    stringLoc += 2;
                }
            }
        }
Ejemplo n.º 2
0
        private void getCoachItem_Click(object sender, EventArgs e)
        {
            string number = StringInputDlg.GetString("Enter Coach number", "(0-31", "0");

            try
            {
                int num = Int32.Parse(number);
                if (num > -1 && num < 32)
                {
                    Tool.CoachKey        = Tool.CoachKeyAll;
                    mResultsTextBox.Text = String.Format("#coach:{0}\n{1}\n{2}", num, Tool.CoachKeyAll, Tool.GetCoachData(num));
                }
            }
            catch {
            }
        }
Ejemplo n.º 3
0
        private void autoUpdateYearsProToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string        baseYear    = StringInputDlg.GetString("Base year:", "Enter the year for the season", "2004");
            string        teamsString = StringInputDlg.GetString("Teams:", "Enter the teams you wish to update (seperated by comma), blank for all teams", "");
            List <string> teams       = new List <string>(teamsString.Split(new char[] { ',' }));

            if (teamsString == "" || teams.Count < 1)
            {
                teams = new List <string>(GamesaveTool.Teams);
                teams.Add("FreeAgents");
                teams.Add("DraftClass");
            }

            if (!String.IsNullOrEmpty(baseYear))
            {
                int year = 0;
                Int32.TryParse(baseYear, out year);
                Tool.AutoUpdateYearsProFromYear(year, teams.ToArray());
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Prompts the user for a string to search for
        /// </summary>
        /// <returns>true if the search string was set</returns>
        public bool SetSearchString()
        {
            bool ret = false;

            if (this.SelectionLength > 0)
            {
                SearchString = this.Text.Substring(this.SelectionStart, this.SelectionLength);
            }
            string result = StringInputDlg.GetString(
                "Enter Search String",
                "Please enter text (or a regex) to search for.",
                SearchString);

            if (!result.Equals(""))
            {
                SearchString = result;
                ret          = true;
            }
            return(ret);
        }
Ejemplo n.º 5
0
        private void getCoachBytesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string number = StringInputDlg.GetString("Enter Coach number", "(0-31", "0");

            try
            {
                int num = Int32.Parse(number);
                if (num > 31)
                {
                    StringBuilder sb = new StringBuilder(5000);
                    for (int t = 0; t < 32; t++)
                    {
                        byte[] data = Tool.GetCoachBytes(t);
                        sb.Append(String.Format("Coach {0:d2}:", t));
                        sb.Append("0x");
                        for (int i = 0; i < data.Length; i++)
                        {
                            sb.Append(String.Format("{0:x2}", data[i]));
                        }
                        sb.Append("\n");
                    }
                    mResultsTextBox.Text = sb.ToString();
                }
                else if (num > -1 && num < 32)
                {
                    byte[]        data = Tool.GetCoachBytes(num);
                    StringBuilder sb   = new StringBuilder(data.Length * 2 + 4);
                    sb.Append("0x");
                    for (int i = 0; i < data.Length; i++)
                    {
                        sb.Append(String.Format("{0:x2}", data[i]));
                    }
                    mResultsTextBox.Text = num + ": Coach Bytes\n" + sb.ToString();
                }
            }
            catch
            {
            }
        }