Exemplo n.º 1
0
 private string WritePacket(PacketWriter p, string text)
 {
     switch (comboBox1.SelectedIndex)
     {
         case 0:
             p.WriteByte(byte.Parse(text));
             break;
         case 1:
             p.WriteShort(short.Parse(text));
             break;
         case 2:
             p.WriteInt(int.Parse(text));
             break;
         case 3:
             p.WriteLong(long.Parse(text));
             break;
         case 4:
             p.WriteString(text);
             break;
         case 5:
             p.WriteMapleString(text);
             break;
         default:
             return String.Format("Unhandled Type: [ {0} ] with Index: {1}", comboBox1.SelectedItem, comboBox1.SelectedIndex);
     }
     return p.ToString();
 }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         using (var p = new PacketWriter())
             richTextBox2.Text = WritePacket(p, richTextBox1.Text);
     }
     catch (Exception ex)
     {
         richTextBox2.Text = ex.Message;
     }
 }