Example #1
0
        /*
         * Track Number / Title                              | Len. | Rate |  FPS  | Resolution + SAR  | Size
         * ------------------------------------------------------------------------------------------------------
         * 01 What Made You Say That                         | 3:02 | 2304 | 29.97 | 704x480 / 640x480 | 54.18 MiB
         * 02 Dance With The One That Brought You            | 2:29 | 1992 | 23.98 | 708x480 / 644x480 | 38.82 MiB
         * 03 You Lay A Whole Lot Of Love On Me              | 2:48 | 1399 | 29.97 | 704x348 / 640x348 | 31.88 MiB
         * 04 Whose Bed Have Your Boots Been Under           | 4:25 | 2004 | 23.98 | 708x480 / 644x480 | 69.42 MiB
         * 05 Any Man Of Mine                                | 4:10 | 2603 | 23.98 | 640x480 / 704x480 | 83.35 MiB
         * 06 The Woman In Me (Needs The man In You)         | 4:47 | 1702 | 23.98 | 704x480 / 640x480 | 64.85 MiB
         * 07 (If You're Not In It For Love) I'm Outta Here! | 4:40 | 1800 | 29.97 | 704x368 / 640x368 | 66.53 MiB
         * 08 You Win My Love                                | 4:33 | 2197 | 29.97 | 704x356 / 640x356 | 77.82 MiB
         * 09 No One Needs To Know                           | 3:46 | 1552 | 23.98 | 704x480 / 640x480 | 47.02 MiB
         * 10 Home Ain't Where His Heart Is (Anymore)        | 4:12 | 1599 | 29.97 | 704x360 / 640x360 | 53.82 MiB
         * 11 God Bless The Child                            | 3:49 | 2597 | 29.97 | 704x480 / 640x480 | 76.18 MiB
         * 12 Love Gets Me Every Time                        | 3:34 | 1906 | 23.98 | 704x480 / 640x480 | 53.56 MiB
         * 13 Don't Be Stupid                                | 3:47 | 3006 | 23.98 | 704x480 / 640x480 | 86.57 MiB
         * 14 You're Still The One                           | 3:36 | 1401 | 23.98 | 704x480 / 640x480 | 41.06 MiB
         * 15 Honey I'm Home                                 | 3:43 | 2706 | 29.97 | 708x480 / 644x480 | 77.10 MiB
         * 16 From This Moment On                            | 4:08 | 1603 | 23.98 | 704x480 / 640x480 | 53.09 MiB
         * 17 That Don't Impress Me Much                     | 3:45 | 1996 | 23.98 | 720x480 / 655x480 | 58.72 MiB
         * 18 Man! I Feel Like A Woman!                      | 3:55 | 1653 | 29.97 | 720x480 / 655x480 | 51.70 MiB
         * 19 You've Got A Way                               | 3:28 | 1003 | 23.98 | 716x320 / 651x320 | 29.67 MiB
         * 20 Come On Over                                   | 3:11 | 2301 | 29.97 | 716x480 / 651x480 | 56.81 MiB
         * 21 Rock This Country!                             | 4:41 | 2099 | 29.97 | 708x480 / 644x480 | 76.79 MiB
         * -------------------------------------------------------------------------------------------------------
         * Total:                                            |80:19 | 1976 |                           |  1.22 GiB
         **/

        public string ToStringMediaList()
        {
            string        titleTracks = "Track Number / Title";
            StringBuilder sbBody      = new StringBuilder();

            List <string> listFileNames   = new List <string>();
            List <string> listDurations   = new List <string>();
            List <string> listResolutions = new List <string>();
            List <string> listFileSizes   = new List <string>();

            string totalSize = GetTotalSize().ToString("0.00") + " MiB";
            string totalDura = GetTotalDurationString();

            foreach (string p in FileCollection)
            {
                listFileNames.Add(Path.GetFileName(p));
            }
            int widthFileName = Math.Max(titleTracks.Length, listFileNames.Max(x => x.Length));

            foreach (MediaFile mf in MediaFiles)
            {
                listDurations.Add(Adapter.GetDurationString(mf.Duration));
                listResolutions.Add(mf.Video.Resolution);
                listFileSizes.Add(mf.FileSizeString);
            }

            int widthTracks    = Math.Max(titleTracks.Length, this.MediaFiles.Count.ToString().Length + widthFileName + 1);
            int widthDura      = Math.Max(totalDura.Length, listDurations.Max(x => x.Length));
            int widthRes       = listResolutions.Max(x => x.Length);
            int widthFileSizes = Math.Max(totalSize.Length, listFileSizes.Max(x => x.Length));

            string sampleLine = GetMediaListLine(this.MediaFiles[0], widthFileName, widthDura, widthRes, widthFileSizes);

            sbBody.Append(titleTracks.PadRight(widthTracks));
            sbBody.Append(" | ");
            sbBody.Append("mm:ss".PadLeft(widthDura));
            sbBody.Append(" | ");
            sbBody.Append("Res".PadLeft(widthRes));
            sbBody.Append(" | ");
            sbBody.Append("Size".PadLeft(widthFileSizes));
            sbBody.AppendLine();

            sbBody.AppendLine("-".PadRight(sampleLine.Length, '-'));
            foreach (MediaFile mf in this.MediaFiles)
            {
                sbBody.AppendLine(GetMediaListLine(mf, widthFileName, widthDura, widthRes, widthFileSizes));
            }
            sbBody.AppendLine("-".PadRight(sampleLine.Length, '-'));
            sbBody.Append("Total:".PadRight(widthTracks));
            sbBody.Append(" | ");
            sbBody.Append(totalDura);
            sbBody.Append(" | ");
            sbBody.Append(" ".PadRight(widthRes));
            sbBody.Append(" | ");
            sbBody.Append(totalSize);

            return(sbBody.ToString());
        }
Example #2
0
        public string GetMediaListLine(MediaFile mf, int widthFileName, int widthDura, int widthRes, int widthFileSizes)
        {
            StringBuilder sbBody = new StringBuilder();

            sbBody.Append(mf.Index.ToString().PadLeft(this.MediaFiles.Count.ToString().Length, '0'));
            sbBody.Append(" ");
            sbBody.Append(mf.FileName.PadRight(widthFileName, ' '));
            sbBody.Append(" | ");
            sbBody.Append(Adapter.GetDurationString(mf.Duration).PadLeft(widthDura, ' '));
            sbBody.Append(" | ");
            sbBody.Append(mf.Video.Resolution.PadLeft(widthRes, ' '));
            sbBody.Append(" | ");
            sbBody.Append(mf.FileSizeString.PadLeft(widthFileSizes, ' '));
            return(sbBody.ToString());
        }
Example #3
0
 public string GetTotalDurationString()
 {
     return(Adapter.GetDurationString(GetTotalDuration()));
 }