using Sarand.Net.Standard.Base.Helpers; using Sarand.Net.Standard.Base.Utils; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace Saxonite.Net.Core.Web.Base.Helpers { //======================================================================= public static class SaxResourceHelper_Web { //------------------------------------------------------------------- // Definitions. //------------------------------------------------------------------- // Properties. public static Assembly MyAssembly { get; } = typeof(SaxResourceHelper_Web).GetTypeInfo().Assembly; //------------------------------------------------------------------- // Text resources. /// Retrieve contents of text resource in this assembly by name. public static String GetResourceText(String resourceFilename, String partialPath = "") { if (!StringUtil.IsBlank(resourceFilename)) { String resourceText = SacsResourceHelper.GetManifestResourceAsText(MyAssembly, partialPath, resourceFilename); if (!StringUtil.IsBlank(resourceText)) return resourceText; } return ""; } //------------------------------------------------------------------- // Resource stream. /// /// Retrieve stream to resource in this assembly. /// public static Stream GetResourceStream(String resourceFilename, String partialPath = "") { if (!StringUtil.IsBlank(resourceFilename)) { return SacsResourceHelper.GetManifestResourceStream(MyAssembly, partialPath, resourceFilename); } return null; } //------------------------------------------------------------------- } //======================================================================= }