Did some corrections because of sweetlib

This commit is contained in:
Serraniel 2018-04-23 21:40:17 +02:00
parent c36acc0750
commit 8ca2ec9b27
2 changed files with 8 additions and 5 deletions

View file

@ -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
@ -135,8 +136,8 @@ namespace DML.AppCore.Classes
Trace($"Updating lastId ({lastId}) to {m.Id}");
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}.");

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
@ -8,6 +9,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 +246,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(CultureInfo.InvariantCulture))
.Replace("%name%", a.Filename)
.Replace("%id%", a.Id.ToString());
@ -277,7 +279,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