示例#1
0
        private void FillContainer_button_Click(object sender, EventArgs e)
        {
            string message   = Message_textBox.Text;
            Image  container = Container_pictureBox.Image;
            Image  filledContainer;
            Method method = GetCurrentMethod();

            Channel channel      = Red_radioButton.Checked ? Channel.R : Green_radioButton.Checked ? Channel.G : Channel.B;
            int     firstNumber  = Convert.ToInt32(BeginNumber_nud.Value);
            int     secondNumber = Convert.ToInt32(EndNumber_nud.Value);

            switch (method)
            {
            case Method.Simple:
                filledContainer = Embedding.Simple(message, container, channel);
                break;

            case Method.BitsSkipping:
                filledContainer = Embedding.Simple(message, container, channel, firstNumber);
                break;

            case Method.RandBitsSkipping:
                filledContainer = Embedding.RandBitsSkipping(message, container, firstNumber, secondNumber);
                break;

            case Method.BlockOneChannel:
                filledContainer = Embedding.BlockOneChannel(message, container, channel, firstNumber, secondNumber);
                break;

            case Method.BlockThreeChannel:
                filledContainer = Embedding.BlockThreeChannel(message, container, firstNumber, secondNumber);
                break;

            default:
                throw new Exception("Error.");
            }

            FilledContainer_pictureBox.Image = filledContainer;
            if (FilledContainer_pictureBox.Image != null)
            {
                SaveFillContainer_button.Enabled = true;
            }
        }