コード例 #1
0
        private void Retrieve(NwdPortableDevice device,
                              NwdPortableDeviceFolder folder,
                              ref NwdUri uri,
                              ref MultiMap<string, NwdPortableDeviceObject> found)
        {
            folder.Refresh(device);

            string nodeName = uri.PopNodeName();

            if (found.ContainsKey(uri.CurrentTraversalUri))
            {
                //used cached lookup
                foreach (NwdPortableDeviceObject pdo in found[uri.CurrentTraversalUri])
                {
                    ProcessPdo(device, pdo, ref uri, ref found);
                }
            }
            else
            {
                //use standard lookup
                if (folder.Files != null)
                {
                    foreach (NwdPortableDeviceObject pdo in folder.Files)
                    {
                        if (NwdUri.MatchNodeName(nodeName, pdo.Name))
                        {
                            ProcessPdo(device, pdo, ref uri, ref found);
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void Retrieve(NwdPortableDevice device,
                              NwdPortableDeviceFolder folder,
                              ref NwdUri uri,
                              ref List<NwdPortableDeviceObject> found)
        {
            folder.Refresh(device);

            string nodeName = uri.PopNodeName();

            if (folder.Files != null)
            {
                foreach (NwdPortableDeviceObject pdo in folder.Files)
                {
                    if (NwdUri.MatchNodeName(nodeName, pdo.Name))
                    {
                        if (uri.HasNodeKeysInStack())
                        {
                            if (pdo is NwdPortableDeviceFolder)
                            {
                                NwdPortableDeviceFolder nextFolder =
                                    (NwdPortableDeviceFolder)pdo;

                                //uri has one level popped, pass the modified uri and
                                //the newly found folder to the next level of recursion
                                Retrieve(device, nextFolder, ref uri, ref found);
                            }
                            else
                            {
                                //bad key (found name but not a folder and keystack isn't empty, so just return)

                                //do nothing
                            }
                        }
                        else
                        {
                            //finished
                            found.Add(pdo);
                        }
                    }
                }
            }
        }