 
  
   
  
   
  
  if (PlayerRectangle.IntersectsWith(Objects[i]) || Player.Location.Y == 790)|| Player.Location.Y == 790         
  
   
  
   
  
   
  
   
  
  margin-bottom: 200px; 
  
   
  
   
  
  private void button3_Click(object sender, EventArgs e) {//Шифруем текст в файл
            if (pictureBox1.Image == null) {
                MessageBox.Show("Изображение не выбрано");
                return;
            }
            Bitmap img = new Bitmap(pictureBox1.Image);
            
            string textDecode = textBox2.Text;
            byte[] bytes = Encoding.UTF8.GetBytes(textDecode);
            int needLength = 4 + bytes.Length;
            if (img.Width * img.Height < needLength)
            {
                MessageBox.Show("Изображение слишком маленькое для шифрования этого текста");
                return;
            }
            short chanel = 2;//0 - красный, 1 - зеленый, 2 - синий
            byte[] length = BitConverter.GetBytes(bytes.Length);
            //пишем шифрованный текст
            int cur = 0;
            for (int y = 0,wl = 0; y < img.Height; y++) {
                for (int x = 0; x < img.Width && cur < bytes.Length; x++) {
                    var pixel = img.GetPixel(x, y);
                    byte writeData = 0;
                    if (wl < 4) //Пишем длинну в начало
                        writeData = length[wl++];
                    else
                        writeData = bytes[cur++];
                    if (chanel == 0)
                        pixel = Color.FromArgb(writeData,pixel.G,pixel.B);
                    else if(chanel == 1)
                        pixel = Color.FromArgb(pixel.R, writeData, pixel.B);
                    else
                        pixel = Color.FromArgb(pixel.R, pixel.G, writeData);
                    img.SetPixel(x,y,pixel);
                }
            }
            SaveFileDialog saveFile = new SaveFileDialog();
            saveFile.Filter = "Image Files (*.png, *.jpg) | *.png; *.jpg";
            saveFile.InitialDirectory = @"C:\";
            if (saveFile.ShowDialog() == DialogResult.OK) {
                textBox1.Text = saveFile.FileName.ToString();
                img.Save(textBox1.Text);
                pictureBox1.ImageLocation = textBox1.Text;
            }
        }
        private void button2_Click(object sender, EventArgs e) {//Дешифруем текст из файла
            if (pictureBox1.Image == null) {
                MessageBox.Show("Изображение не выбрано");
                return;
            }
            short chanel = 2;//по какому каналу читаем, 0 - красный, 1 - зеленый, 2 - синий
            Bitmap img = new Bitmap(pictureBox1.Image);
            byte[] length = new byte[4];
            for (int y = 0, wl = 0; y < img.Height && wl < 4; y++)
            for (int x = 0; x < img.Width && wl < 4; x++) {
                var pixel = img.GetPixel(x, y);
                if (chanel == 0)
                    length[wl++] = pixel.R;
                else if (chanel == 1)
                    length[wl++] = pixel.G;
                else 
                    length[wl++] = pixel.B;
            }
            var len = BitConverter.ToInt32(length,0);
            byte[] textBytes = new byte[len];
            int cur = 0;
            for (int y = 0, wl = 0; y < img.Height; y++) {
                for (int x = 0; x < img.Width && cur < textBytes.Length; x++)
                {
                    if (wl++ < 4) continue;
                    var pixel = img.GetPixel(x, y);
                    if (chanel == 0)
                        textBytes[cur++] = pixel.R;
                    else if (chanel == 1)
                        textBytes[cur++] = pixel.G;
                    else
                        textBytes[cur++] = pixel.B;
                }
            }
            string text = Encoding.UTF8.GetString(textBytes);
            textBox2.Text = text;
        } 
  
   
  
   
  
  