Exemplo n.º 1
0
        public MediaProviderDraggable Convert(IDraggableData aDraggableData)
        {
            string uri = aDraggableData.GetUri();

            if (uri != null)
            {
                List <upnpObject> list = new List <upnpObject>();
                list.Add(UpnpObjectFactory.Create(uri, uri));
                return(new MediaProviderDraggable(new MediaRetrieverNoRetrieve(list)));
            }

            return(null);
        }
Exemplo n.º 2
0
        public MediaProviderDraggable Convert(IDraggableData aDraggableData)
        {
            string text = aDraggableData.GetText();

            if (text != null)
            {
                List <upnpObject> list = new List <upnpObject>();
                list.Add(UpnpObjectFactory.Create(text, text));
                return(new MediaProviderDraggable(new MediaRetrieverNoRetrieve(list)));
            }

            return(null);
        }
Exemplo n.º 3
0
        private IList <upnpObject> CreateUpnpList(DirectoryInfo aDirectory)
        {
            List <upnpObject> list = new List <upnpObject>();

            foreach (DirectoryInfo di in aDirectory.GetDirectories())
            {
                list.AddRange(CreateUpnpList(di));
            }

            FileInfo[] files      = aDirectory.GetFiles();
            string     artworkUri = UpnpObjectFactory.FindArtworkUri(aDirectory, iVirtualFileSystem);

            foreach (FileInfo fi in files)
            {
                upnpObject o = UpnpObjectFactory.Create(fi, artworkUri, iVirtualFileSystem.Uri(fi.FullName));
                if (o != null)
                {
                    list.Add(o);
                }
            }

            return(list);
        }
Exemplo n.º 4
0
        public MediaProviderDraggable Convert(IDraggableData aDraggableData)
        {
            string[] files = aDraggableData.GetFileList();
            if (files == null)
            {
                return(null);
            }

            List <upnpObject> list = new List <upnpObject>();

            try
            {
                foreach (string f in files)
                {
                    try
                    {
                        FileInfo fileInfo = new FileInfo(f);
                        bool     isFolder = (fileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory;

                        if (isFolder && iExpandFolders)
                        {
                            // this container is a folder that must be expanded
                            DirectoryInfo dirInfo = new DirectoryInfo(f);
                            list.AddRange(CreateUpnpList(dirInfo));
                        }
                        else if (isFolder)
                        {
                            // this container is a folder that must not be expanded
                            DirectoryInfo dirInfo    = new DirectoryInfo(f);
                            string        artworkUri = UpnpObjectFactory.FindArtworkUri(dirInfo, iVirtualFileSystem);
                            list.Add(UpnpObjectFactory.Create(dirInfo, artworkUri));
                        }
                        else
                        {
                            if (fileInfo.Extension == PluginManager.kPluginExtension)
                            {
                                list.Add(UpnpObjectFactory.Create(fileInfo.Name, fileInfo.FullName, "application/zip"));
                            }
                            else if (fileInfo.Extension == Playlist.kPlaylistExtension)
                            {
                                list.Add(UpnpObjectFactory.Create(fileInfo, string.Empty, fileInfo.FullName));
                            }
                            else
                            {
                                string     artworkUri = UpnpObjectFactory.FindArtworkUri(fileInfo.Directory, iVirtualFileSystem);
                                upnpObject o          = UpnpObjectFactory.Create(fileInfo, artworkUri, iVirtualFileSystem.Uri(fileInfo.FullName));
                                if (o != null)
                                {
                                    list.Add(o);
                                }
                            }
                        }
                    }
                    catch (FileNotFoundException)
                    {
                        UserLog.WriteLine("Error retrieving content - file not found: " + f);
                    }
                    catch (IOException ex)
                    {
                        UserLog.WriteLine("Error retrieving content - IOException: " + ex + f);
                    }
                }
            }
            catch (HttpServerException ex)
            {
                UserLog.WriteLine("Error retrieving content: " + ex.Message);
            }

            return(new MediaProviderDraggable(new MediaRetrieverNoRetrieve(list)));
        }