From 4fda3814a13744f2b87c1c221972563da23242a8 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Tue, 12 Nov 2024 21:02:28 +0100 Subject: [PATCH] Run dart format --- vrchat_dart/tool/patch_output.dart | 19 ++++++++++++------- .../lib/src/api/files_api.dart | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/vrchat_dart/tool/patch_output.dart b/vrchat_dart/tool/patch_output.dart index bacde22..d65e190 100644 --- a/vrchat_dart/tool/patch_output.dart +++ b/vrchat_dart/tool/patch_output.dart @@ -98,21 +98,26 @@ void patchApi() { var content = file.readAsStringSync(); if (file.path.contains('files_api.dart')) { - final filesApiMapped = { - "final _path = r'/file/image';": "try {_bodyData = FormData.fromMap({'file': file, 'tag': tag, if (animationStyle != null) 'animationStyle': animationStyle, if (maskTag != null) 'maskTag': maskTag,});} catch (error, stackTrace) {", - "final _path = r'/icon';": "try {_bodyData = FormData.fromMap({'file': file});} catch (error, stackTrace) {", - "final _path = r'/gallery';": "try {_bodyData = FormData.fromMap({'file': file});} catch (error, stackTrace) {", + "final _path = r'/file/image';": + "try {\n _bodyData = FormData.fromMap({\n 'file': file,\n 'tag': tag,\n if (animationStyle != null) 'animationStyle': animationStyle,\n if (maskTag != null) 'maskTag': maskTag,\n });\n } catch (error, stackTrace) {", + "final _path = r'/icon';": + "try {\n _bodyData = FormData.fromMap({'file': file});\n } catch (error, stackTrace) {", + "final _path = r'/gallery';": + "try {\n _bodyData = FormData.fromMap({'file': file});\n } catch (error, stackTrace) {", }; - final emptyBlockRegExp = RegExp(r'try \{\} catch \(error, stackTrace\) \{'); + final emptyBlockRegExp = + RegExp(r'try \{\} catch \(error, stackTrace\) \{'); final resultContent = StringBuffer(); var currentIndex = 0; for (final emptyBlock in emptyBlockRegExp.allMatches(content)) { resultContent.write(content.substring(currentIndex, emptyBlock.start)); - final closestPathIndex = content.lastIndexOf(RegExp(r"(final _path = r'[^']+?';)"), emptyBlock.start); - final closestPath = content.substring(closestPathIndex, content.indexOf(';', closestPathIndex) + 1); + final closestPathIndex = content.lastIndexOf( + RegExp(r"(final _path = r'[^']+?';)"), emptyBlock.start); + final closestPath = content.substring( + closestPathIndex, content.indexOf(';', closestPathIndex) + 1); final replacement = filesApiMapped[closestPath] ?? ''; resultContent.write(replacement); currentIndex = emptyBlock.end; diff --git a/vrchat_dart_generated/lib/src/api/files_api.dart b/vrchat_dart_generated/lib/src/api/files_api.dart index c56a6ae..15111db 100644 --- a/vrchat_dart_generated/lib/src/api/files_api.dart +++ b/vrchat_dart_generated/lib/src/api/files_api.dart @@ -956,7 +956,9 @@ class FilesApi { dynamic _bodyData; - try {_bodyData = FormData.fromMap({'file': file});} catch (error, stackTrace) { + try { + _bodyData = FormData.fromMap({'file': file}); + } catch (error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options, @@ -1052,7 +1054,9 @@ class FilesApi { dynamic _bodyData; - try {_bodyData = FormData.fromMap({'file': file});} catch (error, stackTrace) { + try { + _bodyData = FormData.fromMap({'file': file}); + } catch (error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options, @@ -1154,7 +1158,14 @@ class FilesApi { dynamic _bodyData; - try {_bodyData = FormData.fromMap({'file': file, 'tag': tag, if (animationStyle != null) 'animationStyle': animationStyle, if (maskTag != null) 'maskTag': maskTag,});} catch (error, stackTrace) { + try { + _bodyData = FormData.fromMap({ + 'file': file, + 'tag': tag, + if (animationStyle != null) 'animationStyle': animationStyle, + if (maskTag != null) 'maskTag': maskTag, + }); + } catch (error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options,