/// <summary> /// Invokes the <see cref="FileManager"/> to load a carrier image from a specified path to the system. /// </summary> /// <param name="path">Preferably the absolute path of a desired carrier image</param> /// <param name="forceTrueColor">true if the image should be recreated in case it uses a wrong pixel format and false otherwise</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="FileNotFoundException"></exception> /// <exception cref="OutOfMemoryException"></exception> /// <exception cref="Exceptions.WrongPixelFormatException">Always thrown when forceTrueColor is false but the image is not RGB-based</exception> /// <exception cref="FormatException"></exception> private void LoadCarrierImage(string path, bool forceTrueColor) { // Do nothing if the file does not exist if (!File.Exists(path)) { return; } // Do nothing if the image is stored using an inappropriate format if (!_imageExtensions.Contains(Path.GetExtension(path).ToLowerInvariant())) { return; } // Generate carrier image object _carrier = new StegoImage( _fm.ReadImageFile(path, forceTrueColor), Path.GetFileName(path), _fm.GetFileSizeInBytes(path) ); // Display image carrierImagePictureBox.Image = _carrier.Image; // Fill labels with data carrierNameLabel.Text = _carrier.Name; carrierSizeLabel.Text = Converter.BytesToHumanReadableString(_carrier.SizeInBytes); carrierCapacityLabel.Text = Converter.BytesToHumanReadableString( _embedder.CalculateCapacity(_carrier, (byte)(bppComboBox.SelectedIndex + 1))); // Check GUI components CheckEverything(); }