Bumped package version to 1.6.1 and added helper GetValue function to Javascript and improved the documentation.
This commit is contained in:
parent
52a6db9e1a
commit
9367ba0ff5
@ -72,7 +72,7 @@ namespace MontoyaTech.Rest.Net.Example
|
|||||||
{
|
{
|
||||||
File.WriteAllText("test.txt", "hello from a file");
|
File.WriteAllText("test.txt", "hello from a file");
|
||||||
|
|
||||||
var listener = new RouteListener(8080,
|
var listener = new RouteListener(8088,
|
||||||
new Route(HttpRequestMethod.Get, "/status", Status),
|
new Route(HttpRequestMethod.Get, "/status", Status),
|
||||||
new Route<double, double>(HttpRequestMethod.Post, "/add/{a}/{b}", Add),
|
new Route<double, double>(HttpRequestMethod.Post, "/add/{a}/{b}", Add),
|
||||||
new Route(HttpRequestMethod.Get, "/compress", Compress),
|
new Route(HttpRequestMethod.Get, "/compress", Compress),
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
|
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
|
||||||
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
<Version>1.6.0</Version>
|
<Version>1.6.1</Version>
|
||||||
<PackageReleaseNotes></PackageReleaseNotes>
|
<PackageReleaseNotes></PackageReleaseNotes>
|
||||||
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
|
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -302,8 +302,8 @@ namespace MontoyaTech.Rest.Net
|
|||||||
writer.WriteBreak().WriteLine("/**").Indent();
|
writer.WriteBreak().WriteLine("/**").Indent();
|
||||||
writer.WriteLine("Returns the name of a value in this enum. Returns null if the value is invalid.");
|
writer.WriteLine("Returns the name of a value in this enum. Returns null if the value is invalid.");
|
||||||
writer.WriteLine("@function");
|
writer.WriteLine("@function");
|
||||||
writer.WriteLine("@param {number} value");
|
writer.WriteLine("@param {number} value The value to get the name of in this enum.");
|
||||||
writer.WriteLine("@returns {string}");
|
writer.WriteLine("@returns {string} The name for the given value.");
|
||||||
writer.Outdent().WriteLine("*/");
|
writer.Outdent().WriteLine("*/");
|
||||||
writer.WriteLine("static GetName(value) {").Indent();
|
writer.WriteLine("static GetName(value) {").Indent();
|
||||||
writer.WriteLine("switch (value) {").Indent();
|
writer.WriteLine("switch (value) {").Indent();
|
||||||
@ -315,9 +315,29 @@ namespace MontoyaTech.Rest.Net
|
|||||||
writer.WriteLine("return null;");
|
writer.WriteLine("return null;");
|
||||||
writer.Outdent().WriteLine("}");
|
writer.Outdent().WriteLine("}");
|
||||||
|
|
||||||
|
//GetValue function
|
||||||
|
writer.WriteBreak().WriteLine("/**").Indent();
|
||||||
|
writer.WriteLine("Returns the value for a name in this enum. Returns null if the name is invalid.");
|
||||||
|
writer.WriteLine("@function");
|
||||||
|
writer.WriteLine("@param {string} name The name of the item in this enum to get the value of.");
|
||||||
|
writer.WriteLine("@returns {number} The value associated with this name in this enum.");
|
||||||
|
writer.Outdent().WriteLine("*/");
|
||||||
|
writer.WriteLine("static GetValue(name) {").Indent();
|
||||||
|
writer.WriteLine("if (!name) {").Indent();
|
||||||
|
writer.WriteLine("return null;");
|
||||||
|
writer.Outdent().WriteLine("}");
|
||||||
|
writer.WriteLine("switch (name.toLowerCase().trim()) {").Indent();
|
||||||
|
|
||||||
|
for (int i = 0; i < names.Length; i++)
|
||||||
|
writer.WriteLine($"case '{names.GetValue(i).ToString().ToLower()}': return {values.GetValue(i)};");
|
||||||
|
|
||||||
|
writer.Outdent().WriteLine("}");
|
||||||
|
writer.WriteLine("return null;");
|
||||||
|
writer.Outdent().WriteLine("}");
|
||||||
|
|
||||||
//GetNames function
|
//GetNames function
|
||||||
writer.WriteBreak().WriteLine("/**").Indent();
|
writer.WriteBreak().WriteLine("/**").Indent();
|
||||||
writer.WriteLine("Returns the names of this enums values in an array.");
|
writer.WriteLine("Returns the names of this enums values as an array of strings.");
|
||||||
writer.WriteLine("@function");
|
writer.WriteLine("@function");
|
||||||
writer.WriteLine("@returns {Array<string>}");
|
writer.WriteLine("@returns {Array<string>}");
|
||||||
writer.Outdent().WriteLine("*/");
|
writer.Outdent().WriteLine("*/");
|
||||||
@ -332,7 +352,7 @@ namespace MontoyaTech.Rest.Net
|
|||||||
|
|
||||||
//GetValues function
|
//GetValues function
|
||||||
writer.WriteBreak().WriteLine("/**").Indent();
|
writer.WriteBreak().WriteLine("/**").Indent();
|
||||||
writer.WriteLine("Returns the values of this enum in an arrray.");
|
writer.WriteLine("Returns the values of this enum as an arrray of numbers.");
|
||||||
writer.WriteLine("@function");
|
writer.WriteLine("@function");
|
||||||
writer.WriteLine("@returns {Array<number>}");
|
writer.WriteLine("@returns {Array<number>}");
|
||||||
writer.Outdent().WriteLine("*/");
|
writer.Outdent().WriteLine("*/");
|
||||||
@ -348,7 +368,7 @@ namespace MontoyaTech.Rest.Net
|
|||||||
writer.WriteBreak().WriteLine("/**").Indent();
|
writer.WriteBreak().WriteLine("/**").Indent();
|
||||||
writer.WriteLine("Returns the names and values of this enum in an array.");
|
writer.WriteLine("Returns the names and values of this enum in an array.");
|
||||||
writer.WriteLine("@function");
|
writer.WriteLine("@function");
|
||||||
writer.WriteLine("@returns {Array<object>} Where each element has a name and value key.");
|
writer.WriteLine("@returns {Array<object>} Where each element is an object and has a name and value field. Ex: { name: '', value: 0 }");
|
||||||
writer.Outdent().WriteLine("*/");
|
writer.Outdent().WriteLine("*/");
|
||||||
writer.WriteLine("static GetNamesValues() {").Indent();
|
writer.WriteLine("static GetNamesValues() {").Indent();
|
||||||
writer.WriteLine("return [").Indent();
|
writer.WriteLine("return [").Indent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user