diff --git a/Melody49Notifier/Melody49Notifier.csproj b/Melody49Notifier/Melody49Notifier.csproj
index 4c30510..7fd124a 100644
--- a/Melody49Notifier/Melody49Notifier.csproj
+++ b/Melody49Notifier/Melody49Notifier.csproj
@@ -2,6 +2,18 @@
net461
+
+
+
+
+
+
+ Never
+
+
+ Never
+
+
@@ -15,17 +27,11 @@
-
- PreserveNewest
-
PreserveNewest
PreserveNewest
-
- PreserveNewest
-
diff --git a/Melody49Notifier/Notification/NotificationEmailGenerator.cs b/Melody49Notifier/Notification/NotificationEmailGenerator.cs
index be146f9..084a84b 100644
--- a/Melody49Notifier/Notification/NotificationEmailGenerator.cs
+++ b/Melody49Notifier/Notification/NotificationEmailGenerator.cs
@@ -6,6 +6,7 @@
using Melody49Notifier.Models;
using Microsoft.Azure.WebJobs.Host;
using System.IO;
+using System.Reflection;
namespace Melody49Notifier.Notification
{
@@ -20,8 +21,8 @@ public NotificationEmailGenerator(TraceWriter log)
public string CreateFromTemplate(TheaterSchedule currentTheaterSchedule)
{
- string email = File.ReadAllText("EmailTemplate.html");
- string showingTemplate = File.ReadAllText("EmailShowingTemplate.html");
+ string email = GetEmbeddedResourceText("Melody49Notifier.EmailTemplate.html");
+ string showingTemplate = GetEmbeddedResourceText("Melody49Notifier.EmailShowingTemplate.html");
string showings = string.Empty;
@@ -42,5 +43,16 @@ public string CreateFromTemplate(TheaterSchedule currentTheaterSchedule)
return email;
}
+
+ private static string GetEmbeddedResourceText(string resourceName)
+ {
+ Assembly assembly = Assembly.GetExecutingAssembly();
+
+ using (Stream stream = assembly.GetManifestResourceStream(resourceName))
+ using (StreamReader reader = new StreamReader(stream))
+ {
+ return reader.ReadToEnd();
+ }
+ }
}
}