Exemple #1
0
        private void applyDataToCurrentSaveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show(
                "This process will apply the given data to the current save file in memory.\r\n" +
                "You will be prompted for for the data, it must like be in the following example (does not need to be facemask and glove data):\r\n" +
                "   Key=Position,fname,lname,FaceMask,LeftGlove,RightGlove\r\n" +
                "   LookupAndModify \r\n" +
                "   QB,Steve,Young,FaceMask2,None,Team1\r\n" +
                "   QB,Joe,Montana,FaceMask3,Team1,None\r\n\r\n" +
                "In the example above thie feature will search through all players named 'Steve Young' playing QB and\r\n" +
                "set his facemask, left glove and right glove to the data given. Will do the same with 'Joe Montana'"
                , "Info");
            string dataToApply = MessageForm.GetString("Paste data below", "");

            if (dataToApply != null)
            {
                dataToApply = dataToApply.Replace("Team =", "#Team =");
                string      key         = Tool.GetKey(true, true).Replace("#", "");
                InputParser inputParser = new InputParser(Tool);
                inputParser.ProcessText("LookupAndModify\r\n");
                inputParser.ProcessText(dataToApply);
                Tool.SetKey("Key=");
                Tool.GetKey(true, true);
            }
        }
Exemple #2
0
        private void findPlayersMenuItem_Click(object sender, EventArgs e)
        {
            String content = "LookupPlayer\r\n" +
                             mResultsTextBox.Text;
            InputParser parser = new InputParser(Tool);

            parser.ProcessText(content);
            string results = Tool.GetKey(true, true) + "\r\n" +
                             parser.GetLookupPlayers();

            MessageForm.ShowMessage("Results", results, SystemIcons.Information, false, false);
        }
Exemple #3
0
        private void ApplyTextToSave()
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            statusBar1.Text = "Applying data...";
            InputParser parser = new InputParser(this.mTool);
            //parser.UseExistingNames = reuseNamesToConserveNameSpaceToolStripMenuItem.Checked;

            parser.ProcessText(mTextBox.Text);
            sw.Stop();
            statusBar1.Text = "Done Applying data." + (sw.ElapsedMilliseconds / 1000.0) + "s";
            StaticUtils.ShowErrors(false);
        }
Exemple #4
0
        private void ApplyTextToSave()
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            statusBar1.Text = "Applying data...";
            InputParser parser = new InputParser(this.mTool);

            //parser.UseExistingNames = reuseNamesToConserveNameSpaceToolStripMenuItem.Checked;

            parser.ProcessText(mTextBox.Text);
            sw.Stop();
            statusBar1.Text = "Done Applying data." + (sw.ElapsedMilliseconds / 1000.0) + "s";
            StaticUtils.ShowErrors(false);

            string lookupPlayers = parser.GetLookupPlayers();

            if (lookupPlayers != null)
            {
                MessageForm.ShowMessage("Lookup Players", lookupPlayers, SystemIcons.Information, false, false);
            }
        }
