improve standard format by adding date range and tool version
This commit is contained in:
parent
1b2a162ac5
commit
be59588351
@ -3,6 +3,8 @@ using System.Linq;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using EliteBGS.LogGenerator;
|
using EliteBGS.LogGenerator;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace EliteBGS;
|
namespace EliteBGS;
|
||||||
|
|
||||||
@ -23,6 +25,37 @@ public class DiscordLogGenerator {
|
|||||||
new SearchAndRescueFormat(),
|
new SearchAndRescueFormat(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected virtual string GetToolVersion() {
|
||||||
|
Version v = Assembly.GetCallingAssembly().GetName().Version;
|
||||||
|
string ver;
|
||||||
|
if (v == null) {
|
||||||
|
ver = "v?.?.?";
|
||||||
|
} else {
|
||||||
|
ver = "v" + v.ToString(3);
|
||||||
|
}
|
||||||
|
return string.Format("EliteBGS {0}", ver);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual DateTime GetDateOfEarliestEntry(Objective objective) {
|
||||||
|
return objective
|
||||||
|
.Transactions
|
||||||
|
.SelectMany(x => x.Entries)
|
||||||
|
.OrderBy(x => x.Timestamp)
|
||||||
|
.First()
|
||||||
|
.Timestamp
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual DateTime GetDateOfLatestEntry(Objective objective) {
|
||||||
|
return objective
|
||||||
|
.Transactions
|
||||||
|
.SelectMany(x => x.Entries)
|
||||||
|
.OrderByDescending(x => x.Timestamp)
|
||||||
|
.First()
|
||||||
|
.Timestamp
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual string GenerateSummary(Objective objective) {
|
protected virtual string GenerateSummary(Objective objective) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
@ -76,7 +109,14 @@ public class DiscordLogGenerator {
|
|||||||
|
|
||||||
string summary = GenerateSummary(objective);
|
string summary = GenerateSummary(objective);
|
||||||
|
|
||||||
log.AppendFormat("**Date:** {0}\n", DateTime.Now.ToString("dd/MM/yyyy"));
|
log.AppendFormat("**Log Generated:** {0} by {1}\n",
|
||||||
|
DateTime.Now.ToString("dd/MM/yyyy"),
|
||||||
|
GetToolVersion()
|
||||||
|
);
|
||||||
|
log.AppendFormat("**Date:** {0} - {1}\n",
|
||||||
|
GetDateOfEarliestEntry(objective),
|
||||||
|
GetDateOfLatestEntry(objective)
|
||||||
|
);
|
||||||
log.AppendFormat("**Target:** {0}\n", location);
|
log.AppendFormat("**Target:** {0}\n", location);
|
||||||
if (!string.IsNullOrEmpty(summary)) {
|
if (!string.IsNullOrEmpty(summary)) {
|
||||||
log.AppendFormat("**Summary**: {0}\n", summary);
|
log.AppendFormat("**Summary**: {0}\n", summary);
|
||||||
|
Loading…
Reference in New Issue
Block a user