You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB

4 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Reflection;
  4. using System.Text;
  5. namespace Apewer.Web
  6. {
  7. /// <summary>程序集资源。</summary>
  8. public static class Resources
  9. {
  10. static byte[] Bytes(string name)
  11. {
  12. var assembly = Assembly.GetExecutingAssembly();
  13. using (var stream = assembly.GetManifestResourceStream(name)) return stream.Read();
  14. }
  15. static string Text(string name) => BytesUtility.WipeTextBom(Bytes(name)).Text();
  16. /// <summary>获取预置的 favicon.ico 文件,。</summary>
  17. public static byte[] FavIcon() => Bytes("Apewer.FavIcon.ico");
  18. /// <summary>获取用于 .NET Framework 4.0 的 web.config 文件。</summary>
  19. public static string WebConfig40() => Text("Apewer.WebConfig40.xml");
  20. /// <summary>获取用于 .NET Framework 4.6.1 的 web.config 文件。</summary>
  21. public static string WebConfig461(bool netstandard = false) => Text(netstandard ? "Apewer.WebConfigStd.xml" : "Apewer.WebConfig461.xml");
  22. }
  23. }