private object BackgroundCheckResources(BackgroundWorker worker, DoWorkEventArgs e, params object[] args) { var documents = new List<string>(); foreach (object a in args) { string rid = a.ToString(); if (ResourceIdentifier.Validate(rid)) { var resId = new ResourceIdentifier(rid); if (resId.IsFolder) { foreach (IRepositoryItem o in _conn.ResourceService.GetRepositoryResources((string)args[0]).Children) { if (!o.IsFolder) { documents.Add(o.ResourceId); } } } else { documents.Add(rid); } } } var items = new List<string>(); var test = new MockServerConnection() { SiteVersion = _checkVersion }; var caps = new TestCapabilities(test); if (documents.Count == 0) return items.ToArray(); var unit = 100 / documents.Count; var progress = 0.0; worker.ReportProgress(0); foreach (string resId in documents) { IResource res = _conn.ResourceService.GetResource(resId); Version ver = null; try { ver = caps.GetMaxSupportedResourceVersion(res.ResourceType); } catch { items.Add(resId); continue; } //The resource's version is greater than the maximum version supported by //the user's selected site version if (res.ResourceVersion > ver) { items.Add(resId); } progress += unit; worker.ReportProgress((int)progress); } worker.ReportProgress(100); return items.ToArray(); }
private object BackgroundCheckResources(BackgroundWorker worker, DoWorkEventArgs e, params object[] args) { var documents = new List <string>(); foreach (object a in args) { string rid = a.ToString(); if (ResourceIdentifier.Validate(rid)) { var resId = new ResourceIdentifier(rid); if (resId.IsFolder) { foreach (IRepositoryItem o in _conn.ResourceService.GetRepositoryResources((string)args[0]).Children) { if (!o.IsFolder) { documents.Add(o.ResourceId); } } } else { documents.Add(rid); } } } var items = new List <string>(); var test = new MockServerConnection() { SiteVersion = _checkVersion }; var caps = new TestCapabilities(test); if (documents.Count == 0) { return(items.ToArray()); } var unit = 100 / documents.Count; var progress = 0.0; worker.ReportProgress(0); foreach (string resId in documents) { IResource res = _conn.ResourceService.GetResource(resId); Version ver = null; try { ver = caps.GetMaxSupportedResourceVersion(res.ResourceType); } catch { items.Add(resId); continue; } //The resource's version is greater than the maximum version supported by //the user's selected site version if (res.ResourceVersion > ver) { items.Add(resId); } progress += unit; worker.ReportProgress((int)progress); } worker.ReportProgress(100); return(items.ToArray()); }