From e5c1e1345aa569e4b8302a57d3391db44ac4ba1f Mon Sep 17 00:00:00 2001 From: Manuel Grundner Date: Wed, 11 Dec 2019 11:41:09 +0100 Subject: [PATCH] fix: dont use resourcemanager at all #362 --- .../Extensions/AzureHostSupport.cs | 7 +- src/Pretzel.Logic/Pretzel.Logic.csproj | 44 --- .../Properties/Razor.Designer.cs | 281 ------------------ src/Pretzel.Logic/Properties/Razor.resx | 151 ---------- .../Properties/RazorAzure.Designer.cs | 115 ------- src/Pretzel.Logic/Properties/RazorAzure.resx | 130 -------- .../Properties/RazorCsProject.Designer.cs | 213 ------------- .../Properties/RazorCsProject.resx | 166 ----------- .../Properties/RazorWiki.Designer.cs | 164 ---------- src/Pretzel.Logic/Properties/RazorWiki.resx | 133 --------- .../Properties/Resources.Designer.cs | 111 ------- src/Pretzel.Logic/Properties/Resources.resx | 124 -------- src/Pretzel.Logic/Recipes/Recipe.cs | 94 +++--- 13 files changed, 55 insertions(+), 1678 deletions(-) delete mode 100644 src/Pretzel.Logic/Properties/Razor.Designer.cs delete mode 100644 src/Pretzel.Logic/Properties/Razor.resx delete mode 100644 src/Pretzel.Logic/Properties/RazorAzure.Designer.cs delete mode 100644 src/Pretzel.Logic/Properties/RazorAzure.resx delete mode 100644 src/Pretzel.Logic/Properties/RazorCsProject.Designer.cs delete mode 100644 src/Pretzel.Logic/Properties/RazorCsProject.resx delete mode 100644 src/Pretzel.Logic/Properties/RazorWiki.Designer.cs delete mode 100644 src/Pretzel.Logic/Properties/RazorWiki.resx delete mode 100644 src/Pretzel.Logic/Properties/Resources.Designer.cs delete mode 100644 src/Pretzel.Logic/Properties/Resources.resx diff --git a/src/Pretzel.Logic/Extensibility/Extensions/AzureHostSupport.cs b/src/Pretzel.Logic/Extensibility/Extensions/AzureHostSupport.cs index b545eb191..3479ac2a9 100644 --- a/src/Pretzel.Logic/Extensibility/Extensions/AzureHostSupport.cs +++ b/src/Pretzel.Logic/Extensibility/Extensions/AzureHostSupport.cs @@ -6,6 +6,7 @@ using System.Linq; using Pretzel.Logic.Commands; using Pretzel.Logic.Extensions; +using Pretzel.Logic.Recipes; namespace Pretzel.Logic.Extensibility.Extensions { @@ -67,9 +68,9 @@ public void MixIn(string directory) fileSystem.Directory.Move(directoryToMove, Path.Combine(sourceFolder, trimStart)); } - fileSystem.File.WriteAllText(Path.Combine(directory, @"Shim.cs"), Properties.RazorAzure.Shim); - fileSystem.File.WriteAllText(Path.Combine(directory, @"Shim.csproj"), Properties.RazorAzure.ShimProject); - fileSystem.File.WriteAllText(Path.Combine(directory, @"Shim.sln"), Properties.RazorAzure.ShimSolution); + Recipe.CreateFile(GetType(), fileSystem, @"Resources\RazorAzure\Shim.cs", directory, @"Shim.cs"); + Recipe.CreateFile(GetType(), fileSystem, @"Resources\RazorAzure\Shim.csproj", directory, @"Shim.csproj"); + Recipe.CreateFile(GetType(), fileSystem, @"Resources\RazorAzure\Shim.sln", directory, @"Shim.sln"); var currentPath = assembly.GetEntryAssemblyLocation(); var destination = Path.Combine(directory, "Pretzel.exe"); diff --git a/src/Pretzel.Logic/Pretzel.Logic.csproj b/src/Pretzel.Logic/Pretzel.Logic.csproj index 1a4c42fa4..ce643d797 100644 --- a/src/Pretzel.Logic/Pretzel.Logic.csproj +++ b/src/Pretzel.Logic/Pretzel.Logic.csproj @@ -51,50 +51,6 @@ - - - True - True - Razor.resx - - - True - True - RazorAzure.resx - - - True - True - RazorCsProject.resx - - - True - True - RazorWiki.resx - - - True - True - Resources.resx - - - - - ResXFileCodeGenerator - Designer - Razor.Designer.cs - - - ResXFileCodeGenerator - RazorWiki.Designer.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - diff --git a/src/Pretzel.Logic/Properties/Razor.Designer.cs b/src/Pretzel.Logic/Properties/Razor.Designer.cs deleted file mode 100644 index e062866c3..000000000 --- a/src/Pretzel.Logic/Properties/Razor.Designer.cs +++ /dev/null @@ -1,281 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Pretzel.Logic.Properties { - 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", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Razor { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Razor() { - } - - /// - /// 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("Pretzel.Logic.Properties.Razor", typeof(Razor).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 --- - ///layout: post - ///title: About - ///comments: false - ///--- - /// - ///New Site - /// - ///##To Do - /// - ///Edit this Markdown to add an about page. - /// - internal static string About { - get { - return ResourceManager.GetString("About", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to --- - ///layout: nil - ///--- - ///@model Pretzel.Logic.Templating.Context.PageContext - /// - ///<?xml version="1.0"?> - ///<feed xmlns="http://www.w3.org/2005/Atom"> - /// <title>@Model.Site.Title | @Model.Site.Config["author"]</title> - /// <link href="@Model.Site.Config["url"]"/> - /// <link type="application/atom+xml" rel="self" href="@Model.Site.Config["url"]/atom.xml"/> - /// <updated>@Model.Site.Time.ToString("s")</updated> - /// <id>@Model.Site.Config["url"]/</id> - /// <author> - /// <name>@Model.Site.Config["author"]</name> - /// <email>@M [rest of string was truncated]";. - /// - internal static string Atom { - get { - return ResourceManager.GetString("Atom", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to pretzel: - /// engine: razor - /// - ///# Site settings - ///author: # name of the author - ///title: # site title - ///url: # site url - ///contact: # mail of the author. - /// - internal static string Config { - get { - return ResourceManager.GetString("Config", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to --- - ///layout: post - ///title: "My First Post" - ///author: "Author" - ///comments: true - ///--- - /// - ///## Hello world... - /// - ///Code: - /// - ///```cs - ///static void Main() - ///{ - /// Console.WriteLine("Hello World!"); - ///} - ///``` - /// - ///This is my first post on the site!. - /// - internal static string FirstPost { - get { - return ResourceManager.GetString("FirstPost", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to @inherits RazorEngine.Templating.TemplateBase<Pretzel.Logic.Templating.Context.PageContext> - ///<head> - /// <meta content="en-au" http-equiv="Content-Language" /> - /// <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - /// <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="Blog Feed" /> - /// <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Blog Feed" /> - /// <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> /// [rest of string was truncated]";. - /// - internal static string Head { - get { - return ResourceManager.GetString("Head", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to --- - ///layout : layout - ///title : SiteName - ///--- - ///@model Pretzel.Logic.Templating.Context.PageContext - /// - ///<ul class="posts"> - ///@{ - /// var numberPosts = 5; - ///} - /// @for (var i = 0; i < numberPosts && i < Model.Site.Posts.Count; i++) - /// { - /// var post = Model.Site.Posts[i]; - /// <li> - /// <div class="idea"> - /// @if (i == 0 && post.Layout == "post") - /// { - /// <h1><a href="@post.Url">@post.Title</a></h1> - /// <div class="postdate">@post.Dat [rest of string was truncated]";. - /// - internal static string Index { - get { - return ResourceManager.GetString("Index", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to @inherits RazorEngine.Templating.TemplateBase<Pretzel.Logic.Templating.Context.PageContext> - /// - ///<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - ///<html xmlns="http://www.w3.org/1999/xhtml"> - ///@Include("head.cshtml") - ///<body> - /// <div id="container"> - /// <div id="side"> - /// <a href="/" id="home" title="home" alt="home"><img src="/img/logo.png" alt="Site Name" /></a> - /// <div id="hometext"><a href="/">@Model.Site.Tit [rest of string was truncated]";. - /// - internal static string Layout { - get { - return ResourceManager.GetString("Layout", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to --- - ///layout: layout - ///--- - ///@inherits RazorEngine.Templating.TemplateBase<Pretzel.Logic.Templating.Context.PageContext> - /// - ///<div class="entry-container"> - /// <div class='entry'> - /// <h1>@Model.Title</h1> - /// <span class="postdate">@Model.Page.Date.ToString("d MMM, yyyy") - /// @foreach(var tag in Model.Page.Tags) - /// { - /// <li><a href="/tag/@tag">@tag</a></li> - /// } - /// </span> - /// @Raw(Model.Content) - /// </div> - ///</div> - ///<div id="page-navigation"> - /// <div class="left">@if (Model.Previous != null) - /// [rest of string was truncated]";. - /// - internal static string Post { - get { - return ResourceManager.GetString("Post", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to --- - ///layout: nil - ///--- - ///@model Pretzel.Logic.Templating.Context.PageContext - ///<?xml version="1.0" encoding="UTF-8"?> - ///<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> - ///<channel> - /// <title>@Model.Site.Title | @Model.Site.Config["author"]</title> - /// <link>@Model.Site.Config["url"]</link> - /// <atom:link href="@Model.Site.Config["url"]/rss.xml" rel="self" type="application/rss+xml" /> - /// <description>Personal blog of @Model.Site.Config["author"]</description> - /// <language>en-us</language> - /// [rest of string was truncated]";. - /// - internal static string Rss { - get { - return ResourceManager.GetString("Rss", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to --- - ///layout: nil - ///--- - ///@model Pretzel.Logic.Templating.Context.PageContext - /// - ///<?xml version="1.0" encoding="UTF-8" ?> - ///<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" - /// xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - /// xsi:schemalocation="http://www.sitemaps.org/schemas/sitemap/0.9 - /// http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> - /// <!-- Generated with pretzel --> - /// - /// @foreach (var post in Model.Site.Posts) - /// { - /// <url> - /// <loc>http://domai [rest of string was truncated]";. - /// - internal static string Sitemap { - get { - return ResourceManager.GetString("Sitemap", resourceCulture); - } - } - } -} diff --git a/src/Pretzel.Logic/Properties/Razor.resx b/src/Pretzel.Logic/Properties/Razor.resx deleted file mode 100644 index 927009ba8..000000000 --- a/src/Pretzel.Logic/Properties/Razor.resx +++ /dev/null @@ -1,151 +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 - - - - ..\Resources\Razor\About.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Atom.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Config.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\FirstPost.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Head.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Index.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Layout.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Post.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Rss.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Razor\Sitemap.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - \ No newline at end of file diff --git a/src/Pretzel.Logic/Properties/RazorAzure.Designer.cs b/src/Pretzel.Logic/Properties/RazorAzure.Designer.cs deleted file mode 100644 index ea9d99ef1..000000000 --- a/src/Pretzel.Logic/Properties/RazorAzure.Designer.cs +++ /dev/null @@ -1,115 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18033 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Pretzel.Logic.Properties { - 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 RazorAzure { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal RazorAzure() { - } - - /// - /// 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("Pretzel.Logic.Properties.RazorAzure", typeof(RazorAzure).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 ???namespace Shim - ///{ - /// //Without a CS file in a CSProj, MSBuild will fail throwing CS2008 - /// class Shim - /// { - /// } - ///} - ///. - /// - internal static string Shim { - get { - return ResourceManager.GetString("Shim", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ???<?xml version="1.0" encoding="utf-8"?> - ///<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - /// <PropertyGroup> - /// <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration> - /// <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - /// <ProductVersion>8.0.30703</ProductVersion> - /// <SchemaVersion>2.0</SchemaVersion> - /// <ProjectGuid>{08524E18-F666-4F41-93D5-6AB6D97A58E2}</ProjectGuid> - /// <OutputType>Library</Out [rest of string was truncated]";. - /// - internal static string ShimProject { - get { - return ResourceManager.GetString("ShimProject", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ??? - ///Microsoft Visual Studio Solution File, Format Version 11.00 - ///# Visual Studio 2010 - ///Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Sham", "_source\_site", "{F74001E8-C911-4A56-A200-7F6B85564035}" - /// ProjectSection(WebsiteProperties) = preProject - /// TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" - /// Release.AspNetCompiler.VirtualPath = "/" - /// Release.AspNetCompiler.PhysicalPath = "_source\_site" - /// Release.AspNetCompiler.TargetPath = "shim" - /// Release.AspNetCompiler.Updateable = "true" - /// Re [rest of string was truncated]";. - /// - internal static string ShimSolution { - get { - return ResourceManager.GetString("ShimSolution", resourceCulture); - } - } - } -} diff --git a/src/Pretzel.Logic/Properties/RazorAzure.resx b/src/Pretzel.Logic/Properties/RazorAzure.resx deleted file mode 100644 index c06b2f51e..000000000 --- a/src/Pretzel.Logic/Properties/RazorAzure.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 - - - - ..\Resources\RazorAzure\Shim.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\RazorAzure\Shim.csproj;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\RazorAzure\Shim.sln;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - \ No newline at end of file diff --git a/src/Pretzel.Logic/Properties/RazorCsProject.Designer.cs b/src/Pretzel.Logic/Properties/RazorCsProject.Designer.cs deleted file mode 100644 index aece4c2f7..000000000 --- a/src/Pretzel.Logic/Properties/RazorCsProject.Designer.cs +++ /dev/null @@ -1,213 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Pretzel.Logic.Properties { - 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 RazorCsProject { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal RazorCsProject() { - } - - /// - /// 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("Pretzel.Logic.Properties.RazorCsProject", typeof(RazorCsProject).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 resource of type System.Byte[]. - /// - internal static byte[] AssemblyInfo_cs { - get { - object obj = ResourceManager.GetObject("AssemblyInfo_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] Category_cs { - get { - object obj = ResourceManager.GetObject("Category_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] LayoutProject_csproj { - get { - object obj = ResourceManager.GetObject("LayoutProject_csproj", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] LayoutSolution_sln { - get { - object obj = ResourceManager.GetObject("LayoutSolution_sln", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] NonProcessedPage_cs { - get { - object obj = ResourceManager.GetObject("NonProcessedPage_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] NuGet_Config { - get { - object obj = ResourceManager.GetObject("NuGet_Config", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] NuGet_exe { - get { - object obj = ResourceManager.GetObject("NuGet_exe", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] NuGet_targets { - get { - object obj = ResourceManager.GetObject("NuGet_targets", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] packages_config { - get { - object obj = ResourceManager.GetObject("packages_config", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] Page_cs { - get { - object obj = ResourceManager.GetObject("Page_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] PageContext_cs { - get { - object obj = ResourceManager.GetObject("PageContext_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] Paginator_cs { - get { - object obj = ResourceManager.GetObject("Paginator_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] SiteContext_cs { - get { - object obj = ResourceManager.GetObject("SiteContext_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] Tag_cs { - get { - object obj = ResourceManager.GetObject("Tag_cs", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] Web_config { - get { - object obj = ResourceManager.GetObject("Web_config", resourceCulture); - return ((byte[])(obj)); - } - } - } -} diff --git a/src/Pretzel.Logic/Properties/RazorCsProject.resx b/src/Pretzel.Logic/Properties/RazorCsProject.resx deleted file mode 100644 index d5ce0c450..000000000 --- a/src/Pretzel.Logic/Properties/RazorCsProject.resx +++ /dev/null @@ -1,166 +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 - - - - ..\Resources\RazorCsProject\AssemblyInfo_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\Category_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\LayoutProject_csproj;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\LayoutSolution_sln;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\NonProcessedPage_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\NuGet_Config;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\NuGet_exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\NuGet_targets;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\packages_config;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\PageContext_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\Page_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\Paginator_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\SiteContext_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\Tag_cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\RazorCsProject\Web_config;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/Pretzel.Logic/Properties/RazorWiki.Designer.cs b/src/Pretzel.Logic/Properties/RazorWiki.Designer.cs deleted file mode 100644 index df235f845..000000000 --- a/src/Pretzel.Logic/Properties/RazorWiki.Designer.cs +++ /dev/null @@ -1,164 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Pretzel.Logic.Properties { - 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", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class RazorWiki { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal RazorWiki() { - } - - /// - /// 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("Pretzel.Logic.Properties.RazorWiki", typeof(RazorWiki).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 body { - /// padding-top: 80px; - /// padding-bottom: 40px; - ///} - ///. - /// - internal static string DefaultStyle { - get { - return ResourceManager.GetString("DefaultStyle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to --- - ///layout : layout - ///title : Wiki Home - ///--- - /// - ///## Welcome to your pretzel Wiki - /// - ///Simply create folders, and .md files in your pretzel site, and the layout will automatically build a wiki content tree for you - /// - ///Use `order: X` in your yaml front matter to order files. - /// - ///Each folder should contain an index.md file. - /// - internal static string Index { - get { - return ResourceManager.GetString("Index", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to @using System - ///@using System.Collections.Generic - ///@using System.Linq - ///@using System.Text - ///@using Pretzel.Logic.Templating.Context - ///@using Page = Pretzel.Logic.Templating.Context.Page - ///@inherits RazorEngine.Templating.TemplateBase<PageContext> - ///@functions { - /// - /// static string WriteOutContents(PageContext context, IEnumerable<Page> pages, string path) - /// { - /// var level = path.Count(c=>c=='/'); - /// var indent = string.Empty.PadLeft(((level - 1) * 4)) + " "; - /// var sb [rest of string was truncated]";. - /// - internal static string Layout { - get { - return ResourceManager.GetString("Layout", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to - ///.menu-toggle { - /// display:run-in !important; - /// width=10px !important; - /// margin-right:10px !important; - ///} - /// - ///.menu-toggle:hover { - /// color: black !important; - ///} - /// - ///.sidebar-nav { - /// padding: 9px 0; - ///} - /// - ///.navbar .brand { - /// margin-top: 10px; - /// margin-left: 5px; - /// color: White; - /// text-shadow: none; - ///} - /// - ///.btn-navbar { - /// margin-top: 10px; - ///} - /// - ///.navbar-inner { - /// background: #394755; - ///} - /// - ///.navbar-link { - /// color: white; - /// font-size: 16px; - /// margin: 10px 0 10px 10px; - /// padding-right: 0px; - ///} - /// - ///.navba [rest of string was truncated]";. - /// - internal static string Style { - get { - return ResourceManager.GetString("Style", resourceCulture); - } - } - } -} diff --git a/src/Pretzel.Logic/Properties/RazorWiki.resx b/src/Pretzel.Logic/Properties/RazorWiki.resx deleted file mode 100644 index 9bc37caa6..000000000 --- a/src/Pretzel.Logic/Properties/RazorWiki.resx +++ /dev/null @@ -1,133 +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 - - - - ..\Resources\RazorWiki\default.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\RazorWiki\index.md;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\RazorWiki\layout.cshtml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\RazorWiki\style.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - \ No newline at end of file diff --git a/src/Pretzel.Logic/Properties/Resources.Designer.cs b/src/Pretzel.Logic/Properties/Resources.Designer.cs deleted file mode 100644 index c6ae5950e..000000000 --- a/src/Pretzel.Logic/Properties/Resources.Designer.cs +++ /dev/null @@ -1,111 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Pretzel.Logic.Properties { - 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", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// 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("Pretzel.Logic.Properties.Resources", typeof(Resources).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 body - ///{ - /// font-family: Segoe UI, sans-serif; - /// margin-left:auto; - /// margin-right: auto; - /// width:1100px; - ///} - ///h1,h2,h3,h4,h5,h6 - ///{ - /// font-family: Segoe UI Light, Segoe WP Light, Segoe UI, Helvetica, sans-serif; - /// font-weight: lighter; - /// margin-bottom:0px; - ///} - ///h1 - ///{ - /// font-size: 4em; - ///} - ///h2 - ///{ - /// font-size: 2.5em; - ///} - ///a, a:visited - ///{ - /// text-decoration: none; - /// color:#13678b; - ///} - ///a:hover - ///{ - /// color:white; - /// background: #13678b - ///} - ///ul - ///{ - /// margin:0; - /// padding:0; - ///} - ///li - ///{ - /// margin:0; - /// padd [rest of string was truncated]";. - /// - internal static string Style { - get { - return ResourceManager.GetString("Style", resourceCulture); - } - } - } -} diff --git a/src/Pretzel.Logic/Properties/Resources.resx b/src/Pretzel.Logic/Properties/Resources.resx deleted file mode 100644 index 914bac110..000000000 --- a/src/Pretzel.Logic/Properties/Resources.resx +++ /dev/null @@ -1,124 +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 - - - - ..\Resources\Style.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/Pretzel.Logic/Recipes/Recipe.cs b/src/Pretzel.Logic/Recipes/Recipe.cs index 45110d55e..fc0769062 100644 --- a/src/Pretzel.Logic/Recipes/Recipe.cs +++ b/src/Pretzel.Logic/Recipes/Recipe.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Drawing.Imaging; using System.IO; using System.IO.Abstractions; -using System.Reflection; using Pretzel.Logic.Extensibility; using Pretzel.Logic.Extensions; @@ -43,26 +41,26 @@ public void Create() if (wiki) { - fileSystem.File.WriteAllText(Path.Combine(directory, @"_layouts", "layout.cshtml"), Properties.RazorWiki.Layout); - fileSystem.File.WriteAllText(Path.Combine(directory, @"index.md"), Properties.RazorWiki.Index); - fileSystem.File.WriteAllText(Path.Combine(directory, @"css", "style.css"), Properties.RazorWiki.Style); - fileSystem.File.WriteAllText(Path.Combine(directory, @"css", "default.css"), Properties.RazorWiki.DefaultStyle); - fileSystem.File.WriteAllText(Path.Combine(directory, @"_config.yml"), Properties.Razor.Config); + CreateFile(@"Resources\RazorWiki\layout.cshtml", directory, @"_layouts", "layout.cshtml"); + CreateFile(@"Resources\RazorWiki\index.md", directory, "index.md"); + CreateFile(@"Resources\RazorWiki\style.css", directory, @"css", "style.css"); + CreateFile(@"Resources\RazorWiki\default.css", directory, @"css", "default.css"); + CreateFile(@"Resources\Razor\Config.cshtml", directory, "_config.yml"); CreateFavicon(); } else { - fileSystem.File.WriteAllText(Path.Combine(directory, @"rss.xml"), Properties.Razor.Rss); - fileSystem.File.WriteAllText(Path.Combine(directory, @"atom.xml"), Properties.Razor.Atom); - fileSystem.File.WriteAllText(Path.Combine(directory, @"sitemap.xml"), Properties.Razor.Sitemap); - fileSystem.File.WriteAllText(Path.Combine(directory, @"_layouts", "layout.cshtml"), Properties.Razor.Layout); - fileSystem.File.WriteAllText(Path.Combine(directory, @"_layouts", "post.cshtml"), Properties.Razor.Post); - fileSystem.File.WriteAllText(Path.Combine(directory, @"index.cshtml"), Properties.Razor.Index); - fileSystem.File.WriteAllText(Path.Combine(directory, @"about.md"), Properties.Razor.About); - fileSystem.File.WriteAllText(Path.Combine(directory, @"_posts", string.Format("{0}-myfirstpost.md", DateTime.Today.ToString("yyyy-MM-dd"))), Properties.Razor.FirstPost); - fileSystem.File.WriteAllText(Path.Combine(directory, @"css", "style.css"), Properties.Resources.Style); - fileSystem.File.WriteAllText(Path.Combine(directory, @"_config.yml"), Properties.Razor.Config); - fileSystem.File.WriteAllText(Path.Combine(directory, @"_includes", "head.cshtml"), Properties.Razor.Head); + CreateFile(@"Resources\Razor\Rss.cshtml", directory, @"rss.xml"); + CreateFile(@"Resources\Razor\Atom.cshtml", directory, @"atom.xml"); + CreateFile(@"Resources\Razor\Sitemap.cshtml", directory, @"sitemap.xml"); + CreateFile(@"Resources\Razor\Layout.cshtml", directory, @"_layouts", "layout.cshtml"); + CreateFile(@"Resources\Razor\Post.cshtml", directory, @"_layouts", "post.cshtml"); + CreateFile(@"Resources\Razor\Index.cshtml", directory, "index.cshtml"); + CreateFile(@"Resources\Razor\About.cshtml", directory, "about.md"); + fileSystem.File.WriteAllText(Path.Combine(directory, @"_posts", string.Format("{0}-myfirstpost.md", DateTime.Today.ToString("yyyy-MM-dd"))), GetResourceString(@"Resources\Razor\FirstPost.cshtml")); + CreateFile(@"Resources\Style.css", directory, @"css", "style.css"); + CreateFile(@"Resources\Razor\Config.cshtml", directory, "_config.yml"); + CreateFile(@"Resources\Razor\Head.cshtml", directory, @"_includes", "head.cshtml"); CreateImages(); } @@ -80,16 +78,14 @@ public void Create() CreateFile(@"Resources\Liquid\Rss.liquid", directory, @"rss.xml"); CreateFile(@"Resources\Liquid\Atom.liquid", directory, @"atom.xml"); CreateFile(@"Resources\Liquid\Sitemap.liquid", directory, @"sitemap.xml"); - CreateFile(@"Resources\Liquid\Config.liquid", directory, @"_config.yml"); - CreateFile(@"Resources\Liquid\Head.liquid", directory, @"_includes", "head.html"); - CreateFile(@"Resources\Liquid\Layout.liquid", directory, @"_layouts", "layout.html"); CreateFile(@"Resources\Liquid\Post.liquid", directory, @"_layouts", "post.html"); - + CreateFile(@"Resources\Liquid\Index.liquid", directory, @"index.html"); CreateFile(@"Resources\Liquid\About.liquid", directory, @"about.md"); - CreateFile(@"Resources\Style.css", directory, @"style.css"); - fileSystem.File.WriteAllText(Path.Combine(directory, @"_posts", string.Format("{0}-myfirstpost.md", DateTime.Today.ToString("yyyy-MM-dd"))), GetResourceString(@"Resources\Liquid\FirstPost.liquid")); + CreateFile(@"Resources\Style.css", directory, @"css", "style.css"); + CreateFile(@"Resources\Liquid\Config.liquid", directory, @"_config.yml"); + CreateFile(@"Resources\Liquid\Head.liquid", directory, @"_includes", "head.html"); CreateImages(); @@ -119,22 +115,21 @@ private void CreateProject() fileSystem.Directory.CreateDirectory(Path.Combine(layoutDirectory, @"PretzelClasses")); fileSystem.Directory.CreateDirectory(Path.Combine(layoutDirectory, @".nuget")); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"Properties", "AssemblyInfo.cs"), Properties.RazorCsProject.AssemblyInfo_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"PretzelClasses", "Category.cs"), Properties.RazorCsProject.Category_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"LayoutProject.csproj"), Properties.RazorCsProject.LayoutProject_csproj); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"layoutSolution.sln"), Properties.RazorCsProject.LayoutSolution_sln); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"PretzelClasses", "NonProcessedPage.cs"), Properties.RazorCsProject.NonProcessedPage_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @".nuget", "NuGet.config"), Properties.RazorCsProject.NuGet_Config); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @".nuget", "NuGet.exe"), Properties.RazorCsProject.NuGet_exe); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @".nuget", "NuGet.targets"), Properties.RazorCsProject.NuGet_targets); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"PretzelClasses", "PageContext.cs"), Properties.RazorCsProject.PageContext_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"PretzelClasses", "Page.cs"), Properties.RazorCsProject.Page_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"PretzelClasses", "Paginator.cs"), Properties.RazorCsProject.Paginator_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"PretzelClasses", "SiteContext.cs"), Properties.RazorCsProject.SiteContext_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"PretzelClasses", "Tag.cs"), Properties.RazorCsProject.Tag_cs); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"web.config"), Properties.RazorCsProject.Web_config); - fileSystem.File.WriteAllBytes(Path.Combine(layoutDirectory, @"packages.config"), - Properties.RazorCsProject.packages_config); + CreateFile(@"Resources\RazorCsProject\AssemblyInfo_cs", layoutDirectory, @"Properties", "AssemblyInfo.cs"); + CreateFile(@"Resources\RazorCsProject\Category_cs", layoutDirectory, @"PretzelClasses", "Category.cs"); + CreateFile(@"Resources\RazorCsProject\LayoutProject_csproj", layoutDirectory, "LayoutProject.csproj"); + CreateFile(@"Resources\RazorCsProject\LayoutSolution_sln", layoutDirectory, "layoutSolution.sln"); + CreateFile(@"Resources\RazorCsProject\NonProcessedPage_cs", layoutDirectory, @"PretzelClasses", "NonProcessedPage.cs"); + CreateFile(@"Resources\RazorCsProject\NuGet_Config", layoutDirectory, @".nuget", "NuGet.config"); + CreateFile(@"Resources\RazorCsProject\NuGet_exe", layoutDirectory, @".nuget", "NuGet.exe"); + CreateFile(@"Resources\RazorCsProject\NuGet_targets", layoutDirectory, @".nuget", "NuGet.targets"); + CreateFile(@"Resources\RazorCsProject\PageContext_cs", layoutDirectory, @"PretzelClasses", "PageContext.cs"); + CreateFile(@"Resources\RazorCsProject\Page_cs", layoutDirectory, @"PretzelClasses", "Page.cs"); + CreateFile(@"Resources\RazorCsProject\Paginator_cs", layoutDirectory, @"PretzelClasses", "Paginator.cs"); + CreateFile(@"Resources\RazorCsProject\SiteContext_cs", layoutDirectory, @"PretzelClasses", "SiteContext.cs"); + CreateFile(@"Resources\RazorCsProject\Tag_cs", layoutDirectory, @"PretzelClasses", "Tag.cs"); + CreateFile(@"Resources\RazorCsProject\Web_config", layoutDirectory, "web.config"); + CreateFile(@"Resources\RazorCsProject\packages_config", layoutDirectory, "packages.config"); } private void CreateImages() @@ -161,11 +156,21 @@ private void CreateFile(string resourceName, params string[] pathSegments) } } + internal static void CreateFile(Type type, IFileSystem fileSystem, string resourceName, params string[] pathSegments) + { + using (var ms = new MemoryStream()) + using (var resourceStream = GetResourceStream(type, resourceName)) + { + resourceStream.CopyTo(ms); + fileSystem.File.WriteAllBytes(Path.Combine(pathSegments), ms.ToArray()); + } + } + //https://github.com/dotnet/corefx/issues/12565 - private Stream GetResourceStream(string path) + private static Stream GetResourceStream(Type type, string path) { - var assembly = GetType().Assembly; - var name = GetType().Assembly.GetName().Name; + var assembly = type.Assembly; + var name = type.Assembly.GetName().Name; path = path.Replace("/", ".").Replace("\\", "."); @@ -175,6 +180,9 @@ private Stream GetResourceStream(string path) return stream; } + private Stream GetResourceStream(string path) + => GetResourceStream(GetType(), path); + private string GetResourceString(string path) { using (var stream = GetResourceStream(path))