Exemple #1
0
        private void updatePlayerAppearanceFromFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string         fileName = null;
            OpenFileDialog dlg      = new OpenFileDialog();

            dlg.RestoreDirectory = true;
            dlg.Title            = "Select Player appearance data file";
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                fileName = dlg.FileName;
            }
            dlg.Dispose();

            if (fileName != null)
            {
                String text = System.IO.File.ReadAllText(fileName).Replace("\r\n", "\n");
                String currentLine, playerKey;
                int    index      = 0;
                int    numUpdated = 0;
                int    endIndex   = 0;
                if (text != null && text.IndexOf(mApperanceKey) < 10)
                {
                    Tool.SetKey(mApperanceKey.Replace("#", "KEY="));
                    InputParser inputParser = new InputParser(Tool);

                    for (int i = 0; i < Tool.MaxPlayers; i++)
                    {
                        playerKey = String.Concat(Tool.GetAttribute(i, PlayerOffsets.Position), ",",
                                                  Tool.GetPlayerFirstName(i), ",",
                                                  Tool.GetPlayerLastName(i), ",");
                        index = text.IndexOf(playerKey);
                        if (index > -1)
                        {
                            endIndex    = text.IndexOf('\n', index + 10);
                            currentLine = text.Substring(index, endIndex - index);
                            inputParser.SetPlayerData(i, currentLine, false);
                            numUpdated++;
                        }
                    }
                    Tool.SetKey("");
                    mStatusLabel.Text = "Updated " + numUpdated + " Players";
                    MessageBox.Show(mStatusLabel.Text);
                }
                else
                {
                    MessageBox.Show(this, "Error", "Use a valid Apperance file!\nExtract only 'Apperance' from another save and stash in a file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #2
0
        private void updatePlayerAppearanceFromFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string fileName = null;
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.RestoreDirectory = true;
            dlg.Title = "Select Player appearance data file";
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                fileName = dlg.FileName;
            }
            dlg.Dispose();

            if (fileName != null)
            {
                String text = System.IO.File.ReadAllText(fileName).Replace("\r\n", "\n");
                String currentLine, playerKey;
                int index = 0;
                int numUpdated = 0;
                int endIndex = 0;
                if (text != null && text.IndexOf(mApperanceKey) < 10)
                {
                    Tool.SetKey(mApperanceKey.Replace("#", "KEY="));
                    InputParser inputParser = new InputParser(Tool);

                    for (int i = 0; i < Tool.MaxPlayers; i++)
                    {
                        playerKey = String.Concat(Tool.GetAttribute(i, PlayerOffsets.Position), ",",
                                                  Tool.GetPlayerFirstName(i), ",",
                                                  Tool.GetPlayerLastName(i), ",");
                        index = text.IndexOf(playerKey);
                        if (index > -1)
                        {
                            endIndex = text.IndexOf('\n', index + 10);
                            currentLine = text.Substring(index, endIndex-index);
                            inputParser.SetPlayerData(i, currentLine, false);
                            numUpdated++;
                        }
                    }
                    Tool.SetKey("");
                    mStatusLabel.Text = "Updated " + numUpdated + " Players";
                    MessageBox.Show(mStatusLabel.Text);
                }
                else
                {
                    MessageBox.Show(this, "Error", "Use a valid Apperance file!\nExtract only 'Apperance' from another save and stash in a file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }