示例#1
0
        //Loading and reading
        private void LoadButton_Click(object sender, EventArgs e)
        {
            //Show the dialog
            if (OpenVinyl.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    //Load the image
                    vinyl = (Bitmap)Bitmap.FromFile(OpenVinyl.FileName);
                }
                catch (Exception)
                { return; }

                //Reset the selected pixel
                ReadPictureBox.SelectedPixel = new Point(0, 0);

                //Set the background image
                ReadPictureBox.BackgroundImage = vinyl;

                //Set the StartX and StartY maximum
                StartX.Maximum = vinyl.Width - 1;
                StartY.Maximum = vinyl.Height - 1;

                //Set the picture box size
                ReadPictureBox.Size = vinyl.Size;

                //Create a new vinyl reader
                reader = new VinylReader(vinyl)
                {
                    IgnoredColor = IgnoredColorBox.BackColor,
                };

                //Enable the buttons
                IgnoreColorButton.Enabled = true;
                IgnoreSelected.Enabled = true;
                FindStart.Enabled = true;
                StartX.Enabled = true;
                StartY.Enabled = true;
                ReadWhite.Enabled = true;
                ReadRed.Enabled = true;
                ReadGreen.Enabled = true;
                ReadBlue.Enabled = true;
                ReadButton.Enabled = true;
                ByterateTextBox.Enabled = true;
            }
        }
示例#2
0
        private void VerifyButton_Click(object sender, EventArgs e)
        {
            //Create a vinyl reader
            VinylReader r = new VinylReader(writer.Canvas)
            {
                FirstPoint = writer.StartPoint,
                ReadColor = writer.DrawColor,
                IgnoredColor = writer.IgnoreColor,
            };

            //Read the bytes, stop at the original length + 100
            r.Read(writer.SoundData.Length + 100);
            BytesCheckedLabel.Text = "Bytes found: " + r.SoundData.Length.ToString();

            //Check how many bytes were read
            if (r.SoundData.Length > writer.SoundData.Length)
                VerifiedLabel.Text = "Too many bytes found";
            else if (r.SoundData.Length < writer.SoundData.Length)
                VerifiedLabel.Text = "Not enough bytes found";
            else
                VerifiedLabel.Text = "Verified";
        }