wabbajack/Wabbajack.BuildServer/Models/JobQueue/AJobPayload.cs

46 lines
1.4 KiB
C#
Raw Normal View History

2020-01-08 04:41:50 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson.Serialization.Attributes;
using Wabbajack.BuildServer.Model.Models;
2020-01-08 04:41:50 +00:00
using Wabbajack.BuildServer.Models.Jobs;
namespace Wabbajack.BuildServer.Models.JobQueue
{
public abstract class AJobPayload
{
public static List<Type> KnownSubTypes = new List<Type>
{
2020-01-09 04:42:25 +00:00
typeof(IndexJob),
2020-01-09 12:14:48 +00:00
typeof(GetNexusUpdatesJob),
2020-01-10 13:16:41 +00:00
typeof(UpdateModLists),
typeof(EnqueueAllArchives),
2020-01-13 04:04:46 +00:00
typeof(EnqueueAllGameFiles),
2020-01-21 12:49:49 +00:00
typeof(EnqueueRecentFiles),
typeof(UploadToCDN),
typeof(IndexDynDOLOD),
typeof(ReindexArchives),
typeof(PatchArchive)
2020-01-08 04:41:50 +00:00
};
public static Dictionary<Type, string> TypeToName { get; set; }
public static Dictionary<string, Type> NameToType { get; set; }
[BsonIgnore]
public abstract string Description { get; }
public virtual bool UsesNexus { get; } = false;
public abstract Task<JobResult> Execute(DBContext db, SqlService sql,AppSettings settings);
2020-01-08 04:41:50 +00:00
static AJobPayload()
{
NameToType = KnownSubTypes.ToDictionary(t => t.FullName.Substring(t.Namespace.Length + 1), t => t);
TypeToName = NameToType.ToDictionary(k => k.Value, k => k.Key);
}
}
}