2 using System.Collections.Generic;
11 public string Parent { get; set; }
12 public string Id { get; set; }
13 public string Title { get; set; }
14 public string Series { get; set; }
15 public string ClassType { get; set; }
16 public Int64 Size { get; set; }
17 public string Date { get; set; }
20 public class DlnaItemList
22 private const string RootFolderId = "FS-Folder";
24 static DlnaItemList instance = null;
26 private List<DlnaItem> dlnaItem = new List<DlnaItem>();
27 private Dictionary<string, string> folderDictionary = new Dictionary<string, string>();
28 private List<string> invalidFolder = new List<string>();
30 public delegate void ListChangedDelegate();
31 public event ListChangedDelegate ListChanged;
33 public static DlnaItemList GetInstance()
37 instance = new DlnaItemList();
38 instance.InvalidateAll();
44 public void InvalidateAll()
46 invalidFolder.Clear();
47 invalidFolder.Add(RootFolderId);
50 public void Invalidate(string folder)
52 if (invalidFolder.Contains(RootFolderId))
57 if (folder == RootFolderId)
63 if (!invalidFolder.Contains(folder))
65 invalidFolder.Add(folder);
70 public List<DlnaItem> GetList()
75 public Dictionary<string, string> GetFolderList()
77 return this.folderDictionary;
80 public List<string> GetInvalidList()
82 return this.invalidFolder;
85 public void UpdateList(
86 List<DlnaItem> newList)
88 this.dlnaItem = newList;
90 this.invalidFolder.Clear();
93 folderDictionary.Clear();
94 folderDictionary.Add("FS-Folder", "ROOT");
95 foreach (DlnaItem item in this.dlnaItem)
97 if (item.ClassType == "container")
99 folderDictionary.Add(item.Id, item.Title);
103 if (this.ListChanged != null)