File tree Expand file tree Collapse file tree 10 files changed +69
-77
lines changed Expand file tree Collapse file tree 10 files changed +69
-77
lines changed Original file line number Diff line number Diff line change 22using Newtonsoft . Json ;
33using Newtonsoft . Json . Linq ;
44
5- namespace WebIdlCSharp
5+ namespace WebIdlCSharp ;
6+
7+ public abstract class BaseWebIdlDefinition
68{
7- public abstract class BaseWebIdlDefinition
8- {
9- public string Type { get ; set ; }
10- public string Value { get ; set ; }
9+ public string Type { get ; set ; }
10+ public string Value { get ; set ; }
1111
12- public WebIdlTypeDefinition [ ] Values { get ; set ; }
12+ public WebIdlTypeDefinition [ ] Values { get ; set ; }
1313
14- public WebIdlMemberDefinition [ ] Members { get ; set ; }
14+ public WebIdlMemberDefinition [ ] Members { get ; set ; }
1515
16- [ JsonExtensionData ]
17- internal IDictionary < string , JToken > ExtraStuff { get ; set ; }
18- }
16+ [ JsonExtensionData ]
17+ internal IDictionary < string , JToken > ExtraStuff { get ; set ; }
1918}
Original file line number Diff line number Diff line change 1- namespace WebIdlCSharp
1+ namespace WebIdlCSharp ;
2+
3+ public class DetailedNameDescription
24{
3- public class DetailedNameDescription
4- {
5- public string Name { get ; set ; }
5+ public string Name { get ; set ; }
66
7- public string Escaped { get ; set ; }
8- }
7+ public string Escaped { get ; set ; }
98}
Original file line number Diff line number Diff line change 1- namespace WebIdlCSharp
1+ namespace WebIdlCSharp ;
2+
3+ public class GenericInformation
24{
3- public class GenericInformation
4- {
5- public string Value { get ; set ; }
6- }
5+ public string Value { get ; set ; }
76}
Original file line number Diff line number Diff line change 1- namespace WebIdlCSharp
1+ namespace WebIdlCSharp ;
2+
3+ public class WebIdlArgumentDefinition : BaseWebIdlDefinition
24{
3- public class WebIdlArgumentDefinition : BaseWebIdlDefinition
4- {
5- public string Name { get ; set ; }
6- public string EscapedName { get ; set ; }
5+ public string Name { get ; set ; }
6+ public string EscapedName { get ; set ; }
77
8- public WebIdlTypeReference IdlType { get ; set ; }
9- }
8+ public WebIdlTypeReference IdlType { get ; set ; }
109}
Original file line number Diff line number Diff line change 1- namespace WebIdlCSharp
1+ namespace WebIdlCSharp ;
2+
3+ public class WebIdlBodyDefinition : BaseWebIdlDefinition
24{
3- public class WebIdlBodyDefinition : BaseWebIdlDefinition
4- {
5- public DetailedNameDescription Name { get ; set ; }
5+ public DetailedNameDescription Name { get ; set ; }
66
7- public WebIdlTypeReference IdlType { get ; set ; }
7+ public WebIdlTypeReference IdlType { get ; set ; }
88
9- public WebIdlArgumentDefinition [ ] Arguments { get ; set ; }
10- }
9+ public WebIdlArgumentDefinition [ ] Arguments { get ; set ; }
1110}
Original file line number Diff line number Diff line change 33 <PropertyGroup >
44 <TargetFramework >netstandard2.0</TargetFramework >
55 <VersionPrefix >0.1.1</VersionPrefix >
6+ <LangVersion >10</LangVersion >
67 <PackageLicenseExpression >MIT</PackageLicenseExpression >
78 <Description >Library which simplify accessing to WebIDL data.</Description >
89 </PropertyGroup >
Original file line number Diff line number Diff line change 1- namespace WebIdlCSharp
1+ namespace WebIdlCSharp ;
2+
3+ public class WebIdlMemberDefinition : BaseWebIdlDefinition
24{
3- public class WebIdlMemberDefinition : BaseWebIdlDefinition
4- {
5- public string Name { get ; set ; }
5+ public string Name { get ; set ; }
66
7- public WebIdlBodyDefinition Body { get ; set ; }
7+ public WebIdlBodyDefinition Body { get ; set ; }
88
9- public WebIdlTypeReference IdlType { get ; set ; }
10- }
9+ public WebIdlTypeReference IdlType { get ; set ; }
1110}
Original file line number Diff line number Diff line change 11using Newtonsoft . Json ;
22using System . IO ;
33
4- namespace WebIdlCSharp
4+ namespace WebIdlCSharp ;
5+
6+ public static class WebIdlParser
57{
6- public static class WebIdlParser
8+ public static WebIdlTypeDefinition [ ] LoadTypesFromFile ( string fileName )
79 {
8- public static WebIdlTypeDefinition [ ] LoadTypesFromFile ( string fileName )
9- {
10- var content = File . ReadAllText ( fileName ) ;
11- var items = JsonConvert . DeserializeObject < WebIdlTypeDefinition [ ] > ( content ) ;
12- return items ;
13- }
10+ var content = File . ReadAllText ( fileName ) ;
11+ var items = JsonConvert . DeserializeObject < WebIdlTypeDefinition [ ] > ( content ) ;
12+ return items ;
1413 }
1514}
Original file line number Diff line number Diff line change 1- namespace WebIdlCSharp
1+ namespace WebIdlCSharp ;
2+
3+ public class WebIdlTypeDefinition : BaseWebIdlDefinition
24{
3- public class WebIdlTypeDefinition : BaseWebIdlDefinition
4- {
5- public string Name { get ; set ; }
5+ public string Name { get ; set ; }
66
7- public WebIdlTypeReference IdlType { get ; set ; }
7+ public WebIdlTypeReference IdlType { get ; set ; }
88
9- public WebIdlArgumentDefinition [ ] Arguments { get ; set ; }
10- }
9+ public WebIdlArgumentDefinition [ ] Arguments { get ; set ; }
1110}
Original file line number Diff line number Diff line change 22using Newtonsoft . Json ;
33using Newtonsoft . Json . Linq ;
44
5- namespace WebIdlCSharp
5+ namespace WebIdlCSharp ;
6+
7+ public class WebIdlTypeReference : BaseWebIdlDefinition
68{
7- public class WebIdlTypeReference : BaseWebIdlDefinition
8- {
9- [ JsonIgnore ]
10- public WebIdlTypeReference [ ] IdlType { get ; set ; }
9+ [ JsonIgnore ]
10+ public WebIdlTypeReference [ ] IdlType { get ; set ; }
1111
12- [ JsonIgnore ]
13- public string TypeName { get ; set ; }
12+ [ JsonIgnore ]
13+ public string TypeName { get ; set ; }
1414
15- public GenericInformation Generic { get ; set ; }
15+ public GenericInformation Generic { get ; set ; }
1616
17- [ OnDeserialized ]
18- void OnDeserialize ( StreamingContext streamingContext )
17+ [ OnDeserialized ]
18+ void OnDeserialize ( StreamingContext streamingContext )
19+ {
20+ var idlType = this . ExtraStuff [ "idlType" ] ;
21+ switch ( idlType . Type )
1922 {
20- var idlType = this . ExtraStuff [ "idlType" ] ;
21- switch ( idlType . Type )
22- {
23- case JTokenType . String :
24- this . TypeName = idlType . Value < string > ( ) ;
25- break ;
26- case JTokenType . Array :
27- this . IdlType = idlType . ToObject < WebIdlTypeReference [ ] > ( ) ;
28- break ;
29- }
23+ case JTokenType . String :
24+ this . TypeName = idlType . Value < string > ( ) ;
25+ break ;
26+ case JTokenType . Array :
27+ this . IdlType = idlType . ToObject < WebIdlTypeReference [ ] > ( ) ;
28+ break ;
3029 }
3130 }
3231}
You can’t perform that action at this time.
0 commit comments