2020-05-19 03:46:33 +00:00
|
|
|
|
using System;
|
2020-05-20 03:25:41 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.VisualBasic;
|
2020-05-19 03:46:33 +00:00
|
|
|
|
using Wabbajack.Common;
|
2020-05-20 03:25:41 +00:00
|
|
|
|
using Wabbajack.Server.DataLayer;
|
2020-05-19 03:46:33 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Server.DTOs
|
|
|
|
|
{
|
|
|
|
|
public class Patch
|
|
|
|
|
{
|
|
|
|
|
public ArchiveDownload Src { get; set; }
|
|
|
|
|
public ArchiveDownload Dest { get; set; }
|
|
|
|
|
public long PatchSize { get; set; }
|
|
|
|
|
public DateTime? Finished { get; set; }
|
2020-05-20 03:25:41 +00:00
|
|
|
|
public bool? IsFailed { get; set; }
|
|
|
|
|
public string FailMessage { get; set; }
|
|
|
|
|
|
|
|
|
|
public async Task Finish(SqlService sql, long size)
|
|
|
|
|
{
|
|
|
|
|
IsFailed = false;
|
|
|
|
|
Finished = DateTime.UtcNow;
|
|
|
|
|
PatchSize = size;
|
|
|
|
|
await sql.FinializePatch(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task Fail(SqlService sql, string msg)
|
|
|
|
|
{
|
|
|
|
|
IsFailed = true;
|
|
|
|
|
Finished = DateTime.UtcNow;
|
|
|
|
|
FailMessage = msg;
|
|
|
|
|
await sql.FinializePatch(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-19 03:46:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|