|
1 | 1 | import 'dart:io';
|
2 | 2 |
|
3 | 3 | void main() {
|
4 |
| - final props = File('lib/src/webdav/props.csv').readAsLinesSync().map((line) => line.split(',')); |
| 4 | + final props = <String, Map<String, String>>{ |
| 5 | + 'dav': { |
| 6 | + 'getlastmodified': 'String', |
| 7 | + 'getetag': 'String', |
| 8 | + 'getcontenttype': 'String', |
| 9 | + 'getcontentlength': 'int', |
| 10 | + 'resourcetype': 'WebDavResourcetype', |
| 11 | + }, |
| 12 | + 'oc': { |
| 13 | + 'id': 'String', |
| 14 | + 'fileid': 'String', |
| 15 | + 'favorite': 'int', |
| 16 | + 'comments-href': 'String', |
| 17 | + 'comments-count': 'int', |
| 18 | + 'comments-unread': 'int', |
| 19 | + 'downloadURL': 'String', |
| 20 | + 'owner-id': 'String', |
| 21 | + 'owner-display-name': 'String', |
| 22 | + 'size': 'int', |
| 23 | + 'permissions': 'String', |
| 24 | + }, |
| 25 | + 'nc': { |
| 26 | + 'note': 'String', |
| 27 | + 'data-fingerprint': 'String', |
| 28 | + 'has-preview': 'bool', |
| 29 | + 'mount-type': 'String', |
| 30 | + 'is-encrypted': 'int', |
| 31 | + 'metadata_etag': 'String', |
| 32 | + 'upload_time': 'int', |
| 33 | + 'creation_time': 'int', |
| 34 | + 'rich-workspace': 'String', |
| 35 | + }, |
| 36 | + 'ocs': { |
| 37 | + 'share-permissions': 'int', |
| 38 | + }, |
| 39 | + 'ocm': { |
| 40 | + 'share-permissions': 'String', |
| 41 | + }, |
| 42 | + }; |
| 43 | + |
5 | 44 | final valueProps = <String>[];
|
6 | 45 | final findProps = <String>[];
|
7 | 46 | final variables = <String>[];
|
8 |
| - for (final prop in props) { |
9 |
| - final namespacePrefix = prop[0]; |
10 |
| - final namespaceVariable = convertNamespace(namespacePrefix); |
11 |
| - final type = prop[2]; |
12 |
| - final name = prop[1]; |
13 |
| - final variable = namespacePrefix + name.toLowerCase().replaceAll(RegExp('[^a-z]'), ''); |
14 |
| - valueProps.add( |
15 |
| - "@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: false,)\n final $type? $variable;", |
16 |
| - ); |
17 |
| - findProps.add( |
18 |
| - "@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: true, isSelfClosing: true,)\n final List<String?>? $variable;", |
19 |
| - ); |
20 |
| - variables.add(variable); |
| 47 | + for (final namespacePrefix in props.keys) { |
| 48 | + for (final name in props[namespacePrefix]!.keys) { |
| 49 | + final type = props[namespacePrefix]![name]!; |
| 50 | + |
| 51 | + final namespaceVariable = convertNamespace(namespacePrefix); |
| 52 | + final variable = namespacePrefix + name.toLowerCase().replaceAll(RegExp('[^a-z]'), ''); |
| 53 | + valueProps.add( |
| 54 | + "@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: false,)\n final $type? $variable;", |
| 55 | + ); |
| 56 | + findProps.add( |
| 57 | + "@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: true, isSelfClosing: true,)\n final List<String?>? $variable;", |
| 58 | + ); |
| 59 | + variables.add(variable); |
| 60 | + } |
21 | 61 | }
|
22 | 62 | File('lib/src/webdav/props.dart').writeAsStringSync(
|
23 | 63 | [
|
|
0 commit comments