From 6f04123f3fd9717b5a383ebdb0834d47c8e3c2fc Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Tue, 20 Sep 2016 12:19:11 -0500 Subject: [PATCH] replaced resx with simpler static file lookup --- Ficdown.Parser/Ficdown.Parser.csproj | 210 ++++++++++----------- Ficdown.Parser/Render/Template.Designer.cs | 144 -------------- Ficdown.Parser/Render/Template.cs | 29 +++ Ficdown.Parser/Render/Template.resx | 130 ------------- 4 files changed, 132 insertions(+), 381 deletions(-) delete mode 100644 Ficdown.Parser/Render/Template.Designer.cs create mode 100644 Ficdown.Parser/Render/Template.cs delete mode 100644 Ficdown.Parser/Render/Template.resx diff --git a/Ficdown.Parser/Ficdown.Parser.csproj b/Ficdown.Parser/Ficdown.Parser.csproj index 64f078a..18f5d51 100644 --- a/Ficdown.Parser/Ficdown.Parser.csproj +++ b/Ficdown.Parser/Ficdown.Parser.csproj @@ -1,113 +1,109 @@ - - - - Debug - AnyCPU - {780F652D-7541-4171-BB89-2D263D3961DC} - Library - Properties - Ficdown.Parser - Ficdown.Parser - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Epub4Net.1.2.0\lib\net40\Epub4Net.dll - - - ..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll - - - ..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Template.resx - - - - - - - - - - - - - - - - - - - ResXFileCodeGenerator - Template.Designer.cs - - - + + + + Debug + AnyCPU + {780F652D-7541-4171-BB89-2D263D3961DC} + Library + Properties + Ficdown.Parser + Ficdown.Parser + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Epub4Net.1.2.0\lib\net40\Epub4Net.dll + + + ..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll + + + ..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Always + + + + + Always + + + + + Always + + + - \ No newline at end of file + --> + diff --git a/Ficdown.Parser/Render/Template.Designer.cs b/Ficdown.Parser/Render/Template.Designer.cs deleted file mode 100644 index 1ec9869..0000000 --- a/Ficdown.Parser/Render/Template.Designer.cs +++ /dev/null @@ -1,144 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Ficdown.Parser.Render { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Template { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Template() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ficdown.Parser.Render.Template", typeof(Template).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to <!DOCTYPE html> - /// - ///<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> - ///<head> - /// <meta charset="utf-8" /> - /// <title>@Title</title> - /// <link rel="stylesheet" type="text/css" href="styles.css"/> - ///</head> - /// <body> - /// <h1 class="title">@Title</h1> - /// @Description - /// <p><a href="@FirstScene">Begin reading...</a></p> - /// </body> - ///</html>. - /// - internal static string Index { - get { - return ResourceManager.GetString("Index", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <!DOCTYPE html> - /// - ///<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> - ///<head> - /// <meta charset="utf-8" /> - /// <title>@Title</title> - /// <link rel="stylesheet" type="text/css" href="styles.css" /> - ///</head> - ///<body> - /// @Content - ///</body> - ///</html>. - /// - internal static string Scene { - get { - return ResourceManager.GetString("Scene", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to /* Adapted from http://wiki.mobileread.com/wiki/CSS_template */ - /// - ///@page { - /// margin-top: 30px; - /// margin-bottom: 20px; - ///} - /// - ///body { - /// margin-right: 30px; - /// margin-left: 30px; - /// padding: 0; - ///} - /// - ///img { - /// max-width: 100%; - /// oeb-column-number: 1; - /// display: inline-block; - ///} - /// - ///a { - /// font-style: italic; - /// color: #000; - /// text-decoration: none; - ///} - /// - ///h1.title { - /// font-family: Verdana, Geneva, sans-serif; - /// font-size: x-large; - /// text-align: center; - /// font-weight: bold; - /// [rest of string was truncated]";. - /// - internal static string Styles { - get { - return ResourceManager.GetString("Styles", resourceCulture); - } - } - } -} diff --git a/Ficdown.Parser/Render/Template.cs b/Ficdown.Parser/Render/Template.cs new file mode 100644 index 0000000..9fbe368 --- /dev/null +++ b/Ficdown.Parser/Render/Template.cs @@ -0,0 +1,29 @@ +namespace Ficdown.Parser.Render +{ + using System; + using System.IO; + + public static class Template + { + public static string Index + { + get { return GetFileContents("Views/index.html"); } + } + + public static string Scene + { + get { return GetFileContents("Views/scene.html"); } + } + + public static string Styles + { + get { return GetFileContents("Assets/styles.css"); } + } + + private static string GetFileContents(string fname) + { + var path = Path.Combine(Environment.CurrentDirectory, string.Format("Render/{0}", fname)); + return File.ReadAllText(path); + } + } +} diff --git a/Ficdown.Parser/Render/Template.resx b/Ficdown.Parser/Render/Template.resx deleted file mode 100644 index 3db7551..0000000 --- a/Ficdown.Parser/Render/Template.resx +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Views\index.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - Views\scene.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - Assets\styles.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - -