示例#1
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            if (!File.Exists(textBoxPacket.Text))
            {
                MessageBox.Show("指定的封包不存在!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            GsWinPakMgr pakMgr = new GsWinPakMgr();

            if (radioButtonPack.Checked)
            {
                if (!Directory.Exists(textBoxDir.Text))
                {
                    MessageBox.Show("指定的目录不存在!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                try
                {
                    bool ret = pakMgr.Pack(textBoxDir.Text, textBoxPacket.Text);
                    MessageBox.Show("封包完成!");
                }
                catch (FormatException)
                {
                    MessageBox.Show("封包格式错误!");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("封包失败!错误消息:\n" + ex.Message);
                }
            }
            else if (radioButtonExp.Checked)
            {
                if (!Directory.Exists(textBoxDir.Text))
                {
                    Directory.CreateDirectory(textBoxDir.Text);
                }
                try
                {
                    bool ret = pakMgr.Unpack(textBoxDir.Text, textBoxPacket.Text);
                    MessageBox.Show("解包完成!");
                }
                catch (FormatException)
                {
                    MessageBox.Show("封包格式错误!");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("封包失败!错误消息:\n" + ex.Message);
                }
            }
        }
示例#2
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            if (!File.Exists(textBoxPacket.Text))
            {
                MessageBox.Show("指定的封包不存在!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            GsWinPakMgr pakMgr = new GsWinPakMgr();
            if (radioButtonPack.Checked)
            {
                if (!Directory.Exists(textBoxDir.Text))
                {
                    MessageBox.Show("指定的目录不存在!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                try
                {
                    bool ret = pakMgr.Pack(textBoxDir.Text, textBoxPacket.Text);
                    MessageBox.Show("封包完成!");
                }
                catch (FormatException)
                {
                    MessageBox.Show("封包格式错误!");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("封包失败!错误消息:\n" + ex.Message);
                }
            }
            else if (radioButtonExp.Checked)
            {
                if (!Directory.Exists(textBoxDir.Text))
                    Directory.CreateDirectory(textBoxDir.Text);
                try
                {
                    bool ret = pakMgr.Unpack(textBoxDir.Text, textBoxPacket.Text);
                    MessageBox.Show("解包完成!");
                }
                catch (FormatException)
                {
                    MessageBox.Show("封包格式错误!");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("封包失败!错误消息:\n" + ex.Message);
                }
            }
        }