Esempio n. 1
0
        private static bool AddMedia(string filename, MediaType mediaType)
        {
            bool flag = false;

            try
            {
                if (Directory.Exists(filename))
                {
                    flag  = AddMedia(Directory.GetFiles(filename), mediaType);
                    flag |= AddMedia(Directory.GetDirectories(filename), mediaType);
                }
                else if (ZuneLibrary.CanAddMedia(filename, (EMediaTypes)mediaType))
                {
                    flag = ZuneLibrary.AddMedia(filename) != -1;
                }
            }
            catch (UnauthorizedAccessException ex)
            {
            }
            catch (IOException ex)
            {
            }
            return(flag);
        }
Esempio n. 2
0
 private static bool CanAddMedia(string filename, MediaType mediaType, CanAddMediaArgs args)
 {
     try
     {
         return(Directory.Exists(filename) ? ZuneLibrary.CanAddFromFolder(filename) && (CanAddMedia(Directory.GetFiles(filename), mediaType, args) || CanAddMedia(Directory.GetDirectories(filename), mediaType, args)) : ZuneLibrary.CanAddMedia(filename, (EMediaTypes)mediaType));
     }
     catch (UnauthorizedAccessException ex)
     {
         return(false);
     }
     catch (IOException ex)
     {
         return(false);
     }
 }