Added media data class
This commit is contained in:
parent
698729cec7
commit
4d6cc85732
3 changed files with 50 additions and 0 deletions
48
Discord Media Loader.Application/Classes/MediaData.cs
Normal file
48
Discord Media Loader.Application/Classes/MediaData.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DML.AppCore.Classes;
|
||||
using static SweetLib.Utils.Logger.Logger;
|
||||
|
||||
namespace DML.Application.Classes
|
||||
{
|
||||
public class MediaData
|
||||
{
|
||||
public ulong Id { get; set; }
|
||||
public string DownloadSource { get; set; }
|
||||
public ulong GuildId { get; set; }
|
||||
public ulong ChannelId { get; set;}
|
||||
public double TimeStamp { get; set; }
|
||||
public string Filename { get; set; }
|
||||
|
||||
internal void Store()
|
||||
{
|
||||
Debug("Storing job to database...");
|
||||
Trace("Getting jobs collection...");
|
||||
var db = Core.Database.GetCollection<MediaData>("media");
|
||||
|
||||
Trace("Adding new value...");
|
||||
|
||||
if (db.Find(x => x.Id == Id).Any())
|
||||
{
|
||||
db.Update(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Insert(this);
|
||||
}
|
||||
}
|
||||
|
||||
internal void Delete()
|
||||
{
|
||||
Debug("Deleting job from database...");
|
||||
Trace("Getting jobs collection...");
|
||||
var db = Core.Database.GetCollection<MediaData>("media");
|
||||
|
||||
Trace("Deleting value...");
|
||||
db.Delete(Id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 RescanRequired { get; set; } = true;
|
||||
|
||||
public void Store()
|
||||
{
|
||||
|
|
|
@ -161,6 +161,7 @@
|
|||
<Compile Include="Classes\Core.cs" />
|
||||
<Compile Include="Classes\Job.cs" />
|
||||
<Compile Include="Classes\JobScheduler.cs" />
|
||||
<Compile Include="Classes\MediaData.cs" />
|
||||
<Compile Include="Dialogs\LoginDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
Loading…
Add table
Reference in a new issue