From 53f49b20c5bdfb5b3eb99cf6259552591629e815 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Mon, 17 Apr 2017 14:39:29 +0200 Subject: [PATCH] Did some of the MainForm stuff Referenced SweetLib directly (temporary) instead vie Nuget for now. --- .../Classes/Job.cs | 36 +++ .../Classes/Settings.cs | 4 + Discord Media Loader.Application/Core.cs | 5 +- .../DML.Application.csproj | 11 +- .../MainForm.Designer.cs | 238 +++++++++++++++++- Discord Media Loader.Application/MainForm.cs | 140 ++++++++++- .../MainForm.resx | 3 + .../Properties/AssemblyInfo.cs | 4 +- .../packages.config | 1 - Discord Media Loader.sln | 6 + .../Properties/AssemblyInfo.cs | 4 +- 11 files changed, 439 insertions(+), 13 deletions(-) create mode 100644 Discord Media Loader.Application/Classes/Job.cs diff --git a/Discord Media Loader.Application/Classes/Job.cs b/Discord Media Loader.Application/Classes/Job.cs new file mode 100644 index 0000000..ba5aabd --- /dev/null +++ b/Discord Media Loader.Application/Classes/Job.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static SweetLib.Utils.Logger.Logger; + +namespace DML.Application.Classes +{ + public class Job + { + public int Id { get; set; } + public ulong GuildId { get; set; } + public ulong ChannelId { get; set; } + + internal void Store() + { + Debug("Storing job to database..."); + Trace("Getting jobs collection..."); + var jobDb = Core.Database.GetCollection("jobs"); + + Trace("Adding new value..."); + jobDb.Insert(this); + } + + internal static IEnumerable RestoreJobs() + { + Debug("Restoring jobs..."); + Trace("Getting jobs collection..."); + var jobDb = Core.Database.GetCollection("jobs"); + + Trace("Creating new empty job list"); + return jobDb.FindAll(); + } + } +} diff --git a/Discord Media Loader.Application/Classes/Settings.cs b/Discord Media Loader.Application/Classes/Settings.cs index 45de616..3aabe45 100644 --- a/Discord Media Loader.Application/Classes/Settings.cs +++ b/Discord Media Loader.Application/Classes/Settings.cs @@ -18,6 +18,10 @@ namespace DML.Application.Classes public bool UseUserData { get; set; } = false; public bool SavePassword { get; set; } = false; public LogLevel ApplicactionLogLevel { get; set; } = LogLevel.Info | LogLevel.Warn | LogLevel.Error; + public string OperatingFolder { get; set; } + public string FileNameScheme { get; set; } = @"%guild%\%channel%\%guild%_%channel%_%timestamp%_%name%"; + public bool SkipExistingFiles { get; set; } = true; + public int ThreadLimit { get; set; } = 50; internal void Store() { diff --git a/Discord Media Loader.Application/Core.cs b/Discord Media Loader.Application/Core.cs index 7451bf7..aa048ce 100644 --- a/Discord Media Loader.Application/Core.cs +++ b/Discord Media Loader.Application/Core.cs @@ -11,6 +11,7 @@ using Discord.Net; using DML.Application.Classes; using DML.Application.Dialogs; using LiteDB; +using SweetLib.Utils; using SweetLib.Utils.Logger; using SweetLib.Utils.Logger.Memory; using static SweetLib.Utils.Logger.Logger; @@ -75,7 +76,7 @@ namespace DML.Application var logFile = Path.Combine(logFolder, - $"{DateTime.Now.ToString(CultureInfo.CurrentCulture.DateTimeFormat.SortableDateTimePattern).Replace(':', '-')}.log.zip"); + SweetUtils.LegalizeFilename($"{DateTime.Now.ToString(CultureInfo.CurrentCulture.DateTimeFormat.SortableDateTimePattern)}.log.zip")); Trace($"Setting log file: {logFile}"); logMemory.AutoArchiveOnDispose = true; @@ -182,7 +183,7 @@ namespace DML.Application Trace("Dialog closed."); } } - + System.Windows.Forms.Application.Run(new MainForm()); } catch (Exception ex) diff --git a/Discord Media Loader.Application/DML.Application.csproj b/Discord Media Loader.Application/DML.Application.csproj index 6c87c1a..edc1796 100644 --- a/Discord Media Loader.Application/DML.Application.csproj +++ b/Discord Media Loader.Application/DML.Application.csproj @@ -58,10 +58,6 @@ ..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll True - - ..\packages\SweetLib.0.1.24\lib\net45\SweetLib.dll - True - @@ -78,6 +74,7 @@ + @@ -105,6 +102,12 @@ + + + {02c1f8ef-32f2-4e77-a36d-79129402af37} + SweetLib + +