@@ -110,11 +110,11 @@ public static async Task<DeviceOsInfo> GetDeviceOsInfoAsync(DeviceInfo targetDev
110
110
return await GetDeviceOsInfoAsync ( targetDevice ) ;
111
111
}
112
112
113
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
113
+ Debug . LogError ( response . ResponseBody ) ;
114
114
return null ;
115
115
}
116
116
117
- return JsonUtility . FromJson < DeviceOsInfo > ( await response . GetResponseBody ( ) ) ;
117
+ return JsonUtility . FromJson < DeviceOsInfo > ( response . ResponseBody ) ;
118
118
}
119
119
120
120
/// <summary>
@@ -136,11 +136,11 @@ public static async Task<MachineName> GetMachineNameAsync(DeviceInfo targetDevic
136
136
return await GetMachineNameAsync ( targetDevice ) ;
137
137
}
138
138
139
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
139
+ Debug . LogError ( response . ResponseBody ) ;
140
140
return null ;
141
141
}
142
142
143
- return JsonUtility . FromJson < MachineName > ( await response . GetResponseBody ( ) ) ;
143
+ return JsonUtility . FromJson < MachineName > ( response . ResponseBody ) ;
144
144
}
145
145
146
146
/// <summary>
@@ -162,11 +162,11 @@ public static async Task<BatteryInfo> GetBatteryStateAsync(DeviceInfo targetDevi
162
162
return await GetBatteryStateAsync ( targetDevice ) ;
163
163
}
164
164
165
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
165
+ Debug . LogError ( response . ResponseBody ) ;
166
166
return null ;
167
167
}
168
168
169
- return JsonUtility . FromJson < BatteryInfo > ( await response . GetResponseBody ( ) ) ;
169
+ return JsonUtility . FromJson < BatteryInfo > ( response . ResponseBody ) ;
170
170
}
171
171
172
172
/// <summary>
@@ -190,7 +190,7 @@ public static async Task<PowerStateInfo> GetPowerStateAsync(DeviceInfo targetDev
190
190
return null ;
191
191
}
192
192
193
- return JsonUtility . FromJson < PowerStateInfo > ( await response . GetResponseBody ( ) ) ;
193
+ return JsonUtility . FromJson < PowerStateInfo > ( response . ResponseBody ) ;
194
194
}
195
195
196
196
/// <summary>
@@ -220,7 +220,7 @@ public static async Task<bool> RestartAsync(DeviceInfo targetDevice)
220
220
continue ;
221
221
}
222
222
223
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
223
+ Debug . LogError ( response . ResponseBody ) ;
224
224
return false ;
225
225
}
226
226
@@ -235,7 +235,7 @@ public static async Task<bool> RestartAsync(DeviceInfo targetDevice)
235
235
await RestartAsync ( targetDevice ) ;
236
236
}
237
237
238
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
238
+ Debug . LogError ( response . ResponseBody ) ;
239
239
return false ;
240
240
}
241
241
@@ -257,7 +257,7 @@ public static async Task<bool> ShutdownAsync(DeviceInfo targetDevice)
257
257
return await ShutdownAsync ( targetDevice ) ;
258
258
}
259
259
260
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
260
+ Debug . LogError ( response . ResponseBody ) ;
261
261
return false ;
262
262
}
263
263
@@ -298,7 +298,7 @@ public static async Task<bool> IsAppRunningAsync(string packageName, DeviceInfo
298
298
299
299
if ( response . Successful )
300
300
{
301
- var processList = JsonUtility . FromJson < ProcessList > ( await response . GetResponseBody ( ) ) ;
301
+ var processList = JsonUtility . FromJson < ProcessList > ( response . ResponseBody ) ;
302
302
for ( int i = 0 ; i < processList . Processes . Length ; ++ i )
303
303
{
304
304
if ( processList . Processes [ i ] . ImageName . Contains ( appInfo . Name ) )
@@ -315,7 +315,7 @@ public static async Task<bool> IsAppRunningAsync(string packageName, DeviceInfo
315
315
return await IsAppRunningAsync ( packageName , targetDevice , appInfo ) ;
316
316
}
317
317
318
- Debug . LogError ( $ "{ await response . GetResponseBody ( ) } ") ;
318
+ Debug . LogError ( $ "{ response . ResponseBody } ") ;
319
319
return false ;
320
320
}
321
321
@@ -358,11 +358,11 @@ public static async Task<InstalledApps> GetAllInstalledAppsAsync(DeviceInfo targ
358
358
return await GetAllInstalledAppsAsync ( targetDevice ) ;
359
359
}
360
360
361
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
361
+ Debug . LogError ( response . ResponseBody ) ;
362
362
return null ;
363
363
}
364
364
365
- return JsonUtility . FromJson < InstalledApps > ( await response . GetResponseBody ( ) ) ;
365
+ return JsonUtility . FromJson < InstalledApps > ( response . ResponseBody ) ;
366
366
}
367
367
368
368
/// <summary>
@@ -485,7 +485,7 @@ private static async Task<AppInstallStatus> GetInstallStatusAsync(DeviceInfo tar
485
485
486
486
if ( response . Successful )
487
487
{
488
- var status = JsonUtility . FromJson < InstallStatus > ( await response . GetResponseBody ( ) ) ;
488
+ var status = JsonUtility . FromJson < InstallStatus > ( response . ResponseBody ) ;
489
489
490
490
if ( status == null )
491
491
{
@@ -545,7 +545,7 @@ public static async Task<bool> UninstallAppAsync(string packageName, DeviceInfo
545
545
}
546
546
547
547
Debug . LogError ( $ "Failed to uninstall { packageName } on { targetDevice . ToString ( ) } ") ;
548
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
548
+ Debug . LogError ( response . ResponseBody ) ;
549
549
return false ;
550
550
}
551
551
@@ -582,7 +582,7 @@ public static async Task<bool> LaunchAppAsync(string packageName, DeviceInfo tar
582
582
return await LaunchAppAsync ( packageName , targetDevice ) ;
583
583
}
584
584
585
- Debug . LogError ( $ "{ response . ResponseCode } |{ await response . GetResponseBody ( ) } ") ;
585
+ Debug . LogError ( $ "{ response . ResponseCode } |{ response . ResponseBody } ") ;
586
586
return false ;
587
587
}
588
588
@@ -624,7 +624,7 @@ public static async Task<bool> StopAppAsync(string packageName, DeviceInfo targe
624
624
return await StopAppAsync ( packageName , targetDevice ) ;
625
625
}
626
626
627
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
627
+ Debug . LogError ( response . ResponseBody ) ;
628
628
return false ;
629
629
}
630
630
@@ -666,11 +666,11 @@ public static async Task<string> DownloadLogFileAsync(string packageName, Device
666
666
return await DownloadLogFileAsync ( packageName , targetDevice ) ;
667
667
}
668
668
669
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
669
+ Debug . LogError ( response . ResponseBody ) ;
670
670
return string . Empty ;
671
671
}
672
672
673
- File . WriteAllText ( logFile , await response . GetResponseBody ( ) ) ;
673
+ File . WriteAllText ( logFile , response . ResponseBody ) ;
674
674
return logFile ;
675
675
676
676
}
@@ -694,11 +694,11 @@ public static async Task<IpConfigInfo> GetIpConfigInfoAsync(DeviceInfo targetDev
694
694
return await GetIpConfigInfoAsync ( targetDevice ) ;
695
695
}
696
696
697
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
697
+ Debug . LogError ( response . ResponseBody ) ;
698
698
return null ;
699
699
}
700
700
701
- return JsonUtility . FromJson < IpConfigInfo > ( await response . GetResponseBody ( ) ) ;
701
+ return JsonUtility . FromJson < IpConfigInfo > ( response . ResponseBody ) ;
702
702
}
703
703
704
704
/// <summary>
@@ -721,11 +721,11 @@ public static async Task<AvailableWiFiNetworks> GetAvailableWiFiNetworksAsync(De
721
721
return await GetAvailableWiFiNetworksAsync ( targetDevice , interfaceInfo ) ;
722
722
}
723
723
724
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
724
+ Debug . LogError ( response . ResponseBody ) ;
725
725
return null ;
726
726
}
727
727
728
- return JsonUtility . FromJson < AvailableWiFiNetworks > ( await response . GetResponseBody ( ) ) ;
728
+ return JsonUtility . FromJson < AvailableWiFiNetworks > ( response . ResponseBody ) ;
729
729
}
730
730
731
731
/// <summary>
@@ -766,11 +766,11 @@ public static async Task<NetworkInterfaces> GetWiFiNetworkInterfacesAsync(Device
766
766
return await GetWiFiNetworkInterfacesAsync ( targetDevice ) ;
767
767
}
768
768
769
- Debug . LogError ( await response . GetResponseBody ( ) ) ;
769
+ Debug . LogError ( response . ResponseBody ) ;
770
770
return null ;
771
771
}
772
772
773
- return JsonUtility . FromJson < NetworkInterfaces > ( await response . GetResponseBody ( ) ) ;
773
+ return JsonUtility . FromJson < NetworkInterfaces > ( response . ResponseBody ) ;
774
774
}
775
775
776
776
/// <summary>
@@ -827,17 +827,17 @@ public static async Task<bool> EnsureAuthenticationAsync(DeviceInfo targetDevice
827
827
{
828
828
// If null, authentication succeeded but we had no cookie token in the response.
829
829
// This usually means Unity has a cached token, so it can be ignored.
830
- if ( await response . GetResponseBody ( ) != null )
830
+ if ( response . ResponseBody != null )
831
831
{
832
- targetDevice . CsrfToken = await response . GetResponseBody ( ) ;
832
+ targetDevice . CsrfToken = response . ResponseBody ;
833
833
834
834
// Strip the beginning of the cookie header
835
835
targetDevice . CsrfToken = targetDevice . CsrfToken . Replace ( "CSRF-Token=" , string . Empty ) ;
836
836
}
837
837
}
838
838
else
839
839
{
840
- Debug . LogError ( $ "Authentication failed! { await response . GetResponseBody ( ) } ") ;
840
+ Debug . LogError ( $ "Authentication failed! { response . ResponseBody } ") ;
841
841
}
842
842
843
843
if ( ! string . IsNullOrEmpty ( targetDevice . CsrfToken ) )
@@ -898,15 +898,12 @@ private static async Task<Response> DevicePortalAuthorizationAsync(DeviceInfo ta
898
898
}
899
899
900
900
string responseHeaders = webRequest . GetResponseHeaders ( ) . Aggregate ( string . Empty , ( current , header ) => $ "\n { header . Key } : { header . Value } ") ;
901
-
902
- byte [ ] downloadHandlerData = webRequest . downloadHandler ? . data ;
903
- string downloadHandlerText = await ResponseUtils . BytesToString ( downloadHandlerData ) ;
904
-
901
+ string downloadHandlerText = webRequest . downloadHandler ? . text ;
905
902
Debug . LogError ( $ "REST Auth Error: { responseCode } \n { downloadHandlerText } { responseHeaders } ") ;
906
- return new Response ( false , $ "{ downloadHandlerText } ", downloadHandlerData , responseCode ) ;
903
+ return new Response ( false , $ "{ downloadHandlerText } ", webRequest . downloadHandler ? . data , responseCode ) ;
907
904
}
908
905
909
- return new Response ( true , new Task < string > ( ( ) => webRequest . GetResponseHeader ( "Set-Cookie" ) ) , ( ) => webRequest . downloadHandler ? . data , responseCode ) ;
906
+ return new Response ( true , ( ) => webRequest . GetResponseHeader ( "Set-Cookie" ) , ( ) => webRequest . downloadHandler ? . data , responseCode ) ;
910
907
}
911
908
}
912
909
}
0 commit comments