SetDefine() приватный Метод

private SetDefine ( MagickFormat format, string name, bool flag ) : void
format MagickFormat
name string
flag bool
Результат void
Пример #1
0
        private void ExecuteSetDefine(XmlElement element, MagickSettings settings)
        {
            Hashtable arguments = new Hashtable();

            foreach (XmlAttribute attribute in element.Attributes)
            {
                if (attribute.Name == "flag")
                {
                    arguments["flag"] = Variables.GetValue <Boolean>(attribute);
                }
                else if (attribute.Name == "format")
                {
                    arguments["format"] = Variables.GetValue <MagickFormat>(attribute);
                }
                else if (attribute.Name == "name")
                {
                    arguments["name"] = Variables.GetValue <String>(attribute);
                }
                else if (attribute.Name == "value")
                {
                    arguments["value"] = Variables.GetValue <String>(attribute);
                }
            }
            if (OnlyContains(arguments, "format", "name", "flag"))
            {
                settings.SetDefine((MagickFormat)arguments["format"], (String)arguments["name"], (Boolean)arguments["flag"]);
            }
            else if (OnlyContains(arguments, "format", "name", "value"))
            {
                settings.SetDefine((MagickFormat)arguments["format"], (String)arguments["name"], (String)arguments["value"]);
            }
            else if (OnlyContains(arguments, "name", "value"))
            {
                settings.SetDefine((String)arguments["name"], (String)arguments["value"]);
            }
            else
            {
                throw new ArgumentException("Invalid argument combination for 'setDefine', allowed combinations are: [format, name, flag] [format, name, value] [name, value]");
            }
        }
Пример #2
0
 private void ExecuteSetDefine(XmlElement element, MagickSettings settings)
 {
   Hashtable arguments = new Hashtable();
   foreach (XmlAttribute attribute in element.Attributes)
   {
     if (attribute.Name == "flag")
       arguments["flag"] = Variables.GetValue<Boolean>(attribute);
     else if (attribute.Name == "format")
       arguments["format"] = Variables.GetValue<MagickFormat>(attribute);
     else if (attribute.Name == "name")
       arguments["name"] = Variables.GetValue<String>(attribute);
     else if (attribute.Name == "value")
       arguments["value"] = Variables.GetValue<String>(attribute);
   }
   if (OnlyContains(arguments, "format", "name", "flag"))
     settings.SetDefine((MagickFormat)arguments["format"], (String)arguments["name"], (Boolean)arguments["flag"]);
   else if (OnlyContains(arguments, "format", "name", "value"))
     settings.SetDefine((MagickFormat)arguments["format"], (String)arguments["name"], (String)arguments["value"]);
   else if (OnlyContains(arguments, "name", "value"))
     settings.SetDefine((String)arguments["name"], (String)arguments["value"]);
   else
     throw new ArgumentException("Invalid argument combination for 'setDefine', allowed combinations are: [format, name, flag] [format, name, value] [name, value]");
 }