The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

PasteAreaRegistration.cs 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System.Collections.Generic;
  2. using System.Web.Mvc;
  3. using System.Web.Optimization;
  4. using Teknik.Configuration;
  5. namespace Teknik.Areas.Paste
  6. {
  7. public class PasteAreaRegistration : AreaRegistration
  8. {
  9. public override string AreaName
  10. {
  11. get
  12. {
  13. return "Paste";
  14. }
  15. }
  16. public override void RegisterArea(AreaRegistrationContext context)
  17. {
  18. Config config = Config.Load();
  19. context.MapSubdomainRoute(
  20. "Paste.Index", // Route name
  21. new List<string>() { "paste", "p" },
  22. new List<string>() { config.Host }, // domains
  23. "", // URL with parameters
  24. new { controller = "Paste", action = "Index" }, // Parameter defaults
  25. new[] { typeof(Controllers.PasteController).Namespace }
  26. );
  27. context.MapSubdomainRoute(
  28. "Paste.Simple", // Route name
  29. new List<string>() { "paste", "p" },
  30. new List<string>() { config.Host }, // domains
  31. "Simple/{url}/{password}", // URL with parameters
  32. new { controller = "Paste", action = "ViewPaste", type = "Simple", password = UrlParameter.Optional }, // Parameter defaults
  33. new[] { typeof(Controllers.PasteController).Namespace }
  34. );
  35. context.MapSubdomainRoute(
  36. "Paste.Raw", // Route name
  37. new List<string>() { "paste", "p" },
  38. new List<string>() { config.Host }, // domains
  39. "Raw/{url}/{password}", // URL with parameters
  40. new { controller = "Paste", action = "ViewPaste", type = "Raw", password = UrlParameter.Optional }, // Parameter defaults
  41. new[] { typeof(Controllers.PasteController).Namespace }
  42. );
  43. context.MapSubdomainRoute(
  44. "Paste.Download", // Route name
  45. new List<string>() { "paste", "p" },
  46. new List<string>() { config.Host }, // domains
  47. "Download/{url}/{password}", // URL with parameters
  48. new { controller = "Paste", action = "ViewPaste", type = "Download", password = UrlParameter.Optional }, // Parameter defaults
  49. new[] { typeof(Controllers.PasteController).Namespace }
  50. );
  51. context.MapSubdomainRoute(
  52. "Paste.Action", // Route name
  53. new List<string>() { "paste", "p" },
  54. new List<string>() { config.Host }, // domains
  55. "Action/{action}", // URL with parameters
  56. new { controller = "Paste", action = "Index" }, // Parameter defaults
  57. new[] { typeof(Controllers.PasteController).Namespace }
  58. );
  59. context.MapSubdomainRoute(
  60. "Paste.View", // Route name
  61. new List<string>() { "paste", "p" },
  62. new List<string>() { config.Host }, // domains
  63. "{url}/{password}", // URL with parameters
  64. new { controller = "Paste", action = "ViewPaste", type = "Full", password = UrlParameter.Optional }, // Parameter defaults
  65. new[] { typeof(Controllers.PasteController).Namespace }
  66. );
  67. // Register Script Bundles
  68. BundleTable.Bundles.Add(new ScriptBundle("~/bundles/paste").Include(
  69. "~/Scripts/Highlight/highlight.pack.js",
  70. "~/Areas/Paste/Scripts/Paste.js"));
  71. BundleTable.Bundles.Add(new ScriptBundle("~/bundles/syntaxWorker").Include(
  72. "~/Areas/Paste/Scripts/SyntaxWorker.js"));
  73. BundleTable.Bundles.Add(new ScriptBundle("~/bundles/highlight").Include(
  74. "~/Scripts/Highlight/highlight.pack.js"));
  75. // Register Style Bundles
  76. BundleTable.Bundles.Add(new StyleBundle("~/Content/paste").Include(
  77. "~/Content/Highlight/github-gist.css",
  78. "~/Areas/Paste/Content/Paste.css"));
  79. }
  80. }
  81. }