private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (lboxListInventory.SelectedItem != null)
                {
                    string       name      = SuperGlobal.GlobalName;
                    string       item      = "" + lboxListInventory.SelectedItem;
                    string       container = "";
                    string       line;
                    StreamReader file = new StreamReader(@"c:\JDR(Lisa)\Player.txt");
                    while ((line = file.ReadLine()) != null)
                    {
                        string[] splitline = line.Split(' ');
                        if (name == splitline[0])
                        {
                            string line2 = "";
                            int    cc    = 0;
                            foreach (string value in splitline)
                            {
                                if (cc == 3)
                                {
                                    string value2 = "";
                                    value2 = value + "/" + item;
                                    line2  = line2 + " " + value2;
                                }
                                else if (cc == 0)
                                {
                                    line2 = line2 + value;
                                }
                                else
                                {
                                    line2 = line2 + " " + value;
                                }

                                cc++;
                            }
                            container = container + "%" + line2;
                        }
                        else
                        {
                            container = container + "%" + line;
                        }
                    }
                    file.Close();
                    Service.TXTFile tf = new Service.TXTFile();
                    tf.change2(container, "Player");
                    StatPlayerInventory sp = new StatPlayerInventory();
                    sp.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Aucune ligne n'est sélectionnée.");
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            };
        }
Пример #2
0
        private void bntPlayerInventory_Click(object sender, RoutedEventArgs e)
        {
            StatPlayerInventory sti = new StatPlayerInventory();

            sti.Show();
        }