private MultiMap<string, NwdPortableDeviceObject> FindByUriCached(string uri) { MultiMap<string, NwdPortableDeviceObject> masterMap = new MultiMap<string, NwdPortableDeviceObject>(); NwdUri nwdUri = new NwdUri(uri); var col = new NwdPortableDeviceCollection(); try { col.Refresh(); } catch (Exception ex) { Display.Exception(ex); } foreach (var device in col) { if (device.RootFolder != null) { //device level foreach (NwdPortableDeviceObject pdo in device.RootFolder.Files) { //start a new multimap for each device/storage location MultiMap<string, NwdPortableDeviceObject> found = new MultiMap<string, NwdPortableDeviceObject>(); //need to reset Uri for each device/storage location nwdUri.ResetStack(); //internal vs external storage level if (pdo is NwdPortableDeviceFolder) { NwdPortableDeviceFolder folder = (NwdPortableDeviceFolder)pdo; Retrieve(device, folder, ref nwdUri, ref found); } //add found into master map masterMap.AddAll(found); } } } return masterMap; }
private List<NwdPortableDeviceObject> FindByUri(string uri) { List<NwdPortableDeviceObject> found = new List<NwdPortableDeviceObject>(); NwdUri nwdUri = new NwdUri(uri); var col = new NwdPortableDeviceCollection(); try { col.Refresh(); } catch (Exception ex) { Display.Exception(ex); } foreach (var device in col) { if (device.RootFolder != null) { //device level foreach (NwdPortableDeviceObject pdo in device.RootFolder.Files) { //need to reset Uri for each device/storage location nwdUri.ResetStack(); //internal vs external storage level if (pdo is NwdPortableDeviceFolder) { NwdPortableDeviceFolder folder = (NwdPortableDeviceFolder)pdo; Retrieve(device, folder, ref nwdUri, ref found); } } } } return found; }