translation1

translation 1

translation 2

translated video downloader window

batch dialog translation

queue scheduler translated

translated browser monitoring
master
subhra74 2021-12-13 14:06:33 +05:30
parent a8f5555688
commit 46c01ef39d
35 changed files with 633 additions and 82 deletions

139
app/XDM/Lang/English--.txt Normal file
View File

@ -0,0 +1,139 @@
DESC_NEW=*New
DESC_DEL=*Delete
MENU_PAUSE=*Pause
MENU_RESUME=*Resume
CTX_OPEN_FILE=*Open
CTX_OPEN_FOLDER=*Open folder
LBL_SEARCH=*Search
TITLE_SETTINGS=*Settings
MENU_DELETE_COMPLETED=*Remove finished downloads
MENU_IMPORT=*Import
MENU_EXPORT=*Export
MENU_EXIT=*Exit
MENU_UPDATE=*Check for update
MENU_ABOUT=*About XDM
LBL_REPORT_PROBLEM=*Report a problem
LBL_SUPPORT_PAGE=*Help and support
MENU_DELETE_DWN=*Delete downloads
LBL_NEW_DOWNLOAD=*New download
LBL_MENU=*Menu
SETTINGS_MONITORING=*Browser monitoring
ALL_UNFINISHED=*Incomplete
ALL_FINISHED=*Complete
CAT_DOCUMENTS=*Document
CAT_COMPRESSED=*Compressed
CAT_MUSIC=*Music
CAT_VIDEOS=*Video
CAT_PROGRAMS=*Application
LBL_VIDEO_DOWNLOAD=*Video download
MENU_BATCH_DOWNLOAD=*Batch download
DESC_Q_TITLE=*Queue and scheduler
CTX_SAVE_AS=*Save As
CTX_COPY_URL=*Copy URL
CTX_COPY_FILE=*Copy File
MENU_REFRESH_LINK=*Refresh link
LBL_SHOW_PROGRESS=*Show progress
MENU_PROPERTIES=*Properties
MENU_RESTART=*Restart
Q_SCHEDULE_TXT=*Scheduler
Q_MOVE_TO=*Move to Queue
SORT_NAME=*Name
SORT_DATE=*Date
SORT_SIZE=*Size
SORT_STATUS=*Status
MENU_LANG=*Language
MSG_LANG1=*Select language
MSG_LANG2=*Please note changes will take effect next time you start XDM
MSG_OK=*OK
ND_CANCEL=*Cancel
STAT_DOWNLOADING=*Downloading
STAT_STOPPED=*Stopped
STAT_FINISHED=*Finished
ND_ADDRESS=*Address
ND_FILE=*File
LBL_SAVE_IN=*Save in
ND_IGNORE_URL=*Do not capture download from this address
ND_MORE=*More...
ND_DOWNLOAD_LATER=*Download Later
ND_DOWNLOAD_NOW=*Download Now
ND_AUTO_CAT=*Automatically select based on file type
BTN_BROWSE=*Browse...
ND_TITLE=*New Download
DESC_ADV_TITLE=*Advanced settings
ND_AUTH=*Authentication
DESC_NET4=*Proxy settings
SPEED_LIMIT_TITLE=*Speed limit
DESC_USER=*User Name
DESC_PASS=*Password
ND_AUTH_REMEMBER=*Remember authentication for this website
LBL_NET_OPT_DEF=*System default
ND_NO_PROXY=*No Proxy
ND_MANUAL_PROXY=*Manual Proxy
PROXY_HOST=*Proxy Host
Proxy Port=*Proxy Port
DESC_NET7=*Proxy username
DESC_NET8=*Proxy password
ND_SYSTEM_PROXY=*Open system proxy settings
MENU_SPEED_LIMITER=*Speed limiter
MSG_SPEED_LIMIT=*Download speed limit [KB/Sec ](0 unlimited)
MSG_INVALID_PORT=*Invalid port
MSG_INVALID_URL=*Download address is invalid or unsupported
MSG_NO_FILE=*Please enter file name
LBL_NEW_QUEUE=*Name
MSG_DOWNLOAD_FFMPEG=*Download FFmpeg?
LBL_QUEUE_OPT3=*Do not use queue
VID_PASTE_URL=*Please paste video URL link here
SETTINGS_ADV=*Advanced settings
VID_CHK=*Check/Uncheck All
O_VID_FMT=*Formats
BAT_PATTERN=*Pattern
BAT_LINKS=*Links
BAT_SELECT_ITEMS=*Select items to download
BAT_PASTE_LINK=*Please paste download links below
LBL_BATCH_DESC=*Download a group of sequential files using asterisk wild card (example http://xdman.sourceforge.net/images/edge*.png)
LBL_BATCH_ASTERISK=*Replace asterisk with
LBL_BATCH_LETTER=*Letters
LBL_BATCH_NUM=*Numbers
LBL_BATCH_FROM=*From
LBL_BATCH_TO=*To
LBL_BATCH_WILDCARD_SIZE=*Wildcard size
LBL_BATCH_FILE1=*First file
LBL_BATCH_FILE2=*Second file
LBL_BATCH_FILEN=*Last file
BAT_LEADING_ZERO=*Use leading zero
BAT_NO_LINK=*No link
MENU_START_Q=*Start Queue
DESC_SAVE_Q=*Save
Q_ADD=*Add
Q_REMOVE=*Remove
Q_MOVE_UP=*Move up
Q_MOVE_DN=*Move down
Q_MOVE_TO=*Move to...
Q_LIST_FILES=*Files in queue
Q_SCHEDULE_TXT=*Scheduler
Q_ENABLE=*Enable scheduler
MSG_Q_START=*Start queue at
MSG_Q_STOP=*Stop queue at
MSG_Q_DAILY=*Daily
MSG_Q_D1=*Sunday
MSG_Q_D2=*Monday
MSG_Q_D3=*Tuesday
MSG_Q_D4=*Wednesday
MSG_Q_D5=*Thursday
MSG_Q_D6=*Friday
MSG_Q_D7=*Saturday
SETTINGS_GENERAL=*General settings
SETTINGS_NETWORK=*Network settings
SETTINGS_CRED=*Password manager
SETTINGS_ADV=*Advanced settings
DESC_MONITORING_1=*Please select browsers to monitor and make sure, browser addon is installed and enabled in respective browsers
DESC_OTHER_BROWSERS=*XDM can also be integrated into other Chromium based browser (SRWare Iron etc) or Mozilla based (Icewasel, Waterfox etc) browsers using below links
DESC_CHROME=*Chromium based browsers
DESC_MOZ=*Firefox based browsers
DESC_FILETYPES=*XDM will automatically take over downloads from browser for below file types
DESC_DEF=*Defaults
DESC_VIDEOTYPES=*XDM will show download option when below video formats are played in browser
LBL_MIN_VIDEO_SIZE=*Download video larger than
DESC_SITEEXCEPTIONS=*Do not automatically capture downloads from below web sites
MENU_CLIP_ADD=*Monitor clipboard
LBL_GET_TIMESTAMP=*Get timestamp from server

View File

@ -45,4 +45,95 @@ MENU_LANG=Language
MSG_LANG1=Select language
MSG_LANG2=Please note changes will take effect next time you start XDM
MSG_OK=OK
ND_CANCEL=Cancel
ND_CANCEL=Cancel
STAT_DOWNLOADING=Downloading
STAT_STOPPED=Stopped
STAT_FINISHED=Finished
ND_ADDRESS=Address
ND_FILE=File
LBL_SAVE_IN=Save in
ND_IGNORE_URL=Do not capture download from this address
ND_MORE=MORE...
ND_DOWNLOAD_LATER=Download Later
ND_DOWNLOAD_NOW=Download Now
ND_AUTO_CAT=Automatically select based on file type
BTN_BROWSE=Browse...
ND_TITLE=New Download
DESC_ADV_TITLE=Advanced settings
ND_AUTH=Authentication
DESC_NET4=Proxy settings
SPEED_LIMIT_TITLE=Speed limit
DESC_USER=User Name
DESC_PASS=Password
ND_AUTH_REMEMBER=Remember authentication for this website
LBL_NET_OPT_DEF=System default
ND_NO_PROXY=No Proxy
ND_MANUAL_PROXY=Manual Proxy
PROXY_HOST=Proxy Host
Proxy Port=Proxy Port
DESC_NET7=Proxy username
DESC_NET8=Proxy password
ND_SYSTEM_PROXY=Open system proxy settings
MENU_SPEED_LIMITER=Speed limiter
MSG_SPEED_LIMIT=Download speed limit [KB/Sec ](0 unlimited)
MSG_INVALID_PORT=Invalid port
MSG_INVALID_URL=Download address is invalid or unsupported
MSG_NO_FILE=Please enter file name
LBL_NEW_QUEUE=Name
MSG_DOWNLOAD_FFMPEG=Download FFmpeg?
LBL_QUEUE_OPT3=Do not use queue
VID_PASTE_URL=Please paste video URL link here
SETTINGS_ADV=Advanced settings
VID_CHK=Check/Uncheck All
O_VID_FMT=Formats
BAT_PATTERN=Pattern
BAT_LINKS=Links
BAT_SELECT_ITEMS=Select items to download
BAT_PASTE_LINK=Please paste download links below
LBL_BATCH_DESC=Download a group of sequential files using asterisk wild card (example http://xdman.sourceforge.net/images/edge*.png)
LBL_BATCH_ASTERISK=Replace asterisk with
LBL_BATCH_LETTER=Letters
LBL_BATCH_NUM=Numbers
LBL_BATCH_FROM=From
LBL_BATCH_TO=To
LBL_BATCH_WILDCARD_SIZE=Wildcard size
LBL_BATCH_FILE1=First file
LBL_BATCH_FILE2=Second file
LBL_BATCH_FILEN=Last file
BAT_LEADING_ZERO=Use leading zero
BAT_NO_LINK=No link
MENU_START_Q=Start Queue
DESC_SAVE_Q=Save
Q_ADD=Add
Q_REMOVE=Remove
Q_MOVE_UP=Move up
Q_MOVE_DN=Move down
Q_MOVE_TO=Move to...
Q_LIST_FILES=Files in queue
Q_SCHEDULE_TXT=Scheduler
Q_ENABLE=Enable scheduler
MSG_Q_START=Start queue at
MSG_Q_STOP=Stop queue at
MSG_Q_DAILY=Daily
MSG_Q_D1=Sunday
MSG_Q_D2=Monday
MSG_Q_D3=Tuesday
MSG_Q_D4=Wednesday
MSG_Q_D5=Thursday
MSG_Q_D6=Friday
MSG_Q_D7=Saturday
SETTINGS_GENERAL=General settings
SETTINGS_NETWORK=Network settings
SETTINGS_CRED=Password manager
SETTINGS_ADV=Advanced settings
DESC_MONITORING_1=Please select browsers to monitor and make sure, browser addon is installed and enabled in respective browsers
DESC_OTHER_BROWSERS=XDM can also be integrated into other Chromium based browser (SRWare Iron etc) or Mozilla based (Icewasel, Waterfox etc) browsers using below links
DESC_CHROME=Chromium based browsers
DESC_MOZ=Firefox based browsers
DESC_FILETYPES=XDM will automatically take over downloads from browser for below file types
DESC_DEF=Defaults
DESC_VIDEOTYPES=XDM will show download option when below video formats are played in browser
LBL_MIN_VIDEO_SIZE=Download video larger than
DESC_SITEEXCEPTIONS=Do not automatically capture downloads from below web sites
MENU_CLIP_ADD=Monitor clipboard
LBL_GET_TIMESTAMP=Get timestamp from server

View File

@ -36,6 +36,10 @@ namespace Translations
var lines = File.ReadAllLines(path);
foreach (var line in lines)
{
if (string.IsNullOrEmpty(line))
{
continue;
}
var index = line.IndexOf('=');
var key = line.Substring(0, index);
var val = line.Substring(index + 1);

View File

@ -1,5 +1,6 @@
using System.IO;
using TraceLog;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.UI;
@ -7,8 +8,8 @@ namespace XDM.Common.UI
{
internal static class CommonUtils
{
private static string AutoSelectText = "Automatically select based on file type";
private static string BrowseText = "Browse...";
private static string AutoSelectText = TextResource.GetText("ND_AUTO_CAT");
private static string BrowseText = TextResource.GetText("BTN_BROWSE");
//internal static void ProcessManualSelection(string selectedFile, IFileSelectable window, ref string? selectedFolder)
//{
// var file = Path.GetFileName(selectedFile);

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.Common.Segmented;
using XDM.Core.Lib.Util;
@ -74,12 +75,12 @@ namespace XDM.Common.UI
window.DownloadClicked += (a, b) =>
{
OnDownloadClicked(app, appUi, window, fileName, CommonUtils.SelectedFolderFromIndex(window.SeletedFolderIndex), message, true);
OnDownloadClicked(app, window, fileName, CommonUtils.SelectedFolderFromIndex(window.SeletedFolderIndex), message, true);
};
window.DownloadLaterClicked += (a, b) =>
{
OnDownloadClicked(app, appUi, window, fileName, CommonUtils.SelectedFolderFromIndex(window.SeletedFolderIndex), message, false, b.QueueId);
OnDownloadClicked(app, window, fileName, CommonUtils.SelectedFolderFromIndex(window.SeletedFolderIndex), message, false, b.QueueId);
};
window.QueueSchedulerClicked += (s, e) =>
@ -128,17 +129,18 @@ namespace XDM.Common.UI
// window.ShowWindow();
//}
private static void OnDownloadClicked(IApp app, IAppUI appUi, INewDownloadDialogSkeleton window,
private static void OnDownloadClicked(IApp app, INewDownloadDialogSkeleton window,
string fileName, string? selectedFolder, Message message, bool startImmediately, string? queueId = null)
{
if (!Helpers.IsUriValid(window.Url))
{
appUi.ShowMessageBox(window, "URL is invalid");
window.ShowMessageBox(TextResource.GetText("MSG_INVALID_URL"));
return;
}
if (string.IsNullOrEmpty(window.SelectedFileName))
{
appUi.ShowMessageBox(window, "No filename");
window.ShowMessageBox(TextResource.GetText("MSG_NO_FILE"));
return;
}

View File

@ -1,4 +1,5 @@
using System.IO;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.Common.MediaProcessor;
using XDM.Core.Lib.Util;
@ -21,12 +22,12 @@ namespace XDM.Common.UI
{
if (string.IsNullOrEmpty(window.SelectedFileName))
{
appUi.ShowMessageBox(window, "No filename");
window.ShowMessageBox(TextResource.GetText("MSG_NO_FILE"));
return;
}
if (app.IsFFmpegRequiredForDownload(id) && !IsFFmpegInstalled())
{
if (appUi.Confirm(window, "Download FFmpeg?"))
if (appUi.Confirm(window, TextResource.GetText("MSG_DOWNLOAD_FFMPEG")))
{
appUi.InstallLatestFFmpeg();
}
@ -46,7 +47,7 @@ namespace XDM.Common.UI
{
if (string.IsNullOrEmpty(window.SelectedFileName))
{
appUi.ShowMessageBox(window, "No filename");
window.ShowMessageBox(TextResource.GetText("MSG_NO_FILE"));
return;
}
app.StartVideoDownload(id, Helpers.SanitizeFileName(window.SelectedFileName),

View File

@ -280,9 +280,9 @@ namespace XDM.WinForm.UI
"Use Systems proxy settings",
"No Proxy",
"Manual proxy"});
this.comboBox1.Location = new System.Drawing.Point(119, 13);
this.comboBox1.Location = new System.Drawing.Point(116, 13);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(397, 23);
this.comboBox1.Size = new System.Drawing.Size(400, 23);
this.comboBox1.TabIndex = 0;
//
// label3
@ -302,7 +302,7 @@ namespace XDM.WinForm.UI
this.label4.Location = new System.Drawing.Point(15, 44);
this.label4.Margin = new System.Windows.Forms.Padding(5);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(96, 19);
this.label4.Size = new System.Drawing.Size(93, 19);
this.label4.TabIndex = 2;
this.label4.Text = "Proxy Host";
//
@ -313,7 +313,7 @@ namespace XDM.WinForm.UI
this.label5.Location = new System.Drawing.Point(15, 73);
this.label5.Margin = new System.Windows.Forms.Padding(5);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(96, 19);
this.label5.Size = new System.Drawing.Size(93, 19);
this.label5.TabIndex = 3;
this.label5.Text = "Proxy Username";
//
@ -321,7 +321,7 @@ namespace XDM.WinForm.UI
//
this.label6.AutoSize = true;
this.label6.Dock = System.Windows.Forms.DockStyle.Fill;
this.label6.Location = new System.Drawing.Point(272, 44);
this.label6.Location = new System.Drawing.Point(271, 44);
this.label6.Margin = new System.Windows.Forms.Padding(5);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(90, 19);
@ -332,7 +332,7 @@ namespace XDM.WinForm.UI
//
this.label7.AutoSize = true;
this.label7.Dock = System.Windows.Forms.DockStyle.Fill;
this.label7.Location = new System.Drawing.Point(272, 73);
this.label7.Location = new System.Drawing.Point(271, 73);
this.label7.Margin = new System.Windows.Forms.Padding(5);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(90, 19);
@ -342,41 +342,44 @@ namespace XDM.WinForm.UI
// textBox3
//
this.textBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox3.Location = new System.Drawing.Point(119, 42);
this.textBox3.Location = new System.Drawing.Point(116, 42);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(145, 23);
this.textBox3.Size = new System.Drawing.Size(147, 23);
this.textBox3.TabIndex = 6;
//
// textBox4
//
this.textBox4.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox4.Location = new System.Drawing.Point(370, 42);
this.textBox4.Location = new System.Drawing.Point(369, 42);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(146, 23);
this.textBox4.Size = new System.Drawing.Size(147, 23);
this.textBox4.TabIndex = 7;
//
// textBox5
//
this.textBox5.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox5.Location = new System.Drawing.Point(119, 71);
this.textBox5.Location = new System.Drawing.Point(116, 71);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(145, 23);
this.textBox5.Size = new System.Drawing.Size(147, 23);
this.textBox5.TabIndex = 8;
//
// textBox6
//
this.textBox6.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox6.Location = new System.Drawing.Point(370, 71);
this.textBox6.Location = new System.Drawing.Point(369, 71);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(146, 23);
this.textBox6.Size = new System.Drawing.Size(147, 23);
this.textBox6.TabIndex = 9;
//
// button3
//
this.button3.AutoSize = true;
this.button3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel3.SetColumnSpan(this.button3, 4);
this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
this.button3.Location = new System.Drawing.Point(13, 100);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(100, 23);
this.button3.Size = new System.Drawing.Size(503, 25);
this.button3.TabIndex = 10;
this.button3.Text = "Proxy";
this.button3.UseVisualStyleBackColor = true;

View File

@ -1,15 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Translations;
using XDM.Core.Lib.Common;
#if !(NET472_OR_GREATER || NET5_0_OR_GREATER)
using static XDM.WinForm.UI.WinFormsPolyfill;
#endif
namespace XDM.WinForm.UI
{
public partial class AdvancedDownloadDialog : Form
@ -115,10 +114,13 @@ namespace XDM.WinForm.UI
{
if (!Int32.TryParse(textBox4.Text, out _))
{
MessageBox.Show("Invalid port");
MessageBox.Show(TextResource.GetText("MSG_INVALID_PORT"));
e.Cancel = true;
}
};
button3.Margin = new Padding(0, LogicalToDeviceUnits(10), 0, LogicalToDeviceUnits(10));
LoadTexts();
}
private void button1_Click(object sender, EventArgs e)
@ -153,5 +155,23 @@ namespace XDM.WinForm.UI
{
DialogResult = DialogResult.Cancel;
}
private void LoadTexts()
{
tabPage1.Text = TextResource.GetText("ND_AUTH");
tabPage2.Text = TextResource.GetText("DESC_NET4");
tabPage4.Text = TextResource.GetText("MENU_SPEED_LIMITER");
label1.Text = TextResource.GetText("DESC_USER");
label2.Text = TextResource.GetText("DESC_PASS");
checkBox1.Text = TextResource.GetText("ND_AUTH_REMEMBER");
label3.Text = TextResource.GetText("DESC_NET4");
label4.Text = TextResource.GetText("PROXY_HOST");
label5.Text = TextResource.GetText("DESC_NET7");
label6.Text = TextResource.GetText("Proxy Port");
label7.Text = TextResource.GetText("DESC_NET8");
button3.Text = TextResource.GetText("ND_SYSTEM_PROXY");
}
}
}

View File

@ -17,6 +17,8 @@ using XDMApp;
using XDM.Core.Lib.UI;
using Translations;
using XDM.WinForm.UI.FormHelper;
using System.Threading;
using XDM.WinForm.UI.Win32;
#if !(NET472_OR_GREATER || NET5_0_OR_GREATER)
using static XDM.WinForm.UI.WinFormsPolyfill;
@ -52,7 +54,7 @@ namespace XDM.WinForm.UI
public event EventHandler ClipboardChanged;
private IButton newButton, deleteButton, pauseButton, resumeButton, openFileButton, openFolderButton;
private IMenuItem[] menuItems;
private Timer runAfterShown;
private System.Windows.Forms.Timer runAfterShown;
private IFormColors FormColors;
@ -114,7 +116,7 @@ namespace XDM.WinForm.UI
Shown += (_, _) =>
{
runAfterShown = new Timer { Interval = 1000 };
runAfterShown = new() { Interval = 1000 };
runAfterShown.Tick += (x, y) =>
{
Helpers.RunGC();
@ -1764,13 +1766,13 @@ namespace XDM.WinForm.UI
public INewDownloadDialogSkeleton CreateNewDownloadDialog(bool empty)
{
var newDownloadDialogWin32 = new NewDownloadDialogView(empty);
var newDownloadDialogWin32 = new NewDownloadDialogView(empty/*, GlobalFontCollection.RiFontInstance*/);
return newDownloadDialogWin32;
}
public INewVideoDownloadDialog CreateNewVideoDialog()
{
var newVideoDialogWin32 = new NewVideoDownloadDialogView();
var newVideoDialogWin32 = new NewVideoDownloadDialogView(GlobalFontCollection.RiFontInstance);
return newVideoDialogWin32;
}
@ -1921,7 +1923,7 @@ namespace XDM.WinForm.UI
{
this.CreateHandle();
}
SetForegroundWindow(this.Handle);
NativeMethods.SetForegroundWindow(this.Handle);
};
}
@ -2635,6 +2637,24 @@ namespace XDM.WinForm.UI
}
}
//public void RunOnNewThread(Action action)
//{
// var t = new Thread(() =>
// {
// try
// {
// action.Invoke();
// }
// catch (Exception ex)
// {
// Log.Debug(ex, ex.Message);
// }
// })
// { Name = "NEw threAD" };
// t.SetApartmentState(ApartmentState.STA);
// t.Start();
//}
public void ShowBatchDownloadWindow(IApp app, IAppUI appUi)
{
using var dlg = new BatchDownloadWindow(app, appUi);
@ -3486,7 +3506,7 @@ namespace XDM.WinForm.UI
// this.dgActiveList.ClearSelection();
//}
[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
//[DllImport("user32.dll")]
//static extern bool SetForegroundWindow(IntPtr hWnd);
}
}

View File

@ -7,8 +7,9 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Translations;
#if !(NET472_OR_GREATER||NET5_0_OR_GREATER)
#if !(NET472_OR_GREATER || NET5_0_OR_GREATER)
using static XDM.WinForm.UI.WinFormsPolyfill;
#endif
@ -34,6 +35,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
, LogicalToDeviceUnits(10), LogicalToDeviceUnits(2));
this.Padding = new Padding(LogicalToDeviceUnits(10));
this.label1.Padding = new Padding(0, LogicalToDeviceUnits(10), 0, LogicalToDeviceUnits(10));
LoadTexts();
}
private void button1_Click(object sender, EventArgs e)
@ -42,7 +44,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
{
if (subPage.BatchSize == 0)
{
MessageBox.Show("No link");
MessageBox.Show(this, TextResource.GetText("BAT_NO_LINK"));
return;
}
LinksAdded?.Invoke(this, new BatchLinkEventArgs
@ -57,7 +59,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
var uris = textBox1.Text.Split('\r', '\n').Where(x => x.Length > 0).Select(x => new Uri(x)).ToList();
if (uris.Count < 1)
{
MessageBox.Show("No link");
MessageBox.Show(this, TextResource.GetText("BAT_NO_LINK"));
return;
}
LinksAdded?.Invoke(this, new BatchLinkEventArgs
@ -67,7 +69,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
}
catch (UriFormatException)
{
MessageBox.Show("Invalid url");
MessageBox.Show(this, TextResource.GetText("MSG_INVALID_URL"));
}
catch (Exception ex)
{
@ -81,5 +83,14 @@ namespace XDM.WinForm.UI.BachDownloadPages
{
Cancelled?.Invoke(this, EventArgs.Empty);
}
private void LoadTexts()
{
tabPage1.Text = TextResource.GetText("BAT_PATTERN");
tabPage2.Text = TextResource.GetText("BAT_LINKS");
button1.Text= TextResource.GetText("MSG_OK");
button2.Text= TextResource.GetText("ND_CANCEL");
label1.Text= TextResource.GetText("BAT_PASTE_LINK");
}
}
}

View File

@ -186,7 +186,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
this.doNotAddToQueueToolStripMenuItem,
this.manageQueueAndSchedulersToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(231, 70);
this.contextMenuStrip1.Size = new System.Drawing.Size(231, 48);
//
// doNotAddToQueueToolStripMenuItem
//

View File

@ -4,8 +4,9 @@ using System.Collections.Generic;
using System.Windows.Forms;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.Util;
using Translations;
#if !(NET472_OR_GREATER||NET5_0_OR_GREATER)
#if !(NET472_OR_GREATER || NET5_0_OR_GREATER)
using static XDM.WinForm.UI.WinFormsPolyfill;
#endif
@ -34,6 +35,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
label1.Padding = label2.Padding = textBox1.Margin = button3.Margin = padding2;
button1.Padding = button4.Padding = button5.Padding = button2.Padding = padding1;
this.Padding = new Padding(LogicalToDeviceUnits(10));
LoadTexts();
}
public void SetBatchLinks(IEnumerable<Uri> links)
@ -47,7 +49,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
}
catch (UriFormatException)
{
MessageBox.Show("Invalid url");
MessageBox.Show(this, TextResource.GetText("MSG_INVALID_URL"));
}
catch (Exception ex)
{
@ -128,5 +130,18 @@ namespace XDM.WinForm.UI.BachDownloadPages
{
appUI.ShowQueueWindow(this.ParentForm);
}
private void LoadTexts()
{
label2.Text = TextResource.GetText("BAT_SELECT_ITEMS");
label1.Text = TextResource.GetText("LBL_SAVE_IN");
button1.Text = TextResource.GetText("ND_DOWNLOAD_LATER");
button2.Text = TextResource.GetText("ND_DOWNLOAD_NOW");
button4.Text = TextResource.GetText("ND_CANCEL");
button5.Text = TextResource.GetText("ND_MORE");
doNotAddToQueueToolStripMenuItem.Text = TextResource.GetText("LBL_QUEUE_OPT3");
manageQueueAndSchedulersToolStripMenuItem.Text = TextResource.GetText("DESC_Q_TITLE");
}
}
}

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Translations;
namespace XDM.WinForm.UI.BachDownloadPages
{
@ -65,7 +66,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
};
comboBox1.SelectedIndex = 0;
comboBox2.SelectedIndex = comboBox2.Items.Count - 1;
LoadTexts();
}
private void OnBatchPatternChange()
@ -98,7 +99,7 @@ namespace XDM.WinForm.UI.BachDownloadPages
}
catch (UriFormatException)
{
MessageBox.Show("Invalid url");
MessageBox.Show(this,TextResource.GetText("MSG_INVALID_URL"));
}
catch (Exception ex)
{
@ -156,5 +157,20 @@ namespace XDM.WinForm.UI.BachDownloadPages
}
}
}
private void LoadTexts()
{
label1.Text = TextResource.GetText("LBL_BATCH_DESC");
label2.Text = TextResource.GetText("ND_ADDRESS");
label3.Text = TextResource.GetText("LBL_BATCH_ASTERISK");
radioButton1.Text = TextResource.GetText("LBL_BATCH_NUM");
radioButton2.Text = TextResource.GetText("LBL_BATCH_LETTER");
label4.Text = TextResource.GetText("LBL_BATCH_FROM");
label5.Text = TextResource.GetText("LBL_BATCH_TO");
label8.Text = TextResource.GetText("LBL_BATCH_FILE1");
label9.Text = TextResource.GetText("LBL_BATCH_FILE2");
label10.Text = TextResource.GetText("LBL_BATCH_FILEN");
checkBox1.Text = TextResource.GetText("BAT_LEADING_ZERO");
}
}
}

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.Common.Segmented;
@ -98,6 +99,8 @@ namespace XDM.WinForm.UI
this.Controls.Add(page1);
this.Controls.Add(page2);
page1.BringToFront();
Text = TextResource.GetText("MENU_BATCH_DOWNLOAD");
}
}

