Index: MediaPortal.Base/language/strings_en.xml =================================================================== --- MediaPortal.Base/language/strings_en.xml (revision 26938) +++ MediaPortal.Base/language/strings_en.xml (working copy) @@ -1956,5 +1956,7 @@ Mute Edition Chapter + Sort by: Created + Sort by: Modified \ No newline at end of file Index: WindowPlugins/GUIVideoFiles/GUIVideoBaseWindow.cs =================================================================== --- WindowPlugins/GUIVideoFiles/GUIVideoBaseWindow.cs (revision 26938) +++ WindowPlugins/GUIVideoFiles/GUIVideoBaseWindow.cs (working copy) @@ -112,8 +112,10 @@ { switch (s.Trim().ToLower()) { - case "date": - return VideoSort.SortMethod.Date; + case "modified": + return VideoSort.SortMethod.Modified; + case "created": + return VideoSort.SortMethod.Created; case "label": return VideoSort.SortMethod.Label; case "name": @@ -299,9 +301,12 @@ case VideoSort.SortMethod.Name: strLine = GUILocalizeStrings.Get(365); break; - case VideoSort.SortMethod.Date: - strLine = GUILocalizeStrings.Get(104); + case VideoSort.SortMethod.Modified: + strLine = GUILocalizeStrings.Get(333334); break; + case VideoSort.SortMethod.Created: + strLine = GUILocalizeStrings.Get(333333); + break; case VideoSort.SortMethod.Size: strLine = GUILocalizeStrings.Get(105); break; @@ -427,14 +432,16 @@ } if (item.FileInfo != null && !item.IsFolder) { - strDate = item.FileInfo.ModificationTime.ToShortDateString() + " " + - item.FileInfo.ModificationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + if (CurrentSortMethod == VideoSort.SortMethod.Modified) + strDate = item.FileInfo.ModificationTime.ToShortDateString() + " " + item.FileInfo.ModificationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + else + strDate = item.FileInfo.CreationTime.ToShortDateString() + " " + item.FileInfo.CreationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); } if (CurrentSortMethod == VideoSort.SortMethod.Name) { item.Label2 = strSize1; } - else if (CurrentSortMethod == VideoSort.SortMethod.Date) + else if (CurrentSortMethod == VideoSort.SortMethod.Modified || CurrentSortMethod == VideoSort.SortMethod.Created) { item.Label2 = strDate; } @@ -457,7 +464,8 @@ dlg.SetHeading(495); // Sort options dlg.AddLocalizedString(365); // name - dlg.AddLocalizedString(104); // date + dlg.AddLocalizedString(333334); // modified + dlg.AddLocalizedString(333333); // created dlg.AddLocalizedString(105); // size dlg.AddLocalizedString(366); // year dlg.AddLocalizedString(367); // rating @@ -474,14 +482,20 @@ return; } + CurrentSortAsc = true; switch (dlg.SelectedId) { case 365: CurrentSortMethod = VideoSort.SortMethod.Name; break; - case 104: - CurrentSortMethod = VideoSort.SortMethod.Date; + case 333334: + CurrentSortMethod = VideoSort.SortMethod.Modified; + CurrentSortAsc = false; break; + case 333333: + CurrentSortMethod = VideoSort.SortMethod.Created; + CurrentSortAsc = false; + break; case 105: CurrentSortMethod = VideoSort.SortMethod.Size; break; Index: WindowPlugins/GUIVideoFiles/VideoSort.cs =================================================================== --- WindowPlugins/GUIVideoFiles/VideoSort.cs (revision 26938) +++ WindowPlugins/GUIVideoFiles/VideoSort.cs (working copy) @@ -35,12 +35,13 @@ public enum SortMethod { Name = 0, - Date = 1, - Size = 2, - Year = 3, - Rating = 4, - Label = 5, - Unwatched = 6 + Modified = 1, + Created = 2, + Size = 3, + Year = 4, + Rating = 5, + Label = 6, + Unwatched = 7 } protected SortMethod currentSortMethod; @@ -183,8 +184,9 @@ } } - case SortMethod.Date: - + case SortMethod.Modified: + case SortMethod.Created: + if (item1.FileInfo == null) { if (!this.TryGetFileInfo(ref item1)) @@ -201,20 +203,32 @@ } } - item1.Label2 = item1.FileInfo.CreationTime.ToShortDateString() + " " + - item1.FileInfo.CreationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); - item2.Label2 = item2.FileInfo.CreationTime.ToShortDateString() + " " + - item2.FileInfo.CreationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + if (currentSortMethod == SortMethod.Modified) + { + item1.Label2 = item1.FileInfo.ModificationTime.ToShortDateString() + " " + item1.FileInfo.ModificationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + item2.Label2 = item2.FileInfo.ModificationTime.ToShortDateString() + " " + item2.FileInfo.ModificationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + } + else + { + item1.Label2 = item1.FileInfo.CreationTime.ToShortDateString() + " " + item1.FileInfo.CreationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + item2.Label2 = item2.FileInfo.CreationTime.ToShortDateString() + " " + item2.FileInfo.CreationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + } if (sortAscending) { - return DateTime.Compare(item1.FileInfo.CreationTime, item2.FileInfo.CreationTime); + if (currentSortMethod == SortMethod.Modified) + return DateTime.Compare(item1.FileInfo.ModificationTime, item2.FileInfo.ModificationTime); + else + return DateTime.Compare(item1.FileInfo.CreationTime, item2.FileInfo.CreationTime); } else { - return DateTime.Compare(item2.FileInfo.CreationTime, item1.FileInfo.CreationTime); + if (currentSortMethod == SortMethod.Modified) + return DateTime.Compare(item2.FileInfo.ModificationTime, item1.FileInfo.ModificationTime); + else + return DateTime.Compare(item2.FileInfo.CreationTime, item1.FileInfo.CreationTime); } - case SortMethod.Unwatched: + case SortMethod.Unwatched: { int ret = 0; if (item1.IsPlayed && !item2.IsPlayed)