Skip to content

Commit

Permalink
Patch release [v4.1.1.0]
Browse files Browse the repository at this point in the history
- Fixed history not sorting correctly
  • Loading branch information
o7q committed Aug 25, 2023
1 parent 3bc7cf4 commit 59a0c11
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
~ v4.1.1.0
- Fixed history not sorting correctly

~ v4.1.0.0
- Added a new format option named mp4 (fast), this option will download videos as fast as possible and disregard all codecs (this is extremely useful for downloading long videos if you plan on just viewing them, some video editors may not accept this format)
- Minor spelling changes
Expand Down
2 changes: 1 addition & 1 deletion src/MediaDownloader/MediaDownloader/Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void Main()

if (!ytdlpCheck || !ffmpegCheck)
{
CustomMessageBox customMessageBox = new CustomMessageBox("MediaDownloader will download the following redist files." + redistText + "\n\nPress OK to continue\nPress CLOSE to cancel", true);
CustomMessageBox customMessageBox = new CustomMessageBox("MediaDownloader will download the following redist files:" + redistText + "\n\nPress OK to continue\nPress CLOSE to cancel", true);
customMessageBox.ShowDialog();

if (customMessageBox.Result == DialogResult.Cancel)
Expand Down
6 changes: 3 additions & 3 deletions src/MediaDownloader/MediaDownloader/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public MainMenu()
private void Program_Load(object sender, EventArgs e)
{
UpdateListBox(QueueListBox, "MediaDownloader\\config\\queue", false);
UpdateListBox(HistoryListBox, "MediaDownloader\\config\\history", true);
UpdateNumericalListBox(HistoryListBox, "MediaDownloader\\config\\history");

UpdateVersionLabel();

Expand Down Expand Up @@ -216,7 +216,7 @@ private void HistoryLoadButton_Click(object sender, EventArgs e)

private void HistoryRefreshButton_Click(object sender, EventArgs e)
{
UpdateListBox(HistoryListBox, "MediaDownloader\\config\\history", true);
UpdateNumericalListBox(HistoryListBox, "MediaDownloader\\config\\history");
}

private void HistoryRemoveButton_Click(object sender, EventArgs e)
Expand All @@ -225,7 +225,7 @@ private void HistoryRemoveButton_Click(object sender, EventArgs e)
return;

File.Delete("MediaDownloader\\config\\history\\" + HistoryListBox.SelectedItem + ".mdq");
UpdateListBox(HistoryListBox, "MediaDownloader\\config\\history", true);
UpdateNumericalListBox(HistoryListBox, "MediaDownloader\\config\\history");

if (HistoryListBox.Items.Count == 0)
CONFIG.HISTORY_SAVE_INDEX = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace MediaDownloader.Data
{
public static class Storage
{
public const string VERSION = "v4.1.0";
public const string VERSION = "v4.1.1";
public static ConfigBase CONFIG = new ConfigBase();
public static bool IS_DOWNLOADING = false;
}
Expand Down
20 changes: 20 additions & 0 deletions src/MediaDownloader/MediaDownloader/Scripts/Tools/Forms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@ public static void UpdateListBox(ListBox listBox, string source, bool descending
listBox.Items.Add(item);
}

public static void UpdateNumericalListBox(ListBox listBox, string source)
{
List<string> items = new List<string>();
foreach (string file in Directory.GetFiles(source))
{
string item = Path.GetFileNameWithoutExtension(file);
items.Add(item);
}

items.Sort((a, b) =>
{
int numA = int.Parse(a.Substring(a.IndexOf("(") + 1, a.IndexOf(")") - a.IndexOf("(") - 1));
int numB = int.Parse(b.Substring(b.IndexOf("(") + 1, b.IndexOf(")") - b.IndexOf("(") - 1));
return numB.CompareTo(numA);
});

listBox.Items.Clear();
listBox.Items.AddRange(items.ToArray());
}

public static void DrawListBox(ListBox listbox, DrawItemEventArgs e, Color color)
{
// code forked from: https://stackoverflow.com/a/3709452
Expand Down
1 change: 0 additions & 1 deletion to-do.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
- Fix history not ordering properly

0 comments on commit 59a0c11

Please sign in to comment.