View File

@ -338,7 +338,6 @@ namespace XDM.WinForm.UI
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "NewDownloadDialogView";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "New Download";
this.TopMost = true;

View File

@ -2,11 +2,14 @@
using System.Drawing;
using System.Drawing.Text;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using TraceLog;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.UI;
using XDM.WinForm.UI.FormHelper;
using XDMApp;
using XDM.WinForm.UI.Win32;
#if !(NET472_OR_GREATER || NET5_0_OR_GREATER)
using static XDM.WinForm.UI.WinFormsPolyfill;
@ -48,7 +51,9 @@ namespace XDM.WinForm.UI
public NewDownloadDialogView(bool empty)
{
Log.Debug("Thread name: " + Thread.CurrentThread.Name);
InitializeComponent();
this.TopMost = true;
comboBox1 = AppWinPeer.AppsUseLightTheme ? new ComboBox() : new SkinnableComboBox();
this.tableLayoutPanel2.SetColumnSpan(this.comboBox1, 2);
comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
@ -122,6 +127,8 @@ namespace XDM.WinForm.UI
{
this.DestroyEvent?.Invoke(this, EventArgs.Empty);
};
LoadTexts();
}
public void DisposeWindow()
@ -178,9 +185,35 @@ namespace XDM.WinForm.UI
// set => /*comboBox2.SelectedIndex = value == FileConflictResolution.AutoRename ?*/ value = 0 /*: 1*/;
//}
//[STAThread]
public void ShowWindow()
{
this.Show();
//var f = new Form();
//f.TopMost = true;
//f.Show();
//Log.Debug("Thread: " + Thread.CurrentThread.Name);
//if (!IsHandleCreated)
//{
// CreateHandle();
//}
//NativeMethods.SetWindowTopMost(this);
//NativeMethods.SetForegroundWindow(this.Handle);
//this.Shown += (_, _) =>
//{
// TopLevel = true;
// TopMost = true;
// NativeMethods.SetForegroundWindow(this.Handle);
// NativeMethods.SetWindowTopMost(this);
// NativeMethods.SetForegroundWindow(this.Handle);
//};
//TopMost = true;
//Application.DoEvents();
//this.BringToFront();
//Log.Debug("Thread name: " + Thread.CurrentThread.Name);
//this.Visible = true;
//this.Activate();
//Application.Run(this);
}
void INewDownloadDialogSkeleton.Invoke(Action callback)
@ -341,5 +374,24 @@ namespace XDM.WinForm.UI
{
this.QueueSchedulerClicked?.Invoke(this, EventArgs.Empty);
}
private void LoadTexts()
{
label1.Text = TextResource.GetText("ND_ADDRESS");
label2.Text = TextResource.GetText("ND_FILE");
label3.Text = TextResource.GetText("LBL_SAVE_IN");
linkLabel1.Text = TextResource.GetText("ND_IGNORE_URL");
button4.Text = TextResource.GetText("ND_MORE");
button2.Text = TextResource.GetText("ND_DOWNLOAD_LATER");
button1.Text = TextResource.GetText("ND_DOWNLOAD_NOW");
Text = TextResource.GetText("ND_TITLE");
doNotAddToQueueToolStripMenuItem.Text= TextResource.GetText("LBL_QUEUE_OPT3");
manageQueueAndSchedulersToolStripMenuItem.Text= TextResource.GetText("DESC_Q_TITLE");
}
public void ShowMessageBox(string text)
{
MessageBox.Show(this, text);
}
}
}

