Did some of the MainForm stuff
Referenced SweetLib directly (temporary) instead vie Nuget for now.
This commit is contained in:
parent
9384c9c2d0
commit
53f49b20c5
36
Discord Media Loader.Application/Classes/Job.cs
Normal file
36
Discord Media Loader.Application/Classes/Job.cs
Normal file
|
@ -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<Job>("jobs");
|
||||
|
||||
Trace("Adding new value...");
|
||||
jobDb.Insert(this);
|
||||
}
|
||||
|
||||
internal static IEnumerable<Job> RestoreJobs()
|
||||
{
|
||||
Debug("Restoring jobs...");
|
||||
Trace("Getting jobs collection...");
|
||||
var jobDb = Core.Database.GetCollection<Job>("jobs");
|
||||
|
||||
Trace("Creating new empty job list");
|
||||
return jobDb.FindAll();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -58,10 +58,6 @@
|
|||
<HintPath>..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SweetLib, Version=0.1.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SweetLib.0.1.24\lib\net45\SweetLib.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
|
@ -78,6 +74,7 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Classes\Job.cs" />
|
||||
<Compile Include="Classes\Settings.cs" />
|
||||
<Compile Include="Core.cs" />
|
||||
<Compile Include="Dialogs\LoginDialog.cs">
|
||||
|
@ -105,6 +102,12 @@
|
|||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SweetLib\SweetLib\SweetLib.csproj">
|
||||
<Project>{02c1f8ef-32f2-4e77-a36d-79129402af37}</Project>
|
||||
<Name>SweetLib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
238
Discord Media Loader.Application/MainForm.Designer.cs
generated
238
Discord Media Loader.Application/MainForm.Designer.cs
generated
|
@ -29,21 +29,257 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.pnlSettings = new System.Windows.Forms.GroupBox();
|
||||
this.lbThreadLimit = new System.Windows.Forms.Label();
|
||||
this.edThreadLimit = new System.Windows.Forms.NumericUpDown();
|
||||
this.cbSkipExisting = new System.Windows.Forms.CheckBox();
|
||||
this.edNameScheme = new System.Windows.Forms.TextBox();
|
||||
this.lbNameScheme = new System.Windows.Forms.Label();
|
||||
this.btnSearchFolders = new System.Windows.Forms.Button();
|
||||
this.edOperatingFolder = new System.Windows.Forms.TextBox();
|
||||
this.lbOperatingFolder = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.lbGuild = new System.Windows.Forms.Label();
|
||||
this.cbGuild = new System.Windows.Forms.ComboBox();
|
||||
this.lbChannel = new System.Windows.Forms.Label();
|
||||
this.cbChannel = new System.Windows.Forms.ComboBox();
|
||||
this.btnAddJob = new System.Windows.Forms.Button();
|
||||
this.pnlSettings.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.edThreadLimit)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlSettings
|
||||
//
|
||||
this.pnlSettings.Controls.Add(this.lbThreadLimit);
|
||||
this.pnlSettings.Controls.Add(this.edThreadLimit);
|
||||
this.pnlSettings.Controls.Add(this.cbSkipExisting);
|
||||
this.pnlSettings.Controls.Add(this.edNameScheme);
|
||||
this.pnlSettings.Controls.Add(this.lbNameScheme);
|
||||
this.pnlSettings.Controls.Add(this.btnSearchFolders);
|
||||
this.pnlSettings.Controls.Add(this.edOperatingFolder);
|
||||
this.pnlSettings.Controls.Add(this.lbOperatingFolder);
|
||||
this.pnlSettings.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnlSettings.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlSettings.Name = "pnlSettings";
|
||||
this.pnlSettings.Size = new System.Drawing.Size(553, 93);
|
||||
this.pnlSettings.TabIndex = 0;
|
||||
this.pnlSettings.TabStop = false;
|
||||
this.pnlSettings.Text = "Settings";
|
||||
//
|
||||
// lbThreadLimit
|
||||
//
|
||||
this.lbThreadLimit.AutoSize = true;
|
||||
this.lbThreadLimit.Location = new System.Drawing.Point(12, 67);
|
||||
this.lbThreadLimit.Name = "lbThreadLimit";
|
||||
this.lbThreadLimit.Size = new System.Drawing.Size(64, 13);
|
||||
this.lbThreadLimit.TabIndex = 6;
|
||||
this.lbThreadLimit.Text = "Thread limit:";
|
||||
//
|
||||
// edThreadLimit
|
||||
//
|
||||
this.edThreadLimit.Location = new System.Drawing.Point(113, 65);
|
||||
this.edThreadLimit.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.edThreadLimit.Name = "edThreadLimit";
|
||||
this.edThreadLimit.Size = new System.Drawing.Size(120, 20);
|
||||
this.edThreadLimit.TabIndex = 7;
|
||||
this.edThreadLimit.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.edThreadLimit.ValueChanged += new System.EventHandler(this.DoSomethingChanged);
|
||||
//
|
||||
// cbSkipExisting
|
||||
//
|
||||
this.cbSkipExisting.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbSkipExisting.AutoSize = true;
|
||||
this.cbSkipExisting.Location = new System.Drawing.Point(447, 42);
|
||||
this.cbSkipExisting.Name = "cbSkipExisting";
|
||||
this.cbSkipExisting.Size = new System.Drawing.Size(106, 17);
|
||||
this.cbSkipExisting.TabIndex = 5;
|
||||
this.cbSkipExisting.Text = "Skip existing files";
|
||||
this.cbSkipExisting.UseVisualStyleBackColor = true;
|
||||
this.cbSkipExisting.TextChanged += new System.EventHandler(this.DoSomethingChanged);
|
||||
//
|
||||
// edNameScheme
|
||||
//
|
||||
this.edNameScheme.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.edNameScheme.Location = new System.Drawing.Point(113, 39);
|
||||
this.edNameScheme.Name = "edNameScheme";
|
||||
this.edNameScheme.Size = new System.Drawing.Size(328, 20);
|
||||
this.edNameScheme.TabIndex = 4;
|
||||
this.edNameScheme.TextChanged += new System.EventHandler(this.DoSomethingChanged);
|
||||
//
|
||||
// lbNameScheme
|
||||
//
|
||||
this.lbNameScheme.AutoSize = true;
|
||||
this.lbNameScheme.Location = new System.Drawing.Point(12, 42);
|
||||
this.lbNameScheme.Name = "lbNameScheme";
|
||||
this.lbNameScheme.Size = new System.Drawing.Size(95, 13);
|
||||
this.lbNameScheme.TabIndex = 3;
|
||||
this.lbNameScheme.Text = "File name scheme:";
|
||||
//
|
||||
// btnSearchFolders
|
||||
//
|
||||
this.btnSearchFolders.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSearchFolders.Location = new System.Drawing.Point(522, 11);
|
||||
this.btnSearchFolders.Name = "btnSearchFolders";
|
||||
this.btnSearchFolders.Size = new System.Drawing.Size(25, 23);
|
||||
this.btnSearchFolders.TabIndex = 2;
|
||||
this.btnSearchFolders.Text = "...";
|
||||
this.btnSearchFolders.UseVisualStyleBackColor = true;
|
||||
this.btnSearchFolders.Click += new System.EventHandler(this.btnSearchFolders_Click);
|
||||
//
|
||||
// edOperatingFolder
|
||||
//
|
||||
this.edOperatingFolder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.edOperatingFolder.Location = new System.Drawing.Point(113, 13);
|
||||
this.edOperatingFolder.Name = "edOperatingFolder";
|
||||
this.edOperatingFolder.Size = new System.Drawing.Size(403, 20);
|
||||
this.edOperatingFolder.TabIndex = 1;
|
||||
this.edOperatingFolder.TextChanged += new System.EventHandler(this.DoSomethingChanged);
|
||||
//
|
||||
// lbOperatingFolder
|
||||
//
|
||||
this.lbOperatingFolder.AutoSize = true;
|
||||
this.lbOperatingFolder.Location = new System.Drawing.Point(12, 16);
|
||||
this.lbOperatingFolder.Name = "lbOperatingFolder";
|
||||
this.lbOperatingFolder.Size = new System.Drawing.Size(85, 13);
|
||||
this.lbOperatingFolder.TabIndex = 0;
|
||||
this.lbOperatingFolder.Text = "Operating folder:";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.btnAddJob);
|
||||
this.groupBox1.Controls.Add(this.cbChannel);
|
||||
this.groupBox1.Controls.Add(this.lbChannel);
|
||||
this.groupBox1.Controls.Add(this.cbGuild);
|
||||
this.groupBox1.Controls.Add(this.lbGuild);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupBox1.Location = new System.Drawing.Point(0, 93);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(553, 57);
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Add a job";
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 311);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(553, 22);
|
||||
this.statusStrip1.TabIndex = 2;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox2.Location = new System.Drawing.Point(0, 150);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(553, 161);
|
||||
this.groupBox2.TabIndex = 3;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Jobs";
|
||||
//
|
||||
// lbGuild
|
||||
//
|
||||
this.lbGuild.AutoSize = true;
|
||||
this.lbGuild.Location = new System.Drawing.Point(12, 22);
|
||||
this.lbGuild.Name = "lbGuild";
|
||||
this.lbGuild.Size = new System.Drawing.Size(34, 13);
|
||||
this.lbGuild.TabIndex = 0;
|
||||
this.lbGuild.Text = "Guild:";
|
||||
//
|
||||
// cbGuild
|
||||
//
|
||||
this.cbGuild.FormattingEnabled = true;
|
||||
this.cbGuild.Location = new System.Drawing.Point(52, 19);
|
||||
this.cbGuild.Name = "cbGuild";
|
||||
this.cbGuild.Size = new System.Drawing.Size(181, 21);
|
||||
this.cbGuild.TabIndex = 1;
|
||||
this.cbGuild.SelectedIndexChanged += new System.EventHandler(this.cbGuild_SelectedIndexChanged);
|
||||
//
|
||||
// lbChannel
|
||||
//
|
||||
this.lbChannel.AutoSize = true;
|
||||
this.lbChannel.Location = new System.Drawing.Point(239, 22);
|
||||
this.lbChannel.Name = "lbChannel";
|
||||
this.lbChannel.Size = new System.Drawing.Size(49, 13);
|
||||
this.lbChannel.TabIndex = 2;
|
||||
this.lbChannel.Text = "Channel:";
|
||||
//
|
||||
// cbChannel
|
||||
//
|
||||
this.cbChannel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbChannel.FormattingEnabled = true;
|
||||
this.cbChannel.Location = new System.Drawing.Point(294, 19);
|
||||
this.cbChannel.Name = "cbChannel";
|
||||
this.cbChannel.Size = new System.Drawing.Size(181, 21);
|
||||
this.cbChannel.TabIndex = 3;
|
||||
//
|
||||
// btnAddJob
|
||||
//
|
||||
this.btnAddJob.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnAddJob.Location = new System.Drawing.Point(481, 19);
|
||||
this.btnAddJob.Name = "btnAddJob";
|
||||
this.btnAddJob.Size = new System.Drawing.Size(66, 23);
|
||||
this.btnAddJob.TabIndex = 4;
|
||||
this.btnAddJob.Text = "&Add";
|
||||
this.btnAddJob.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
||||
this.ClientSize = new System.Drawing.Size(553, 333);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.pnlSettings);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(100, 75);
|
||||
this.Name = "MainForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Discord Medial Loader";
|
||||
this.Shown += new System.EventHandler(this.MainForm_Shown);
|
||||
this.pnlSettings.ResumeLayout(false);
|
||||
this.pnlSettings.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.edThreadLimit)).EndInit();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox pnlSettings;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label lbThreadLimit;
|
||||
private System.Windows.Forms.NumericUpDown edThreadLimit;
|
||||
private System.Windows.Forms.CheckBox cbSkipExisting;
|
||||
private System.Windows.Forms.TextBox edNameScheme;
|
||||
private System.Windows.Forms.Label lbNameScheme;
|
||||
private System.Windows.Forms.Button btnSearchFolders;
|
||||
private System.Windows.Forms.TextBox edOperatingFolder;
|
||||
private System.Windows.Forms.Label lbOperatingFolder;
|
||||
private System.Windows.Forms.Button btnAddJob;
|
||||
private System.Windows.Forms.ComboBox cbChannel;
|
||||
private System.Windows.Forms.Label lbChannel;
|
||||
private System.Windows.Forms.ComboBox cbGuild;
|
||||
private System.Windows.Forms.Label lbGuild;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,150 @@
|
|||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Discord;
|
||||
using static SweetLib.Utils.Logger.Logger;
|
||||
|
||||
namespace DML.Application
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private bool IsInitialized { get; set; } = false;
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void MainForm_Shown(object sender, System.EventArgs e)
|
||||
{
|
||||
Trace("MainForm shown executed.");
|
||||
RefreshComponents();
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
|
||||
private void RefreshComponents()
|
||||
{
|
||||
Debug("Refreshing components...");
|
||||
|
||||
Trace("Refreshing operating folder component...");
|
||||
edOperatingFolder.Text = Core.Settings.OperatingFolder;
|
||||
|
||||
Trace("Refreshing name scheme component...");
|
||||
edNameScheme.Text = Core.Settings.FileNameScheme;
|
||||
|
||||
Trace("Refreshing skip existing files component...");
|
||||
cbSkipExisting.Checked = Core.Settings.SkipExistingFiles;
|
||||
|
||||
Trace("Refreshing thread limit component...");
|
||||
edThreadLimit.Value = Core.Settings.ThreadLimit;
|
||||
|
||||
Trace("Adding guilds to component...");
|
||||
cbGuild.Items.AddRange(Core.Client.Servers.OrderBy(g => g.Name).Select(g => g.Name).ToArray());
|
||||
cbGuild.SelectedIndex = 0;
|
||||
Trace("Guild component initialized.");
|
||||
}
|
||||
|
||||
private void DoSomethingChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
Debug($"DoSomethingChanged excuted by {sender}.");
|
||||
if (!IsInitialized)
|
||||
{
|
||||
Trace("Form not initialized. Leaving DoSomethingChanged...");
|
||||
return;
|
||||
}
|
||||
|
||||
Trace("Updating operating folder...");
|
||||
Core.Settings.OperatingFolder = edOperatingFolder.Text;
|
||||
|
||||
Trace("Updating name scheme...");
|
||||
Core.Settings.FileNameScheme = edNameScheme.Text;
|
||||
|
||||
Trace("Updating skip existing files...");
|
||||
Core.Settings.SkipExistingFiles = cbSkipExisting.Checked;
|
||||
|
||||
Trace("Updating thread limit...");
|
||||
Core.Settings.ThreadLimit = (int)edThreadLimit.Value;
|
||||
|
||||
Trace("Storing new settings...");
|
||||
Core.Settings.Store();
|
||||
|
||||
Info("New settings have been saved.");
|
||||
}
|
||||
|
||||
private void btnSearchFolders_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
Trace("Operating folder button pressed.");
|
||||
using (var browserDialog = new FolderBrowserDialog())
|
||||
{
|
||||
Debug("Showing file browser dialog for operating folder...");
|
||||
|
||||
browserDialog.SelectedPath = edOperatingFolder.Text;
|
||||
browserDialog.ShowNewFolderButton = true;
|
||||
browserDialog.Description = "Select an operating folder...";
|
||||
|
||||
if (browserDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
edOperatingFolder.Text = browserDialog.SelectedPath;
|
||||
Debug("Updated operating folder.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Server FindServerByName(string name)
|
||||
{
|
||||
Trace($"Trying to find server by name: {name}");
|
||||
return (from s in Core.Client.Servers where s.Name == name select s).FirstOrDefault();
|
||||
}
|
||||
|
||||
private Channel FindChannelByName(Server server, string name)
|
||||
{
|
||||
Trace($"Trying to find channel in {server} by name: {name}");
|
||||
return (from c in server.TextChannels where c.Name == name select c).FirstOrDefault();
|
||||
}
|
||||
|
||||
private Server FindServerById(ulong id)
|
||||
{
|
||||
Trace($"Trying to find server by Id: {id}");
|
||||
return (from s in Core.Client.Servers where s.Id == id select s).FirstOrDefault();
|
||||
}
|
||||
|
||||
private Channel FindChannelById(Server server, ulong id)
|
||||
{
|
||||
Trace($"Trying to find channel in {server} by id: {id}");
|
||||
return (from c in server.TextChannels where c.Id == id select c).FirstOrDefault();
|
||||
}
|
||||
|
||||
private void cbGuild_SelectedIndexChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
Trace("Guild index changed.");
|
||||
Debug("Updating channel dropdown component...");
|
||||
|
||||
UseWaitCursor = true;
|
||||
try
|
||||
{
|
||||
var guild = FindServerByName(cbGuild.Text);
|
||||
|
||||
if (guild != null)
|
||||
{
|
||||
Trace("Cleaning channel component from old values...");
|
||||
cbChannel.Items.Clear();
|
||||
|
||||
Trace("Adding new channels...");
|
||||
cbChannel.Items.AddRange(guild.TextChannels.OrderBy(c => c.Position).Select(c => c.Name).ToArray());
|
||||
Trace($"Added {cbChannel.Items.Count} channels.");
|
||||
|
||||
cbChannel.SelectedIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Warn($"Guild {cbGuild.Text} could not be found!");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
UseWaitCursor = false;
|
||||
}
|
||||
|
||||
Debug("Finished updating channel dropdown component.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,9 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
|
|
@ -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("0.2.116.0")]
|
||||
[assembly: AssemblyFileVersion("0.2.116.0")]
|
||||
[assembly: AssemblyVersion("0.2.137.0")]
|
||||
[assembly: AssemblyFileVersion("0.2.137.0")]
|
||||
|
|
|
@ -5,6 +5,5 @@
|
|||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net461" />
|
||||
<package id="Nito.AsyncEx" version="3.0.1" targetFramework="net461" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net461" />
|
||||
<package id="SweetLib" version="0.1.24" targetFramework="net461" />
|
||||
<package id="WebSocket4Net" version="0.14.1" targetFramework="net461" />
|
||||
</packages>
|
|
@ -7,6 +7,8 @@ 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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -21,6 +23,10 @@ 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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -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("0.99.44.0")]
|
||||
[assembly: AssemblyFileVersion("0.99.44.0")]
|
||||
[assembly: AssemblyVersion("0.99.65.0")]
|
||||
[assembly: AssemblyFileVersion("0.99.65.0")]
|
||||
|
|
Loading…
Reference in a new issue