Permalink
Browse files

no message

  • Loading branch information...
1 parent 9dfef4b commit 6ea87d5eef627297df43f2e76027b90b2c7a30aa @neuecc committed Jul 27, 2016
Showing with 50,296 additions and 1 deletion.
  1. +22 −1 LightNode.sln
  2. +64 −0 Source/LightNode2/Diagnostics/ILightNodeLogger.cs
  3. +21 −0 Source/LightNode2/Formatter/IContentFormatter.cs
  4. +118 −0 Source/LightNode2/Formatter/JsonContentFormatter.cs
  5. +148 −0 Source/LightNode2/Formatter/StandardContentFormatters.cs
  6. +19 −0 Source/LightNode2/LightNode2.xproj
  7. +19 −0 Source/LightNode2/Properties/AssemblyInfo.cs
  8. +14 −0 Source/LightNode2/Server/DebugOnlyClientGenerateAttribute.cs
  9. +14 −0 Source/LightNode2/Server/DefineTypeScriptGenerateAttribute.cs
  10. +14 −0 Source/LightNode2/Server/IgnoreClientGenerateAttribute.cs
  11. +14 −0 Source/LightNode2/Server/IgnoreOperationAttribute.cs
  12. +14 −0 Source/LightNode2/Server/LightNodeContract.cs
  13. +62 −0 Source/LightNode2/Server/LightNodeFilterAttribute.cs
  14. +181 −0 Source/LightNode2/Server/LightNodeOptions.cs
  15. +330 −0 Source/LightNode2/Server/LightNodeServer.cs
  16. +97 −0 Source/LightNode2/Server/LightNodeServerMiddleware.cs
  17. +68 −0 Source/LightNode2/Server/OperationContext.cs
  18. +59 −0 Source/LightNode2/Server/OperationCoordinator.cs
  19. +479 −0 Source/LightNode2/Server/OperationHandler.cs
  20. +99 −0 Source/LightNode2/Server/OperationOptionAttribute.cs
  21. +108 −0 Source/LightNode2/Server/ParameterBinder.cs
  22. +47 −0 Source/LightNode2/Server/RequestPath.cs
  23. +69 −0 Source/LightNode2/Server/ReturnStatusCodeException.cs
  24. +302 −0 Source/LightNode2/Server/TypeBinder.cs
  25. +60 −0 Source/LightNode2/Server/Utility/HttpContextHelper.cs
  26. +344 −0 Source/LightNode2/Server/Utility/MetaEnum.cs
  27. +53 −0 Source/LightNode2/Server/Utility/TypeHelper.cs
  28. +169 −0 Source/LightNode2/Server/Utility/UnclosableStream.cs
  29. +17 −0 Source/LightNode2/Server/Utility/Utils.cs
  30. +85 −0 Source/LightNode2/Server/ValueProvider.cs
  31. +378 −0 Source/LightNode2/Swagger/LightNodeSwaggerMiddleware.cs
  32. +137 −0 Source/LightNode2/Swagger/Schema/SwaggerDocument.cs
  33. +29 −0 Source/LightNode2/Swagger/SwaggerOptions.cs
  34. +1,362 −0 Source/LightNode2/Swagger/SwaggerUI/css/print.css
  35. +125 −0 Source/LightNode2/Swagger/SwaggerUI/css/reset.css
  36. +1,489 −0 Source/LightNode2/Swagger/SwaggerUI/css/screen.css
  37. +250 −0 Source/LightNode2/Swagger/SwaggerUI/css/style.css
  38. +14 −0 Source/LightNode2/Swagger/SwaggerUI/css/typography.css
  39. BIN Source/LightNode2/Swagger/SwaggerUI/fonts/DroidSans-Bold.ttf
  40. BIN Source/LightNode2/Swagger/SwaggerUI/fonts/DroidSans.ttf
  41. BIN Source/LightNode2/Swagger/SwaggerUI/images/collapse.gif
  42. BIN Source/LightNode2/Swagger/SwaggerUI/images/expand.gif
  43. BIN Source/LightNode2/Swagger/SwaggerUI/images/explorer_icons.png
  44. BIN Source/LightNode2/Swagger/SwaggerUI/images/favicon-16x16.png
  45. BIN Source/LightNode2/Swagger/SwaggerUI/images/favicon-32x32.png
  46. BIN Source/LightNode2/Swagger/SwaggerUI/images/favicon.ico
  47. BIN Source/LightNode2/Swagger/SwaggerUI/images/logo_small.png
  48. BIN Source/LightNode2/Swagger/SwaggerUI/images/pet_store_api.png
  49. BIN Source/LightNode2/Swagger/SwaggerUI/images/throbber.gif
  50. BIN Source/LightNode2/Swagger/SwaggerUI/images/wordnik_api.png
  51. +107 −0 Source/LightNode2/Swagger/SwaggerUI/index.html
  52. +56 −0 Source/LightNode2/Swagger/SwaggerUI/lang/en.js
  53. +53 −0 Source/LightNode2/Swagger/SwaggerUI/lang/es.js
  54. +54 −0 Source/LightNode2/Swagger/SwaggerUI/lang/fr.js
  55. +56 −0 Source/LightNode2/Swagger/SwaggerUI/lang/geo.js
  56. +52 −0 Source/LightNode2/Swagger/SwaggerUI/lang/it.js
  57. +53 −0 Source/LightNode2/Swagger/SwaggerUI/lang/ja.js
  58. +53 −0 Source/LightNode2/Swagger/SwaggerUI/lang/ko-kr.js
  59. +53 −0 Source/LightNode2/Swagger/SwaggerUI/lang/pl.js
  60. +53 −0 Source/LightNode2/Swagger/SwaggerUI/lang/pt.js
  61. +56 −0 Source/LightNode2/Swagger/SwaggerUI/lang/ru.js
  62. +53 −0 Source/LightNode2/Swagger/SwaggerUI/lang/tr.js
  63. +39 −0 Source/LightNode2/Swagger/SwaggerUI/lang/translator.js
  64. +53 −0 Source/LightNode2/Swagger/SwaggerUI/lang/zh-cn.js
  65. +15 −0 Source/LightNode2/Swagger/SwaggerUI/lib/backbone-min.js
  66. +2,065 −0 Source/LightNode2/Swagger/SwaggerUI/lib/es5-shim.js
  67. +28 −0 Source/LightNode2/Swagger/SwaggerUI/lib/handlebars-2.0.0.js
  68. +2 −0 Source/LightNode2/Swagger/SwaggerUI/lib/highlight.9.1.0.pack.js
  69. +34 −0 Source/LightNode2/Swagger/SwaggerUI/lib/highlight.9.1.0.pack_extended.js
  70. +2 −0 Source/LightNode2/Swagger/SwaggerUI/lib/jquery-1.8.0.min.js
  71. +18 −0 Source/LightNode2/Swagger/SwaggerUI/lib/jquery.ba-bbq.min.js
  72. +1 −0 Source/LightNode2/Swagger/SwaggerUI/lib/jquery.slideto.min.js
  73. +8 −0 Source/LightNode2/Swagger/SwaggerUI/lib/jquery.wiggle.min.js
  74. +3 −0 Source/LightNode2/Swagger/SwaggerUI/lib/js-yaml.min.js
  75. +11 −0 Source/LightNode2/Swagger/SwaggerUI/lib/jsoneditor.min.js
  76. +102 −0 Source/LightNode2/Swagger/SwaggerUI/lib/lodash.min.js
  77. +1,272 −0 Source/LightNode2/Swagger/SwaggerUI/lib/marked.js
  78. +23 −0 Source/LightNode2/Swagger/SwaggerUI/lib/object-assign-pollyfill.js
  79. +347 −0 Source/LightNode2/Swagger/SwaggerUI/lib/swagger-oauth.js
  80. +20 −0 Source/LightNode2/Swagger/SwaggerUI/o2c.html
  81. +24,603 −0 Source/LightNode2/Swagger/SwaggerUI/swagger-ui.js
  82. +10 −0 Source/LightNode2/Swagger/SwaggerUI/swagger-ui.min.js
  83. +24 −0 Source/LightNode2/project.json
  84. +4,788 −0 Source/LightNode2/project.lock.json
  85. +24 −0 WebApplicationCore1/Program.cs
  86. +187 −0 WebApplicationCore1/Project_Readme.html
  87. +27 −0 WebApplicationCore1/Properties/launchSettings.json
  88. +84 −0 WebApplicationCore1/Startup.cs
  89. +25 −0 WebApplicationCore1/WebApplicationCore1.xproj
  90. +53 −0 WebApplicationCore1/project.json
  91. +8,818 −0 WebApplicationCore1/project.lock.json
  92. +14 −0 WebApplicationCore1/web.config
  93. +3 −0 global.json