View File

@ -2,7 +2,9 @@
using System.Drawing;
using System.Drawing.Text;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.UI;
using XDM.WinForm.UI.FormHelper;
@ -34,7 +36,7 @@ namespace XDM.WinForm.UI
public DownloadSchedule? DownloadSchedule { get; set; }
public NewVideoDownloadDialogView()
public NewVideoDownloadDialogView(PrivateFontCollection fc)
{
InitializeComponent();
@ -45,11 +47,10 @@ namespace XDM.WinForm.UI
comboBox1.Dock = DockStyle.Fill;
this.tableLayoutPanel2.Controls.Add(this.comboBox1, 1, 1);
fontCollection = new PrivateFontCollection();
fontCollection.AddFontFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"FontAwesome\remixicon.ttf"));
fontCollection = fc;
fontAwesomeFont = new Font(fontCollection.Families[0], 32);
lblFileIcon.Font = fontAwesomeFont;
lblFileIcon.Text = ((char)Int32.Parse("ecd9"/*"ec28"*//*"eb99"*/,
lblFileIcon.Text = ((char)Int32.Parse("ecd9"/*"ec28"*//*"eb99"*/,
System.Globalization.NumberStyles.HexNumber)).ToString();
if (!AppWinPeer.AppsUseLightTheme)
@ -68,7 +69,7 @@ namespace XDM.WinForm.UI
comboBox1.ForeColor = colors.ToolbarButtonForeColor;
((SkinnableComboBox)comboBox1).BorderColor = colors.ToolbarBackColor;
((SkinnableComboBox)comboBox1).ButtonColor = colors.BorderColor;
DarkModeHelper.StyleFlatTextBox(txtFileName,colors);
DarkModeHelper.StyleFlatTextBox(txtFileName, colors);
//DarkModeHelper.StyleFlatTextBox(textBox2);
DarkModeHelper.StyleFlatButton(btnCancel, colors);
@ -81,6 +82,7 @@ namespace XDM.WinForm.UI
//label5.ForeColor = Color.FromArgb(50, 50, 50);
}
LoadTexts();
}
public event EventHandler DownloadClicked;
@ -168,9 +170,20 @@ namespace XDM.WinForm.UI
// return null;
//}
//[STAThread]
public void ShowWindow()
{
this.Show();
//var t = new Thread(() =>
//{
// this.Load += (_, _) =>
// {
// this.TopMost = true;
// };
// Application.Run(this);
//});
//t.SetApartmentState(ApartmentState.STA);
//t.Start();
}
private void btnDownload_Click(object sender, EventArgs e)
@ -255,5 +268,22 @@ namespace XDM.WinForm.UI
{
this.QueueSchedulerClicked?.Invoke(this, EventArgs.Empty);
}
public void ShowMessageBox(string text)
{
MessageBox.Show(this, text);
}
private void LoadTexts()
{
lblAddress.Text = TextResource.GetText("LBL_NEW_QUEUE");
lblFile.Text = TextResource.GetText("LBL_SAVE_IN");
btnCancel.Text = TextResource.GetText("ND_MORE");
btnLater.Text = TextResource.GetText("ND_DOWNLOAD_LATER");
btnDownload.Text = TextResource.GetText("ND_DOWNLOAD_NOW");
Text = TextResource.GetText("ND_TITLE");
doNotAddToQueueToolStripMenuItem.Text = TextResource.GetText("LBL_QUEUE_OPT3");
manageQueueAndSchedulerToolStripMenuItem.Text = TextResource.GetText("DESC_Q_TITLE");
}
}
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.UI;
using XDM.Core.Lib.Util;
@ -80,6 +81,8 @@ namespace XDM.WinForm.UI
button1.Padding = button2.Padding = button3.Padding = button3.Padding =
button4.Padding = button5.Padding = button6.Padding = button7.Padding =
button9.Padding = button10.Padding = btnUp.Padding = btnDown.Padding = buttonMargin;
LoadTexts();
}
private void ListSelectionChanged()
@ -434,5 +437,24 @@ namespace XDM.WinForm.UI
this.queueSelectionDialog = null;
this.tableLayoutPanel1.Enabled = true;
}
private void LoadTexts()
{
Text = TextResource.GetText("DESC_Q_TITLE");
button1.Text = TextResource.GetText("DESC_NEW");
button2.Text = TextResource.GetText("DESC_DEL");
button3.Text = TextResource.GetText("MENU_START_Q");
button4.Text = TextResource.GetText("MENU_PAUSE");
button5.Text = TextResource.GetText("DESC_SAVE_Q");
button6.Text = TextResource.GetText("ND_CANCEL");
button7.Text = TextResource.GetText("Q_ADD");
button9.Text = TextResource.GetText("Q_REMOVE");
btnUp.Text = TextResource.GetText("Q_MOVE_UP");
btnDown.Text = TextResource.GetText("Q_MOVE_DN");
button10.Text = TextResource.GetText("Q_MOVE_TO");
tabPage1.Text = TextResource.GetText("Q_LIST_FILES");
tabPage2.Text = TextResource.GetText("Q_SCHEDULE_TXT");
checkBox1.Text = TextResource.GetText("Q_ENABLE");
}
}
}

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using Translations;
using XDM.Core.Lib.Common;
namespace XDM.WinForm.UI
@ -43,6 +44,8 @@ namespace XDM.WinForm.UI
dateTimePicker1.ValueChanged += (_, _) => this.ValueChanged?.Invoke(this, EventArgs.Empty);
dateTimePicker2.ValueChanged += (_, _) => this.ValueChanged?.Invoke(this, EventArgs.Empty);
LoadTexts();
}
private CheckBox[] checkBoxes;
@ -113,5 +116,19 @@ namespace XDM.WinForm.UI
}
}
}
private void LoadTexts()
{
label2.Text = TextResource.GetText("MSG_Q_START");
label1.Text = TextResource.GetText("MSG_Q_STOP");
chkEveryday.Text = TextResource.GetText("MSG_Q_DAILY");
chkSun.Text = TextResource.GetText("MSG_Q_D1");
chkMon.Text = TextResource.GetText("MSG_Q_D2");
chkTue.Text = TextResource.GetText("MSG_Q_D3");
chkWed.Text = TextResource.GetText("MSG_Q_D4");
chkThu.Text = TextResource.GetText("MSG_Q_D5");
chkFri.Text = TextResource.GetText("MSG_Q_D6");
chkSat.Text = TextResource.GetText("MSG_Q_D7");
}
}
}

