EliteBGS/BGS/NonaDiscordLog.cs

60 lines
1.8 KiB
C#
Raw Normal View History

2021-07-09 11:03:30 +02:00
using System;
using System.Text;
2022-01-22 08:57:59 +01:00
using System.Globalization;
2021-08-25 16:36:57 +02:00
using EDJournal;
2021-07-09 11:03:30 +02:00
2021-11-10 21:24:39 +01:00
namespace EliteBGS.BGS {
public class NonaDiscordLog : DiscordLogGenerator {
2021-07-09 11:03:30 +02:00
private string FormatDate() {
2022-01-22 08:57:59 +01:00
CultureInfo cultureInfo = CultureInfo.InvariantCulture;
2021-07-09 11:03:30 +02:00
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";
2022-09-24 09:42:57 +02:00
} else if (today.Day == 23) {
suffix = "rd";
2021-07-09 11:03:30 +02:00
} else {
suffix = "th";
}
date.AppendFormat("{0} {1}{2}, {3}",
2022-01-22 08:57:59 +01:00
cultureInfo.DateTimeFormat.GetMonthName(today.Month),
today.Day, suffix,
2021-07-09 11:03:30 +02:00
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.ToLocationString());
log.Append(":clipboard: `Conducted:`\n");
log.Append("```");
2022-01-27 23:23:15 +01:00
return log.ToString();
}
protected override string GenerateObjectiveFooter(Objective objective) {
return "```";
2022-01-23 17:05:43 +01:00
}
protected override string GenerateHeader() {
return string.Format(":clock2: `Date:` {0}", FormatDate());
}
protected override string GenerateFooter() {
return "";
2021-07-09 11:03:30 +02:00
}
2022-01-06 16:24:20 +01:00
public override string ToString() {
return "Nova Navy Log";
}
2021-07-09 11:03:30 +02:00
}
}