private void ExecuteAddNoise(XmlElement element, MagickImage image)
{
Hashtable arguments = new Hashtable();
foreach (XmlAttribute attribute in element.Attributes)
{
if (attribute.Name == "attenuate")
arguments["attenuate"] = Variables.GetValue<double>(attribute);
else if (attribute.Name == "channels")
arguments["channels"] = Variables.GetValue<Channels>(attribute);
else if (attribute.Name == "noiseType")
arguments["noiseType"] = Variables.GetValue<NoiseType>(attribute);
}
if (OnlyContains(arguments, "noiseType"))
image.AddNoise((NoiseType)arguments["noiseType"]);
else if (OnlyContains(arguments, "noiseType", "attenuate"))
image.AddNoise((NoiseType)arguments["noiseType"], (double)arguments["attenuate"]);
else if (OnlyContains(arguments, "noiseType", "attenuate", "channels"))
image.AddNoise((NoiseType)arguments["noiseType"], (double)arguments["attenuate"], (Channels)arguments["channels"]);
else if (OnlyContains(arguments, "noiseType", "channels"))
image.AddNoise((NoiseType)arguments["noiseType"], (Channels)arguments["channels"]);
else
throw new ArgumentException("Invalid argument combination for 'addNoise', allowed combinations are: [noiseType] [noiseType, attenuate] [noiseType, attenuate, channels] [noiseType, channels]");
}
private void ExecuteAddProfile(XmlElement element, MagickImage image)