View File

@ -10,6 +10,7 @@ using System.Drawing.Text;
using XDM.WinForm.UI.FormHelper;
using System.IO;
using XDMApp;
using Translations;
namespace XDM.WinForm.UI.SettingsPages
{
@ -66,6 +67,8 @@ namespace XDM.WinForm.UI.SettingsPages
//button3.Font = ri64Font;
//button3.Text = RemixIcon.GetFontIcon("ec7d") + "\nEdge";
LoadTexts();
}
protected override void OnHandleCreated(EventArgs e)
@ -184,5 +187,22 @@ namespace XDM.WinForm.UI.SettingsPages
Config.Instance.MonitorClipboard = checkBox2.Checked;
Config.Instance.MinVideoSize = (int)numericUpDown1.Value;
}
private void LoadTexts()
{
label1.Text = TextResource.GetText("DESC_MONITORING_1");
label2.Text = TextResource.GetText("DESC_OTHER_BROWSERS");
label4.Text = TextResource.GetText("DESC_MOZ");
label3.Text = TextResource.GetText("DESC_CHROME");
label5.Text = TextResource.GetText("DESC_FILETYPES");
button9.Text = TextResource.GetText("DESC_DEF");
button11.Text = TextResource.GetText("DESC_DEF");
button10.Text = TextResource.GetText("DESC_DEF");
label6.Text = TextResource.GetText("DESC_VIDEOTYPES");
label7.Text = TextResource.GetText("LBL_MIN_VIDEO_SIZE");
label9.Text = TextResource.GetText("DESC_SITEEXCEPTIONS");
checkBox2.Text = TextResource.GetText("MENU_CLIP_ADD");
checkBox4.Text = TextResource.GetText("LBL_GET_TIMESTAMP");
}
}
}

