Added media data class

This commit is contained in:
Serraniel 2018-02-01 20:47:04 +01:00
parent 698729cec7
commit 4d6cc85732
3 changed files with 50 additions and 0 deletions

View 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);
}
}
}

View file

@ -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()
{

View file

@ -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>