/// <summary> /// Indicates if all children are ignored. /// </summary> /// <returns><c>true</c>, if all children are ignored, <c>false</c> otherwise.</returns> /// <param name="obj">Remote cmis object.</param> public static bool AreAllChildrenIgnored(this ICmisObject obj) { IList <string> devices = obj.IgnoredDevices(); if (devices.Contains("*") || devices.Contains(ConfigManager.CurrentConfig.DeviceId.ToString().ToLower())) { return(true); } else { return(false); } }
/// <summary> /// Removes the sync ignore flags of the given device Ids from the given cmis object. /// </summary> /// <param name="obj">Remote CMIS Object.</param> /// <param name="deviceIds">Device identifiers which should be removed from ignore list.</param> public static void RemoveSyncIgnore(this ICmisObject obj, params string[] deviceIds) { var ids = obj.SecondaryObjectTypeIds(); if (ids.Contains("gds:sync")) { var devices = obj.IgnoredDevices(); if (deviceIds == null || deviceIds.Length == 0) { if (devices.Remove("*") || devices.Remove(ConfigManager.CurrentConfig.DeviceId.ToString().ToLower())) { if (devices.Count > 0) { Dictionary <string, object> properties = new Dictionary <string, object>(); properties.Add("gds:ignoreDeviceIds", devices); obj.UpdateProperties(properties, true); } else { obj.RemoveAllSyncIgnores(); } } } else { bool changed = false; foreach (var removeId in deviceIds) { if (devices.Remove(removeId)) { changed = true; } } if (changed) { if (devices.Count > 0) { Dictionary <string, object> properties = new Dictionary <string, object>(); properties.Add("gds:ignoreDeviceIds", devices); obj.UpdateProperties(properties, true); } else { obj.RemoveAllSyncIgnores(); } } } } }