Exemple #1
0
        } // GetCurrentUserVideosFolder

        public static string GetTestMedia()
        {
            string folder;
            int    step;

            step   = 1;
            folder = null;
            while (true)
            {
                try
                {
                    switch (step)
                    {
                    case 1: folder = KnownFolders.GetKnownFolder(KnownFolders.Common.SampleVideos, KnownFolders.Flags.None); break;

                    case 2: folder = KnownFolders.GetKnownFolder(KnownFolders.CurrentUser.Videos, KnownFolders.Flags.None); break;

                    case 3: folder = KnownFolders.GetKnownFolder(KnownFolders.Common.SampleMusic, KnownFolders.Flags.None); break;

                    case 4: folder = KnownFolders.GetKnownFolder(KnownFolders.CurrentUser.Music, KnownFolders.Flags.None); break;

                    default:
                        return(null);
                    } // switch

                    var files = Directory.GetFiles(folder);
                    var q     = from file in files
                                let ext = Path.GetExtension(file).ToLowerInvariant()
                                          where ((ext == ".wmv") || (ext == ".mp4") || (ext == ".mkv") || (ext == ".avi") ||
                                                 (ext == ".wma") || (ext == ".mp3") || (ext == ".aac") || (ext == ".wav"))
                                          select file;
                    var media = q.FirstOrDefault();
                    if (media != null)
                    {
                        return(media);
                    }
                }
                catch
                {
                    // ignore
                } // try-catch
                step++;
            }     // while
        }         // GetTestMedia
Exemple #2
0
        } // GetProgramFilesx86Folder

        public static string GetCurrentUserVideosFolder()
        {
            var folder = KnownFolders.GetKnownFolder(KnownFolders.CurrentUser.Videos, KnownFolders.Flags.None);

            return(System.Environment.ExpandEnvironmentVariables(folder));
        } // GetCurrentUserVideosFolder
Exemple #3
0
        }     // GetProgramFilesAnyFolder

        public static string GetProgramFilesx86Folder()
        {
            var folder = KnownFolders.GetKnownFolder(KnownFolders.System.ProgramFiles_x86, KnownFolders.Flags.None);

            return(System.Environment.ExpandEnvironmentVariables(folder));
        } // GetProgramFilesx86Folder