Exemple #5
0
        static void Main(string[] args)
        {
            if (args.Length == 0) //GUI mode
            {
                GUI_MODE = true;

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
            else
            {
                GamesaveTool tool = null;
                // arguments
                string saveFileName, outputFileName, dataToApplyTextFile;
                saveFileName = outputFileName = dataToApplyTextFile = null;
                string key      = "";
                string coachKey = "";

                bool showAppearance, showSpecialteams, showAbilities, showPlaybooks, showSchedule, readFromStdIn,
                     autoUpdateDepthChart, autoUpdatePbp, autoUpdatePhoto, showFreeAgents, showDraftClass, showCoaches;
                showAppearance           = showSpecialteams = showAbilities = showPlaybooks = showSchedule = readFromStdIn =
                    autoUpdateDepthChart = autoUpdatePbp = autoUpdatePhoto = showFreeAgents = showDraftClass =
                        showCoaches      = false;

                #region Argument processing
                string arg = "";
                for (int i = 0; i < args.Length; i++)
                {
                    arg = args[i].ToLower();
                    switch (arg)
                    {
                    case "-app":    showAppearance = true; break;

                    case "-st":     showSpecialteams = true; break;

                    case "-ab":     showAbilities = true; break;

                    case "-sch":    showSchedule = true;  break;

                    case "-stdin":  readFromStdIn = true; break;

                    case "-pb":     showPlaybooks = true; break;

                    case "-audc":   autoUpdateDepthChart = true; break;

                    case "-aupbp":  autoUpdatePbp = true; break;

                    case "-auph":   autoUpdatePhoto = true; break;

                    case "-fa":   showFreeAgents = true; break;

                    case "-dc":     showDraftClass = true; break;

                    case "-coach":  showCoaches = true; break;

                    case "-help":       // common help message arguments
                    case "--help":
                    case "/help":
                    case "/?":
                        PrintUsage();
                        return;

                    default:
                        if (args[i].StartsWith("-out:"))
                        {
                            outputFileName = args[i].Substring(5);
                        }
                        else if (args[i].EndsWith(".txt"))
                        {
                            dataToApplyTextFile = args[i];
                        }
                        else if (args[i].EndsWith(".dat", StringComparison.InvariantCultureIgnoreCase) || args[i].EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
                        {
                            saveFileName = args[i];
                        }
                        else if (args[i].StartsWith("-Key:"))
                        {
                            key = args[i].Substring(5);
                        }
                        else if (args[i].StartsWith("-CoachKey:"))
                        {
                            coachKey = args[i].Substring(10);
                        }
                        else
                        {
                            Console.Error.WriteLine("Argument not applied: " + args[i]);
                        }
                        break;
                    }
                }
                #endregion

                #region load save file
                if (saveFileName != null)
                {
                    try
                    {
                        tool = new GamesaveTool();
                        if (!tool.LoadSaveFile(saveFileName))
                        {
                            Console.Error.WriteLine("File '{0}' does not exist. Make sure you have the correct path to the file specified. ", saveFileName);
                            return;
                        }
                    }
                    catch
                    {
                        Console.Error.WriteLine("Error loading file '{0}'. Make sure it is an actual NFL2K5 roster or franchise file. ", saveFileName);
                        return;
                    }
                }
                #endregion
                InputParser parser = new InputParser(tool);
                if (key != "")
                {
                    parser.ProcessText("Key=" + key);
                }
                if (coachKey != "")
                {
                    parser.ProcessText("CoachKey=" + coachKey);
                }

                #region apply text data
                if ((dataToApplyTextFile != null || readFromStdIn) && outputFileName != null)  // apply data to save file
                {
                    if (tool == null)
                    {
                        Console.Error.WriteLine("You must specify a valid save file name in order to apply data.");
                        PrintUsage();
                        return;
                    }
                    if (readFromStdIn)
                    {
                        parser.ReadFromStdin();
                    }
                    else
                    {
                        parser.ProcessFile(dataToApplyTextFile);
                    }
                    if (autoUpdateDepthChart)
                    {
                        tool.AutoUpdateDepthChart();
                    }
                    if (autoUpdatePbp)
                    {
                        tool.AutoUpdatePBP();
                    }
                    if (autoUpdatePhoto)
                    {
                        tool.AutoUpdatePhoto();
                    }
                    try // write to the file specified.
                    {
                        tool.SaveFile(outputFileName);
                        //return;
                    }
                    catch (Exception e)
                    {
                        Console.Error.WriteLine("Error writing to file: {0}. {1}", outputFileName,
                                                e.Message + "\n" + e.StackTrace
                                                );
                    }
                }
                #endregion

                #region printing stuff out
                //TODO: add support for showing playbooks
                if (tool != null)
                {
                    StringBuilder builder = new StringBuilder(5000);
                    if (showAbilities || showAppearance)
                    {
                        builder.Append(tool.GetKey(showAbilities, showAppearance));
                        builder.Append(tool.GetLeaguePlayers(showAbilities, showAppearance, showSpecialteams));
                        if (showFreeAgents)
                        {
                            builder.Append(tool.GetTeamPlayers("FreeAgents", showAbilities, showAppearance, false));
                        }
                        if (showDraftClass)
                        {
                            builder.Append(tool.GetTeamPlayers("DraftClass", showAbilities, showAppearance, false));
                        }
                        if (showCoaches)
                        {
                            builder.Append(tool.GetCoachData());
                        }
                    }
                    if (showSchedule && tool.SaveType == SaveType.Franchise)
                    {
                        builder.Append(tool.GetSchedule());
                    }

                    string lookupPlayers = parser.GetLookupPlayers();
                    if (lookupPlayers != null)
                    {
                        builder.Append(lookupPlayers);
                    }

                    Console.Write(builder.ToString());
                }
                else
                {
                    Console.Error.WriteLine("Error! you need to specify a valid save file.");
                    PrintUsage();
                    return;
                }
                #endregion

                StaticUtils.ShowErrors(true);
            }
        }