Example #1
0
        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);
        }
Example #2
0
 public static void DeserializeEditable(this WiaPropertyCollection props, Dictionary <int, object> values)
 {
     foreach (var kvp in values)
     {
         var prop = props.GetOrNull(kvp.Key);
         if (prop != null)
         {
             try
             {
                 prop.Value = kvp.Value;
             }
             catch (ArgumentException)
             {
             }
             catch (WiaException)
             {
             }
         }
     }
 }
Example #3
0
 public static Dictionary <int, object> SerializeEditable(this WiaPropertyCollection props)
 {
     return(props.Where(x => x.Type == WiaPropertyType.I4).ToDictionary(x => x.Id, x => x.Value));
 }
Example #4
0
 protected internal WiaDeviceInfo(WiaVersion version, IntPtr propStorageHandle) : base(version)
 {
     Properties = new WiaPropertyCollection(version, propStorageHandle);
 }