The next generation of the Teknik Services. Written in ASP.NET. Fork for blog tags.
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.

PasteAreaRegistration.cs 4.4KB

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