private void bntAddPlayer_Click(object sender, RoutedEventArgs e)
        {
            string       item      = txtPlayerName.Text;
            string       container = "";
            int          counter   = 0;
            string       line;
            StreamReader file = new StreamReader(@"c:\JDR(Lisa)\PlayerCreation.txt");

            while ((line = file.ReadLine()) != null)
            {
                if (counter == 0)
                {
                    container = item + "" + container;
                }
                else
                {
                    container = container + " " + line;
                }
                counter++;
            }
            file.Close();
            Service.TXTFile tf = new Service.TXTFile();
            tf.write(container, "Player");
            tf.clearPlayerCreation();
            MainWindow mn = new MainWindow();

            mn.Show();
            this.Close();
        }
        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            string       container = "";
            int          counter   = 0;
            string       line;
            StreamReader file = new StreamReader(@"c:\JDR(Lisa)\PlayerCreation.txt");

            while ((line = file.ReadLine()) != null)
            {
                if (counter == 3)
                {
                    line      = "";
                    container = container + " " + line;
                }
                else
                {
                    container = container + " " + line;
                }
                counter++;
            }
            file.Close();
            Service.TXTFile tf = new Service.TXTFile();
            tf.clearPlayerInventory(container);
            PlayerInventory pi = new PlayerInventory();

            pi.Show();
            this.Close();
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (lboxEnnemyListAdd.SelectedItem != null)
                {
                    lboxEnnemyListAdd.Items.Remove(lboxEnnemyListAdd.SelectedItem);

                    var list = "";

                    foreach (var item in lboxEnnemyListAdd.Items)
                    {
                        list = list + "/" + item.ToString();
                    }
                    Service.TXTFile tXT = new Service.TXTFile();
                    tXT.delete(list, "ListEnnemy");
                }
                else
                {
                    MessageBox.Show("Aucune ligne n'est sélectionnée.");
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            };
            WAddEnnemy sten = new WAddEnnemy();

            sten.Show();
            this.Close();
        }
        private void bntAddEnnemy_Click(object sender, RoutedEventArgs e)
        {
            string       life      = txtAddEnnemy.Text;
            string       container = "";
            int          counter   = 0;
            string       line;
            StreamReader file = new StreamReader(@"c:\JDR(Lisa)\PlayerCreation.txt");

            while ((line = file.ReadLine()) != null)
            {
                if (counter == 1)
                {
                    container = container + " " + life;
                }
                else
                {
                    container = container + " " + line;
                }
                counter++;
            }
            file.Close();
            Service.TXTFile tf = new Service.TXTFile();
            tf.change(container, "PlayerCreation");
            WAddPlayer wa = new WAddPlayer();

            wa.Show();
            this.Close();
        }
 public StatPlayerInventory()
 {
     InitializeComponent();
     Service.TXTFile tf = new Service.TXTFile();
     tf.create("ListInventory.txt");
     readerPI();
     readerLI();
 }
 public PlayerCapacity()
 {
     InitializeComponent();
     Service.TXTFile tf = new Service.TXTFile();
     tf.create("ListCapacity.txt");
     readerPC();
     readerLC();
 }
        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            Service.TXTFile tx = new Service.TXTFile();
            tx.clear("GameEnnemy");
            WAddEnnemy sten = new WAddEnnemy();

            sten.Show();
            this.Close();
        }
        private void btnClearPlayer_Click(object sender, RoutedEventArgs e)
        {
            Service.TXTFile tx = new Service.TXTFile();
            tx.clear("Player");
            MainWindow mn = new MainWindow();

            mn.Show();
            this.Close();
        }
        private void btnAddPlayer_Click(object sender, RoutedEventArgs e)
        {
            Service.TXTFile tf = new Service.TXTFile();
            tf.create("PlayerCreation.txt");
            WAddPlayer adp = new WAddPlayer();

            adp.Show();
            this.Close();
        }
 public MainWindow()
 {
     InitializeComponent();
     Service.TXTFile tf = new Service.TXTFile();
     tf.create("Player.txt");
     tf.create("ListEnnemy.txt");
     tf.create("GameEnnemy.txt");
     reader();
 }
 private void btnDeleteItem_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (lboxPlayerInventory.SelectedItem != null)
         {
             lboxPlayerInventory.Items.Remove(lboxPlayerInventory.SelectedItem);
             var list = "";
             foreach (var item in lboxPlayerInventory.Items)
             {
                 list = list + "/" + item.ToString();
             }
             string       container = "";
             int          counter   = 0;
             string       line;
             StreamReader file = new StreamReader(@"c:\JDR(Lisa)\PlayerCreation.txt");
             while ((line = file.ReadLine()) != null)
             {
                 if (counter == 3)
                 {
                     container = container + " " + list;
                 }
                 else
                 {
                     container = container + " " + line;
                 }
                 counter++;
             }
             file.Close();
             Service.TXTFile tf = new Service.TXTFile();
             tf.change(container, "PlayerCreation");
             PlayerInventory pi = new PlayerInventory();
             pi.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Aucune ligne n'est sélectionnée.");
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     };
 }