View File

@ -1,15 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using Translations;
using XDM.Core.Lib.Common;
using XDM.Core.Lib.Util;
using XDM.WinForm.UI.SettingsPages;
@ -29,6 +21,9 @@ namespace XDM.WinForm.UI
int initialPage = 0)
{
InitializeComponent();
Text = TextResource.GetText("TITLE_SETTINGS");
button2.Text = TextResource.GetText("DESC_SAVE_Q");
button1.Text = TextResource.GetText("ND_CANCEL");
this.app = app;
this.initialPage = initialPage;
var pagePadding = new Padding(LogicalToDeviceUnits(10));
@ -56,12 +51,14 @@ namespace XDM.WinForm.UI
}
}
var panelNames = new string[] {
"Browser monitoring",
"General settings",
"Network settings",
"Password manager",
"Advanced settings" };
var panelNames = new string[]
{
TextResource.GetText("SETTINGS_MONITORING"),
TextResource.GetText("SETTINGS_GENERAL"),
TextResource.GetText("SETTINGS_NETWORK"),
TextResource.GetText("SETTINGS_CRED"),
TextResource.GetText("SETTINGS_ADV")
};
foreach (var text in panelNames)
{

View File

@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using Translations;
namespace XDM.WinForm.UI
{
@ -9,6 +10,9 @@ namespace XDM.WinForm.UI
{
InitializeComponent();
numericUpDown1.Maximum = Int32.MaxValue;
checkBox2.Text = TextResource.GetText("MENU_SPEED_LIMITER");
label8.Text = TextResource.GetText("MSG_SPEED_LIMIT");
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using Translations;
using XDM.Core.Lib.Common;
using XDM.WinForm.UI.FormHelper;
@ -51,6 +52,11 @@ namespace XDM.WinForm.UI.VideoDownloaderPages
textBox3.BackColor = Color.FromArgb(65, 65, 65);
textBox3.ForeColor = Color.White;
}
label1.Text = TextResource.GetText("VID_PASTE_URL");
checkBox1.Text = TextResource.GetText("SETTINGS_ADV");
label2.Text = TextResource.GetText("DESC_USER");
label3.Text = TextResource.GetText("DESC_PASS");
}
private void button1_Click(object sender, EventArgs e)

View File

@ -301,7 +301,7 @@ namespace XDM.WinForm.UI.VideoDownloaderPages
this.doNotAddToQueueToolStripMenuItem,
this.manageQueueAndSchedulersToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(231, 48);
this.contextMenuStrip1.Size = new System.Drawing.Size(231, 70);
//
// doNotAddToQueueToolStripMenuItem
//

View File

@ -12,6 +12,7 @@ using XDM.Core.Lib.Util;
using YDLWrapper;
using XDM.WinForm.UI.FormHelper;
using System.Drawing;
using Translations;
#if !(NET472_OR_GREATER || NET5_0_OR_GREATER)
using static XDM.WinForm.UI.WinFormsPolyfill;
@ -132,6 +133,8 @@ namespace XDM.WinForm.UI.VideoDownloaderPages
MenuHelper.CustomizeMenuAppearance(contextMenuStrip1);
MenuHelper.FixHiDpiMargin(contextMenuStrip1);
}
LoadTexts();
}
public void SetVideoResultList(List<YDLVideoEntry> items)
@ -377,5 +380,21 @@ namespace XDM.WinForm.UI.VideoDownloaderPages
{
App.AppUI.ShowQueueWindow(this.ParentForm);
}
private void LoadTexts()
{
label2.Text = TextResource.GetText("O_VID_FMT");
checkBox1.Text = TextResource.GetText("VID_CHK");
label1.Text = TextResource.GetText("LBL_SAVE_IN");
button4.Text = TextResource.GetText("ND_MORE");
button2.Text = TextResource.GetText("ND_DOWNLOAD_LATER");
button1.Text = TextResource.GetText("ND_DOWNLOAD_NOW");
dataGridView1.Columns["Column2"].HeaderText = TextResource.GetText("SORT_NAME");
dataGridView1.Columns["Column4"].HeaderText = TextResource.GetText("O_VID_FMT");
doNotAddToQueueToolStripMenuItem.Text = TextResource.GetText("LBL_QUEUE_OPT3");
manageQueueAndSchedulersToolStripMenuItem.Text = TextResource.GetText("DESC_Q_TITLE");
}
}
}

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using Translations;
using XDM.WinForm.UI.FormHelper;
namespace XDM.WinForm.UI.VideoDownloaderPages
@ -23,6 +24,7 @@ namespace XDM.WinForm.UI.VideoDownloaderPages
var fg = Color.White;
DarkModeHelper.StyleFlatButton(button1, bg, fg);
}
button1.Text = TextResource.GetText("ND_CANCEL");
}
private void button1_Click(object sender, EventArgs e)

