Make Dark the default theme

Light is burning my eyes
pull/7/head
Alexey Golub 7 years ago
parent 95d581797b
commit 34afce2a66

@ -2,7 +2,7 @@
{ {
public enum Theme public enum Theme
{ {
Light, Dark,
Dark Light
} }
} }

@ -10,8 +10,8 @@ namespace DiscordChatExporter
{ {
public static class Program public static class Program
{ {
private static readonly DiscordApiService DiscordApiService = new DiscordApiService(); private static readonly DiscordApiService ApiService = new DiscordApiService();
private static readonly HtmlExportService HtmlExportService = new HtmlExportService(); private static readonly HtmlExportService ExportService = new HtmlExportService();
private static Options GetOptions(string[] args) private static Options GetOptions(string[] args)
{ {
@ -51,12 +51,12 @@ namespace DiscordChatExporter
// Get messages // Get messages
Console.WriteLine("Getting messages..."); Console.WriteLine("Getting messages...");
var messages = await DiscordApiService.GetMessagesAsync(options.Token, options.ChannelId); var messages = await ApiService.GetMessagesAsync(options.Token, options.ChannelId);
var chatLog = new ChatLog(options.ChannelId, messages); var chatLog = new ChatLog(options.ChannelId, messages);
// Export // Export
Console.WriteLine("Exporting messages..."); Console.WriteLine("Exporting messages...");
HtmlExportService.Export($"{options.ChannelId}.html", chatLog, options.Theme); ExportService.Export($"{options.ChannelId}.html", chatLog, options.Theme);
} }
public static void Main(string[] args) public static void Main(string[] args)

@ -4,10 +4,11 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>Discord Chat Log</title> <title>Discord Chat Log</title>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<style id="theme">
</style> <style id="theme"></style>
</head> </head>
<body> <body>

@ -14,10 +14,10 @@ namespace DiscordChatExporter.Services
{ {
private HtmlDocument GetTemplate() private HtmlDocument GetTemplate()
{ {
string templateName = "DiscordChatExporter.Resources.HtmlExportService.Template.html"; string resourcePath = "DiscordChatExporter.Resources.HtmlExportService.Template.html";
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();
var stream = assembly.GetManifestResourceStream(templateName); var stream = assembly.GetManifestResourceStream(resourcePath);
if (stream == null) if (stream == null)
throw new MissingManifestResourceException("Could not find template resource"); throw new MissingManifestResourceException("Could not find template resource");
@ -31,12 +31,12 @@ namespace DiscordChatExporter.Services
private string GetStyle(Theme theme) private string GetStyle(Theme theme)
{ {
string styleName = $"DiscordChatExporter.Resources.HtmlExportService.{theme}Theme.css"; string resourcePath = $"DiscordChatExporter.Resources.HtmlExportService.{theme}Theme.css";
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();
var stream = assembly.GetManifestResourceStream(styleName); var stream = assembly.GetManifestResourceStream(resourcePath);
if (stream == null) if (stream == null)
throw new MissingManifestResourceException("Could not find theme style resource"); throw new MissingManifestResourceException("Could not find style resource");
using (stream) using (stream)
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))

Loading…
Cancel
Save