add a bot header for discord log parsing
This commit is contained in:
parent
a3b7623557
commit
c43d2ff1d3
@ -111,10 +111,6 @@ public class DiscordLogGenerator {
|
|||||||
|
|
||||||
string summary = GenerateSummary(objective);
|
string summary = GenerateSummary(objective);
|
||||||
|
|
||||||
log.AppendFormat("**Log Generated:** {0} by {1}\n",
|
|
||||||
DateTime.Now.ToString("dd/MM/yyyy"),
|
|
||||||
GetToolVersion()
|
|
||||||
);
|
|
||||||
var earliest = GetDateOfEarliestEntry(objective);
|
var earliest = GetDateOfEarliestEntry(objective);
|
||||||
var latest = GetDateOfLatestEntry(objective);
|
var latest = GetDateOfLatestEntry(objective);
|
||||||
if (earliest != null && latest != null) {
|
if (earliest != null && latest != null) {
|
||||||
@ -149,6 +145,16 @@ public class DiscordLogGenerator {
|
|||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual string Name {
|
||||||
|
get { return "GenericLog"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string BotHeader() {
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendFormat("**Bot-Header**: {0}; {1}\n", GetToolVersion(), this.Name);
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual string GenerateDiscordLog(Report report) {
|
public virtual string GenerateDiscordLog(Report report) {
|
||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
|
|
||||||
@ -164,6 +170,7 @@ public class DiscordLogGenerator {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.AppendFormat("{0}", BotHeader());
|
||||||
log.AppendFormat("{0}", GenerateHeader());
|
log.AppendFormat("{0}", GenerateHeader());
|
||||||
|
|
||||||
foreach (Objective objective in objectives) {
|
foreach (Objective objective in objectives) {
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
public class GenericDiscordLog : DiscordLogGenerator {
|
public class GenericDiscordLog : DiscordLogGenerator {
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return "Generic Log";
|
return "Generic";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Name {
|
||||||
|
get { return "Generic"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ public partial class MainWindow : MetroWindow {
|
|||||||
private LoadEntriesWindow loadentries = null;
|
private LoadEntriesWindow loadentries = null;
|
||||||
|
|
||||||
private static readonly List<DiscordLogGenerator> logtypes = new List<DiscordLogGenerator>() {
|
private static readonly List<DiscordLogGenerator> logtypes = new List<DiscordLogGenerator>() {
|
||||||
new NonaDiscordLog(),
|
|
||||||
new GenericDiscordLog(),
|
new GenericDiscordLog(),
|
||||||
|
new NonaDiscordLog(),
|
||||||
new OneLineDiscordLog(),
|
new OneLineDiscordLog(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,12 @@ using System.Linq;
|
|||||||
namespace EliteBGS.BGS;
|
namespace EliteBGS.BGS;
|
||||||
|
|
||||||
public class NonaDiscordLog : DiscordLogGenerator {
|
public class NonaDiscordLog : DiscordLogGenerator {
|
||||||
|
protected override string BotHeader() {
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendFormat(":robot: `Bot-Header`: {0}; {1}\n", GetToolVersion(), this.Name);
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
private string FormatDate() {
|
private string FormatDate() {
|
||||||
CultureInfo cultureInfo = CultureInfo.InvariantCulture;
|
CultureInfo cultureInfo = CultureInfo.InvariantCulture;
|
||||||
StringBuilder date = new StringBuilder();
|
StringBuilder date = new StringBuilder();
|
||||||
@ -79,6 +85,10 @@ public class NonaDiscordLog : DiscordLogGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return "Nova Navy Log";
|
return "Nova Navy";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Name {
|
||||||
|
get { return "NovaNavy"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ public class OneLineDiscordLog : DiscordLogGenerator {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.AppendFormat("{0}\n", BotHeader());
|
||||||
|
|
||||||
foreach (Objective objective in objectives) {
|
foreach (Objective objective in objectives) {
|
||||||
log.AppendFormat("{0}", GenerateObjectiveHeader(objective));
|
log.AppendFormat("{0}", GenerateObjectiveHeader(objective));
|
||||||
|
|
||||||
@ -60,6 +62,10 @@ public class OneLineDiscordLog : DiscordLogGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return "One Line Report";
|
return "One Line";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Name {
|
||||||
|
get { return "OneLine"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user