View File

@ -10,6 +10,7 @@ using XDM.WinForm.UI.VideoDownloaderPages;
using YDLWrapper;
using System.Threading;
using XDM.WinForm.UI.FormHelper;
using Translations;
namespace XDM.WinForm.UI
{
@ -18,7 +19,7 @@ namespace XDM.WinForm.UI
private VideoDownloaderPage1 page1;
private VideoDownloaderPage2 page2;
private VideoDownloaderPage3 page3;
private YDLProcess ydl;
private YDLProcess ydl;
private IFormColors colors;
public VideoDownloaderWindow(Font searchFont, IApp app, IAppUI appUi)
@ -80,6 +81,8 @@ namespace XDM.WinForm.UI
DarkModeHelper.UseImmersiveDarkMode(this.Handle, true);
this.BackColor = colors.ToolbarBackColor;
}
Text = TextResource.GetText("LBL_VIDEO_DOWNLOAD");
}
protected override void OnClosing(CancelEventArgs e)

View File

@ -0,0 +1,25 @@
using System;
using System.Windows.Forms;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using TraceLog;
namespace XDM.WinForm.UI.Win32
{
internal static class NativeMethods
{
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
int x, int y, int cx, int cy, uint uFlags);
internal static void SetWindowTopMost(Form f)
{
SetWindowPos(f.Handle, new IntPtr(-1), 0, 0, 0, 0, 0x0001 | 0x0002 | 0x0040 | 0);
Log.Debug("SetWindowPos: " + Marshal.GetLastWin32Error());
}
}
}

