diff --git a/SmartGlass.Cli/AuthenticateCommand.cs b/SmartGlass.Cli/AuthenticateCommand.cs index b50b645..667ff14 100644 --- a/SmartGlass.Cli/AuthenticateCommand.cs +++ b/SmartGlass.Cli/AuthenticateCommand.cs @@ -1,11 +1,7 @@ using System; -using System.IO; using System.Threading; using System.Threading.Tasks; using NClap.Metadata; -using NClap.Repl; - -using XboxWebApi; using XboxWebApi.Authentication; using XboxWebApi.Authentication.Model; @@ -34,12 +30,8 @@ public override async Task ExecuteAsync(CancellationToken cancel) AuthenticationService authService = new AuthenticationService(response); - authService.Authenticate(); - - using (FileStream fs = File.Open(TokenFilePath, FileMode.Create)) - { - authService.DumpToFile(fs); - } + await authService.AuthenticateAsync(); + await authService.DumpToJsonFileAsync(TokenFilePath); } catch (Exception e) { diff --git a/SmartGlass.Cli/BroadcastCommand.cs b/SmartGlass.Cli/BroadcastCommand.cs index baae198..4183416 100644 --- a/SmartGlass.Cli/BroadcastCommand.cs +++ b/SmartGlass.Cli/BroadcastCommand.cs @@ -30,14 +30,11 @@ public override async Task ExecuteAsync(CancellationToken cancel) { using (FileStream fs = File.Open(TokenFilePath, FileMode.Open)) { - AuthService = AuthenticationService.LoadFromFile(fs); - AuthService.Authenticate(); + AuthService = await AuthenticationService.LoadFromJsonFileStream(fs); + await AuthService.AuthenticateAsync(); } - using (FileStream fs = File.Open(TokenFilePath, FileMode.Create)) - { - AuthService.DumpToFile(fs); - } + await AuthService.DumpToJsonFileAsync(TokenFilePath); } Console.WriteLine($"Connecting to {Hostname}..."); diff --git a/SmartGlass.Cli/ConnectCommand.cs b/SmartGlass.Cli/ConnectCommand.cs index bd61c8a..d08af69 100644 --- a/SmartGlass.Cli/ConnectCommand.cs +++ b/SmartGlass.Cli/ConnectCommand.cs @@ -27,14 +27,11 @@ public override async Task ExecuteAsync(CancellationToken cancel) { using (FileStream fs = File.Open(TokenFilePath, FileMode.Open)) { - AuthService = AuthenticationService.LoadFromFile(fs); - AuthService.Authenticate(); + AuthService = await AuthenticationService.LoadFromJsonFileStream(fs); + await AuthService.AuthenticateAsync(); } - using (FileStream fs = File.Open(TokenFilePath, FileMode.Create)) - { - AuthService.DumpToFile(fs); - } + await AuthService.DumpToJsonFileAsync(TokenFilePath); } Console.WriteLine($"Connecting to {Hostname}..."); diff --git a/SmartGlass.Cli/SmartGlass.Cli.csproj b/SmartGlass.Cli/SmartGlass.Cli.csproj index c20b7db..fe24b80 100644 --- a/SmartGlass.Cli/SmartGlass.Cli.csproj +++ b/SmartGlass.Cli/SmartGlass.Cli.csproj @@ -7,8 +7,8 @@ - - - + + + diff --git a/SmartGlass.Tests/SmartGlass.Tests.csproj b/SmartGlass.Tests/SmartGlass.Tests.csproj index b472bfa..c43d40c 100644 --- a/SmartGlass.Tests/SmartGlass.Tests.csproj +++ b/SmartGlass.Tests/SmartGlass.Tests.csproj @@ -8,8 +8,11 @@ - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/SmartGlass/SmartGlass.csproj b/SmartGlass/SmartGlass.csproj index 5f6ee9a..8615014 100644 --- a/SmartGlass/SmartGlass.csproj +++ b/SmartGlass/SmartGlass.csproj @@ -1,6 +1,6 @@ - netstandard2.1 + netstandard2.0 OpenXbox.SmartGlass Joel Day, Team OpenXbox Xbox One SmartGlass/Arcadia client library for .NET