diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 80214b7..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Chris S.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/README.md b/README.md
index 090d621..f5e347b 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,208 @@
-[](https://www.nuget.org/packages/SignalrTypescriptGenerator)
+[](https://ci.appveyor.com/project/cjbhaines/signalr-hubs-typescriptgenerator)
-# SignalrTypescriptGenerator
-A command line tool for generating typescript definitions for Signalr
+# Signalr.Hubs.TypeScriptGenerator
+Utility library for generating typescript definitions for Signalr Hubs. This is a fork of [yetanotherchris/SignalrTypeScriptGenerator](https://github.com/yetanotherchris/SignalrTypeScriptGenerator "SignalrTypeScriptGenerator") by [yetanotherchris](https://github.com/yetanotherchris "yetanotherchris"). I have split the packages up into a referenced library and a console app.
-This tool is based off this gist: https://gist.github.com/robfe/4583549. It works using the same C# logic, but skips the need for a T4 template which can be fiddly to get working on build servers.
+Our usage at Genius Sports is to generate the Hub proxies at build time using our [geniussportsgroup/SignalR.ProxyGenerator](https://github.com/geniussportsgroup/SignalR.ProxyGenerator "Proxy Generator") publishing them to our internal NPM feed. We then use this tool to generate TypeScript definitions our those proxies again publishing them to our internal NPM feed. This allows our UI developers to get strongly typed Hub APIs and allows us to do proper Continous Integrtaion between the back end and front end. Move quickly and break fast.
-### Nuget
- install-package SignalrTypescriptGenerator
+## Installation - Nuget
-### Usage
+- [Signalr.Hubs.TypeScriptGenerator](https://www.nuget.org/packages/Signalr.Hubs.TypeScriptGenerator "Signalr.Hubs.TypeScriptGenerator")
+- [Signalr.Hubs.TypeScriptGenerator.Console](https://www.nuget.org/packages/Signalr.Hubs.TypeScriptGenerator.Console "Signalr.Hubs.TypeScriptGenerator.Console")
- .\SignalrTypescriptGenerator.exe -a "c:\etc\path-to-myassembly.dll"
+## Usage
-This will print the Typescript to the console window. You can write to a file, which automatically checks if the file has changed:
+### Signalr.Hubs.TypeScriptGenerator
+The utility library is simple to use, load any assemblies required and then create a HubTypeScriptGenerator and call Generate. It returns the TypeScript as a string. We can't pick a specific assembly to scan because we are using the SignalR DefaultHubManager which looks in all loaded assemblies.
- .\SignalrTypescriptGenerator.exe -a "c:\etc\path-to-myassembly.dll" -o "C:\temp\.myfile.d.ts"
+ var generator = new HubTypeScriptGenerator();
+ var typeScript = generator.Generate();
-If you don't specify an output file, the typescript output is written to the console window. A post-build command line in Visual Studio might look like this:
- $(SolutionDir)\packages\SignalrTypescriptGenerator.1.0.11\tools\SignalrTypescriptGenerator.exe -a "$(TargetPath)" -o "$(SolutionDir)src\MyProject.Web\Scripts\typings\Hubs.d.ts"
\ No newline at end of file
+### Signalr.Hubs.TypeScriptGenerator.Console
+This will output the TypeScript to the specified file path
+
+ .\Signalr.Hubs.TypeScriptGenerator.Console.exe -a "c:\etc\path-to-myassembly.dll" -o "C:\temp\.myfile.d.ts"
+
+If the output file is not specified the result is written to standard out.
+
+**# ONLY COMBATIBLE WITH SIGNALR VERSIONS AT 2.2.1.0 OR EARLIER #**
+
+We have compiled this at verison 2.2.1.0 so in order for the HubManager to recognise your hubs we are using an assembly redirect. If Microsoft release a new version we will need to update this.
+
+
+
+
+
+
+### Data Contract Property Name
+Sometimes the serialized name of your data contract properties are changed from the actual C# property name. This is done through the DataMember property:
+
+ [DataContract]
+ public class SomethingDto
+ {
+ [DataMember(Name = "iChangedTheName")]
+ public string Property1 { get; set; }
+
+ [DataMember]
+ public Guid Property2 { get; set; }
+ }
+
+This library will respect the DataMember name and use this as the TypeScript property name:
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+ {
+ interface SomethingDto
+ {
+ iChangedTheName : string;
+ Property2 : System.Guid;
+ }
+ }
+
+## Example Output
+
+
+ /// Autogenerated at 16/09/2016 13:22:56 by https://github.com/geniussportsgroup/Signalr.Hubs.TypeScriptGenerator
+ ///
+ ///
+
+ // Hubs
+ interface SignalR
+ {
+ hubA : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.HubA;
+ hubC : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.HubC;
+ hubB : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.HubB;
+ }
+
+ // Service contracts
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+ {
+
+ interface HubA
+ {
+ server : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.HubAServer;
+ client : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.IHubAClient;
+ }
+
+ interface HubAServer
+ {
+ getSomething() : JQueryPromise;
+ ping() : JQueryPromise;
+ }
+ }
+
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+ {
+
+ interface HubC
+ {
+ server : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.HubCServer;
+ // Hub does not have a Client Interface as a generic argument - it is recommend to add one
+ client : any;
+ }
+
+ interface HubCServer
+ {
+ aServerSideMethod() : JQueryPromise;
+ }
+ }
+
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+ {
+
+ interface HubB
+ {
+ server : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.HubBServer;
+ client : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs.IHubBClient;
+ }
+
+ interface HubBServer
+ {
+ getOtherSomething() : JQueryPromise;
+ doOtherSomethingElse() : JQueryPromise;
+ }
+ }
+
+
+ // Clients
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+ {
+ interface IHubAClient
+ {
+ pong : () => void;
+ takeThis : (somethingDto : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts.SomethingDto) => void;
+ }
+ }
+
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+ {
+ interface IHubBClient
+ {
+ takeOtherThis : (otherSomethingDto : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts.OtherSomethingDto) => void;
+ }
+ }
+
+
+ // Data contracts
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+ {
+ interface OtherSomethingDto
+ {
+ Property1 : string;
+ Property2 : Date;
+ Property3 : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts.InnerSomethingDto;
+ Property4 : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts.InnerSomethingDto;
+ }
+ }
+
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+ {
+ interface InnerSomethingDto
+ {
+ InnerProperty1 : number;
+ innerProperty2 : Date;
+ innerProperty3WithCrazyCustomName : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts.SomethingEnum;
+ }
+ }
+
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+ {
+ interface SomethingDto
+ {
+ iChangedTheName : string;
+ Property2 : System.Guid;
+ Property3 : GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts.InnerSomethingDto;
+ }
+ }
+
+
+ declare module System
+ {
+ interface Guid
+ {
+ }
+ }
+
+
+ // Enums
+
+ declare module GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+ {
+ enum SomethingEnum
+ {
+ One = 0,
+ Two = 1,
+ Three = 2,
+ }
+ }
+
+
diff --git a/Signalr.Hubs.TypescriptGenerator.sln b/Signalr.Hubs.TypescriptGenerator.sln
new file mode 100644
index 0000000..118a93a
--- /dev/null
+++ b/Signalr.Hubs.TypescriptGenerator.sln
@@ -0,0 +1,48 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Signalr.Hubs.TypeScriptGenerator", "src\Signalr.Hubs.TypeScriptGenerator\Signalr.Hubs.TypeScriptGenerator.csproj", "{C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Signalr.Hubs.TypeScriptGenerator.Console", "src\Signalr.Hubs.TypeScriptGenerator.Console\Signalr.Hubs.TypeScriptGenerator.Console.csproj", "{B68600AA-F2AE-4EBF-9AF5-DEF252E71142}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "App", "App", "{AE98D3B3-6832-4544-A021-3C32156F971B}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".sln", ".sln", "{6C40DD74-1C6E-4292-9252-252D1573C321}"
+ ProjectSection(SolutionItems) = preProject
+ README.md = README.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{5522BF7C-CC56-45CA-8C07-A735916CC2BE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleUsage", "src\SampleUsage\SampleUsage.csproj", "{668072BF-5142-4796-BA67-8CB676C7196C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B68600AA-F2AE-4EBF-9AF5-DEF252E71142}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B68600AA-F2AE-4EBF-9AF5-DEF252E71142}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B68600AA-F2AE-4EBF-9AF5-DEF252E71142}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B68600AA-F2AE-4EBF-9AF5-DEF252E71142}.Release|Any CPU.Build.0 = Release|Any CPU
+ {668072BF-5142-4796-BA67-8CB676C7196C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {668072BF-5142-4796-BA67-8CB676C7196C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {668072BF-5142-4796-BA67-8CB676C7196C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {668072BF-5142-4796-BA67-8CB676C7196C}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE} = {AE98D3B3-6832-4544-A021-3C32156F971B}
+ {B68600AA-F2AE-4EBF-9AF5-DEF252E71142} = {AE98D3B3-6832-4544-A021-3C32156F971B}
+ {668072BF-5142-4796-BA67-8CB676C7196C} = {5522BF7C-CC56-45CA-8C07-A735916CC2BE}
+ EndGlobalSection
+EndGlobal
diff --git a/SignalrTypescriptGenerator.sln b/SignalrTypescriptGenerator.sln
deleted file mode 100644
index 4fa3942..0000000
--- a/SignalrTypescriptGenerator.sln
+++ /dev/null
@@ -1,22 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignalrTypescriptGenerator", "src\SignalrTypescriptGenerator\SignalrTypescriptGenerator.csproj", "{C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/icon.png b/icon.png
deleted file mode 100644
index f8e0350..0000000
Binary files a/icon.png and /dev/null differ
diff --git a/src/SampleUsage/App.config b/src/SampleUsage/App.config
new file mode 100644
index 0000000..d92337c
--- /dev/null
+++ b/src/SampleUsage/App.config
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SampleUsage/DataContracts/InheritedSomethingDto.cs b/src/SampleUsage/DataContracts/InheritedSomethingDto.cs
new file mode 100644
index 0000000..639de57
--- /dev/null
+++ b/src/SampleUsage/DataContracts/InheritedSomethingDto.cs
@@ -0,0 +1,11 @@
+using System.Runtime.Serialization;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+{
+ [DataContract]
+ public class InheritedSomethingDto : SomethingDto
+ {
+ [DataMember]
+ public int InheritedSomethingDtoProperty1 { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/DataContracts/InnerSomethingDto.cs b/src/SampleUsage/DataContracts/InnerSomethingDto.cs
new file mode 100644
index 0000000..8d34c83
--- /dev/null
+++ b/src/SampleUsage/DataContracts/InnerSomethingDto.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+{
+ [DataContract]
+ public class InnerSomethingDto
+ {
+ [DataMember]
+ public int InnerProperty1 { get; set; }
+
+ [DataMember(Name = "innerProperty2")]
+ public DateTime InnerProperty2 { get; set; }
+
+ [DataMember(Name = "innerProperty3WithCrazyCustomName")]
+ public SomethingEnum InnerProperty3 { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/DataContracts/OtherSomethingDto.cs b/src/SampleUsage/DataContracts/OtherSomethingDto.cs
new file mode 100644
index 0000000..e651bfb
--- /dev/null
+++ b/src/SampleUsage/DataContracts/OtherSomethingDto.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+{
+ [DataContract]
+ public class OtherSomethingDto
+ {
+ [DataMember]
+ public string Property1 { get; set; }
+
+ [DataMember]
+ public DateTime Property2 { get; set; }
+
+ [DataMember]
+ public InnerSomethingDto Property3 { get; set; }
+
+ [DataMember]
+ public InnerSomethingDto Property4 { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/DataContracts/SomethingDto.cs b/src/SampleUsage/DataContracts/SomethingDto.cs
new file mode 100644
index 0000000..725b401
--- /dev/null
+++ b/src/SampleUsage/DataContracts/SomethingDto.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+{
+ [DataContract]
+ public class SomethingDto
+ {
+ [DataMember(Name = "iChangedTheName")]
+ public string Property1 { get; set; }
+
+ [DataMember]
+ public Guid Property2 { get; set; }
+
+ [DataMember]
+ public InnerSomethingDto Property3 { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/DataContracts/SomethingEnum.cs b/src/SampleUsage/DataContracts/SomethingEnum.cs
new file mode 100644
index 0000000..decec97
--- /dev/null
+++ b/src/SampleUsage/DataContracts/SomethingEnum.cs
@@ -0,0 +1,15 @@
+using System.Runtime.Serialization;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts
+{
+ [DataContract]
+ public enum SomethingEnum
+ {
+ [EnumMember]
+ One,
+ [EnumMember]
+ Two,
+ [EnumMember]
+ Three,
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/GenerateHubTypeScript.cs b/src/SampleUsage/GenerateHubTypeScript.cs
new file mode 100644
index 0000000..1d54d37
--- /dev/null
+++ b/src/SampleUsage/GenerateHubTypeScript.cs
@@ -0,0 +1,16 @@
+using NUnit.Framework;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage
+{
+ [TestFixture]
+ public class GenerateHubTypeScript
+ {
+ [Test]
+ public void Generate()
+ {
+ var hubTypeScriptGenerator = new HubTypeScriptGenerator();
+ var typeScript = hubTypeScriptGenerator.Generate();
+ System.Console.WriteLine(typeScript);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/Hubs/HubA.cs b/src/SampleUsage/Hubs/HubA.cs
new file mode 100644
index 0000000..64697bf
--- /dev/null
+++ b/src/SampleUsage/Hubs/HubA.cs
@@ -0,0 +1,28 @@
+using GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts;
+using Microsoft.AspNet.SignalR;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+{
+ public interface IHubAClient
+ {
+ void Pong();
+ void TakeThis(SomethingDto somethingDto);
+ }
+
+ public class HubA : Hub
+ {
+ public SomethingDto GetSomething()
+ {
+ return new SomethingDto();
+ }
+
+ public InheritedSomethingDto GetInheritedSomething()
+ {
+ return new InheritedSomethingDto();
+ }
+
+ public void Ping()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/Hubs/HubB.cs b/src/SampleUsage/Hubs/HubB.cs
new file mode 100644
index 0000000..56a0f0d
--- /dev/null
+++ b/src/SampleUsage/Hubs/HubB.cs
@@ -0,0 +1,22 @@
+using GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.DataContracts;
+using Microsoft.AspNet.SignalR;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+{
+ public interface IHubBClient
+ {
+ void TakeOtherThis(OtherSomethingDto otherSomethingDto);
+ }
+
+ public class HubB : Hub
+ {
+ public OtherSomethingDto GetOtherSomething()
+ {
+ return new OtherSomethingDto();
+ }
+
+ public void DoOtherSomethingElse()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SampleUsage/Hubs/HubCWithNoClientInterface.cs b/src/SampleUsage/Hubs/HubCWithNoClientInterface.cs
new file mode 100644
index 0000000..befafbf
--- /dev/null
+++ b/src/SampleUsage/Hubs/HubCWithNoClientInterface.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNet.SignalR;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage.Hubs
+{
+ public class HubC : Hub
+ {
+ public void AServerSideMethod()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Properties/AssemblyInfo.cs b/src/SampleUsage/Properties/AssemblyInfo.cs
similarity index 67%
rename from src/SignalrTypescriptGenerator/Properties/AssemblyInfo.cs
rename to src/SampleUsage/Properties/AssemblyInfo.cs
index 3538b3b..8b27b17 100644
--- a/src/SignalrTypescriptGenerator/Properties/AssemblyInfo.cs
+++ b/src/SampleUsage/Properties/AssemblyInfo.cs
@@ -1,36 +1,36 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("SignalrTypescriptGenerator")]
-[assembly: AssemblyDescription("Command line tool for generating Typescript hub definitions for a Signalr assembly.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("C.Small")]
-[assembly: AssemblyProduct("SignalrTypescriptGenerator")]
-[assembly: AssemblyCopyright("Copyright © C.Small 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c90f8c7b-213b-4cd0-a9f0-3a39634cecde")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.13.0")]
-[assembly: AssemblyFileVersion("1.0.13.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleUsage")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SampleUsage")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("668072bf-5142-4796-ba67-8cb676c7196c")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/SampleUsage/SampleUsage.csproj b/src/SampleUsage/SampleUsage.csproj
new file mode 100644
index 0000000..2072867
--- /dev/null
+++ b/src/SampleUsage/SampleUsage.csproj
@@ -0,0 +1,100 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {668072BF-5142-4796-BA67-8CB676C7196C}
+ Library
+ Properties
+ GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage
+ GeniusSports.Signalr.Hubs.TypeScriptGenerator.SampleUsage
+ v4.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll
+ True
+
+
+ ..\..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll
+ True
+
+
+ ..\..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll
+ True
+
+
+ ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
+ True
+
+
+ ..\..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll
+ True
+
+
+ ..\..\packages\Owin.1.0\lib\net40\Owin.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}
+ Signalr.Hubs.TypeScriptGenerator
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/SampleUsage/packages.config b/src/SampleUsage/packages.config
new file mode 100644
index 0000000..a562550
--- /dev/null
+++ b/src/SampleUsage/packages.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypeScriptGenerator.Console/App.config b/src/Signalr.Hubs.TypeScriptGenerator.Console/App.config
new file mode 100644
index 0000000..df8577d
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/App.config
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Signalr.Hubs.TypeScriptGenerator.Console/AssemblyLoader.cs b/src/Signalr.Hubs.TypeScriptGenerator.Console/AssemblyLoader.cs
new file mode 100644
index 0000000..3f8db7f
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/AssemblyLoader.cs
@@ -0,0 +1,29 @@
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Console
+{
+ internal class AssemblyLoader
+ {
+ public void LoadAssemblyIntoAppDomain(string assemblyPath)
+ {
+ var currentDomain = AppDomain.CurrentDomain;
+ currentDomain.AssemblyResolve += LoadFromSameFolder;
+ Assembly.LoadFile(assemblyPath);
+ }
+
+ private static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
+ {
+ var directoryName = Path.GetDirectoryName(args.RequestingAssembly.Location);
+ var assemblyPath = Path.Combine(directoryName, new AssemblyName(args.Name).Name + ".dll");
+ if (!File.Exists(assemblyPath))
+ {
+ return null;
+ }
+
+ var assembly = Assembly.LoadFrom(assemblyPath);
+ return assembly;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/CommandLineOptions.cs b/src/Signalr.Hubs.TypeScriptGenerator.Console/CommandLineOptions.cs
similarity index 56%
rename from src/SignalrTypescriptGenerator/Models/CommandLineOptions.cs
rename to src/Signalr.Hubs.TypeScriptGenerator.Console/CommandLineOptions.cs
index 6137711..51d6e0b 100644
--- a/src/SignalrTypescriptGenerator/Models/CommandLineOptions.cs
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/CommandLineOptions.cs
@@ -1,13 +1,20 @@
-using CommandLine;
-
-namespace SignalrTypescriptGenerator.Models
-{
- public class CommandLineOptions
- {
- [Option('a', "assembly", HelpText = "The path to the assembly (.dll/.exe)", Required = true)]
- public string AssemblyPath { get; set; }
-
- [Option('o', "outfile", HelpText = "The path to the file to generate. If this is empty, the output is written to stdout.")]
- public string OutFile { get; set; }
- }
+using CommandLine;
+using CommandLine.Text;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Console
+{
+ public class CommandLineOptions
+ {
+ [Option('a', "assembly", HelpText = "The path to the assembly (.dll/.exe)", Required = true)]
+ public string AssemblyPath { get; set; }
+
+ [Option('o', "outfile", HelpText = "The path to the file to generate. If this is empty, the output is written to stdout.")]
+ public string OutFile { get; set; }
+
+ [HelpOption]
+ public string GetUsage()
+ {
+ return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current));
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypeScriptGenerator.Console/Program.cs b/src/Signalr.Hubs.TypeScriptGenerator.Console/Program.cs
new file mode 100644
index 0000000..195517c
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/Program.cs
@@ -0,0 +1,71 @@
+using System;
+using System.IO;
+using System.Reflection;
+using CommandLine;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Console
+{
+ public class Program
+ {
+ public static int Main(string[] args)
+ {
+ if (AppDomain.CurrentDomain.IsDefaultAppDomain())
+ {
+ return RunInNewAppDomainToAllowRazorEngineToCleanup(args);
+ }
+
+ try
+ {
+ var options = new CommandLineOptions();
+ if (Parser.Default.ParseArguments(args, options))
+ {
+ Run(options);
+ return 0;
+ }
+
+ System.Console.WriteLine("Error parsing command line options");
+ System.Console.WriteLine(options.GetUsage());
+ System.Console.ReadKey();
+ return 1;
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Error generating TypeScript");
+ System.Console.WriteLine(e);
+ return 1;
+ }
+ }
+
+ private static int RunInNewAppDomainToAllowRazorEngineToCleanup(string[] args)
+ {
+ var appDomain = AppDomain.CreateDomain("RazorEngine", null, AppDomain.CurrentDomain.SetupInformation);
+ var exitCode = appDomain.ExecuteAssembly(Assembly.GetExecutingAssembly().Location, args);
+ AppDomain.Unload(appDomain);
+ return exitCode;
+ }
+
+ private static void Run(CommandLineOptions commandLineOptions)
+ {
+ LoadAssemblies(commandLineOptions);
+
+ var hubTypeScriptGenerator = new HubTypeScriptGenerator();
+ var outputText = hubTypeScriptGenerator.Generate();
+
+ if (string.IsNullOrWhiteSpace(commandLineOptions.OutFile))
+ {
+ System.Console.WriteLine(outputText);
+ }
+ else
+ {
+ File.WriteAllText(commandLineOptions.OutFile, outputText);
+ }
+ }
+
+
+ private static void LoadAssemblies(CommandLineOptions commandLineOptions)
+ {
+ var assemblyLoader = new AssemblyLoader();
+ assemblyLoader.LoadAssemblyIntoAppDomain(commandLineOptions.AssemblyPath);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypeScriptGenerator.Console/Properties/AssemblyInfo.cs b/src/Signalr.Hubs.TypeScriptGenerator.Console/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..3ef6860
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/Properties/AssemblyInfo.cs
@@ -0,0 +1,12 @@
+using System.Reflection;
+
+[assembly: AssemblyTitle("Signalr.Hubs.TypeScriptGenerator.Console")]
+[assembly: AssemblyDescription("Command line tool for generating TypeScript hub definitions for a Signalr assembly.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Genius Sports")]
+[assembly: AssemblyProduct("Signalr.Hubs.TypeScriptGenerator.Console")]
+[assembly: AssemblyCopyright("Copyright © Genius Sports 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyVersion("1.0.6.0")]
+[assembly: AssemblyFileVersion("1.0.6.0")]
diff --git a/src/Signalr.Hubs.TypeScriptGenerator.Console/Signalr.Hubs.TypeScriptGenerator.Console.csproj b/src/Signalr.Hubs.TypeScriptGenerator.Console/Signalr.Hubs.TypeScriptGenerator.Console.csproj
new file mode 100644
index 0000000..5f2bc2e
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/Signalr.Hubs.TypeScriptGenerator.Console.csproj
@@ -0,0 +1,101 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {B68600AA-F2AE-4EBF-9AF5-DEF252E71142}
+ Exe
+ Properties
+ GeniusSports.Signalr.Hubs.TypeScriptGenerator.Console
+ GeniusSports.Signalr.Hubs.TypeScriptGenerator.Console
+ v4.5
+ 512
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll
+ True
+
+
+ ..\..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll
+ True
+
+
+ ..\..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll
+ True
+
+
+ ..\..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll
+ True
+
+
+ ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
+ True
+
+
+ ..\..\packages\Owin.1.0\lib\net40\Owin.dll
+ True
+
+
+ ..\..\packages\RazorEngine.3.9.0\lib\net45\RazorEngine.dll
+ True
+
+
+
+
+ ..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {c90f8c7b-213b-4cd0-a9f0-3a39634cecde}
+ Signalr.Hubs.TypeScriptGenerator
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypeScriptGenerator.Console/Signalr.Hubs.TypeScriptGenerator.Console.nuspec b/src/Signalr.Hubs.TypeScriptGenerator.Console/Signalr.Hubs.TypeScriptGenerator.Console.nuspec
new file mode 100644
index 0000000..c758b19
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/Signalr.Hubs.TypeScriptGenerator.Console.nuspec
@@ -0,0 +1,17 @@
+
+
+
+ Signalr.Hubs.TypeScriptGenerator.Console
+ $version$
+ Signalr TypeScript Hub Generator
+ Genius Sports
+ Genius Sports
+ https://github.com/geniussportsgroup/Signalr.Hubs.TypeScriptGenerator
+ false
+ Command line tool for generating TypeScript hub definitions for a Signalr assembly.
+ typescript signalr hubs
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypeScriptGenerator.Console/packages.config b/src/Signalr.Hubs.TypeScriptGenerator.Console/packages.config
new file mode 100644
index 0000000..1d495d5
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator.Console/packages.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypeScriptGenerator/Helpers/HubDescriptorProvider.cs b/src/Signalr.Hubs.TypeScriptGenerator/Helpers/HubDescriptorProvider.cs
new file mode 100644
index 0000000..63822d9
--- /dev/null
+++ b/src/Signalr.Hubs.TypeScriptGenerator/Helpers/HubDescriptorProvider.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Microsoft.AspNet.SignalR;
+using Microsoft.AspNet.SignalR.Hubs;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Helpers
+{
+ public class HubDescriptorProvider : IHubDescriptorProvider
+ {
+ private readonly IDependencyResolver resolver;
+
+ public HubDescriptorProvider(IDependencyResolver resolver)
+ {
+ this.resolver = resolver;
+ }
+
+ public IList GetHubs()
+ {
+ return GetHubsInternal().Values.ToList();
+ }
+
+ private IDictionary GetHubsInternal()
+ {
+ // Getting all IHub-implementing types that apply
+ var assemblyLocator = (IAssemblyLocator)resolver.GetService(typeof(IAssemblyLocator));
+ var types = assemblyLocator.GetAssemblies()
+ .SelectMany(GetTypesSafe)
+ .Where(IsHubType)
+ .ToList();
+
+ // Building cache entries for each descriptor
+ // Each descriptor is stored in dictionary under a key
+ // that is it's name or the name provided by an attribute
+ var hubDescriptors = types
+ .Select(type => new HubDescriptor
+ {
+ NameSpecified = (type.GetHubAttributeName() != null),
+ Name = type.GetHubName(),
+ HubType = type
+ });
+
+ var cacheEntries = new Dictionary(StringComparer.OrdinalIgnoreCase);
+
+ foreach (var descriptor in hubDescriptors)
+ {
+ HubDescriptor oldDescriptor = null;
+ if (!cacheEntries.TryGetValue(descriptor.Name, out oldDescriptor))
+ {
+ cacheEntries[descriptor.Name] = descriptor;
+ }
+ else
+ {
+ throw new InvalidOperationException();
+ }
+ }
+
+ return cacheEntries;
+ }
+
+ public bool TryGetHub(string hubName, out HubDescriptor descriptor)
+ {
+ return GetHubsInternal().TryGetValue(hubName, out descriptor);
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "If we throw then it's not a hub type")]
+ private static bool IsHubType(Type type)
+ {
+ try
+ {
+ return typeof(Hub).IsAssignableFrom(type) &&
+ !type.IsAbstract &&
+ (type.Attributes.HasFlag(TypeAttributes.Public) ||
+ type.Attributes.HasFlag(TypeAttributes.NestedPublic));
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "If we throw then we have an empty type")]
+ private IEnumerable GetTypesSafe(Assembly a)
+ {
+ try
+ {
+ return a.GetTypes();
+ }
+ catch (ReflectionTypeLoadException ex)
+ {
+ return ex.Types.Where(t => t != null);
+ }
+ catch (Exception ex)
+ {
+ return Enumerable.Empty();
+ }
+ }
+ }
+
+ internal static class HubTypeExtensions
+ {
+ internal static string GetHubName(this Type type)
+ {
+ if (!typeof(IHub).IsAssignableFrom(type))
+ {
+ return null;
+ }
+
+ return GetHubAttributeName(type) ?? GetHubTypeName(type);
+ }
+
+ internal static string GetHubAttributeName(this Type type)
+ {
+ if (!typeof(IHub).IsAssignableFrom(type))
+ {
+ return null;
+ }
+
+ // We can still return null if there is no attribute name
+ return ReflectionHelper.GetAttributeValue(type, attr => attr.HubName);
+ }
+
+ private static string GetHubTypeName(Type type)
+ {
+ var lastIndexOfBacktick = type.Name.LastIndexOf('`');
+ if (lastIndexOfBacktick == -1)
+ {
+ return type.Name;
+ }
+ else
+ {
+ return type.Name.Substring(0, lastIndexOfBacktick);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/AssemblyLoader.cs b/src/Signalr.Hubs.TypescriptGenerator/AssemblyLoader.cs
new file mode 100644
index 0000000..4a51ff4
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/AssemblyLoader.cs
@@ -0,0 +1,29 @@
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator
+{
+ internal class AssemblyLoader
+ {
+ public void LoadAssemblyIntoAppDomain(string assemblyPath)
+ {
+ var currentDomain = AppDomain.CurrentDomain;
+ currentDomain.AssemblyResolve += LoadFromSameFolder;
+ Assembly.LoadFile(assemblyPath);
+ }
+
+ private static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
+ {
+ var directoryName = Path.GetDirectoryName(args.RequestingAssembly.Location);
+ var assemblyPath = Path.Combine(directoryName, new AssemblyName(args.Name).Name + ".dll");
+ if (!File.Exists(assemblyPath))
+ {
+ return null;
+ }
+
+ var assembly = Assembly.LoadFrom(assemblyPath);
+ return assembly;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Helpers/HubHelper.cs b/src/Signalr.Hubs.TypescriptGenerator/Helpers/HubHelper.cs
new file mode 100644
index 0000000..7526100
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Helpers/HubHelper.cs
@@ -0,0 +1,121 @@
+using GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models;
+using Microsoft.AspNet.SignalR;
+using Microsoft.AspNet.SignalR.Hubs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using TypeInfo = GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models.TypeInfo;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Helpers
+{
+ internal class HubHelper
+ {
+ private readonly DefaultHubManager hubmanager;
+ private readonly TypeHelper typeHelper;
+
+ public HubHelper()
+ {
+ typeHelper = new TypeHelper();
+
+ var defaultDependencyResolver = new DefaultDependencyResolver();
+ hubmanager = new DefaultHubManager(defaultDependencyResolver);
+ }
+
+ public List GetHubs()
+ {
+ return hubmanager
+ .GetHubs()
+ .Select(hub => new TypeInfo(name: hub.NameSpecified ? hub.Name : typeHelper.FirstCharLowered(hub.Name), typescriptType: hub.HubType.FullName))
+ .ToList();
+ }
+
+ public List GetServiceContracts()
+ {
+ var list = new List();
+
+ foreach (var hub in hubmanager.GetHubs())
+ {
+ var hubMethods = hubmanager
+ .GetHubMethods(hub.Name)
+ .Select(method =>
+ {
+ var methodParametersString = method.Parameters.Select(x => x.Name + " : " + typeHelper.GetTypeContractName(x.ParameterType));
+ return new FunctionDetails(
+ name: typeHelper.FirstCharLowered(method.Name),
+ arguments: $"({string.Join(", ", methodParametersString)})",
+ returnType: $"JQueryPromise<{typeHelper.GetTypeContractName(method.ReturnType)}>");
+ })
+ .ToList();
+
+ var hubType = hub.HubType;
+ var clientType = typeHelper.ClientType(hubType);
+ list.Add(new ServiceInfo(
+ moduleName: hubType.Namespace,
+ interfaceName: hubType.Name,
+ clientType: clientType != null ? clientType.FullName : "any",
+ serverType: hubType.Name + "Server",
+ serverTypeFullNamespace: hubType.FullName + "Server",
+ serverFunctions: hubMethods));
+ }
+
+ return list;
+ }
+
+ public List GetClients()
+ {
+ var list = new List();
+
+ foreach (var hub in hubmanager.GetHubs())
+ {
+ var hubType = hub.HubType;
+ var clientType = typeHelper.ClientType(hubType);
+
+ if (clientType != null)
+ {
+ list.Add(new ClientInfo(moduleName: clientType.Namespace, interfaceName: clientType.Name, functionDetails: typeHelper.GetClientFunctions(hubType)));
+ }
+ }
+
+ return list;
+ }
+
+ public List GetDataContracts()
+ {
+ var list = new List();
+
+ while (typeHelper.InterfaceTypes.Count != 0)
+ {
+ var type = typeHelper.InterfaceTypes.Pop();
+
+ var properties = type
+ .GetProperties(BindingFlags.Instance | BindingFlags.Public)
+ .Select(prop => new TypeInfo(name: typeHelper.GetPropertyName(prop), typescriptType: typeHelper.GetTypeContractName(prop.PropertyType)))
+ .ToList();
+
+ list.Add(new DataContractInfo(moduleName: type.Namespace, interfaceName: typeHelper.GenericSpecificName(type, false), properties: properties));
+ }
+
+ return list;
+ }
+
+ public List GetEnums()
+ {
+ var list = new List();
+
+ while (typeHelper.EnumTypes.Count != 0)
+ {
+ var type = typeHelper.EnumTypes.Pop();
+
+ var enumProperties =
+ Enum.GetNames(type)
+ .Select(propertyName => new TypeInfo(name: propertyName, typescriptType: $"{Enum.Parse(type, propertyName):D}"))
+ .ToList();
+
+ list.Add(new EnumInfo(moduleName: type.Namespace, interfaceName: typeHelper.GenericSpecificName(type, false), properties: enumProperties));
+ }
+
+ return list;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/TypeHelper.cs b/src/Signalr.Hubs.TypescriptGenerator/Helpers/TypeHelper.cs
similarity index 72%
rename from src/SignalrTypescriptGenerator/TypeHelper.cs
rename to src/Signalr.Hubs.TypescriptGenerator/Helpers/TypeHelper.cs
index d934935..aca425a 100644
--- a/src/SignalrTypescriptGenerator/TypeHelper.cs
+++ b/src/Signalr.Hubs.TypescriptGenerator/Helpers/TypeHelper.cs
@@ -1,139 +1,143 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using Microsoft.AspNet.SignalR;
-using SignalrTypescriptGenerator.Models;
-
-namespace SignalrTypescriptGenerator
-{
- internal class TypeHelper
- {
- private readonly HashSet _doneTypes;
- public readonly Stack InterfaceTypes;
- public readonly Stack EnumTypes;
-
- public TypeHelper()
- {
- _doneTypes = new HashSet();
- InterfaceTypes = new Stack();
- EnumTypes = new Stack();
- }
-
- public List GetClientFunctions(Type hubType)
- {
- var list = new List();
-
- Type clientType = ClientType(hubType);
- if (clientType != null)
- {
- foreach (var method in clientType.GetMethods())
- {
- var functionDetails = new FunctionDetails();
- IEnumerable ps = method.GetParameters().Select(x => x.Name + " : " + GetTypeContractName(x.ParameterType));
- string functionName = FirstCharLowered(method.Name);
- string functionArgs = "(" + string.Join(", ", ps) + ")";
-
- functionDetails.Name = functionName;
- functionDetails.Arguments = functionArgs;
-
- list.Add(functionDetails);
- }
- }
-
- return list;
- }
-
- public string FirstCharLowered(string s)
- {
- return Regex.Replace(s, "^.", x => x.Value.ToLowerInvariant());
- }
-
- public Type ClientType(Type hubType)
- {
- while (hubType != null && hubType != typeof(Hub))
- {
- if (hubType.IsGenericType && hubType.GetGenericTypeDefinition() == typeof(Hub<>))
- {
- return hubType.GetGenericArguments().Single();
- }
- hubType = hubType.BaseType;
- }
- return null;
- }
-
- public string GetTypeContractName(Type type)
- {
- if (type == typeof(Task))
- {
- return "void";
- }
-
- if (type.IsArray)
- {
- return GetTypeContractName(type.GetElementType()) + "[]";
- }
-
- if (type.IsGenericType)
- {
- if (typeof(Task<>).IsAssignableFrom(type.GetGenericTypeDefinition()))
- {
- return GetTypeContractName(type.GetGenericArguments()[0]);
- }
-
- if (typeof(Nullable<>).IsAssignableFrom(type.GetGenericTypeDefinition()))
- {
- return GetTypeContractName(type.GetGenericArguments()[0]);
- }
-
- if (typeof(List<>).IsAssignableFrom(type.GetGenericTypeDefinition()))
- {
- return GetTypeContractName(type.GetGenericArguments()[0]) + "[]";
- }
- }
-
- switch (type.Name.ToLowerInvariant())
- {
-
- case "datetime":
- return "Date";
- case "int16":
- case "int32":
- case "int64":
- case "single":
- case "double":
- return "number";
- case "boolean":
- return "boolean";
- case "void":
- case "string":
- return type.Name.ToLowerInvariant();
- }
-
- if (!_doneTypes.Contains(type))
- {
- _doneTypes.Add(type);
- if (type.IsEnum)
- {
- EnumTypes.Push(type);
- }
- else
- {
- InterfaceTypes.Push(type);
- }
- }
- return GenericSpecificName(type, true);
- }
-
- public string GenericSpecificName(Type type, bool referencing)
- {
- string name = (referencing ? type.FullName : type.Name).Split('`').First();
- if (type.IsGenericType)
- {
- name += "_" + string.Join("_", type.GenericTypeArguments.Select(a => GenericSpecificName(a, false))) + "_";
- }
- return name;
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models;
+using Microsoft.AspNet.SignalR;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Helpers
+{
+ internal class TypeHelper
+ {
+ private readonly HashSet doneTypes;
+
+ public readonly Stack InterfaceTypes;
+ public readonly Stack EnumTypes;
+
+ public TypeHelper()
+ {
+ doneTypes = new HashSet();
+ InterfaceTypes = new Stack();
+ EnumTypes = new Stack();
+ }
+
+ public List GetClientFunctions(Type hubType)
+ {
+ var list = new List();
+
+ var clientType = ClientType(hubType);
+ if (clientType != null)
+ {
+ foreach (var method in clientType.GetMethods())
+ {
+ var ps = method.GetParameters().Select(x => x.Name + " : " + GetTypeContractName(x.ParameterType));
+ var functionName = FirstCharLowered(method.Name);
+ var functionArgs = "(" + string.Join(", ", ps) + ")";
+ list.Add(new FunctionDetails(name: functionName, arguments: functionArgs, returnType: null));
+ }
+ }
+
+ return list;
+ }
+
+ public string FirstCharLowered(string s)
+ {
+ return Regex.Replace(s, "^.", x => x.Value.ToLowerInvariant());
+ }
+
+ public Type ClientType(Type hubType)
+ {
+ while (hubType != null && hubType != typeof(Hub))
+ {
+ if (hubType.IsGenericType && hubType.GetGenericTypeDefinition() == typeof(Hub<>))
+ {
+ return hubType.GetGenericArguments().Single();
+ }
+ hubType = hubType.BaseType;
+ }
+ return null;
+ }
+
+ public string GetTypeContractName(Type type)
+ {
+ if (type == typeof(Task))
+ {
+ return "void";
+ }
+
+ if (type.IsArray)
+ {
+ return GetTypeContractName(type.GetElementType()) + "[]";
+ }
+
+ if (type.IsGenericType)
+ {
+ if (typeof(Task<>).IsAssignableFrom(type.GetGenericTypeDefinition()))
+ {
+ return GetTypeContractName(type.GetGenericArguments()[0]);
+ }
+
+ if (typeof(Nullable<>).IsAssignableFrom(type.GetGenericTypeDefinition()))
+ {
+ return GetTypeContractName(type.GetGenericArguments()[0]);
+ }
+
+ if (typeof(List<>).IsAssignableFrom(type.GetGenericTypeDefinition()))
+ {
+ return GetTypeContractName(type.GetGenericArguments()[0]) + "[]";
+ }
+ }
+
+ switch (type.Name.ToLowerInvariant())
+ {
+
+ case "datetime":
+ return "Date";
+ case "int16":
+ case "int32":
+ case "int64":
+ case "single":
+ case "double":
+ return "number";
+ case "boolean":
+ return "boolean";
+ case "void":
+ case "string":
+ return type.Name.ToLowerInvariant();
+ }
+
+ if (!doneTypes.Contains(type))
+ {
+ doneTypes.Add(type);
+ if (type.IsEnum)
+ {
+ EnumTypes.Push(type);
+ }
+ else
+ {
+ InterfaceTypes.Push(type);
+ }
+ }
+ return GenericSpecificName(type, true);
+ }
+
+ public string GenericSpecificName(Type type, bool referencing)
+ {
+ string name = (referencing ? type.FullName : type.Name).Split('`').First();
+ if (type.IsGenericType)
+ {
+ name += "_" + string.Join("_", type.GenericTypeArguments.Select(a => GenericSpecificName(a, false))) + "_";
+ }
+ return name;
+ }
+
+ public string GetPropertyName(PropertyInfo prop)
+ {
+ var dataMemberAttribute = prop.GetCustomAttribute();
+ return !string.IsNullOrWhiteSpace(dataMemberAttribute?.Name) ? dataMemberAttribute.Name : prop.Name;
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/HubTypeScriptGenerator.cs b/src/Signalr.Hubs.TypescriptGenerator/HubTypeScriptGenerator.cs
new file mode 100644
index 0000000..2342cf6
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/HubTypeScriptGenerator.cs
@@ -0,0 +1,50 @@
+using System;
+using System.IO;
+using System.Reflection;
+using GeniusSports.Signalr.Hubs.TypeScriptGenerator.Helpers;
+using GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models;
+using RazorEngine;
+using RazorEngine.Templating;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator
+{
+ public class HubTypeScriptGenerator
+ {
+ public string Generate()
+ {
+ var model = GenerateTypeScriptModel();
+ var template = ReadEmbeddedFile("template.cshtml");
+ var outputText = Engine.Razor.RunCompile(template, "templateKey", null, model);
+ return outputText;
+ }
+
+ private static TypesModel GenerateTypeScriptModel()
+ {
+ var signalrHelper = new HubHelper();
+ return new TypesModel(
+ hubs: signalrHelper.GetHubs(),
+ serviceContracts: signalrHelper.GetServiceContracts(),
+ clients: signalrHelper.GetClients(),
+ dataContracts: signalrHelper.GetDataContracts(),
+ enums: signalrHelper.GetEnums());
+ }
+
+ private static string ReadEmbeddedFile(string file)
+ {
+ string resourcePath = $"{typeof(HubTypeScriptGenerator).Namespace}.{file}";
+
+ using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourcePath))
+ {
+ if (stream == null) throw new InvalidOperationException($"Unable to find '{resourcePath}' as an embedded resource");
+
+ string textContent;
+ using (var reader = new StreamReader(stream))
+ {
+ textContent = reader.ReadToEnd();
+ }
+
+ return textContent;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Models/ClientInfo.cs b/src/Signalr.Hubs.TypescriptGenerator/Models/ClientInfo.cs
new file mode 100644
index 0000000..dcc879d
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Models/ClientInfo.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+{
+ public class ClientInfo
+ {
+ public string ModuleName { get; }
+ public string InterfaceName { get; }
+ public List FunctionDetails { get; }
+
+ public ClientInfo(string moduleName, string interfaceName, List functionDetails)
+ {
+ ModuleName = moduleName;
+ InterfaceName = interfaceName;
+ FunctionDetails = functionDetails;
+ }
+
+ public override string ToString()
+ {
+ return $"ModuleName:{ModuleName},InterfaceName:{InterfaceName}";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Models/DataContractInfo.cs b/src/Signalr.Hubs.TypescriptGenerator/Models/DataContractInfo.cs
new file mode 100644
index 0000000..3bddcee
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Models/DataContractInfo.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+{
+ public class DataContractInfo
+ {
+ public string ModuleName { get; }
+ public string InterfaceName { get; }
+ public List Properties { get; }
+
+ public DataContractInfo(string moduleName, string interfaceName, List properties)
+ {
+ ModuleName = moduleName;
+ InterfaceName = interfaceName;
+ Properties = properties;
+ }
+
+ public override string ToString()
+ {
+ return $"ModuleName:{ModuleName},InterfaceName:{InterfaceName};Properties:[{string.Join(",", Properties)}]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Models/EnumInfo.cs b/src/Signalr.Hubs.TypescriptGenerator/Models/EnumInfo.cs
new file mode 100644
index 0000000..3bfe745
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Models/EnumInfo.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+{
+ public class EnumInfo
+ {
+ public string ModuleName { get; }
+ public string InterfaceName { get; }
+ public List Properties { get; }
+
+ public EnumInfo(string moduleName, string interfaceName, List properties)
+ {
+ ModuleName = moduleName;
+ InterfaceName = interfaceName;
+ Properties = properties;
+ }
+
+ public override string ToString()
+ {
+ return $"ModuleName:{ModuleName},InterfaceName:{InterfaceName};Properties:[{string.Join(",", Properties)}]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Models/FunctionDetails.cs b/src/Signalr.Hubs.TypescriptGenerator/Models/FunctionDetails.cs
new file mode 100644
index 0000000..1ecfca2
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Models/FunctionDetails.cs
@@ -0,0 +1,21 @@
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+{
+ public class FunctionDetails
+ {
+ public string Name { get; }
+ public string Arguments { get; }
+ public string ReturnType { get; }
+
+ public FunctionDetails(string name, string arguments, string returnType)
+ {
+ Name = name;
+ Arguments = arguments;
+ ReturnType = returnType;
+ }
+
+ public override string ToString()
+ {
+ return $"Name:{Name},Arguments:{Arguments};ReturnType:[{string.Join(",", ReturnType)}]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Models/ServiceInfo.cs b/src/Signalr.Hubs.TypescriptGenerator/Models/ServiceInfo.cs
new file mode 100644
index 0000000..e57e5bb
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Models/ServiceInfo.cs
@@ -0,0 +1,30 @@
+using System.Collections.Generic;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+{
+ public class ServiceInfo
+ {
+ public string ModuleName { get; }
+ public string InterfaceName { get; }
+ public string ClientType { get; }
+
+ public string ServerType { get; }
+ public string ServerTypeFullNamespace { get; }
+ public List ServerFunctions { get; }
+
+ public ServiceInfo(string moduleName, string interfaceName, string clientType, string serverType, string serverTypeFullNamespace, List serverFunctions)
+ {
+ ModuleName = moduleName;
+ InterfaceName = interfaceName;
+ ClientType = clientType;
+ ServerType = serverType;
+ ServerTypeFullNamespace = serverTypeFullNamespace;
+ ServerFunctions = serverFunctions;
+ }
+
+ public override string ToString()
+ {
+ return $"ModuleName:{ModuleName},InterfaceName:{InterfaceName},ClientType:{ClientType}";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Models/TypeInfo.cs b/src/Signalr.Hubs.TypescriptGenerator/Models/TypeInfo.cs
new file mode 100644
index 0000000..8d37e69
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Models/TypeInfo.cs
@@ -0,0 +1,19 @@
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+{
+ public class TypeInfo
+ {
+ public string Name { get; }
+ public string TypeScriptType { get; }
+
+ public TypeInfo(string name, string typescriptType)
+ {
+ Name = name;
+ TypeScriptType = typescriptType;
+ }
+
+ public override string ToString()
+ {
+ return $"Name:{Name},TypeScriptType:{TypeScriptType}]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Models/TypesModel.cs b/src/Signalr.Hubs.TypescriptGenerator/Models/TypesModel.cs
new file mode 100644
index 0000000..21f9d31
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Models/TypesModel.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+{
+ public class TypesModel
+ {
+ public List Hubs { get; }
+ public List ServiceContracts { get; }
+ public List Clients { get; }
+ public List DataContracts { get; }
+ public List Enums { get; }
+
+ public DateTime LastGenerated => DateTime.UtcNow;
+
+ public TypesModel(List hubs, List serviceContracts, List clients, List dataContracts, List enums)
+ {
+ Hubs = hubs;
+ ServiceContracts = serviceContracts;
+ Clients = clients;
+ DataContracts = dataContracts;
+ Enums = enums;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Properties/AssemblyInfo.cs b/src/Signalr.Hubs.TypescriptGenerator/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..e9d330d
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Properties/AssemblyInfo.cs
@@ -0,0 +1,12 @@
+using System.Reflection;
+
+[assembly: AssemblyTitle("Signalr.Hubs.TypeScriptGenerator")]
+[assembly: AssemblyDescription("Utility library for generating TypeScript hub definitions for a Signalr assembly.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Genius Sports")]
+[assembly: AssemblyProduct("Signalr.Hubs.TypeScriptGenerator")]
+[assembly: AssemblyCopyright("Copyright © Genius Sports 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyVersion("1.0.6.0")]
+[assembly: AssemblyFileVersion("1.0.6.0")]
diff --git a/src/SignalrTypescriptGenerator/SignalrTypescriptGenerator.csproj b/src/Signalr.Hubs.TypescriptGenerator/Signalr.Hubs.TypescriptGenerator.csproj
similarity index 72%
rename from src/SignalrTypescriptGenerator/SignalrTypescriptGenerator.csproj
rename to src/Signalr.Hubs.TypescriptGenerator/Signalr.Hubs.TypescriptGenerator.csproj
index e53d5f4..c57c41c 100644
--- a/src/SignalrTypescriptGenerator/SignalrTypescriptGenerator.csproj
+++ b/src/Signalr.Hubs.TypescriptGenerator/Signalr.Hubs.TypescriptGenerator.csproj
@@ -1,108 +1,108 @@
-
-
-
-
- Debug
- AnyCPU
- {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}
- Exe
- Properties
- SignalrTypescriptGenerator
- SignalrTypescriptGenerator
- v4.5.1
- 512
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\packages\CommandLineParser.2.0.275-beta\lib\net45\CommandLine.dll
- True
-
-
- ..\..\packages\Microsoft.AspNet.SignalR.Core.2.2.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll
- True
-
-
- ..\..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll
- True
-
-
- ..\..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll
- True
-
-
- ..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll
- True
-
-
- ..\..\packages\Owin.1.0\lib\net40\Owin.dll
- True
-
-
- ..\..\packages\RazorEngine.3.7.7\lib\net45\RazorEngine.dll
- True
-
-
-
-
- ..\..\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ AnyCPU
+ {C90F8C7B-213B-4CD0-A9F0-3A39634CECDE}
+ Library
+ Properties
+ GeniusSports.Signalr.Hubs.TypeScriptGenerator
+ GeniusSports.Signalr.Hubs.TypeScriptGenerator
+ v4.5
+ 512
+ true
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+ ..\..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll
+ True
+
+
+ ..\..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll
+ True
+
+
+ ..\..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll
+ True
+
+
+ ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
+ True
+
+
+ ..\..\packages\Owin.1.0\lib\net40\Owin.dll
+ True
+
+
+ ..\..\packages\RazorEngine.3.9.0\lib\net45\RazorEngine.dll
+ True
+
+
+
+
+
+ ..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/Signalr.Hubs.TypescriptGenerator.nuspec b/src/Signalr.Hubs.TypescriptGenerator/Signalr.Hubs.TypescriptGenerator.nuspec
new file mode 100644
index 0000000..1fa1015
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/Signalr.Hubs.TypescriptGenerator.nuspec
@@ -0,0 +1,17 @@
+
+
+
+ Signalr.Hubs.TypeScriptGenerator
+ $version$
+ Signalr TypeScript Hub Generator
+ Genius Sports
+ Genius Sports
+ https://github.com/geniussportsgroup/Signalr.Hubs.TypeScriptGenerator
+ false
+ Utility library for generating TypeScript hub definitions for a Signalr assembly.
+ typescript signalr hubs
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/app.config b/src/Signalr.Hubs.TypescriptGenerator/app.config
new file mode 100644
index 0000000..d973905
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/app.config
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Signalr.Hubs.TypescriptGenerator/packages.config b/src/Signalr.Hubs.TypescriptGenerator/packages.config
new file mode 100644
index 0000000..9e590c9
--- /dev/null
+++ b/src/Signalr.Hubs.TypescriptGenerator/packages.config
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/template.cshtml b/src/Signalr.Hubs.TypescriptGenerator/template.cshtml
similarity index 61%
rename from src/SignalrTypescriptGenerator/template.cshtml
rename to src/Signalr.Hubs.TypescriptGenerator/template.cshtml
index 6ff2307..2db6c89 100644
--- a/src/SignalrTypescriptGenerator/template.cshtml
+++ b/src/Signalr.Hubs.TypescriptGenerator/template.cshtml
@@ -1,86 +1,91 @@
-@using System
-@using SignalrTypescriptGenerator.Models
-@*Model is a TypesModel*@
-// Get signalr.d.ts.ts from https://github.com/borisyankov/DefinitelyTyped (or delete the reference)
-///
-///
-
-// Hubs
-interface SignalR
-{
- @foreach (TypeInfo type in Model.Hubs)
- {
- @(type.Name) : @(type.TypescriptType);
- }
-}
-
-// Service contracts
-@foreach (ServiceInfo serviceInfo in Model.ServiceContracts){
-
-declare module @serviceInfo.ModuleName
-{
-
- interface @serviceInfo.InterfaceName
- {
- server : @Raw(serviceInfo.ServerTypeFullNamespace);
- client : @Raw(serviceInfo.ClientType);
- }
-
- interface @serviceInfo.ServerType
- {
- @foreach (FunctionDetails functionDetails in serviceInfo.ServerFunctions)
- {
- @Raw(functionDetails.Name + functionDetails.Arguments) : @Raw(functionDetails.ReturnType);
- }
- }
-}
-
-}
-
-// Clients
-@foreach (ClientInfo clientInfo in Model.Clients){
-
-declare module @clientInfo.ModuleName
-{
- interface @clientInfo.InterfaceName
- {
- @foreach (FunctionDetails functionDetails in clientInfo.FunctionDetails)
- {
- @Raw(functionDetails.Name) : @Raw(functionDetails.Arguments) => void;
- }
- }
-}
-
-}
-
-// Data contracts
-@foreach (DataContractInfo dataContractInfo in Model.DataContracts){
-
-declare module @dataContractInfo.ModuleName
-{
- interface @dataContractInfo.InterfaceName
- {
- @foreach (TypeInfo property in dataContractInfo.Properties)
- {
- @Raw(property.Name) : @Raw(property.TypescriptType);
- }
- }
-}
-
-}
-
-// Enums
-@foreach (EnumInfo enumInfo in Model.Enums){
-
-declare module @enumInfo.ModuleName
-{
- enum @enumInfo.InterfaceName
- {
- @foreach (TypeInfo property in enumInfo.Properties)
- {
- @Raw(property.Name) = @Raw(property.TypescriptType),
- }
- }
-}
-
+@using System
+@using GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models
+@model GeniusSports.Signalr.Hubs.TypeScriptGenerator.Models.TypesModel
+
+/// Autogenerated at @Model.LastGenerated by https://github.com/geniussportsgroup/Signalr.Hubs.TypeScriptGenerator
+///
+///
+
+// Hubs
+interface SignalR
+{
+ @foreach (TypeInfo type in Model.Hubs)
+ {
+ @(type.Name) : @(type.TypeScriptType);
+ }
+}
+
+// Service contracts
+@foreach (ServiceInfo serviceInfo in Model.ServiceContracts){
+
+declare module @serviceInfo.ModuleName
+{
+
+ interface @serviceInfo.InterfaceName
+ {
+ server : @Raw(serviceInfo.ServerTypeFullNamespace);
+ @if (serviceInfo.ClientType == "any")
+ {
+ @Raw(" // Hub does not have a Client Interface as a generic argument - it is recommend to add one" + Environment.NewLine);
+ }
+ client : @Raw(serviceInfo.ClientType);
+ }
+
+ interface @serviceInfo.ServerType
+ {
+ @foreach (FunctionDetails functionDetails in serviceInfo.ServerFunctions)
+ {
+ @Raw(functionDetails.Name + functionDetails.Arguments) : @Raw(functionDetails.ReturnType);
+ }
+ }
+}
+
+}
+
+// Clients
+@foreach (ClientInfo clientInfo in Model.Clients){
+
+declare module @clientInfo.ModuleName
+{
+ interface @clientInfo.InterfaceName
+ {
+ @foreach (FunctionDetails functionDetails in clientInfo.FunctionDetails)
+ {
+ @Raw(functionDetails.Name) : @Raw(functionDetails.Arguments) => void;
+ }
+ }
+}
+
+}
+
+// Data contracts
+@foreach (DataContractInfo dataContractInfo in Model.DataContracts){
+
+declare module @dataContractInfo.ModuleName
+{
+ interface @dataContractInfo.InterfaceName
+ {
+ @foreach (TypeInfo property in dataContractInfo.Properties)
+ {
+ @Raw(property.Name) : @Raw(property.TypeScriptType);
+ }
+ }
+}
+
+}
+
+// Enums
+@foreach (EnumInfo enumInfo in Model.Enums){
+
+declare module @enumInfo.ModuleName
+{
+ enum @enumInfo.InterfaceName
+ {
+ @foreach (TypeInfo property in enumInfo.Properties)
+ {
+ @Raw(property.Name) = @Raw(property.TypeScriptType),
+ }
+ }
+}
+
}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/App.config b/src/SignalrTypescriptGenerator/App.config
deleted file mode 100644
index 8c18ddd..0000000
--- a/src/SignalrTypescriptGenerator/App.config
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/ClientInfo.cs b/src/SignalrTypescriptGenerator/Models/ClientInfo.cs
deleted file mode 100644
index d1ebd14..0000000
--- a/src/SignalrTypescriptGenerator/Models/ClientInfo.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Collections.Generic;
-
-namespace SignalrTypescriptGenerator.Models
-{
- public class ClientInfo
- {
- public string ModuleName { get; set; }
- public string InterfaceName { get; set; }
- public List FunctionDetails { get; set; }
-
- public ClientInfo()
- {
- FunctionDetails = new List();
- }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/DataContractInfo.cs b/src/SignalrTypescriptGenerator/Models/DataContractInfo.cs
deleted file mode 100644
index 5b341b6..0000000
--- a/src/SignalrTypescriptGenerator/Models/DataContractInfo.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Collections.Generic;
-
-namespace SignalrTypescriptGenerator.Models
-{
- public class DataContractInfo
- {
- public string ModuleName { get; set; }
- public string InterfaceName { get; set; }
- public List Properties { get; set; }
-
- public DataContractInfo()
- {
- Properties = new List();
- }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/EnumInfo.cs b/src/SignalrTypescriptGenerator/Models/EnumInfo.cs
deleted file mode 100644
index 6031165..0000000
--- a/src/SignalrTypescriptGenerator/Models/EnumInfo.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Collections.Generic;
-
-namespace SignalrTypescriptGenerator.Models
-{
- public class EnumInfo
- {
- public string ModuleName { get; set; }
- public string InterfaceName { get; set; }
- public List Properties { get; set; }
-
- public EnumInfo()
- {
- Properties = new List();
- }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/FunctionDetails.cs b/src/SignalrTypescriptGenerator/Models/FunctionDetails.cs
deleted file mode 100644
index 3e13d6e..0000000
--- a/src/SignalrTypescriptGenerator/Models/FunctionDetails.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace SignalrTypescriptGenerator.Models
-{
- public class FunctionDetails
- {
- public string Name { get; set; }
- public string Arguments { get; set; }
- public string ReturnType { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/ServiceInfo.cs b/src/SignalrTypescriptGenerator/Models/ServiceInfo.cs
deleted file mode 100644
index f0d8214..0000000
--- a/src/SignalrTypescriptGenerator/Models/ServiceInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Collections.Generic;
-
-namespace SignalrTypescriptGenerator.Models
-{
- public class ServiceInfo
- {
- public string ModuleName { get; set; }
- public string InterfaceName { get; set; }
- public string ClientType { get; set; }
-
- public string ServerType { get; set; }
- public string ServerTypeFullNamespace { get; set; }
- public List ServerFunctions { get; set; }
-
- public ServiceInfo()
- {
- ServerFunctions = new List();
- }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/TypeInfo.cs b/src/SignalrTypescriptGenerator/Models/TypeInfo.cs
deleted file mode 100644
index 6b3906a..0000000
--- a/src/SignalrTypescriptGenerator/Models/TypeInfo.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace SignalrTypescriptGenerator.Models
-{
- public class TypeInfo
- {
- public string Name { get; set; }
- public string TypescriptType { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Models/TypesModel.cs b/src/SignalrTypescriptGenerator/Models/TypesModel.cs
deleted file mode 100644
index 6961be0..0000000
--- a/src/SignalrTypescriptGenerator/Models/TypesModel.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace SignalrTypescriptGenerator.Models
-{
- public class TypesModel
- {
- public List Hubs { get; set; }
- public List ServiceContracts { get; set; }
- public List Clients { get; set; }
- public List DataContracts { get; set; }
- public List Enums { get; set; }
-
- public string LastGenerated
- {
- get
- {
- return $"// Autogenerated by SignalrTypescriptGenerator.exe at {DateTime.Now}";
- }
- }
-
- public TypesModel()
- {
- Hubs = new List();
- ServiceContracts = new List();
- }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/Program.cs b/src/SignalrTypescriptGenerator/Program.cs
deleted file mode 100644
index 5fbfd7f..0000000
--- a/src/SignalrTypescriptGenerator/Program.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Security.Cryptography;
-using System.Text;
-using CommandLine;
-using RazorEngine;
-using RazorEngine.Templating;
-using SignalrTypescriptGenerator.Models;
-using Encoding = System.Text.Encoding;
-
-namespace SignalrTypescriptGenerator
-{
- class Program
- {
- static int Main(string[] args)
- {
- if (AppDomain.CurrentDomain.IsDefaultAppDomain())
- {
- return RunInNewAppDomainToAllowRazorEngineToCleanup(args);
- }
-
- try
- {
- return Parser.Default.ParseArguments(args)
- .MapResult(options =>
- {
- Run(options);
- return 0;
- },
- errors => 1);
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- return 1;
- }
- }
-
- static int RunInNewAppDomainToAllowRazorEngineToCleanup(string[] args)
- {
- var appDomain = AppDomain.CreateDomain("RazorEngine", null, AppDomain.CurrentDomain.SetupInformation);
- var exitCode = appDomain.ExecuteAssembly(Assembly.GetExecutingAssembly().Location, args);
- AppDomain.Unload(appDomain);
- return exitCode;
- }
-
- static void Run(CommandLineOptions commandLineOptions)
- {
- var signalrHelper = new SignalrHubinator(commandLineOptions.AssemblyPath);
-
- var model = new TypesModel();
- model.Hubs = signalrHelper.GetHubs();
- model.ServiceContracts = signalrHelper.GetServiceContracts();
- model.Clients = signalrHelper.GetClients();
- model.DataContracts = signalrHelper.GetDataContracts();
- model.Enums = signalrHelper.GetEnums();
-
- string template = ReadEmbeddedFile("template.cshtml");
- string outputText = Engine.Razor.RunCompile(template, "templateKey", null, model);
-
- if (!string.IsNullOrEmpty(commandLineOptions.OutFile))
- {
- if (FileHasChanged(commandLineOptions.OutFile, outputText))
- {
- outputText = model.LastGenerated + Environment.NewLine + outputText;
- File.WriteAllText(commandLineOptions.OutFile, outputText);
- }
- }
- else
- {
- outputText = model.LastGenerated + Environment.NewLine + outputText;
- Console.WriteLine(outputText);
- }
- }
-
- static bool FileHasChanged(string filename, string contents)
- {
- string currentContents = File.Exists(filename) ? File.ReadAllText(filename) : string.Empty;
-
- // Remove the timestamp
- int startIndex = currentContents.IndexOf("// Autogenerated", StringComparison.Ordinal);
- if (startIndex > -1)
- {
- int endIndex = currentContents.IndexOf(Environment.NewLine, startIndex, StringComparison.Ordinal);
- if (endIndex > startIndex)
- {
- currentContents = currentContents.Substring(endIndex + Environment.NewLine.Length);
- }
- }
-
- string currentHash = GetMd5(currentContents);
- string newHash = GetMd5(contents);
- Console.WriteLine("[SignalrTypescriptGenerator] Existing MD5 for {0}: {1}", filename, currentHash);
- Console.WriteLine("[SignalrTypescriptGenerator] New MD5: {0}", newHash);
-
- bool hashesAreDifferent = (currentHash != newHash);
- Console.WriteLine("[SignalrTypescriptGenerator] (content is {0})", hashesAreDifferent ? "different - generating new file" : "the same - skipping file generation.");
-
- return hashesAreDifferent;
- }
-
- static string GetMd5(string contents)
- {
- using (var md5 = MD5.Create())
- {
- using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(contents)))
- {
- var hash = md5.ComputeHash(memoryStream);
-
- StringBuilder result = new StringBuilder();
- foreach (byte b in hash)
- result = result.Append(b.ToString("x2"));
-
- return result.ToString();
- }
- }
- }
-
- static string ReadEmbeddedFile(string file)
- {
- string resourcePath = string.Format("{0}.{1}", typeof(Program).Namespace, file);
-
- Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourcePath);
- if (stream == null)
- throw new InvalidOperationException(string.Format("Unable to find '{0}' as an embedded resource", resourcePath));
-
- string textContent = "";
- using (StreamReader reader = new StreamReader(stream))
- {
- textContent = reader.ReadToEnd();
- }
-
- return textContent;
- }
- }
-}
diff --git a/src/SignalrTypescriptGenerator/SignalrHubinator.cs b/src/SignalrTypescriptGenerator/SignalrHubinator.cs
deleted file mode 100644
index c29333c..0000000
--- a/src/SignalrTypescriptGenerator/SignalrHubinator.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using Microsoft.AspNet.SignalR;
-using Microsoft.AspNet.SignalR.Hubs;
-using SignalrTypescriptGenerator.Models;
-using TypeInfo = SignalrTypescriptGenerator.Models.TypeInfo;
-
-namespace SignalrTypescriptGenerator
-{
- internal class SignalrHubinator
- {
- private static string _assemblyRootFolder;
- private readonly TypeHelper _typeHelper;
- private DefaultHubManager _hubmanager;
-
- public SignalrHubinator(string assemblyPath)
- {
- _assemblyRootFolder = Path.GetDirectoryName(assemblyPath);
- LoadAssemblyIntoAppDomain(assemblyPath);
-
- _typeHelper = new TypeHelper();
-
- var defaultDependencyResolver = new DefaultDependencyResolver();
- _hubmanager = new DefaultHubManager(defaultDependencyResolver);
- }
-
- public TypeHelper TypeHelper
- {
- get { return _typeHelper; }
- }
-
- private static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
- {
- string assemblyPath = Path.Combine(_assemblyRootFolder, new AssemblyName(args.Name).Name + ".dll");
- if (File.Exists(assemblyPath) == false)
- return null;
-
- Assembly assembly = Assembly.LoadFrom(assemblyPath);
- return assembly;
- }
-
- private void LoadAssemblyIntoAppDomain(string assemblyPath)
- {
- AppDomain currentDomain = AppDomain.CurrentDomain;
- currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder);
- Assembly.LoadFile(assemblyPath);
- }
-
- public List GetHubs()
- {
- var items = new List();
- foreach (var hub in _hubmanager.GetHubs())
- {
- string name = hub.NameSpecified ? hub.Name : _typeHelper.FirstCharLowered(hub.Name);
- string typename = hub.HubType.FullName;
-
- items.Add(new TypeInfo() { Name = name, TypescriptType = typename });
- }
-
- return items;
- }
-
- public List GetServiceContracts()
- {
- var list = new List();
- var serviceInfo = new ServiceInfo();
-
- foreach (var hub in _hubmanager.GetHubs())
- {
- Type hubType = hub.HubType;
-
- string moduleName = hubType.Namespace;
- string interfaceName = hubType.Name;
- serviceInfo.ModuleName = moduleName;
- serviceInfo.InterfaceName = interfaceName;
-
- Type clientType = TypeHelper.ClientType(hubType);
- string clientTypeName = clientType != null ? clientType.FullName : "any";
- serviceInfo.ClientType = clientTypeName;
-
- // Server type and functions
- string serverType = hubType.Name + "Server";
- string serverFullNamespace = hubType.FullName + "Server";
- serviceInfo.ServerType = serverType;
- serviceInfo.ServerTypeFullNamespace = serverFullNamespace;
- foreach (var method in _hubmanager.GetHubMethods(hub.Name))
- {
- var ps = method.Parameters.Select(x => x.Name + " : " + TypeHelper.GetTypeContractName(x.ParameterType));
- var functionDetails = new FunctionDetails()
- {
- Name = _typeHelper.FirstCharLowered(method.Name),
- Arguments = "(" + string.Join(", ", ps) + ")",
- ReturnType = "JQueryPromise<" +TypeHelper.GetTypeContractName(method.ReturnType)+ ">"
- };
-
- serviceInfo.ServerFunctions.Add(functionDetails);
- }
-
- list.Add(serviceInfo);
- }
-
- return list;
- }
-
- public List GetClients()
- {
- var list = new List();
-
- foreach (var hub in _hubmanager.GetHubs())
- {
- Type hubType = hub.HubType;
- Type clientType = TypeHelper.ClientType(hubType);
-
- if (clientType != null)
- {
- string moduleName = clientType.Namespace;
- string interfaceName = clientType.Name;
- var clientInfo = new ClientInfo();
-
- clientInfo.ModuleName = moduleName;
- clientInfo.InterfaceName = interfaceName;
- clientInfo.FunctionDetails = TypeHelper.GetClientFunctions(hubType);
- list.Add(clientInfo);
- }
- }
-
- return list;
- }
-
- public List GetDataContracts()
- {
- var list = new List();
-
- while (_typeHelper.InterfaceTypes.Count != 0)
- {
- var type = _typeHelper.InterfaceTypes.Pop();
- var dataContractInfo = new DataContractInfo();
-
- string moduleName = type.Namespace;
- string interfaceName = _typeHelper.GenericSpecificName(type, false);
-
- dataContractInfo.ModuleName = moduleName;
- dataContractInfo.InterfaceName = interfaceName;
-
- foreach (var property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly))
- {
- string propertyName = property.Name;
- string typeName = _typeHelper.GetTypeContractName(property.PropertyType);
-
- dataContractInfo.Properties.Add(new TypeInfo() { Name = propertyName, TypescriptType = typeName });
- }
-
- list.Add(dataContractInfo);
- }
-
- return list;
- }
-
- public List GetEnums()
- {
- var list = new List();
-
- while (_typeHelper.EnumTypes.Count != 0)
- {
- var type = _typeHelper.EnumTypes.Pop();
- var enuminfo = new EnumInfo();
-
- string moduleName = type.Namespace;
- string interfaceName = _typeHelper.GenericSpecificName(type, false);
-
- enuminfo.ModuleName = moduleName;
- enuminfo.InterfaceName = interfaceName;
-
- foreach (string name in Enum.GetNames(type))
- {
- string propertyName = name;
- string typeName = string.Format("{0:D}", Enum.Parse(type, name));
-
- enuminfo.Properties.Add(new TypeInfo() { Name = propertyName, TypescriptType = typeName });
- }
-
- list.Add(enuminfo);
- }
-
- return list;
- }
- }
-}
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/SignalrTypescriptGenerator.nuspec b/src/SignalrTypescriptGenerator/SignalrTypescriptGenerator.nuspec
deleted file mode 100644
index ca0e722..0000000
--- a/src/SignalrTypescriptGenerator/SignalrTypescriptGenerator.nuspec
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- SignalrTypescriptGenerator
- $version$
- Signalr Typescript Hub Generator
- C.Small
- >C.Small
- https://github.com/yetanotherchris/SignalrTypescriptGenerator
- https://raw.githubusercontent.com/yetanotherchris/SignalrTypescriptGenerator/master/icon.png
- false
- Command line tool for generating Typescript hub definitions for a Signalr assembly.
- Breaking change: now use -a for the assembly, and -o for the file to write. See the Github project page for examples.
- C.Small Copyright 2016
- typescript signalr hubs
-
-
-
-
-
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/build-nuget.ps1 b/src/SignalrTypescriptGenerator/build-nuget.ps1
deleted file mode 100644
index 195b099..0000000
--- a/src/SignalrTypescriptGenerator/build-nuget.ps1
+++ /dev/null
@@ -1,7 +0,0 @@
-# This could be automated via appveyor
-Write-Host "Make sure you have updated the assemblyinfo file and compiled in release mode first."
-$version = Read-Host "What is the version number?"
-$apikey = Read-Host "Enter a nuget.org API key"
-
-nuget pack .\SignalrTypescriptGenerator.nuspec -Prop Configuration=Release -Version $version
-nuget push ".\SignalrTypescriptGenerator.$version.nupkg" $apikey -Source https://www.nuget.org/api/v2/package
\ No newline at end of file
diff --git a/src/SignalrTypescriptGenerator/packages.config b/src/SignalrTypescriptGenerator/packages.config
deleted file mode 100644
index b2b7d4e..0000000
--- a/src/SignalrTypescriptGenerator/packages.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file