Exemple #12
0
        private void bntAddCapacity_Click(object sender, RoutedEventArgs e)
        {
            string       item      = txtAddCapacity.Text;
            string       container = "";
            string       line;
            StreamReader file = new StreamReader(@"c:\JDR(Lisa)\ListCapacity.txt");

            while ((line = file.ReadLine()) != null)
            {
                container = container + " " + line;
            }
            container = container + " " + item;
            file.Close();
            Service.TXTFile tf = new Service.TXTFile();
            tf.change(container, "ListCapacity");
            PlayerCapacity ac = new PlayerCapacity();

            ac.Show();
            this.Close();
        }
 private void btnAdd_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (lboxListCapacity.SelectedItem != null)
         {
             string       item      = "" + lboxListCapacity.SelectedItem;
             string       container = "";
             int          counter   = 0;
             string       line;
             StreamReader file = new StreamReader(@"c:\JDR(Lisa)\PlayerCreation.txt");
             while ((line = file.ReadLine()) != null)
             {
                 if (counter == 2)
                 {
                     line      = line + "/" + item;
                     container = container + " " + line;
                 }
                 else
                 {
                     container = container + " " + line;
                 }
                 counter++;
             }
             file.Close();
             Service.TXTFile tf = new Service.TXTFile();
             tf.change(container, "PlayerCreation");
             PlayerCapacity pi = new PlayerCapacity();
             pi.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Aucune ligne n'est sélectionnée.");
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     };
 }
 private void btnAddEn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (lboxEnnemyListAdd.SelectedItem != null)
         {
             string       ennemy = "" + lboxEnnemyListAdd.SelectedItem;
             string       line;
             string       container = "";
             StreamReader file      = new StreamReader(@"c:\JDR(Lisa)\ListEnnemy.txt");
             while ((line = file.ReadLine()) != null)
             {
                 string[] words = line.Split(' ');
                 // Get Name
                 if (ennemy == words[0])
                 {
                     Service.Service serv = new Service.Service();
                     string          id   = serv.RandomString(6);
                     container = id + "/" + words[0] + " " + words[1] + " " + words[2] + " " + words[3] + " " + words[4] + " " + words[5] + " " + words[6];
                 }
             }
             file.Close();
             Service.TXTFile tf1 = new Service.TXTFile();
             tf1.write(container, "GameEnnemy");
             WAddEnnemy sten = new WAddEnnemy();
             sten.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Aucune ligne n'est sélectionnée.");
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     };
 }
        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);
            };
        }
Exemple #16
0
        private void bntAddEnnemy_Click(object sender, RoutedEventArgs e)
        {
            string line;
            string container = "";
            string name      = txtName.Text;
            string hp        = txtHp.Text;
            string xp        = txtXp.Text;
            string gold      = txtXp.Text;
            string loot      = "";
            string aptitude  = "";
            string atk       = txtAtk.Text;

            if (name == "" || name == null)
            {
                name = "none";
            }

            if (hp == "" || hp == null)
            {
                hp = "1";
            }

            if (xp == "" || xp == null)
            {
                xp = "1";
            }

            if (gold == "" || gold == null)
            {
                gold = "1";
            }

            if (loot == "" || loot == null)
            {
                loot = "none";
            }
            if (aptitude == "" || aptitude == null)
            {
                aptitude = "none";
            }
            if (atk == "" || atk == null)
            {
                atk = "none";
            }


            StreamReader file = new StreamReader(@"c:\JDR(Lisa)\GameEnnemy.txt");

            while ((line = file.ReadLine()) != null)
            {
                string[] words = line.Split(' ');
                if (name == words[0])
                {
                    MessageBox.Show("0");
                    container = container + "%" + name + " " + hp + " " + xp + " " + gold + " " + loot + " " + aptitude + " " + atk;
                }
                else
                {
                    MessageBox.Show("1");
                    container = container + "%" + line;
                }
            }
            file.Close();
            Service.TXTFile tf = new Service.TXTFile();
            tf.addEnnemy(container, "GameEnnemy");
            WAddEnnemy ad = new WAddEnnemy();

            ad.Show();
            this.Close();
        }