View
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.22823.1
+VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1D780B80-C034-4AF9-8A47-3C4C3708E198}"
ProjectSection(SolutionItems) = preProject
@@ -93,6 +93,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LightNode.Client.AngularJS.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LightNode.Sample.Server.ForAngularClient", "Sample\LightNode.Sample.Server.ForAngularClient\LightNode.Sample.Server.ForAngularClient.csproj", "{0134B165-ACB4-4051-A7A3-FD9DF4C88B20}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".NET Core", ".NET Core", "{04B4FBC7-68FF-4FD3-ADF0-A037BF260C19}"
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LightNode2", "Source\LightNode2\LightNode2.xproj", "{AAFA9D36-DB57-4CA2-9137-05CC4B9EC4D1}"
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplicationCore1", "WebApplicationCore1\WebApplicationCore1.xproj", "{0EA8F2C9-A92C-4EE3-B43B-9A96498B6800}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2E1B3D87-7088-484B-A8DA-C7C10A07D94F}"
+ ProjectSection(SolutionItems) = preProject
+ global.json = global.json
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -215,6 +226,14 @@ Global
{0134B165-ACB4-4051-A7A3-FD9DF4C88B20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0134B165-ACB4-4051-A7A3-FD9DF4C88B20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0134B165-ACB4-4051-A7A3-FD9DF4C88B20}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AAFA9D36-DB57-4CA2-9137-05CC4B9EC4D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAFA9D36-DB57-4CA2-9137-05CC4B9EC4D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AAFA9D36-DB57-4CA2-9137-05CC4B9EC4D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AAFA9D36-DB57-4CA2-9137-05CC4B9EC4D1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0EA8F2C9-A92C-4EE3-B43B-9A96498B6800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0EA8F2C9-A92C-4EE3-B43B-9A96498B6800}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0EA8F2C9-A92C-4EE3-B43B-9A96498B6800}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0EA8F2C9-A92C-4EE3-B43B-9A96498B6800}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -235,5 +254,7 @@ Global
{9E4C02D4-BFC8-48F5-BAE8-5AD88B384961} = {7632038A-C89C-4EF9-B4FF-BEF11F02F9F4}
{4B0914D8-6360-487E-8EB4-89CC1DB112F6} = {05E4C673-1F12-449D-A3A4-F7C6FFD91701}
{0134B165-ACB4-4051-A7A3-FD9DF4C88B20} = {05E4C673-1F12-449D-A3A4-F7C6FFD91701}
+ {AAFA9D36-DB57-4CA2-9137-05CC4B9EC4D1} = {04B4FBC7-68FF-4FD3-ADF0-A037BF260C19}
+ {0EA8F2C9-A92C-4EE3-B43B-9A96498B6800} = {04B4FBC7-68FF-4FD3-ADF0-A037BF260C19}
EndGlobalSection
EndGlobal
@@ -0,0 +1,64 @@
+using System;
+using LightNode.Server;
+
+namespace LightNode.Diagnostics
+{
+ public interface ILightNodeLogger
+ {
+ void ExecuteFinished(string path, bool interrupted, double elapsed);
+ void ExecuteStart(string path);
+ void InitializeComplete(double elapsed);
+ void MethodNotAllowed(OperationMissingKind kind, string path, string method);
+ void NegotiateFormatFailed(OperationMissingKind kind, string ext);
+ void OperationNotFound(OperationMissingKind kind, string path);
+ void ParameterBindMissing(OperationMissingKind kind, string parameterName);
+ void ProcessRequestStart(string path);
+ void RegisiterOperation(string className, string methodName, double elapsed);
+ }
+
+ internal class NullLightNodeLogger : ILightNodeLogger
+ {
+ internal static readonly ILightNodeLogger Instance = new NullLightNodeLogger();
+
+ NullLightNodeLogger()
+ {
+
+ }
+
+ public void ExecuteFinished(string path, bool interrupted, double elapsed)
+ {
+ }
+
+ public void ExecuteStart(string path)
+ {
+ }
+
+ public void InitializeComplete(double elapsed)
+ {
+ }
+
+ public void MethodNotAllowed(OperationMissingKind kind, string path, string method)
+ {
+ }
+
+ public void NegotiateFormatFailed(OperationMissingKind kind, string ext)
+ {
+ }
+
+ public void OperationNotFound(OperationMissingKind kind, string path)
+ {
+ }
+
+ public void ParameterBindMissing(OperationMissingKind kind, string parameterName)
+ {
+ }
+
+ public void ProcessRequestStart(string path)
+ {
+ }
+
+ public void RegisiterOperation(string className, string methodName, double elapsed)
+ {
+ }
+ }
+}
@@ -0,0 +1,21 @@
+using System;
+using System.IO;
+using System.Text;
+
+namespace LightNode.Core
+{
+ public interface IContentFormatter
+ {
+ string MediaType { get; }
+ string ContentEncoding { get; }
+ string Ext { get; }
+ Encoding Encoding { get; }
+ void Serialize(Stream stream, object obj);
+ object Deserialize(Type type, Stream stream);
+ }
+
+ public interface IContentFormatterFactory
+ {
+ IContentFormatter CreateFormatter();
+ }
+}
@@ -0,0 +1,118 @@
+using LightNode.Core;
+using Newtonsoft.Json;
+using System;
+using System.IO;
+using System.Text;
+
+namespace LightNode.Formatter
+{
+ public class JsonContentFormatter : LightNode.Formatter.ContentFormatterBase
+ {
+ readonly JsonSerializer serializer;
+
+ public JsonContentFormatter(string mediaType = "application/json", string ext = "json")
+ : this(new JsonSerializer(), mediaType, ext)
+ {
+ }
+
+ public JsonContentFormatter(JsonSerializer serializer, string mediaType = "application/json", string ext = "json")
+ : this(serializer, new UTF8Encoding(false), mediaType, ext)
+ {
+ }
+
+ public JsonContentFormatter(Encoding encoding, string mediaType = "application/json", string ext = "json")
+ : this(new JsonSerializer(), encoding, mediaType, ext)
+ {
+ }
+
+ public JsonContentFormatter(JsonSerializer serializer, Encoding encoding, string mediaType = "application/json", string ext = "json")
+ : base(mediaType, ext, encoding)
+ {
+ this.serializer = serializer;
+ }
+
+ public override void Serialize(System.IO.Stream stream, object obj)
+ {
+ using (var sw = new StreamWriter(stream, Encoding ?? new UTF8Encoding(false)))
+ {
+ serializer.Serialize(sw, obj);
+ }
+ }
+
+ public override object Deserialize(Type type, System.IO.Stream stream)
+ {
+ using (var sr = new StreamReader(stream, Encoding ?? new UTF8Encoding(false)))
+ {
+ return serializer.Deserialize(sr, type);
+ }
+ }
+ }
+
+ public class JsonContentFormatterFactory : IContentFormatterFactory
+ {
+ public IContentFormatter CreateFormatter()
+ {
+ return new JsonContentFormatter();
+ }
+ }
+
+ public class GZipJsonContentFormatter : LightNode.Formatter.ContentFormatterBase
+ {
+ readonly JsonSerializer serializer;
+
+ public override string ContentEncoding
+ {
+ get
+ {
+ return "gzip";
+ }
+ }
+
+ public GZipJsonContentFormatter(string mediaType = "application/json", string ext = "json")
+ : this(new JsonSerializer(), mediaType, ext)
+ {
+ }
+
+ public GZipJsonContentFormatter(JsonSerializer serializer, string mediaType = "application/json", string ext = "json")
+ : this(serializer, new UTF8Encoding(false), mediaType, ext)
+ {
+ }
+
+ public GZipJsonContentFormatter(Encoding encoding, string mediaType = "application/json", string ext = "json")
+ : this(new JsonSerializer(), encoding, mediaType, ext)
+ {
+ }
+
+ public GZipJsonContentFormatter(JsonSerializer serializer, Encoding encoding, string mediaType = "application/json", string ext = "json")
+ : base(mediaType, ext, encoding)
+ {
+ this.serializer = serializer;
+ }
+
+ public override void Serialize(System.IO.Stream stream, object obj)
+ {
+ using (var gzip = new System.IO.Compression.GZipStream(stream, System.IO.Compression.CompressionLevel.Fastest))
+ using (var sw = new StreamWriter(gzip, Encoding ?? new UTF8Encoding(false)))
+ {
+ serializer.Serialize(sw, obj);
+ }
+ }
+
+ public override object Deserialize(Type type, System.IO.Stream stream)
+ {
+ using (var gzip = new System.IO.Compression.GZipStream(stream, System.IO.Compression.CompressionMode.Decompress))
+ using (var sr = new StreamReader(gzip, Encoding ?? new UTF8Encoding(false)))
+ {
+ return serializer.Deserialize(sr, type);
+ }
+ }
+ }
+
+ public class GZipJsonContentFormatterFactory : IContentFormatterFactory
+ {
+ public IContentFormatter CreateFormatter()
+ {
+ return new GZipJsonContentFormatter();
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit 6ea87d5

Please sign in to comment.