/// <summary> /// Deserializes xml markup from file into an ResourceList object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output ResourceList object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out ResourceList obj, out System.Exception exception) { exception = null; obj = default(ResourceList); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } }
public static bool LoadFromFile(string fileName, out ResourceList obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); }
public static bool Deserialize(string xml, out ResourceList obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); }
/// <summary> /// Deserializes workflow markup into an ResourceList object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output ResourceList object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out ResourceList obj, out System.Exception exception) { exception = null; obj = default(ResourceList); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } }
private System.Collections.IEnumerable GetSorted(ResourceList list) { //Sort them before returning them SortedList<string, RepositoryModelItem> folders = new SortedList<string, RepositoryModelItem>(); SortedList<string, RepositoryModelItem> docs = new SortedList<string, RepositoryModelItem>(); foreach (var item in list.Children) { if (item.IsFolder && !item.HasChildren && this.OmitEmptyFolders) continue; if (item.IsFolder) folders.Add(item.ResourceId, new RepositoryModelItem(item)); else if (!HasFilteredTypes() || (HasFilteredTypes() && IsFilteredType(item.ResourceType))) docs.Add(item.ResourceId, new RepositoryModelItem(item)); } foreach (var folder in folders.Values) { yield return folder; } foreach (var doc in docs.Values) { yield return doc; } }
private System.Collections.IEnumerable GetSorted(string connectionName, ResourceList list) { //Sort them before returning them SortedList<string, RepositoryItem> folders = new SortedList<string, RepositoryItem>(); SortedList<string, RepositoryItem> docs = new SortedList<string, RepositoryItem>(); foreach (var item in list.Children) { var it = new RepositoryItem(connectionName, item); it.Model = this; if (it.IsFolder) folders.Add(it.ResourceId, it); else docs.Add(it.ResourceId, it); } foreach (var folder in folders.Values) { yield return folder; } foreach (var doc in docs.Values) { yield return doc; } }
private void PopulateDocumentList(ResourceList list) { lstResources.Clear(); SortedList<string, ResourceListResourceDocument> items = new SortedList<string, ResourceListResourceDocument>(); foreach (var item in list.Items) { var doc = item as ResourceListResourceDocument; if (doc != null) { string sortKey = doc.Name + "." + doc.ResourceType; items.Add(sortKey, doc); } } foreach (var doc in items.Values) { var li = new ListViewItem(doc.Name); li.Tag = doc; try { var rt = ResourceIdentifier.GetResourceType(doc.ResourceId); li.ImageIndex = RepositoryIcons.GetImageIndexForResourceType(rt); } catch { li.ImageIndex = RepositoryIcons.RES_UNKNOWN; } lstResources.Items.Add(li); } }