From 57db3edc8af1f7bb4550d2ed76a7858882e3a75a Mon Sep 17 00:00:00 2001 From: Serraniel Date: Sun, 20 May 2018 16:22:04 +0200 Subject: [PATCH 01/24] Fixed nuget referencing to SweetLib and maintained code so it will compile with current SweetLib Version --- DML.Client/DML.Client.csproj | 4 ---- Discord Media Loader.Application/Classes/Job.cs | 5 +++-- .../Classes/JobScheduler.cs | 5 +++-- .../DML.Application.csproj | 10 ++++++---- Discord Media Loader.Application/app.config | 16 ++++++++++++++++ Discord Media Loader.Application/packages.config | 2 ++ Discord Media Loader.sln | 8 +------- Discord Media Loader/App.config | 16 ++++++++++++++++ 8 files changed, 47 insertions(+), 19 deletions(-) diff --git a/DML.Client/DML.Client.csproj b/DML.Client/DML.Client.csproj index 4b6dd43..3bcc684 100644 --- a/DML.Client/DML.Client.csproj +++ b/DML.Client/DML.Client.csproj @@ -8,8 +8,4 @@ - - - - diff --git a/Discord Media Loader.Application/Classes/Job.cs b/Discord Media Loader.Application/Classes/Job.cs index a2ea874..1b5c8d0 100644 --- a/Discord Media Loader.Application/Classes/Job.cs +++ b/Discord Media Loader.Application/Classes/Job.cs @@ -7,6 +7,7 @@ using Discord.WebSocket; using DML.Application.Classes; using DML.Client; using SweetLib.Utils; +using SweetLib.Utils.Extensions; using static SweetLib.Utils.Logger.Logger; namespace DML.AppCore.Classes @@ -136,7 +137,7 @@ namespace DML.AppCore.Classes lastId = m.Id; } - if (SweetUtils.DateTimeToUnixTimeStamp(m.CreatedAt.UtcDateTime) <= StopTimestamp) + if (m.CreatedAt.UtcDateTime.ToUnixTimeStamp() <= StopTimestamp) { Debug("Found a message with a known timestamp...Stopping scan."); finished = true; @@ -163,7 +164,7 @@ namespace DML.AppCore.Classes if (result.Count > 0) { Trace("Updating StopTimestamp for next scan..."); - StopTimestamp = SweetUtils.DateTimeToUnixTimeStamp(result[result.Count - 1].CreatedAt.UtcDateTime); + StopTimestamp = result[result.Count - 1].CreatedAt.UtcDateTime.ToUnixTimeStamp(); } Debug($"Fisnished scan of guild {GuildId} channel {ChannelId}."); diff --git a/Discord Media Loader.Application/Classes/JobScheduler.cs b/Discord Media Loader.Application/Classes/JobScheduler.cs index 0d48177..6a88229 100644 --- a/Discord Media Loader.Application/Classes/JobScheduler.cs +++ b/Discord Media Loader.Application/Classes/JobScheduler.cs @@ -8,6 +8,7 @@ using Discord; using Discord.WebSocket; using DML.Application.Classes; using SweetLib.Utils; +using SweetLib.Utils.Extensions; using SweetLib.Utils.Logger; namespace DML.AppCore.Classes @@ -244,7 +245,7 @@ namespace DML.AppCore.Classes fileName = fileName.Replace("%guild%", serverName) .Replace("%channel%", channelName) - .Replace("%timestamp%", SweetUtils.DateTimeToUnixTimeStamp(message.CreatedAt.UtcDateTime).ToString()) + .Replace("%timestamp%", message.CreatedAt.UtcDateTime.ToUnixTimeStamp().ToString()) .Replace("%name%", a.Filename) .Replace("%id%", a.Id.ToString()); @@ -277,7 +278,7 @@ namespace DML.AppCore.Classes Logger.Debug($"Downloaded attachment {a.Id}."); Logger.Trace("Updating known timestamp for job..."); - job.KnownTimestamp = SweetUtils.DateTimeToUnixTimeStamp(message.CreatedAt.UtcDateTime); + job.KnownTimestamp = message.CreatedAt.UtcDateTime.ToUnixTimeStamp(); job.Store(); } finally diff --git a/Discord Media Loader.Application/DML.Application.csproj b/Discord Media Loader.Application/DML.Application.csproj index 02bf1f5..0e3a4d2 100644 --- a/Discord Media Loader.Application/DML.Application.csproj +++ b/Discord Media Loader.Application/DML.Application.csproj @@ -61,6 +61,9 @@ ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll + + ..\packages\Microsoft.Win32.Registry.4.3.0\lib\net46\Microsoft.Win32.Registry.dll + ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll @@ -83,6 +86,9 @@ ..\packages\SharpRaven.2.2.0\lib\net45\SharpRaven.dll + + ..\packages\SweetLib.0.2.1-alpha\lib\netstandard1.3\SweetLib.dll + ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll @@ -207,10 +213,6 @@ - - {02c1f8ef-32f2-4e77-a36d-79129402af37} - SweetLib - {045eb4a1-34e7-47e0-867e-e10c40505095} DML.Client diff --git a/Discord Media Loader.Application/app.config b/Discord Media Loader.Application/app.config index d5170f1..05e0aae 100644 --- a/Discord Media Loader.Application/app.config +++ b/Discord Media Loader.Application/app.config @@ -18,6 +18,22 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Discord Media Loader.Application/packages.config b/Discord Media Loader.Application/packages.config index d3092d0..9142f47 100644 --- a/Discord Media Loader.Application/packages.config +++ b/Discord Media Loader.Application/packages.config @@ -11,11 +11,13 @@ + + diff --git a/Discord Media Loader.sln b/Discord Media Loader.sln index 8124baf..09f9aa3 100644 --- a/Discord Media Loader.sln +++ b/Discord Media Loader.sln @@ -7,9 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord Media Loader", "Dis EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DML.Application", "Discord Media Loader.Application\DML.Application.csproj", "{C130DE6A-3237-42B5-BE9F-783D1CD104C6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib", "..\SweetLib\SweetLib\SweetLib.csproj", "{02C1F8EF-32F2-4E77-A36D-79129402AF37}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DML.Client", "DML.Client\DML.Client.csproj", "{045EB4A1-34E7-47E0-867E-E10C40505095}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DML.Client", "DML.Client\DML.Client.csproj", "{045EB4A1-34E7-47E0-867E-E10C40505095}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -25,10 +23,6 @@ Global {C130DE6A-3237-42B5-BE9F-783D1CD104C6}.Debug|Any CPU.Build.0 = Debug|Any CPU {C130DE6A-3237-42B5-BE9F-783D1CD104C6}.Release|Any CPU.ActiveCfg = Release|Any CPU {C130DE6A-3237-42B5-BE9F-783D1CD104C6}.Release|Any CPU.Build.0 = Release|Any CPU - {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Release|Any CPU.Build.0 = Release|Any CPU {045EB4A1-34E7-47E0-867E-E10C40505095}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {045EB4A1-34E7-47E0-867E-E10C40505095}.Debug|Any CPU.Build.0 = Debug|Any CPU {045EB4A1-34E7-47E0-867E-E10C40505095}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Discord Media Loader/App.config b/Discord Media Loader/App.config index 7cf02b2..1974fd7 100644 --- a/Discord Media Loader/App.config +++ b/Discord Media Loader/App.config @@ -21,6 +21,22 @@ + + + + + + + + + + + + + + + + From 2a6f1a49fc31a6dfa33790ece6f0805a27a28361 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Thu, 24 May 2018 20:15:39 +0200 Subject: [PATCH 02/24] Fixed an error which issued an exception on startup if a guild is temporary not available --- Discord Media Loader.Application/MainForm.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Discord Media Loader.Application/MainForm.cs b/Discord Media Loader.Application/MainForm.cs index 59ccd1c..d74faba 100644 --- a/Discord Media Loader.Application/MainForm.cs +++ b/Discord Media Loader.Application/MainForm.cs @@ -57,7 +57,7 @@ namespace DML.Application if (cbGuild.Items.Count == 0) { Trace("Adding guilds to component..."); - cbGuild.Items.AddRange(DMLClient.Client.Guilds.OrderBy(g => g.Name).Select(g => g.Name).ToArray()); + cbGuild.Items.AddRange(DMLClient.Client.Guilds.Where(g => g.Name != null).OrderBy(g => g.Name).Select(g => g.Name).ToArray()); cbGuild.SelectedIndex = 0; Trace("Guild component initialized."); } From 00fa6782716aa70797fbda1d0c2cf7354d557e3f Mon Sep 17 00:00:00 2001 From: Serraniel Date: Thu, 24 May 2018 20:16:59 +0200 Subject: [PATCH 03/24] Build --- Discord Media Loader.Application/Properties/AssemblyInfo.cs | 4 ++-- Discord Media Loader/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Discord Media Loader.Application/Properties/AssemblyInfo.cs b/Discord Media Loader.Application/Properties/AssemblyInfo.cs index 1e11210..b9030cb 100644 --- a/Discord Media Loader.Application/Properties/AssemblyInfo.cs +++ b/Discord Media Loader.Application/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.1.1.0")] +[assembly: AssemblyFileVersion("1.1.1.0")] diff --git a/Discord Media Loader/Properties/AssemblyInfo.cs b/Discord Media Loader/Properties/AssemblyInfo.cs index f0e87e1..1222c99 100644 --- a/Discord Media Loader/Properties/AssemblyInfo.cs +++ b/Discord Media Loader/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.2.0")] -[assembly: AssemblyFileVersion("1.0.2.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("1.0.3.0")] From 801a0da615d9c2ade83aaea8497e7d29796c2605 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Fri, 15 Jun 2018 18:32:18 +0200 Subject: [PATCH 04/24] Added class for identified strings --- .../DML.Application.csproj | 1 + .../Helper/IdentifiedString.cs | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Discord Media Loader.Application/Helper/IdentifiedString.cs diff --git a/Discord Media Loader.Application/DML.Application.csproj b/Discord Media Loader.Application/DML.Application.csproj index 0e3a4d2..17496c5 100644 --- a/Discord Media Loader.Application/DML.Application.csproj +++ b/Discord Media Loader.Application/DML.Application.csproj @@ -179,6 +179,7 @@ FrmInternalSplash.cs + Form diff --git a/Discord Media Loader.Application/Helper/IdentifiedString.cs b/Discord Media Loader.Application/Helper/IdentifiedString.cs new file mode 100644 index 0000000..828d6cf --- /dev/null +++ b/Discord Media Loader.Application/Helper/IdentifiedString.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DML.Application.Helper +{ + internal class IdentifiedString + { + internal T Id { get; set; } + internal string Caption { get; set; } + + internal IdentifiedString(T id, string caption) + { + Id = id; + Caption = caption; + } + + public override string ToString() => Caption; + } +} From 5e940c09bde35500e720fc6528b6b8187e3bd528 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Fri, 15 Jun 2018 18:33:00 +0200 Subject: [PATCH 05/24] Added implementation for guild and channel selection with identified strings --- Discord Media Loader.Application/MainForm.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Discord Media Loader.Application/MainForm.cs b/Discord Media Loader.Application/MainForm.cs index d74faba..99b2fe9 100644 --- a/Discord Media Loader.Application/MainForm.cs +++ b/Discord Media Loader.Application/MainForm.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; @@ -8,7 +9,9 @@ using Discord; using Discord.WebSocket; using DML.AppCore.Classes; using DML.Application.Classes; +using DML.Application.Helper; using DML.Client; +using static DML.Client.DMLClient; using static SweetLib.Utils.Logger.Logger; namespace DML.Application @@ -57,7 +60,9 @@ namespace DML.Application if (cbGuild.Items.Count == 0) { Trace("Adding guilds to component..."); - cbGuild.Items.AddRange(DMLClient.Client.Guilds.Where(g => g.Name != null).OrderBy(g => g.Name).Select(g => g.Name).ToArray()); + + cbGuild.Items.AddRange(DMLClient.Client.Guilds.Where(g => g.Name != null).OrderBy(g => g.Name).Select(g => new IdentifiedString(g.Id, g.Name)).ToArray()); + cbGuild.SelectedIndex = 0; Trace("Guild component initialized."); } @@ -153,7 +158,7 @@ namespace DML.Application UseWaitCursor = true; try { - var guild = FindServerByName(cbGuild.Text); + var guild = FindServerById(((IdentifiedString)cbGuild.SelectedItem).Id); if (guild != null) { @@ -161,7 +166,9 @@ namespace DML.Application cbChannel.Items.Clear(); Trace("Adding new channels..."); - cbChannel.Items.AddRange(guild.TextChannels.OrderBy(c => c.Position).Select(c => c.Name).ToArray()); + + cbChannel.Items.AddRange(guild.TextChannels.OrderBy(c => c.Position).Select(c => new IdentifiedString(c.Id, c.Name)).ToArray()); + Trace($"Added {cbChannel.Items.Count} channels."); cbChannel.SelectedIndex = 0; @@ -183,8 +190,8 @@ namespace DML.Application { var job = new Job { - GuildId = FindServerByName(cbGuild.Text).Id, - ChannelId = FindChannelByName(FindServerByName(cbGuild.Text), cbChannel.Text).Id + GuildId = ((IdentifiedString)cbGuild.SelectedItem).Id, + ChannelId = ((IdentifiedString)cbChannel.SelectedItem).Id }; if (!(from j in Core.Scheduler.JobList From 5c936841643fc0372791210c62e4d99a4f92ea1d Mon Sep 17 00:00:00 2001 From: Serraniel Date: Fri, 15 Jun 2018 18:46:44 +0200 Subject: [PATCH 06/24] Switched joblist to IdentifiedString objects --- Discord Media Loader.Application/MainForm.cs | 30 ++++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/Discord Media Loader.Application/MainForm.cs b/Discord Media Loader.Application/MainForm.cs index 99b2fe9..ce7b754 100644 --- a/Discord Media Loader.Application/MainForm.cs +++ b/Discord Media Loader.Application/MainForm.cs @@ -72,8 +72,7 @@ namespace DML.Application lbxJobs.Items.Clear(); foreach (var job in Core.Scheduler.JobList) { - lbxJobs.Items.Add( - $"{FindServerById(job.GuildId)?.Name}:{FindChannelById(FindServerById(job.GuildId), job.ChannelId)?.Name}"); + lbxJobs.Items.Add(new IdentifiedString(job.Id, $"{FindServerById(job.GuildId)?.Name}:{FindChannelById(FindServerById(job.GuildId), job.ChannelId)?.Name}")); } lbxJobs.SelectedIndex = oldIndex; @@ -215,28 +214,15 @@ namespace DML.Application MessageBox.Show("No job has been seleted.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - var jobNameData = lbxJobs.SelectedItem.ToString().Split(':'); + var jobId = ((IdentifiedString)lbxJobs.SelectedItem).Id; - var guildName = ""; - for (var i = 0; i < jobNameData.Length - 1; i++) - guildName += jobNameData[i] + ":"; - guildName = guildName.Substring(0, guildName.Length - 1); - - var channelName = jobNameData[jobNameData.Length - 1]; - - var guild = FindServerByName(guildName); - var channel = FindChannelByName(guild, channelName); - - foreach (var job in Core.Scheduler.JobList) + var job = Core.Scheduler.JobList.FirstOrDefault(j => j.Id == jobId); + if (job != null) { - if (job.GuildId == guild.Id && job.ChannelId == channel.Id) - { - Core.Scheduler.JobList.Remove(job); - Core.Scheduler.RunningJobs.Remove(job.Id); - job.Stop(); - job.Delete(); - break; - } + Core.Scheduler.JobList.Remove(job); + Core.Scheduler.RunningJobs.Remove(job.Id); + job.Stop(); + job.Delete(); } lbxJobs.SelectedIndex = -1; From 8c7253dfccc117e132451b8f7b1bd255f150d847 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Fri, 15 Jun 2018 18:51:16 +0200 Subject: [PATCH 07/24] Changed combobox style of guild and channel selection to suggest elements from its data lists --- .../MainForm.Designer.cs | 92 ++++++++++--------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/Discord Media Loader.Application/MainForm.Designer.cs b/Discord Media Loader.Application/MainForm.Designer.cs index d3ea045..8fdcfd2 100644 --- a/Discord Media Loader.Application/MainForm.Designer.cs +++ b/Discord Media Loader.Application/MainForm.Designer.cs @@ -46,6 +46,11 @@ this.cbGuild = new System.Windows.Forms.ComboBox(); this.lbGuild = new System.Windows.Forms.Label(); this.statusStrip = new System.Windows.Forms.StatusStrip(); + this.lbStatus = new System.Windows.Forms.ToolStripDropDownButton(); + this.invisibleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.doNotDisturbToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.doNotDenyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pgbProgress = new System.Windows.Forms.ToolStripProgressBar(); this.lbProgress = new System.Windows.Forms.ToolStripStatusLabel(); this.lblVersionPlaceholder = new System.Windows.Forms.ToolStripStatusLabel(); @@ -57,11 +62,6 @@ this.btnDelete = new System.Windows.Forms.Button(); this.lbxJobs = new System.Windows.Forms.ListBox(); this.tmrRefreshProgress = new System.Windows.Forms.Timer(this.components); - this.lbStatus = new System.Windows.Forms.ToolStripDropDownButton(); - this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.doNotDenyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.doNotDisturbToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.invisibleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tmrTriggerRefresh = new System.Windows.Forms.Timer(this.components); this.pnlSettings.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edThreadLimit)).BeginInit(); @@ -206,6 +206,8 @@ // this.cbChannel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.cbChannel.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.cbChannel.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.cbChannel.FormattingEnabled = true; this.cbChannel.Location = new System.Drawing.Point(294, 19); this.cbChannel.Name = "cbChannel"; @@ -223,6 +225,8 @@ // // cbGuild // + this.cbGuild.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.cbGuild.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.cbGuild.FormattingEnabled = true; this.cbGuild.Location = new System.Drawing.Point(52, 19); this.cbGuild.Name = "cbGuild"; @@ -254,6 +258,45 @@ this.statusStrip.TabIndex = 2; this.statusStrip.Text = "statusStrip1"; // + // lbStatus + // + this.lbStatus.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.invisibleToolStripMenuItem, + this.doNotDisturbToolStripMenuItem, + this.doNotDenyToolStripMenuItem, + this.onlineToolStripMenuItem}); + this.lbStatus.Name = "lbStatus"; + this.lbStatus.Size = new System.Drawing.Size(13, 20); + this.lbStatus.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked); + // + // invisibleToolStripMenuItem + // + this.invisibleToolStripMenuItem.Name = "invisibleToolStripMenuItem"; + this.invisibleToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.invisibleToolStripMenuItem.Tag = "3"; + this.invisibleToolStripMenuItem.Text = "Invisible"; + // + // doNotDisturbToolStripMenuItem + // + this.doNotDisturbToolStripMenuItem.Name = "doNotDisturbToolStripMenuItem"; + this.doNotDisturbToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.doNotDisturbToolStripMenuItem.Tag = "2"; + this.doNotDisturbToolStripMenuItem.Text = "Do not disturb"; + // + // doNotDenyToolStripMenuItem + // + this.doNotDenyToolStripMenuItem.Name = "doNotDenyToolStripMenuItem"; + this.doNotDenyToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.doNotDenyToolStripMenuItem.Tag = "1"; + this.doNotDenyToolStripMenuItem.Text = "Idle"; + // + // onlineToolStripMenuItem + // + this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem"; + this.onlineToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.onlineToolStripMenuItem.Tag = "0"; + this.onlineToolStripMenuItem.Text = "Online"; + // // pgbProgress // this.pgbProgress.Name = "pgbProgress"; @@ -341,45 +384,6 @@ this.tmrRefreshProgress.Interval = 500; this.tmrRefreshProgress.Tick += new System.EventHandler(this.tmrRefreshProgress_Tick); // - // lbStatus - // - this.lbStatus.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.invisibleToolStripMenuItem, - this.doNotDisturbToolStripMenuItem, - this.doNotDenyToolStripMenuItem, - this.onlineToolStripMenuItem}); - this.lbStatus.Name = "lbStatus"; - this.lbStatus.Size = new System.Drawing.Size(13, 20); - this.lbStatus.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked); - // - // onlineToolStripMenuItem - // - this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem"; - this.onlineToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.onlineToolStripMenuItem.Tag = "0"; - this.onlineToolStripMenuItem.Text = "Online"; - // - // doNotDenyToolStripMenuItem - // - this.doNotDenyToolStripMenuItem.Name = "doNotDenyToolStripMenuItem"; - this.doNotDenyToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.doNotDenyToolStripMenuItem.Tag = "1"; - this.doNotDenyToolStripMenuItem.Text = "Idle"; - // - // doNotDisturbToolStripMenuItem - // - this.doNotDisturbToolStripMenuItem.Name = "doNotDisturbToolStripMenuItem"; - this.doNotDisturbToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.doNotDisturbToolStripMenuItem.Tag = "2"; - this.doNotDisturbToolStripMenuItem.Text = "Do not disturb"; - // - // invisibleToolStripMenuItem - // - this.invisibleToolStripMenuItem.Name = "invisibleToolStripMenuItem"; - this.invisibleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.invisibleToolStripMenuItem.Tag = "3"; - this.invisibleToolStripMenuItem.Text = "Invisible"; - // // tmrTriggerRefresh // this.tmrTriggerRefresh.Interval = 5000; From 033cb203b0119fb0206be6132047101e27fcc401 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Fri, 15 Jun 2018 18:59:34 +0200 Subject: [PATCH 08/24] Revert "Merge branch 'bugfix/UI-improvments' into support/1.1" This reverts commit 33474c2daba0f1849e372c0531a0a7aed9fc4083, reversing changes made to 6b2fc74a9e316435222005abdd2f053f83a8ad2f. --- .../MainForm.Designer.cs | 92 +++++++++---------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/Discord Media Loader.Application/MainForm.Designer.cs b/Discord Media Loader.Application/MainForm.Designer.cs index 8fdcfd2..d3ea045 100644 --- a/Discord Media Loader.Application/MainForm.Designer.cs +++ b/Discord Media Loader.Application/MainForm.Designer.cs @@ -46,11 +46,6 @@ this.cbGuild = new System.Windows.Forms.ComboBox(); this.lbGuild = new System.Windows.Forms.Label(); this.statusStrip = new System.Windows.Forms.StatusStrip(); - this.lbStatus = new System.Windows.Forms.ToolStripDropDownButton(); - this.invisibleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.doNotDisturbToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.doNotDenyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pgbProgress = new System.Windows.Forms.ToolStripProgressBar(); this.lbProgress = new System.Windows.Forms.ToolStripStatusLabel(); this.lblVersionPlaceholder = new System.Windows.Forms.ToolStripStatusLabel(); @@ -62,6 +57,11 @@ this.btnDelete = new System.Windows.Forms.Button(); this.lbxJobs = new System.Windows.Forms.ListBox(); this.tmrRefreshProgress = new System.Windows.Forms.Timer(this.components); + this.lbStatus = new System.Windows.Forms.ToolStripDropDownButton(); + this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.doNotDenyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.doNotDisturbToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.invisibleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tmrTriggerRefresh = new System.Windows.Forms.Timer(this.components); this.pnlSettings.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edThreadLimit)).BeginInit(); @@ -206,8 +206,6 @@ // this.cbChannel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.cbChannel.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.cbChannel.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.cbChannel.FormattingEnabled = true; this.cbChannel.Location = new System.Drawing.Point(294, 19); this.cbChannel.Name = "cbChannel"; @@ -225,8 +223,6 @@ // // cbGuild // - this.cbGuild.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.cbGuild.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.cbGuild.FormattingEnabled = true; this.cbGuild.Location = new System.Drawing.Point(52, 19); this.cbGuild.Name = "cbGuild"; @@ -258,45 +254,6 @@ this.statusStrip.TabIndex = 2; this.statusStrip.Text = "statusStrip1"; // - // lbStatus - // - this.lbStatus.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.invisibleToolStripMenuItem, - this.doNotDisturbToolStripMenuItem, - this.doNotDenyToolStripMenuItem, - this.onlineToolStripMenuItem}); - this.lbStatus.Name = "lbStatus"; - this.lbStatus.Size = new System.Drawing.Size(13, 20); - this.lbStatus.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked); - // - // invisibleToolStripMenuItem - // - this.invisibleToolStripMenuItem.Name = "invisibleToolStripMenuItem"; - this.invisibleToolStripMenuItem.Size = new System.Drawing.Size(150, 22); - this.invisibleToolStripMenuItem.Tag = "3"; - this.invisibleToolStripMenuItem.Text = "Invisible"; - // - // doNotDisturbToolStripMenuItem - // - this.doNotDisturbToolStripMenuItem.Name = "doNotDisturbToolStripMenuItem"; - this.doNotDisturbToolStripMenuItem.Size = new System.Drawing.Size(150, 22); - this.doNotDisturbToolStripMenuItem.Tag = "2"; - this.doNotDisturbToolStripMenuItem.Text = "Do not disturb"; - // - // doNotDenyToolStripMenuItem - // - this.doNotDenyToolStripMenuItem.Name = "doNotDenyToolStripMenuItem"; - this.doNotDenyToolStripMenuItem.Size = new System.Drawing.Size(150, 22); - this.doNotDenyToolStripMenuItem.Tag = "1"; - this.doNotDenyToolStripMenuItem.Text = "Idle"; - // - // onlineToolStripMenuItem - // - this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem"; - this.onlineToolStripMenuItem.Size = new System.Drawing.Size(150, 22); - this.onlineToolStripMenuItem.Tag = "0"; - this.onlineToolStripMenuItem.Text = "Online"; - // // pgbProgress // this.pgbProgress.Name = "pgbProgress"; @@ -384,6 +341,45 @@ this.tmrRefreshProgress.Interval = 500; this.tmrRefreshProgress.Tick += new System.EventHandler(this.tmrRefreshProgress_Tick); // + // lbStatus + // + this.lbStatus.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.invisibleToolStripMenuItem, + this.doNotDisturbToolStripMenuItem, + this.doNotDenyToolStripMenuItem, + this.onlineToolStripMenuItem}); + this.lbStatus.Name = "lbStatus"; + this.lbStatus.Size = new System.Drawing.Size(13, 20); + this.lbStatus.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked); + // + // onlineToolStripMenuItem + // + this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem"; + this.onlineToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.onlineToolStripMenuItem.Tag = "0"; + this.onlineToolStripMenuItem.Text = "Online"; + // + // doNotDenyToolStripMenuItem + // + this.doNotDenyToolStripMenuItem.Name = "doNotDenyToolStripMenuItem"; + this.doNotDenyToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.doNotDenyToolStripMenuItem.Tag = "1"; + this.doNotDenyToolStripMenuItem.Text = "Idle"; + // + // doNotDisturbToolStripMenuItem + // + this.doNotDisturbToolStripMenuItem.Name = "doNotDisturbToolStripMenuItem"; + this.doNotDisturbToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.doNotDisturbToolStripMenuItem.Tag = "2"; + this.doNotDisturbToolStripMenuItem.Text = "Do not disturb"; + // + // invisibleToolStripMenuItem + // + this.invisibleToolStripMenuItem.Name = "invisibleToolStripMenuItem"; + this.invisibleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.invisibleToolStripMenuItem.Tag = "3"; + this.invisibleToolStripMenuItem.Text = "Invisible"; + // // tmrTriggerRefresh // this.tmrTriggerRefresh.Interval = 5000; From 145a5eb0ca368aacd1fea714db574ce480110c75 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Fri, 15 Jun 2018 19:04:32 +0200 Subject: [PATCH 09/24] Build --- Discord Media Loader.Application/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Discord Media Loader.Application/Properties/AssemblyInfo.cs b/Discord Media Loader.Application/Properties/AssemblyInfo.cs index b9030cb..a856e06 100644 --- a/Discord Media Loader.Application/Properties/AssemblyInfo.cs +++ b/Discord Media Loader.Application/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.1.0")] -[assembly: AssemblyFileVersion("1.1.1.0")] +[assembly: AssemblyVersion("1.1.2.0")] +[assembly: AssemblyFileVersion("1.1.2.0")] From f28091da2d86fd2d7708e964c2bf430c486e7bff Mon Sep 17 00:00:00 2001 From: Serraniel Date: Tue, 14 Aug 2018 21:29:48 +0200 Subject: [PATCH 10/24] Added notice to readme that the project currently is on hold due to discord changes --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 76946ef..0dac475 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # Discord Media Loader + +#PROBABLY DISCONTINUED!! THIS PROJECT IS ON HOLD DUE TO DISCORD DOUBLING DOWN ON SELFBOTS (THAT DO VIOLATE TOS AFTER ALL). LATEST COMMIT SHOULD REMAIN STABLE!! + *Discord Media Loader* is a small tool for downloading all attachments of *Discord* servers. **[Download](https://github.com/Serraniel/DiscordMediaLoader/releases)** From 01c5a0d30a2a9d1c2283e1780f08df742b0da094 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Tue, 14 Aug 2018 21:32:31 +0200 Subject: [PATCH 11/24] Fixed readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dac475..bef5442 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Discord Media Loader -#PROBABLY DISCONTINUED!! THIS PROJECT IS ON HOLD DUE TO DISCORD DOUBLING DOWN ON SELFBOTS (THAT DO VIOLATE TOS AFTER ALL). LATEST COMMIT SHOULD REMAIN STABLE!! +# PROBABLY DISCONTINUED!! THIS PROJECT IS ON HOLD DUE TO DISCORD DOUBLING DOWN ON SELFBOTS (THAT DO VIOLATE TOS AFTER ALL). LATEST COMMIT SHOULD REMAIN STABLE!! *Discord Media Loader* is a small tool for downloading all attachments of *Discord* servers. From a85aa1f96c73a1d3c2a260cfc515eb62bbf22ce2 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 29 Aug 2018 22:55:01 +0200 Subject: [PATCH 12/24] Added startup confirmation to inform the user about selfbots violating discord tos --- Discord Media Loader.Application/Classes/Core.cs | 15 +++++++++++++-- .../Classes/Settings.cs | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index c740049..00104dd 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -82,7 +82,6 @@ namespace DML.Application.Classes Logger.Trace("Created log folder."); } - var logFile = Path.Combine(logFolder, SweetUtils.LegalizeFilename($"{DateTime.Now.ToString(CultureInfo.CurrentCulture.DateTimeFormat.SortableDateTimePattern)}.log.zip")); @@ -109,6 +108,18 @@ namespace DML.Application.Classes Settings.Store(); } + if (Settings.ShowStartUpHints) + { + if (MessageBox.Show(splash, "This tool is considered as a selfbot which may violate the Discord TOS. By using this tool you take the risk to get your account banned. Although this never happened yet (as far as I know) you have to confirm to this.\n\r\n\rDo you wish to continue?", "HOLD UP!!", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + splash.Close(); + return; + } + + Settings.ShowStartUpHints = false; + Settings.Store(); + } + Logger.Debug("Loading jobs collection out of database..."); Scheduler.JobList = Job.RestoreJobs().ToList(); @@ -175,7 +186,7 @@ namespace DML.Application.Classes if (!string.IsNullOrEmpty(Settings.LoginToken)) { Logger.Debug("Trying to login with last known token..."); - loggedIn= await DMLClient.Login(Settings.LoginToken); + loggedIn = await DMLClient.Login(Settings.LoginToken); } if (!loggedIn) diff --git a/Discord Media Loader.Application/Classes/Settings.cs b/Discord Media Loader.Application/Classes/Settings.cs index a9544ee..906697e 100644 --- a/Discord Media Loader.Application/Classes/Settings.cs +++ b/Discord Media Loader.Application/Classes/Settings.cs @@ -15,6 +15,7 @@ namespace DML.Application.Classes public string FileNameScheme { get; set; } = @"%guild%\%channel%\%id%"; public bool SkipExistingFiles { get; set; } = true; public int ThreadLimit { get; set; } = 50; + public bool ShowStartUpHints { get; set; } = true; public void Store() { From 4b6cc8cd932ab381ed60023e97227d62b4af5ac7 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 29 Aug 2018 22:59:12 +0200 Subject: [PATCH 13/24] Fixed the instructions how to gather the login token --- .../Dialogs/LoginDialog.Designer.cs | 8 +++++--- Discord Media Loader.Application/Dialogs/LoginDialog.resx | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Discord Media Loader.Application/Dialogs/LoginDialog.Designer.cs b/Discord Media Loader.Application/Dialogs/LoginDialog.Designer.cs index 0a48921..2c13385 100644 --- a/Discord Media Loader.Application/Dialogs/LoginDialog.Designer.cs +++ b/Discord Media Loader.Application/Dialogs/LoginDialog.Designer.cs @@ -44,7 +44,7 @@ this.pnlButtons.Controls.Add(this.btnAbort); this.pnlButtons.Controls.Add(this.btnOk); this.pnlButtons.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlButtons.Location = new System.Drawing.Point(0, 168); + this.pnlButtons.Location = new System.Drawing.Point(0, 189); this.pnlButtons.Name = "pnlButtons"; this.pnlButtons.Size = new System.Drawing.Size(426, 51); this.pnlButtons.TabIndex = 0; @@ -71,9 +71,11 @@ // // lbHowToToken // + this.lbHowToToken.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); this.lbHowToToken.Location = new System.Drawing.Point(7, 58); this.lbHowToToken.Name = "lbHowToToken"; - this.lbHowToToken.Size = new System.Drawing.Size(412, 87); + this.lbHowToToken.Size = new System.Drawing.Size(412, 128); this.lbHowToToken.TabIndex = 5; this.lbHowToToken.Text = resources.GetString("lbHowToToken.Text"); // @@ -97,7 +99,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(426, 219); + this.ClientSize = new System.Drawing.Size(426, 240); this.Controls.Add(this.lbHowToToken); this.Controls.Add(this.edToken); this.Controls.Add(this.lbToken); diff --git a/Discord Media Loader.Application/Dialogs/LoginDialog.resx b/Discord Media Loader.Application/Dialogs/LoginDialog.resx index 0ffe195..3eab166 100644 --- a/Discord Media Loader.Application/Dialogs/LoginDialog.resx +++ b/Discord Media Loader.Application/Dialogs/LoginDialog.resx @@ -120,7 +120,9 @@ To find your login token please start Discord and press Ctrl + Shift + I shortcut. A browser inspector will open. Navigate into the "Application" tab and select "Local Storage" / "https://discordapp.com". If the right site keeps blank use "Session Storage" instead. -Look for the token key and copy its value without the quotation marks. +Look for the token key and copy its value without the quotation marks. + +IF YOU CANNOT FIND YOUR TOKEN you can try pressing Ctrl + R while having the inspector open. While reloading you still should be able to grab the token. It may disappear after discord has finished loading. From a3942c782b3f3537c51631ef9b05b28faded918e Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 29 Aug 2018 23:16:04 +0200 Subject: [PATCH 14/24] Added option to copy login token to clipboard --- .../MainForm.Designer.cs | 116 ++++++++++-------- Discord Media Loader.Application/MainForm.cs | 7 ++ 2 files changed, 74 insertions(+), 49 deletions(-) diff --git a/Discord Media Loader.Application/MainForm.Designer.cs b/Discord Media Loader.Application/MainForm.Designer.cs index d3ea045..5f54124 100644 --- a/Discord Media Loader.Application/MainForm.Designer.cs +++ b/Discord Media Loader.Application/MainForm.Designer.cs @@ -46,6 +46,11 @@ this.cbGuild = new System.Windows.Forms.ComboBox(); this.lbGuild = new System.Windows.Forms.Label(); this.statusStrip = new System.Windows.Forms.StatusStrip(); + this.lbStatus = new System.Windows.Forms.ToolStripDropDownButton(); + this.invisibleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.doNotDisturbToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.doNotDenyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pgbProgress = new System.Windows.Forms.ToolStripProgressBar(); this.lbProgress = new System.Windows.Forms.ToolStripStatusLabel(); this.lblVersionPlaceholder = new System.Windows.Forms.ToolStripStatusLabel(); @@ -57,12 +62,9 @@ this.btnDelete = new System.Windows.Forms.Button(); this.lbxJobs = new System.Windows.Forms.ListBox(); this.tmrRefreshProgress = new System.Windows.Forms.Timer(this.components); - this.lbStatus = new System.Windows.Forms.ToolStripDropDownButton(); - this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.doNotDenyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.doNotDisturbToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.invisibleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tmrTriggerRefresh = new System.Windows.Forms.Timer(this.components); + this.showTokenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.pnlSettings.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edThreadLimit)).BeginInit(); this.groupBox1.SuspendLayout(); @@ -254,6 +256,45 @@ this.statusStrip.TabIndex = 2; this.statusStrip.Text = "statusStrip1"; // + // lbStatus + // + this.lbStatus.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.invisibleToolStripMenuItem, + this.doNotDisturbToolStripMenuItem, + this.doNotDenyToolStripMenuItem, + this.onlineToolStripMenuItem}); + this.lbStatus.Name = "lbStatus"; + this.lbStatus.Size = new System.Drawing.Size(13, 20); + this.lbStatus.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked); + // + // invisibleToolStripMenuItem + // + this.invisibleToolStripMenuItem.Name = "invisibleToolStripMenuItem"; + this.invisibleToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.invisibleToolStripMenuItem.Tag = "3"; + this.invisibleToolStripMenuItem.Text = "Invisible"; + // + // doNotDisturbToolStripMenuItem + // + this.doNotDisturbToolStripMenuItem.Name = "doNotDisturbToolStripMenuItem"; + this.doNotDisturbToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.doNotDisturbToolStripMenuItem.Tag = "2"; + this.doNotDisturbToolStripMenuItem.Text = "Do not disturb"; + // + // doNotDenyToolStripMenuItem + // + this.doNotDenyToolStripMenuItem.Name = "doNotDenyToolStripMenuItem"; + this.doNotDenyToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.doNotDenyToolStripMenuItem.Tag = "1"; + this.doNotDenyToolStripMenuItem.Text = "Idle"; + // + // onlineToolStripMenuItem + // + this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem"; + this.onlineToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.onlineToolStripMenuItem.Tag = "0"; + this.onlineToolStripMenuItem.Text = "Online"; + // // pgbProgress // this.pgbProgress.Name = "pgbProgress"; @@ -267,19 +308,21 @@ // lblVersionPlaceholder // this.lblVersionPlaceholder.Name = "lblVersionPlaceholder"; - this.lblVersionPlaceholder.Size = new System.Drawing.Size(426, 17); + this.lblVersionPlaceholder.Size = new System.Drawing.Size(459, 17); this.lblVersionPlaceholder.Spring = true; // // lbVersion // this.lbVersion.Name = "lbVersion"; - this.lbVersion.Size = new System.Drawing.Size(118, 17); - this.lbVersion.Text = "v https://github.com"; + this.lbVersion.Size = new System.Drawing.Size(54, 17); + this.lbVersion.Text = "VERSION"; // // btnDropDown // this.btnDropDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.btnDropDown.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.showTokenToolStripMenuItem, + this.toolStripSeparator2, this.visitGithubToolStripMenuItem, this.aboutToolStripMenuItem}); this.btnDropDown.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -290,14 +333,14 @@ // visitGithubToolStripMenuItem // this.visitGithubToolStripMenuItem.Name = "visitGithubToolStripMenuItem"; - this.visitGithubToolStripMenuItem.Size = new System.Drawing.Size(135, 22); + this.visitGithubToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.visitGithubToolStripMenuItem.Text = "Visit Github"; this.visitGithubToolStripMenuItem.Click += new System.EventHandler(this.visitGithubToolStripMenuItem_Click); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(135, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // @@ -341,50 +384,23 @@ this.tmrRefreshProgress.Interval = 500; this.tmrRefreshProgress.Tick += new System.EventHandler(this.tmrRefreshProgress_Tick); // - // lbStatus - // - this.lbStatus.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.invisibleToolStripMenuItem, - this.doNotDisturbToolStripMenuItem, - this.doNotDenyToolStripMenuItem, - this.onlineToolStripMenuItem}); - this.lbStatus.Name = "lbStatus"; - this.lbStatus.Size = new System.Drawing.Size(13, 20); - this.lbStatus.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked); - // - // onlineToolStripMenuItem - // - this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem"; - this.onlineToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.onlineToolStripMenuItem.Tag = "0"; - this.onlineToolStripMenuItem.Text = "Online"; - // - // doNotDenyToolStripMenuItem - // - this.doNotDenyToolStripMenuItem.Name = "doNotDenyToolStripMenuItem"; - this.doNotDenyToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.doNotDenyToolStripMenuItem.Tag = "1"; - this.doNotDenyToolStripMenuItem.Text = "Idle"; - // - // doNotDisturbToolStripMenuItem - // - this.doNotDisturbToolStripMenuItem.Name = "doNotDisturbToolStripMenuItem"; - this.doNotDisturbToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.doNotDisturbToolStripMenuItem.Tag = "2"; - this.doNotDisturbToolStripMenuItem.Text = "Do not disturb"; - // - // invisibleToolStripMenuItem - // - this.invisibleToolStripMenuItem.Name = "invisibleToolStripMenuItem"; - this.invisibleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.invisibleToolStripMenuItem.Tag = "3"; - this.invisibleToolStripMenuItem.Text = "Invisible"; - // // tmrTriggerRefresh // this.tmrTriggerRefresh.Interval = 5000; this.tmrTriggerRefresh.Tick += new System.EventHandler(this.tmrTriggerRefresh_Tick); // + // showTokenToolStripMenuItem + // + this.showTokenToolStripMenuItem.Name = "showTokenToolStripMenuItem"; + this.showTokenToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.showTokenToolStripMenuItem.Text = "Copy login token"; + this.showTokenToolStripMenuItem.Click += new System.EventHandler(this.showTokenToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -448,5 +464,7 @@ private System.Windows.Forms.ToolStripMenuItem doNotDenyToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem onlineToolStripMenuItem; private System.Windows.Forms.Timer tmrTriggerRefresh; + private System.Windows.Forms.ToolStripMenuItem showTokenToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; } } \ No newline at end of file diff --git a/Discord Media Loader.Application/MainForm.cs b/Discord Media Loader.Application/MainForm.cs index ce7b754..b0a991a 100644 --- a/Discord Media Loader.Application/MainForm.cs +++ b/Discord Media Loader.Application/MainForm.cs @@ -282,5 +282,12 @@ namespace DML.Application lbStatus.Text = DMLClient.Client.CurrentUser.Status.ToString(); tmrTriggerRefresh.Stop(); } + + private void showTokenToolStripMenuItem_Click(object sender, EventArgs e) + { + Clipboard.SetText(Core.Settings.LoginToken); + MessageBox.Show(this, "Your login token has been copied to your clipboard.", "Discord Media Loader", + MessageBoxButtons.OK); + } } } From d773f7036da1665a48347552b34564c561eb0bcb Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 29 Aug 2018 23:21:05 +0200 Subject: [PATCH 15/24] Build --- Discord Media Loader.Application/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Discord Media Loader.Application/Properties/AssemblyInfo.cs b/Discord Media Loader.Application/Properties/AssemblyInfo.cs index a856e06..8d7d910 100644 --- a/Discord Media Loader.Application/Properties/AssemblyInfo.cs +++ b/Discord Media Loader.Application/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.2.0")] -[assembly: AssemblyFileVersion("1.1.2.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] From 03172ab363258f8bea2d96962738bc69d80b6be0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 29 Aug 2018 23:28:47 +0200 Subject: [PATCH 16/24] Update README.md Removed discontinued message Added hint, that the selfbot is against discord tos and use is at own risk --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bef5442..83cb148 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Discord Media Loader -# PROBABLY DISCONTINUED!! THIS PROJECT IS ON HOLD DUE TO DISCORD DOUBLING DOWN ON SELFBOTS (THAT DO VIOLATE TOS AFTER ALL). LATEST COMMIT SHOULD REMAIN STABLE!! +## IMPORTANT: This selfbot may violate discord TOS. Use at own risk!!! *Discord Media Loader* is a small tool for downloading all attachments of *Discord* servers. From c9a2fc114040bc5e246081651bb213445e1af221 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 30 Jan 2019 20:35:29 +0100 Subject: [PATCH 17/24] #10 Fixed handling of outdated / wrong logintokens --- DML.Client/DMLClient.cs | 2 +- .../Classes/Core.cs | 41 +++++++++++++------ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/DML.Client/DMLClient.cs b/DML.Client/DMLClient.cs index 691f563..07060f0 100644 --- a/DML.Client/DMLClient.cs +++ b/DML.Client/DMLClient.cs @@ -22,4 +22,4 @@ namespace DML.Client return Client.LoginState == LoginState.LoggedIn && Client.ConnectionState == ConnectionState.Connected; } } -} +} \ No newline at end of file diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index 00104dd..930e251 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -1,11 +1,5 @@ -using System; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Runtime; -using System.Threading.Tasks; -using System.Windows.Forms; -using Discord; +using Discord; +using Discord.Net; using Discord.WebSocket; using DML.AppCore.Classes; using DML.Application.Dialogs; @@ -16,6 +10,13 @@ using SharpRaven.Data; using SweetLib.Utils; using SweetLib.Utils.Logger; using SweetLib.Utils.Logger.Memory; +using System; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime; +using System.Threading.Tasks; +using System.Windows.Forms; using Logger = SweetLib.Utils.Logger.Logger; namespace DML.Application.Classes @@ -175,7 +176,6 @@ namespace DML.Application.Classes Logger.Info("Trying to log into discord..."); - var abort = false; DMLClient.Client.Connected += Client_Connected; @@ -183,10 +183,19 @@ namespace DML.Application.Classes while (!loggedIn) { - if (!string.IsNullOrEmpty(Settings.LoginToken)) + var token = "abc"; + try { - Logger.Debug("Trying to login with last known token..."); - loggedIn = await DMLClient.Login(Settings.LoginToken); + if (!string.IsNullOrEmpty(Settings.LoginToken)) + { + Logger.Debug("Trying to login with last known token..."); + loggedIn = await DMLClient.Login(token); + } + + } + catch (HttpException e) + { + Logger.Warn("HTTPException occured during login. Probably from login token."); } if (!loggedIn) @@ -248,12 +257,16 @@ namespace DML.Application.Classes var isError = false; var guild = FindServerById(job.GuildId); if (guild == null) + { isError = true; + } else { var channel = FindChannelById(guild, job.ChannelId); if (channel == null) + { isError = true; + } } if (isError) @@ -280,9 +293,11 @@ namespace DML.Application.Classes } catch (Exception ex) { - Logger.Error($"{ex.Message} occured at: {ex.StackTrace}"); + Logger.Error($"{ex.Message} [{ex.GetType().Name}] occured at: {ex.StackTrace}"); if (MessageBox.Show($"An error occured while running Discord Media Loader:\n{ex.GetType().Name}: {ex.Message}\n\nDo you aggree to sending the error report to the creator of the tool?", "Discord Media Loader", MessageBoxButtons.YesNo) == DialogResult.Yes) + { Raven.Capture(new SentryEvent(ex)); + } } } From 224273d97b356f694e3634998ff9e485b6f68bf7 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 30 Jan 2019 20:47:13 +0100 Subject: [PATCH 18/24] #10 Removed dead code --- .../Classes/Core.cs | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index 930e251..f570af6 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -206,42 +206,6 @@ namespace DML.Application.Classes } } - /*while ((Client.LoginState != LoginState.LoggedIn || Client.ConnectionState!=ConnectionState.Connected) && !abort) - { - Logger.Debug(Client.ConnectionState.ToString()); - Logger.Debug(Client.LoginState.ToString()); - - Logger.Trace("Entering login loop."); - - try - { - if (Client.ConnectionState == ConnectionState.Connecting) - continue; - - if (!string.IsNullOrEmpty(Settings.LoginToken)) - { - Logger.Debug("Trying to login with last known token..."); - await Client.LoginAsync(TokenType.User, Settings.LoginToken); - await Client.StartAsync(); - await Task.Delay(1000); - } - - } - catch (HttpException ex) - { - Logger.Warn($"Login seems to have failed or gone wrong: {ex.GetType().Name} - {ex.Message}"); - } - - if (Client.LoginState == LoginState.LoggedOut) - { - Settings.Password = string.Empty; - Logger.Debug("Showing dialog for username and password..."); - var loginDlg = new LoginDialog(); - loginDlg.ShowDialog(); - Logger.Trace("Dialog closed."); - } - }*/ - Logger.Debug("Start checking for invalid jobs..."); //Client From ff52b5eb8ac83ae5fb0af63cbc0d5a56e982c52e Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 30 Jan 2019 20:50:22 +0100 Subject: [PATCH 19/24] #10 Fixed testing code --- Discord Media Loader.Application/Classes/Core.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index f570af6..8036846 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -183,13 +183,12 @@ namespace DML.Application.Classes while (!loggedIn) { - var token = "abc"; try { if (!string.IsNullOrEmpty(Settings.LoginToken)) { Logger.Debug("Trying to login with last known token..."); - loggedIn = await DMLClient.Login(token); + loggedIn = await DMLClient.Login(Settings.LoginToken); } } From 560c3711fa203ebab232a339581f716a35d23c5c Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 30 Jan 2019 20:50:53 +0100 Subject: [PATCH 20/24] #10 Some optimization --- Discord Media Loader.Application/Classes/Core.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index 8036846..fa97eeb 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -192,7 +192,7 @@ namespace DML.Application.Classes } } - catch (HttpException e) + catch (HttpException) { Logger.Warn("HTTPException occured during login. Probably from login token."); } From d90457b6e3221ea50e408b40fca45ab428c0e5d9 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 30 Jan 2019 20:54:07 +0100 Subject: [PATCH 21/24] #20 Only continue after login dialog if "ok" is the dialog result. --- Discord Media Loader.Application/Classes/Core.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index f570af6..477643e 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -193,7 +193,7 @@ namespace DML.Application.Classes } } - catch (HttpException e) + catch (HttpException) { Logger.Warn("HTTPException occured during login. Probably from login token."); } @@ -202,7 +202,10 @@ namespace DML.Application.Classes { Logger.Debug("Showing dialog for username and password..."); var loginDlg = new LoginDialog(); - loginDlg.ShowDialog(); + if (loginDlg.ShowDialog() != DialogResult.OK) + { + return; + } } } From 6b6991f3096ab19a9b3f809982ce754483e8db43 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 30 Jan 2019 21:01:16 +0100 Subject: [PATCH 22/24] Build preperation --- Discord Media Loader.Application/Properties/AssemblyInfo.cs | 6 +++--- Discord Media Loader/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Discord Media Loader.Application/Properties/AssemblyInfo.cs b/Discord Media Loader.Application/Properties/AssemblyInfo.cs index 8d7d910..1f4853b 100644 --- a/Discord Media Loader.Application/Properties/AssemblyInfo.cs +++ b/Discord Media Loader.Application/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Serraniel")] [assembly: AssemblyProduct("Discord Media Loader.Application")] -[assembly: AssemblyCopyright("Copyright © 2017 - 2018 by Serraniel")] +[assembly: AssemblyCopyright("Copyright © 2017 - 2019 by Serraniel")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.2.1.0")] +[assembly: AssemblyFileVersion("1.2.1.0")] diff --git a/Discord Media Loader/Properties/AssemblyInfo.cs b/Discord Media Loader/Properties/AssemblyInfo.cs index 1222c99..682e27d 100644 --- a/Discord Media Loader/Properties/AssemblyInfo.cs +++ b/Discord Media Loader/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Serraniel")] [assembly: AssemblyProduct("Discord Media Loader")] -[assembly: AssemblyCopyright("Copyright © 2017 - 2018 by Serraniel")] +[assembly: AssemblyCopyright("Copyright © 2017 - 2019 by Serraniel")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] From 945a92b99580675f9f2d1eed79b4ab2f881532e2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 1 Feb 2019 23:25:25 +0100 Subject: [PATCH 23/24] Update README.md Added build status bade --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83cb148..e8ead6d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ *Discord Media Loader* is a small tool for downloading all attachments of *Discord* servers. -**[Download](https://github.com/Serraniel/DiscordMediaLoader/releases)** +**[Download](https://github.com/Serraniel/DiscordMediaLoader/releases)** **Build:** [![build status badge](https://ci.serraniel.com/app/rest/builds/buildType:(DiscordMediaLoader_BuildMaster)/statusIcon)](https://ci.serraniel.com/viewType.html?buildTypeId=DiscordMediaLoader_BuildMaster) ## License From 0772edd35429de98ddb7a06c82c3f4e0ec506e52 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Fri, 15 Feb 2019 17:11:00 +0100 Subject: [PATCH 24/24] Debug database in debug configuration --- Discord Media Loader.Application/Classes/Core.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index c4645f2..4a91ebe 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -95,8 +95,12 @@ namespace DML.Application.Classes logMemory.ArchiveFile = logFile; } + var databasePath = Path.Combine(DataDirectory, "config.db"); +#if DEBUG + databasePath = Path.Combine(DataDirectory, "config.debug.db"); +#endif Logger.Debug("Loading database..."); - Database = new LiteDatabase(Path.Combine(DataDirectory, "config.db")); + Database = new LiteDatabase(databasePath); Database.Log.Logging += (message) => Logger.Trace($"LiteDB: {message}"); Logger.Debug("Loading settings collection out of database..."); @@ -277,7 +281,7 @@ namespace DML.Application.Classes splash.Close(); Logger.Info("Starting scheduler..."); - Scheduler.Start(); + // Scheduler.Start(); System.Windows.Forms.Application.Run(new MainForm());