public static Dictionary <int, object> Delta(this WiaPropertyCollection props, Dictionary <int, object> target) { var source = props.SerializeEditable(); var delta = new Dictionary <int, object>(); foreach (var kvp in target) { if (source.ContainsKey(kvp.Key) && !Equals(source[kvp.Key], kvp.Value)) { delta.Add(kvp.Key, kvp.Value); } } return(delta); }
public static void DeserializeEditable(this WiaPropertyCollection props, Dictionary <int, object> values) { foreach (var kvp in values) { var prop = props[kvp.Key]; if (prop != null) { try { prop.Value = kvp.Value; } catch (ArgumentException) { } catch (WiaException) { } } } }
public static Dictionary <int, object> SerializeEditable(this WiaPropertyCollection props) { return(props.Where(x => x.Type == WiaPropertyType.I4).ToDictionary(x => x.Id, x => x.Value)); }
protected internal WiaDeviceInfo(WiaVersion version, IntPtr propStorageHandle) : base(version) { Properties = new WiaPropertyCollection(version, propStorageHandle); }