private static Properties ReadSliceInfo(IProperties properties) { Properties props = new Properties(); props["ID"] = (int)properties["sliceID"]; props["GroupID"] = (int)properties["groupID"]; if (properties.Contains("Nm") == true) { props["Name"] = properties["Nm"] as string; } props["Left"] = (int)properties["bounds.Left"]; props["Top"] = (int)properties["bounds.Top"]; props["Right"] = (int)properties["bounds.Rght"]; props["Bottom"] = (int)properties["bounds.Btom"]; props["Url"] = properties["url"] as string; props["Target"] = properties["null"] as string; props["Message"] = properties["Msge"] as string; props["AltTag"] = properties["altTag"] as string; if (properties.Contains("bgColor") == true) { props["Alpha"] = (byte)(int)properties["bgColor.alpha"]; props["Red"] = (byte)(int)properties["bgColor.Rd"]; props["Green"] = (byte)(int)properties["bgColor.Grn"]; props["Blue"] = (byte)(int)properties["bgColor.Bl"]; } return(props); }
public static bool TryGetValue <T>(this IProperties props, ref T value, string propertyName) { if (props.Contains(propertyName) == false) { return(false); } value = (T)props[propertyName]; return(true); }
public static bool TryGetValue <T>(this IProperties props, ref T value, string property, params string[] properties) { string propertyName = GeneratePropertyName(property, properties); if (props.Contains(propertyName) == false) { return(false); } value = props.ToValue <T>(propertyName); return(true); }
private static PsdLayerConfigSet _ParseConfig(PsdDocument document) { IProperties imageResources = document.ImageResources; if (imageResources.Contains("XmpMetadata")) { var xmpImageResource = imageResources["XmpMetadata"] as Reader_XmpMetadata; var xmpValue = xmpImageResource.Value["Xmp"] as string; return(ParseXmp(xmpValue)); } else { return(new PsdLayerConfigSet()); } }
public static bool Contains(this IProperties props, string property, params string[] properties) { return(props.Contains(GeneratePropertyName(property, properties))); }
public bool Contains(string name) { return(CurrProperties.Contains(name)); }
private static Properties ReadSliceInfo(IProperties properties) { Properties props = new Properties(); props["ID"] = (int)properties["sliceID"]; props["GroupID"] = (int)properties["groupID"]; if (properties.Contains("Nm") == true) props["Name"] = properties["Nm"] as string; props["Left"] = (int)properties["bounds.Left"]; props["Top"] = (int)properties["bounds.Top"]; props["Right"] = (int)properties["bounds.Rght"]; props["Bottom"] = (int)properties["bounds.Btom"]; props["Url"] = properties["url"] as string; props["Target"] = properties["null"] as string; props["Message"] = properties["Msge"] as string; props["AltTag"] = properties["altTag"] as string; if (properties.Contains("bgColor") == true) { props["Alpha"] = (byte)(int)properties["bgColor.alpha"]; props["Red"] = (byte)(int)properties["bgColor.Rd"]; props["Green"] = (byte)(int)properties["bgColor.Grn"]; props["Blue"] = (byte)(int)properties["bgColor.Bl"]; } return props; }
/// <summary> /// Removes saved value of this option from the properties dictionary /// </summary> /// <param name="properties">Properties dictionary</param> public void RemoveValue(IProperties properties) { if (properties == null) { throw new ArgumentNullException("properties"); } if (properties.Contains(FullName)) { string currentValue = properties.GetString(FullName, null); properties.Remove(FullName); if (Removed != null) { Removed(this, new OptionValueEventArgs(currentValue)); } } }
/// <summary> /// Checks if this option has a saved value in the properties dictionary /// </summary> /// <param name="properties">Properties dictionary</param> /// <returns>True if this option has a saved value in the properties dictionary. False otherwise</returns> public bool HasValue(IProperties properties) { if (properties == null) { throw new ArgumentNullException("properties"); } return properties.Contains(FullName); }
/// <summary> /// Saves a value for this option in the properties dictionary /// </summary> /// <param name="properties">Properties dictionary</param> /// <param name="value">Value to save</param> public void SetValue(IProperties properties, object value) { if (properties == null) { throw new ArgumentNullException("properties"); } if (value == null) { throw new ArgumentNullException("value"); } string currentValue = properties.Contains(FullName) ? properties.GetString(FullName, null) : null; string newValue = Convert.ToBase64String(Utils.BinarySerialize(value)); if ((currentValue == null) || !string.Equals(currentValue, newValue, StringComparison.Ordinal)) { properties.SetString(FullName, newValue); if (currentValue == null) { if (Created != null) { Created(this, new OptionValueEventArgs(newValue)); } } else { if (Changed != null) { Changed(this, new OptionChangedEventArgs(currentValue, newValue)); } } } }
/// <summary> /// Retrieves this option's value from the properties dictionary /// </summary> /// <param name="properties">Properties dictionary</param> /// <returns>Value of this option</returns> public object GetValue(IProperties properties) { if (properties == null) { throw new ArgumentNullException("properties"); } string fullName = FullName; if (properties.Contains(fullName)) { string val = properties.GetString(fullName, null); if (string.IsNullOrEmpty(val)) { return null; } return Utils.BinaryDeserialize(Convert.FromBase64String(val)); } return DefaultValue; }
public static Boolean Contains(this IProperties props, String property, params String[] properties) { return(props.Contains(GeneratePropertyName(property, properties))); }