From 0e1d4a7cf2d4d278e50713063e39f867618f27f7 Mon Sep 17 00:00:00 2001 From: svatal <swata@centrum.cz> Date: Thu, 10 Aug 2017 10:29:36 +0200 Subject: [PATCH] fixed generator not to prefix native types --- .../Chrome/Overlay/HighlightQuadCommand.cs | 2 +- source/ProtocolGenerator/Program.cs | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/source/ChromeDevTools/Protocol/Chrome/Overlay/HighlightQuadCommand.cs b/source/ChromeDevTools/Protocol/Chrome/Overlay/HighlightQuadCommand.cs index 04bce85..a3d9ca4 100644 --- a/source/ChromeDevTools/Protocol/Chrome/Overlay/HighlightQuadCommand.cs +++ b/source/ChromeDevTools/Protocol/Chrome/Overlay/HighlightQuadCommand.cs @@ -14,7 +14,7 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Overlay /// <summary> /// Gets or sets Quad to highlight /// </summary> - public DOM.double[] Quad { get; set; } + public double[] Quad { get; set; } /// <summary> /// Gets or sets The highlight fill color (default: transparent). /// </summary> diff --git a/source/ProtocolGenerator/Program.cs b/source/ProtocolGenerator/Program.cs index b2f9a87..ea412f5 100644 --- a/source/ProtocolGenerator/Program.cs +++ b/source/ProtocolGenerator/Program.cs @@ -1,6 +1,4 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; @@ -139,7 +137,10 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator { itemsType = items.TypeReference; } - domainDictionary[type.Name] = domain + "." + itemsType + "[]"; + if (IsGeneratedNativeType(itemsType)) + domainDictionary[type.Name] = itemsType + "[]"; + else + domainDictionary[type.Name] = domain + "." + itemsType + "[]"; } private static void WriteProtocolClasses(DirectoryInfo directory, string ns, string domainName, IEnumerable<Type> types, IEnumerable<Command> commands, IEnumerable<Event> events) @@ -481,6 +482,20 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator } } + private static bool IsGeneratedNativeType(string propertyType) + { + switch (propertyType) + { + case "double": + case "long": + case "bool": + case "object": + return true; + default: + return false; + } + } + private static string GeneratePropertyName(string propertyName) { return ToCamelCase(propertyName); -- GitLab