View File

@ -57,7 +57,7 @@ namespace XDMApp
Id = id,
Progress = 0,
Size = fileSize,
Status = DownloadStatus.Waiting,
Status = DownloadStatus.Stopped,
TargetDir = "",
PrimaryUrl = primaryUrl,
Authentication = authentication,
@ -193,7 +193,7 @@ namespace XDMApp
{
var download = this.peer.FindInProgressItem(id);
if (download == null) return;
download.Status = DownloadStatus.Waiting;
download.Status = DownloadStatus.Stopped;
UpdateToolbarButtonState();
});
}
@ -226,7 +226,7 @@ namespace XDMApp
{
return;
}
RunOnUiThread(() =>
peer.RunOnUIThread(() =>
{
NewDownloadPromptTracker.PromptOpen(url);
NewDownloadDialogHelper.CreateAndShowDialog(this.App, this, this.CreateNewDownloadDialog(false), message,
@ -389,7 +389,10 @@ namespace XDMApp
{
peer.NewDownloadClicked += (s, e) =>
{
NewDownloadDialogHelper.CreateAndShowDialog(this.App, this, CreateNewDownloadDialog(true));
peer.RunOnUIThread(() =>
{
NewDownloadDialogHelper.CreateAndShowDialog(this.App, this, CreateNewDownloadDialog(true));
});
};
peer.YoutubeDLDownloadClicked += (s, e) =>

View File

@ -80,7 +80,7 @@ namespace XDM.Core.Lib.Common
public enum DownloadStatus
{
Downloading, Stopped, Finished, Waiting
Downloading, Stopped, Finished
}
internal static class FinishedDownloadEntrySerializerV1

View File

@ -12,6 +12,7 @@ namespace XDM.Core.Lib.Common
void DisposeWindow();
void Invoke(Action callback);
void ShowWindow();
void ShowMessageBox(string message);
string Url { get; set; }
AuthenticationInfo? Authentication { get; set; }
ProxyInfo? Proxy { get; set; }

View File

@ -11,6 +11,7 @@ namespace XDM.Core.Lib.Common
void DisposeWindow();
void Invoke(Action callback);
void ShowWindow();
void ShowMessageBox(string text);
string FileSize { get; set; }
public AuthenticationInfo? Authentication { get; set; }
public ProxyInfo? Proxy { get; set; }

View File

@ -124,6 +124,8 @@ namespace XDM.Core.Lib.UI
IQueueSelectionDialog CreateQueueSelectionDialog();
//void RunOnNewThread(Action action);
event EventHandler<CategoryChangedEventArgs> CategoryChanged;
event EventHandler InProgressContextMenuOpening;

View File

@ -15,6 +15,7 @@ using XDM.Core.Lib.Common.Segmented;
using XDM.Core.Lib.Common.Hls;
using XDM.Core.Lib.Common.Dash;
using System.Text;
using Translations;
#if !NET5_0_OR_GREATER
using NetFX.Polyfill;
@ -81,7 +82,12 @@ namespace XDM.Core.Lib.Util
{
try
{
new Uri(url);
var u = new Uri(url);
var scheme = u.Scheme?.ToLowerInvariant();
if (scheme != "http" && scheme != "https")
{
return false;
}
return true;
}
catch
@ -1140,6 +1146,21 @@ namespace XDM.Core.Lib.Util
return category.Value.FileExtensions.Contains(ext.ToUpperInvariant());
}
private static string GetStatusText(DownloadStatus status)
{
switch (status)
{
case DownloadStatus.Downloading:
return TextResource.GetText("STAT_DOWNLOADING");
case DownloadStatus.Stopped:
return TextResource.GetText("STAT_STOPPED");
case DownloadStatus.Finished:
return TextResource.GetText("STAT_FINISHED");
default:
return status.ToString();
}
}
public static string GenerateStatusText(InProgressDownloadEntry ent)
{
var text = string.Empty;
@ -1148,7 +1169,7 @@ namespace XDM.Core.Lib.Util
{
if (string.IsNullOrEmpty(ent.ETA) && string.IsNullOrEmpty(ent.DownloadSpeed))
{
text = ent.Status.ToString();
text = GetStatusText(ent.Status);
}
else if (string.IsNullOrEmpty(ent.ETA))
{
@ -1160,12 +1181,12 @@ namespace XDM.Core.Lib.Util
}
else
{
text = ent.ETA + " @ " + ent.DownloadSpeed;
text = $"{ent.DownloadSpeed} - {ent.ETA}";
}
}
else
{
text = ent.Status.ToString();
text = GetStatusText(ent.Status);
}
return text;

View File

@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\MediaParser.Hls\MediaParser.csproj" />
<ProjectReference Include="..\TraceLog\TraceLog.csproj" />
<ProjectReference Include="..\Translations\Translations.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'net5.0' ">