Skip to content
Snippets Groups Projects
Commit 382be158 authored by Kevin Prudente's avatar Kevin Prudente
Browse files

Merge pull request #2 from quamotion/features/multiversion

Use strongly-typed .NET classes to generate the protocol classes
parents 6a12f9e0 2efa6e7d
No related branches found
No related tags found
No related merge requests found
Showing
with 21424 additions and 87 deletions
......@@ -2,7 +2,7 @@ using MasterDevs.ChromeDevTools;
namespace MasterDevs.ChromeDevTools.Protocol.Accessibility{
/// <summary>
///
/// Attributes which apply to widgets.
/// </summary>
public enum AXWidgetAttributes
{
......
using System.Collections.ObjectModel;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
class Command : ProtocolItem
{
public Command()
{
this.Returns = new Collection<Property>();
this.Handlers = new Collection<string>();
this.Parameters = new Collection<Property>();
}
public Collection<Property> Returns
{
get;
set;
}
public Property Error
{
get;
set;
}
public Collection<string> Handlers
{
get;
set;
}
public Collection<Property> Parameters
{
get;
set;
}
public bool async
{
get;
set;
}
public string Redirect
{
get;
set;
}
}
}
using Newtonsoft.Json;
using System.Collections.ObjectModel;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
class Domain : ProtocolItem
{
public Domain()
{
this.Types = new Collection<Type>();
this.Events = new Collection<Event>();
this.Commands = new Collection<Command>();
}
[JsonProperty(PropertyName = "domain")]
public override string Name
{
get;
set;
}
public Collection<Type> Types
{
get;
set;
}
public Collection<Command> Commands
{
get;
set;
}
public Collection<Event> Events
{
get;
set;
}
public string Availability
{
get;
set;
}
public string FeatureGuard
{
get;
set;
}
}
}
using System.Collections.ObjectModel;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
class Event : ProtocolItem
{
public Event()
{
this.Parameters = new Collection<Property>();
this.Handlers = new Collection<string>();
}
public Collection<Property> Parameters
{
get;
set;
}
public Collection<string> Handlers
{
get;
set;
}
public bool Deprecated
{
get;
set;
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -50,14 +50,43 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Command.cs" />
<Compile Include="Domain.cs" />
<Compile Include="Event.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Property.cs" />
<Compile Include="Protocol.cs" />
<Compile Include="ProtocolItem.cs" />
<Compile Include="Type.cs" />
<Compile Include="Version.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Inspector-0.1.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Inspector-1.0.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Inspector-1.1.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Inspector-iOS-7.0.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Inspector-iOS-8.0.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Inspector-iOS-9.0.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Inspector-iOS-9.3.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="protocol.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
This diff is collapsed.
using Newtonsoft.Json;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
class Property : Type
{
[JsonProperty("name")]
public override string Name
{
get;
set;
}
public bool Optional
{
get;
set;
}
}
}
using System.Collections.ObjectModel;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
class Protocol
{
public Collection<string> Compatible
{
get;
set;
}
public Version Version
{
get;
set;
}
public Collection<Domain> Domains
{
get;
set;
}
}
}
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
abstract class ProtocolItem
{
public virtual string Description
{
get;
set;
}
public virtual bool Hidden
{
get;
set;
}
public virtual string Name
{
get;
set;
}
public override string ToString()
{
return this.Name;
}
}
}
# What about these .json files?
The .json files describe the remote debugging protocol. They originate from Webkit (which Safari uses), which was forked
by Chromium (which Chrome uses).
Hence, the protocols are similar, but not the same. Plus, both Webkit and Chromium have released multiple versions of the
protocol.
## iOS
There are versions of protocol.json for iOS 7, 8, 9 and 9.3
You can find them on the:
* [Official SVN repository](http://trac.webkit.org/browser/trunk/Source/WebInspectorUI/Versions/)
* [GitHub mirror](https://github.com/WebKit/webkit/tree/master/Source/WebInspectorUI/Versions)
## Chrome
Chrome maintains three versions 0.1, 1.0 and 1.1; plus an additional "tip of the head" version simply known
as `protocol.json`.
You can find them on the:
* [Official SVN repository](https://src.chromium.org/viewvc/blink/trunk/Source/devtools/)
* [GitHub mirror](https://github.com/nwjs/blink/tree/nw12/Source/devtools)
\ No newline at end of file
using Newtonsoft.Json;
using System.Collections.ObjectModel;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
class Type : ProtocolItem
{
public Type()
{
this.Enum = new Collection<string>();
this.Properties = new Collection<Property>();
}
[JsonProperty(PropertyName = "Id")]
public override string Name
{
get;
set;
}
[JsonProperty(PropertyName ="type")]
public string Kind
{
get;
set;
}
public Collection<string> Enum
{
get;
set;
}
public Collection<Property> Properties
{
get;
set;
}
public Type Items
{
get;
set;
}
public int MinItems
{
get;
set;
}
public int MaxItems
{
get;
set;
}
[JsonProperty("$ref")]
public string TypeReference
{
get;
set;
}
}
}
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{
class Version
{
public string Major
{
get;
set;
}
public string Minor
{
get;
set;
}
public override string ToString()
{
return $"{this.Major}.{this.Minor}";
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment