private void General_Load(object sender, EventArgs e) { LoadopenFile.Filter = "RolePlayMaker(*.RPM)|*.RPM"; LoadopenFile.ShowDialog(); path = LoadopenFile.FileName; if (LoadopenFile.FileName != "") //если в окне была нажата кнопка "ОК" { try { Person nwPer = new Person(); nwPer.Load(path); ////////////////////////////// NameTextBox.Text = nwPer.Name; ClasstextBox1.Text = nwPer.Class; TraittextBox1.Text = nwPer.Trait; HP.Value = nwPer.HP; MaxHp.Value = nwPer.MaxHP; XPValue.Value = nwPer.XP; LvLValue.Value = nwPer.LvL; KB.Value = nwPer.KB; UpedArmor.Value = nwPer.KBArmor; ////////////////////////////////////// Strength.Value = nwPer.Strength; Perception.Value = nwPer.Perception; Endurance.Value = nwPer.Endurance; Charisma.Value = nwPer.Charisma; Intelligence.Value = nwPer.Intelligence; Agility.Value = nwPer.Agility; Luck.Value = nwPer.Luck; ///////////////////////////////////////// LightWeapons1.Value = (int)nwPer.LightWeapons; HeavyWeapons1.Value = (int)nwPer.HeavyWeapons; EnergyWeapons1.Value = (int)nwPer.EnergyWeapons; Unarmed1.Value = (int)nwPer.Unarmed; ColdWeapons1.Value = (int)nwPer.ColdWeapons; ThrowingWeapons1.Value = (int)nwPer.ThrowingWeapons; Medic1.Value = (int)nwPer.Medic; Repair1.Value = (int)nwPer.Repair; Science1.Value = (int)nwPer.Science; Oratory1.Value = (int)nwPer.Oratory; Barter1.Value = (int)nwPer.Barter; Survival1.Value = (int)nwPer.Survival; Lockpick1.Value = (int)nwPer.Lockpick; Theft1.Value = (int)nwPer.Theft; Stealth1.Value = (int)nwPer.Stealth; SabotageExplosives1.Value = (int)nwPer.SabotageExplosives; ///////////////////////////////// Head.Text = nwPer.Head; Neck.Text = nwPer.Neck; Shoulders.Text = nwPer.Shoulders; Spine.Text = nwPer.Spine; Chest.Text = nwPer.Chest; Hand.Text = nwPer.Hand; Gloves.Text = nwPer.Gloves; Belt.Text = nwPer.Belt; Pants.Text = nwPer.Pants; Shoes.Text = nwPer.Shoes; Finger1.Text = nwPer.Finger1; Finger2.Text = nwPer.Finger2; Finger3.Text = nwPer.Finger3; Finger4.Text = nwPer.Finger4; Other.Text = nwPer.Other; RightHand.Text = nwPer.RightHand; LeftHand.Text = nwPer.LeftHand; Replacement.Text = nwPer.Replacement; BackpackTextBox1.Text = nwPer.backpack; Perks.Text = nwPer.Perks; Effects.Text = nwPer.Effects; } catch { DialogResult rezult = MessageBox.Show("Невозможно открыть выбранный файл", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } } else { Close(); } }
private void CharacterNetwork_Load(object sender, EventArgs e) { IPAddress temp = IPAddress.Parse(host); _serverSocket = new Socket(temp.AddressFamily, SocketType.Stream, ProtocolType.Tcp); _serverSocket.Connect(new IPEndPoint(temp, port)); if (_serverSocket.Connected) { AddMessage("Связь с сервером установлена."); listenThread = new Thread(listner); listenThread.IsBackground = true; listenThread.Start(); AddMessage($"Добро пожаловать, {Nick}"); nameData.Text = Nick; } else { AddMessage("Связь с сервером не установлена."); Close(); } LoadopenFile.Filter = "RolePlayMaker(*.RPM)|*.RPM"; LoadopenFile.ShowDialog(); path = LoadopenFile.FileName; if (LoadopenFile.FileName != "") //если в окне была нажата кнопка "ОК" { try { Person nwPer = new Person(); nwPer.Load(path); ////////////////////////////// NameTextBox.Text = nwPer.Name; ClasstextBox1.Text = nwPer.Class; TraittextBox1.Text = nwPer.Trait; HP.Value = nwPer.HP; MaxHp.Value = nwPer.MaxHP; XPValue.Value = nwPer.XP; LvLValue.Value = nwPer.LvL; KB.Value = nwPer.KB; UpedArmor.Value = nwPer.KBArmor; ////////////////////////////////////// Strength.Value = nwPer.Strength; Perception.Value = nwPer.Perception; Endurance.Value = nwPer.Endurance; Charisma.Value = nwPer.Charisma; Intelligence.Value = nwPer.Intelligence; Agility.Value = nwPer.Agility; Luck.Value = nwPer.Luck; ///////////////////////////////////////// LightWeapons1.Value = (int)nwPer.LightWeapons; HeavyWeapons1.Value = (int)nwPer.HeavyWeapons; EnergyWeapons1.Value = (int)nwPer.EnergyWeapons; Unarmed1.Value = (int)nwPer.Unarmed; ColdWeapons1.Value = (int)nwPer.ColdWeapons; ThrowingWeapons1.Value = (int)nwPer.ThrowingWeapons; Medic1.Value = (int)nwPer.Medic; Repair1.Value = (int)nwPer.Repair; Science1.Value = (int)nwPer.Science; Oratory1.Value = (int)nwPer.Oratory; Barter1.Value = (int)nwPer.Barter; Survival1.Value = (int)nwPer.Survival; Lockpick1.Value = (int)nwPer.Lockpick; Theft1.Value = (int)nwPer.Theft; Stealth1.Value = (int)nwPer.Stealth; SabotageExplosives1.Value = (int)nwPer.SabotageExplosives; ///////////////////////////////// Head.Text = nwPer.Head; Neck.Text = nwPer.Neck; Shoulders.Text = nwPer.Shoulders; Spine.Text = nwPer.Spine; Chest.Text = nwPer.Chest; Hand.Text = nwPer.Hand; Gloves.Text = nwPer.Gloves; Belt.Text = nwPer.Belt; Pants.Text = nwPer.Pants; Shoes.Text = nwPer.Shoes; Finger1.Text = nwPer.Finger1; Finger2.Text = nwPer.Finger2; Finger3.Text = nwPer.Finger3; Finger4.Text = nwPer.Finger4; Other.Text = nwPer.Other; RightHand.Text = nwPer.RightHand; LeftHand.Text = nwPer.LeftHand; Replacement.Text = nwPer.Replacement; BackpackTextBox1.Text = nwPer.backpack; Perks.Text = nwPer.Perks; Effects.Text = nwPer.Effects; } catch { DialogResult rezult = MessageBox.Show("Невозможно открыть выбранный файл", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } } else { Close(); } }