aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs32
1 files changed, 2 insertions, 30 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs b/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs
index 501058016..6bbcd1884 100644
--- a/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs
+++ b/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/Program.cs
@@ -17,15 +17,10 @@ namespace Tango.WebClientGenerator
static void Main(string[] args)
{
//Generate PPC client.
- //GenerateWebClient<PPC.Common.Web.LoginRequest, PPC.Common.Web.LoginResponse, MachineService.Controllers.PPCController>("Tango.PPC.Common.Web", "PPCWebClientBase", PathHelper.GetSolutionFolder() + @"\PPC\Tango.PPC.Common\Web");
+ GenerateWebClient<PPC.Common.Web.LoginRequest, PPC.Common.Web.LoginResponse, MachineService.Controllers.PPCController>("Tango.PPC.Common.Web", "PPCWebClientBase", PathHelper.GetSolutionFolder() + @"\PPC\Tango.PPC.Common\Web");
//Generate Machine Studio client.
- //GenerateWebClient<MachineStudio.Common.Web.LoginRequest, MachineStudio.Common.Web.LoginResponse, MachineService.Controllers.MachineStudioController>("Tango.MachineStudio.Common.Web", "MachineStudioWebClientBase", PathHelper.GetSolutionFolder() + @"\MachineStudio\Tango.MachineStudio.Common\Web");
-
- //Generate FSE client.
- GenerateWebClientV2<FSE.Web.Messages.LoginRequest, FSE.Web.Messages.LoginResponse, MachineService.Controllers.FSEController>("Tango.FSE.BL.Web", "FSEWebClientBase", PathHelper.GetSolutionFolder() + @"\FSE\Tango.FSE.BL\Web");
-
- Console.WriteLine("Done");
+ GenerateWebClient<MachineStudio.Common.Web.LoginRequest, MachineStudio.Common.Web.LoginResponse, MachineService.Controllers.MachineStudioController>("Tango.MachineStudio.Common.Web", "MachineStudioWebClientBase", PathHelper.GetSolutionFolder() + @"\MachineStudio\Tango.MachineStudio.Common\Web");
}
private static void GenerateWebClient<TLoginRequest, TLoginResponse, TController>(String nameSpace, String name, String path) where TLoginRequest : WebRequestMessage where TLoginResponse : WebTokenResponse where TController : TangoController
@@ -50,28 +45,5 @@ namespace Tango.WebClientGenerator
String code = model.GenerateCode();
File.WriteAllText(Path.Combine(path, name + ".cs"), code);
}
-
- private static void GenerateWebClientV2<TLoginRequest, TLoginResponse, TController>(String nameSpace, String name, String path) where TLoginRequest : WebRequestMessage where TLoginResponse : WebTokenResponse where TController : TangoController
- {
- TangoWebClientv2CodeFile model = new TangoWebClientv2CodeFile();
- model.Namespace = nameSpace;
- model.ControllerName = typeof(TController).Name.Replace("Controller", "");
- model.Name = name;
- model.LoginRequest = typeof(TLoginRequest).FullName;
- model.LoginResponse = typeof(TLoginResponse).FullName;
-
- foreach (var action in typeof(TController).GetMethods().Where(x => typeof(WebResponseMessage).IsAssignableFrom(x.ReturnType) && x.Name != "Login"))
- {
- model.Actions.Add(new TangoWebClientv2CodeFile.ControllerAction()
- {
- Name = action.Name,
- Request = action.GetParameters()[0].ParameterType.FullName,
- Response = action.ReturnType.FullName,
- });
- }
-
- String code = model.GenerateCode();
- File.WriteAllText(Path.Combine(path, name + ".cs"), code);
- }
}
}