EliteBGS/BGS/NonaDiscordLog.cs

58 lines
1.7 KiB
C#

using System;
using System.Text;
using System.Globalization;
using EDJournal;
namespace EliteBGS.BGS {
public class NonaDiscordLog : DiscordLogGenerator {
private string FormatDate() {
CultureInfo cultureInfo = CultureInfo.InvariantCulture;
StringBuilder date = new StringBuilder();
DateTime today = DateTime.Now;
string suffix;
if (today.Day == 1 || today.Day == 21 || today.Day == 31) {
suffix = "st";
} else if (today.Day == 2 || today.Day == 22) {
suffix = "nd";
} else {
suffix = "th";
}
date.AppendFormat("{0} {1}{2}, {3}",
cultureInfo.DateTimeFormat.GetMonthName(today.Month),
today.Day, suffix,
today.Year + EliteDangerous.YearOffset
);
return date.ToString();
}
protected override string GenerateObjectiveHeader(Objective objective) {
StringBuilder log = new StringBuilder();
log.AppendFormat(":globe_with_meridians: `Location:` {0}\n", objective.ToShortString());
log.Append(":clipboard: `Conducted:`\n");
log.Append("```");
return log.ToString();
}
protected override string GenerateObjectiveFooter(Objective objective) {
return "```";
}
protected override string GenerateHeader() {
return string.Format(":clock2: `Date:` {0}", FormatDate());
}
protected override string GenerateFooter() {
return "";
}
public override string ToString() {
return "Nova Navy Log";
}
}
}