From f13db85eb23322d85dba52149b423c4f712dab5e Mon Sep 17 00:00:00 2001 From: Gapodo Date: Mon, 4 Dec 2023 16:37:48 +0100 Subject: [PATCH] save --- .../LANCommander.PCGamingWiki.csproj | 29 ++- .../LANCommander.PlaynitePlugin.csproj | 213 ++++-------------- .../Properties/AssemblyInfo.cs | 36 --- .../SaveController.cs | 1 + .../packages.config | 24 -- .../LANCommander.PowerShell.Tests.csproj | 141 +++--------- .../Properties/AssemblyInfo.cs | 11 - LANCommander.PowerShell.Tests/packages.config | 16 -- .../LANCommander.PowerShell.csproj | 95 ++------ .../Properties/AssemblyInfo.cs | 36 --- LANCommander.PowerShell/packages.config | 4 - LANCommander.SDK/Client.cs | 41 ++-- LANCommander.SDK/LANCommander.SDK.csproj | 27 +-- LANCommander.sln | 110 ++++----- .../FileManagerComponents/FileManager.razor | 1 - LANCommander/Controllers/ServerController.cs | 2 +- LANCommander/LANCommander.csproj | 16 +- .../Charts/NetworkDownloadRate.razor | 94 -------- .../Dashboard/Charts/NetworkUploadRate.razor | 93 -------- .../Charts/ProcessorUtilization.razor | 85 ------- LANCommander/Pages/Dashboard/Index.razor | 24 -- LANCommander/Pages/Files.razor | 3 +- LANCommander/Pages/Servers/Edit.razor | 3 +- LANCommander/Pages/Settings/Archives.razor | 3 +- LANCommander/Pages/Settings/Media.razor | 3 +- LANCommander/Pages/Settings/UserSaves.razor | 3 +- LANCommander/Services/ScriptService.cs | 2 +- 27 files changed, 214 insertions(+), 902 deletions(-) delete mode 100644 LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs delete mode 100644 LANCommander.Playnite.Extension/packages.config delete mode 100644 LANCommander.PowerShell.Tests/packages.config delete mode 100644 LANCommander.PowerShell/Properties/AssemblyInfo.cs delete mode 100644 LANCommander.PowerShell/packages.config delete mode 100644 LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor delete mode 100644 LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor delete mode 100644 LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor diff --git a/LANCommander.PCGamingWiki/LANCommander.PCGamingWiki.csproj b/LANCommander.PCGamingWiki/LANCommander.PCGamingWiki.csproj index 94bf156..4b9cbf4 100644 --- a/LANCommander.PCGamingWiki/LANCommander.PCGamingWiki.csproj +++ b/LANCommander.PCGamingWiki/LANCommander.PCGamingWiki.csproj @@ -1,16 +1,13 @@ - - - - netstandard2.0 - - - - - - - - - - - - + + + net8.0 + + + + + + + + + + \ No newline at end of file diff --git a/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj b/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj index e4332fa..25190ba 100644 --- a/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj +++ b/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj @@ -1,169 +1,46 @@ - - - - - Debug - AnyCPU - {F9EB13D4-8FD9-4095-B934-F7EC681E6901} - Library - Properties - LANCommander.PlaynitePlugin - LANCommander.PlaynitePlugin - v4.6.2 - 512 - true - true - - - true - full - false - ..\..\..\..\Games\Playnite\Extensions\LANCommander\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\rix0rrr.BeaconLib.1.0.2\lib\net40\BeaconLib.dll - - - ..\packages\ByteSize.2.1.1\lib\net45\ByteSize.dll - - - ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll - - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - - ..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll - - - ..\packages\PlayniteSDK.6.10.0\lib\net462\Playnite.SDK.dll - - - - - ..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll - - - ..\packages\SharpCompress.0.34.2\lib\net462\SharpCompress.dll - - - - ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - - - - ..\packages\PowerShellStandard.Library.5.1.1\lib\net452\System.Management.Automation.dll - - - ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - - ..\packages\System.Text.Encoding.CodePages.8.0.0\lib\net462\System.Text.Encoding.CodePages.dll - - - ..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll - - - ..\packages\System.Text.Json.8.0.0\lib\net462\System.Text.Json.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll - - - ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll - - - - - - - - - - - - ..\packages\YamlDotNet.5.4.0\lib\net45\YamlDotNet.dll - True - - - ..\packages\ZstdSharp.Port.0.7.2\lib\net461\ZstdSharp.dll - - - - - - - - - - - - Views\LANCommanderSettingsView.xaml - - - - - Authentication.xaml - - - - - PreserveNewest - - - - PreserveNewest - - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - {807943bf-0c7d-4ed3-8393-cfee64e3138c} - LANCommander.PowerShell - - - {4c2a71fd-a30b-4d62-888a-4ef843d8e506} - LANCommander.SDK - - - - + + + net8.0-windows + Library + false + true + true + + + ..\..\..\..\Games\Playnite\Extensions\LANCommander\ + + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs b/LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs deleted file mode 100644 index 003df30..0000000 --- a/LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LANCommander.PlaynitePlugin")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LANCommander.PlaynitePlugin")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f9eb13d4-8fd9-4095-b934-f7ec681e6901")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LANCommander.Playnite.Extension/SaveController.cs b/LANCommander.Playnite.Extension/SaveController.cs index 557ee2e..2074a5f 100644 --- a/LANCommander.Playnite.Extension/SaveController.cs +++ b/LANCommander.Playnite.Extension/SaveController.cs @@ -2,6 +2,7 @@ using Playnite.SDK; using Playnite.SDK.Models; using Playnite.SDK.Plugins; +using Microsoft.AspNetCore.Mvc; namespace LANCommander.PlaynitePlugin { diff --git a/LANCommander.Playnite.Extension/packages.config b/LANCommander.Playnite.Extension/packages.config deleted file mode 100644 index b8af6d4..0000000 --- a/LANCommander.Playnite.Extension/packages.config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj b/LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj index 6abd110..39d8f21 100644 --- a/LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj +++ b/LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj @@ -1,115 +1,28 @@ - - - - - - Debug - AnyCPU - {D7069A13-F0AA-4CBF-9013-4276F130A6DD} - Library - Properties - LANCommander.PowerShell.Tests - LANCommander.PowerShell.Tests - v4.6.2 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll - - - ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - ..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll - - - ..\packages\SharpCompress.0.34.2\lib\net462\SharpCompress.dll - - - - ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - - - - ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - - ..\packages\System.Text.Encoding.CodePages.8.0.0\lib\net462\System.Text.Encoding.CodePages.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll - - - - ..\packages\YamlDotNet.5.4.0\lib\net45\YamlDotNet.dll - - - ..\packages\ZstdSharp.Port.0.7.4\lib\net462\ZstdSharp.dll - - - - - - - - - - - - - {807943bf-0c7d-4ed3-8393-cfee64e3138c} - LANCommander.PowerShell - - - {4c2a71fd-a30b-4d62-888a-4ef843d8e506} - LANCommander.SDK - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + + + net8.0-windows + false + LANCommander.PowerShell.Tests + LANCommander.PowerShell.Tests + Copyright © 2023 + 1.0.0.0 + 1.0.0.0 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs b/LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs index 82c8b70..2bc22e2 100644 --- a/LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs +++ b/LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs @@ -1,20 +1,9 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("LANCommander.PowerShell.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LANCommander.PowerShell.Tests")] -[assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("d7069a13-f0aa-4cbf-9013-4276f130a6dd")] - -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LANCommander.PowerShell.Tests/packages.config b/LANCommander.PowerShell.Tests/packages.config deleted file mode 100644 index 98b3d19..0000000 --- a/LANCommander.PowerShell.Tests/packages.config +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LANCommander.PowerShell/LANCommander.PowerShell.csproj b/LANCommander.PowerShell/LANCommander.PowerShell.csproj index b59a2f6..4dc1099 100644 --- a/LANCommander.PowerShell/LANCommander.PowerShell.csproj +++ b/LANCommander.PowerShell/LANCommander.PowerShell.csproj @@ -1,75 +1,22 @@ - - - - - Debug - AnyCPU - {807943BF-0C7D-4ED3-8393-CFEE64E3138C} - Library - Properties - LANCommander.PowerShell - LANCommander.PowerShell - v4.6.2 - 512 - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - ..\packages\PowerShellStandard.Library.5.1.1\lib\net452\System.Management.Automation.dll - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - - - - {4c2a71fd-a30b-4d62-888a-4ef843d8e506} - LANCommander.SDK - - - + + + net8.0-windows + Library + false + true + true + + + + PreserveNewest + + + + + + + + + + \ No newline at end of file diff --git a/LANCommander.PowerShell/Properties/AssemblyInfo.cs b/LANCommander.PowerShell/Properties/AssemblyInfo.cs deleted file mode 100644 index 87468b6..0000000 --- a/LANCommander.PowerShell/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LANCommander.PowerShell")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LANCommander.PowerShell")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("807943bf-0c7d-4ed3-8393-cfee64e3138c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LANCommander.PowerShell/packages.config b/LANCommander.PowerShell/packages.config deleted file mode 100644 index 411c02f..0000000 --- a/LANCommander.PowerShell/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/LANCommander.SDK/Client.cs b/LANCommander.SDK/Client.cs index d299672..d5a5760 100644 --- a/LANCommander.SDK/Client.cs +++ b/LANCommander.SDK/Client.cs @@ -48,7 +48,7 @@ namespace LANCommander.SDK var response = ApiClient.Post(request); - return response.Data; + return response; } private T PostRequest(string route) @@ -58,7 +58,7 @@ namespace LANCommander.SDK var response = ApiClient.Post(request); - return response.Data; + return response; } private T GetRequest(string route) @@ -68,7 +68,7 @@ namespace LANCommander.SDK var response = ApiClient.Get(request); - return response.Data; + return response; } private string DownloadRequest(string route, Action progressHandler, Action completeHandler) @@ -82,7 +82,7 @@ namespace LANCommander.SDK client.DownloadProgressChanged += (s, e) => progressHandler(e); client.DownloadFileCompleted += (s, e) => completeHandler(e); - client.DownloadFileAsync(new Uri($"{ApiClient.BaseUrl}{route}"), tempFile); + client.DownloadFileAsync(new Uri($"{ApiClient.Options.BaseUrl}{route}"), tempFile); return tempFile; } @@ -96,18 +96,20 @@ namespace LANCommander.SDK client.Headers.Add("Authorization", $"Bearer {Token.AccessToken}"); - var ws = client.OpenRead(new Uri($"{ApiClient.BaseUrl}{route}")); + var ws = client.OpenRead(new Uri($"{ApiClient.Options.BaseUrl}{route}")); return new TrackableStream(ws, true, Convert.ToInt64(client.ResponseHeaders["Content-Length"])); } public async Task AuthenticateAsync(string username, string password) { - var response = await ApiClient.ExecuteAsync(new RestRequest("/api/Auth", Method.POST).AddJsonBody(new AuthRequest() - { - UserName = username, - Password = password - })); + + var response = await ApiClient.ExecutePostAsync(new RestRequest("/api/Auth").AddJsonBody( + new AuthRequest() + { + UserName = username, + Password = password + })); switch (response.StatusCode) { @@ -133,7 +135,7 @@ namespace LANCommander.SDK public async Task RegisterAsync(string username, string password) { - var response = await ApiClient.ExecuteAsync(new RestRequest("/api/auth/register", Method.POST).AddJsonBody(new AuthRequest() + var response = await ApiClient.ExecutePostAsync(new RestRequest("/api/auth/register").AddJsonBody(new AuthRequest() { UserName = username, Password = password @@ -163,7 +165,7 @@ namespace LANCommander.SDK public async Task PingAsync() { - var response = await ApiClient.ExecuteAsync(new RestRequest("/api/Ping", Method.GET)); + var response = await ApiClient.ExecuteGetAsync(new RestRequest("/api/Ping")); return response.StatusCode == HttpStatusCode.OK; } @@ -177,14 +179,11 @@ namespace LANCommander.SDK var response = ApiClient.Post(request); - if (response.StatusCode != HttpStatusCode.OK) - throw new WebException(response.ErrorMessage); - Token = new AuthToken { - AccessToken = response.Data.AccessToken, - RefreshToken = response.Data.RefreshToken, - Expiration = response.Data.Expiration + AccessToken = response.AccessToken, + RefreshToken = response.RefreshToken, + Expiration = response.Expiration }; return Token; @@ -286,19 +285,19 @@ namespace LANCommander.SDK { Logger?.LogTrace("Uploading save..."); - var request = new RestRequest($"/api/Saves/Upload/{gameId}", Method.POST) + var request = new RestRequest($"/api/Saves/Upload/{gameId}", Method.Post) .AddHeader("Authorization", $"Bearer {Token.AccessToken}"); request.AddFile(gameId, data, gameId); var response = ApiClient.Post(request); - return response.Data; + return response; } public string GetMediaUrl(Media media) { - return (new Uri(ApiClient.BaseUrl, $"/api/Media/{media.Id}/Download?fileId={media.FileId}").ToString()); + return (new Uri(ApiClient.Options.BaseUrl, $"/api/Media/{media.Id}/Download?fileId={media.FileId}").ToString()); } public string GetKey(Guid id) diff --git a/LANCommander.SDK/LANCommander.SDK.csproj b/LANCommander.SDK/LANCommander.SDK.csproj index 0ffed07..f5ffe1a 100644 --- a/LANCommander.SDK/LANCommander.SDK.csproj +++ b/LANCommander.SDK/LANCommander.SDK.csproj @@ -1,15 +1,12 @@ - - - - netstandard2.0 - - - - - - - - - - - + + + net8.0 + + + + + + + + + \ No newline at end of file diff --git a/LANCommander.sln b/LANCommander.sln index f77170c..ae27d57 100644 --- a/LANCommander.sln +++ b/LANCommander.sln @@ -1,55 +1,55 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.1.32328.378 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander", "LANCommander\LANCommander.csproj", "{C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.PlaynitePlugin", "LANCommander.Playnite.Extension\LANCommander.PlaynitePlugin.csproj", "{F9EB13D4-8FD9-4095-B934-F7EC681E6901}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.SDK", "LANCommander.SDK\LANCommander.SDK.csproj", "{4C2A71FD-A30B-4D62-888A-4EF843D8E506}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.PCGamingWiki", "LANCommander.PCGamingWiki\LANCommander.PCGamingWiki.csproj", "{2436B817-4475-4E70-9BB2-E1E7866DB79F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.PowerShell", "LANCommander.PowerShell\LANCommander.PowerShell.csproj", "{807943BF-0C7D-4ED3-8393-CFEE64E3138C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.PowerShell.Tests", "LANCommander.PowerShell.Tests\LANCommander.PowerShell.Tests.csproj", "{D7069A13-F0AA-4CBF-9013-4276F130A6DD}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Release|Any CPU.Build.0 = Release|Any CPU - {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Release|Any CPU.Build.0 = Release|Any CPU - {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Release|Any CPU.Build.0 = Release|Any CPU - {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Release|Any CPU.Build.0 = Release|Any CPU - {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Release|Any CPU.Build.0 = Release|Any CPU - {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {CBA5868D-8784-40B3-8E3D-46C24FDDC425} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32328.378 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander", "LANCommander\LANCommander.csproj", "{C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.PlaynitePlugin", "LANCommander.Playnite.Extension\LANCommander.PlaynitePlugin.csproj", "{F9EB13D4-8FD9-4095-B934-F7EC681E6901}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.SDK", "LANCommander.SDK\LANCommander.SDK.csproj", "{4C2A71FD-A30B-4D62-888A-4EF843D8E506}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.PCGamingWiki", "LANCommander.PCGamingWiki\LANCommander.PCGamingWiki.csproj", "{2436B817-4475-4E70-9BB2-E1E7866DB79F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.PowerShell", "LANCommander.PowerShell\LANCommander.PowerShell.csproj", "{807943BF-0C7D-4ED3-8393-CFEE64E3138C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.PowerShell.Tests", "LANCommander.PowerShell.Tests\LANCommander.PowerShell.Tests.csproj", "{D7069A13-F0AA-4CBF-9013-4276F130A6DD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}.Release|Any CPU.Build.0 = Release|Any CPU + {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9EB13D4-8FD9-4095-B934-F7EC681E6901}.Release|Any CPU.Build.0 = Release|Any CPU + {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4C2A71FD-A30B-4D62-888A-4EF843D8E506}.Release|Any CPU.Build.0 = Release|Any CPU + {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2436B817-4475-4E70-9BB2-E1E7866DB79F}.Release|Any CPU.Build.0 = Release|Any CPU + {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Release|Any CPU.Build.0 = Release|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CBA5868D-8784-40B3-8E3D-46C24FDDC425} + EndGlobalSection +EndGlobal diff --git a/LANCommander/Components/FileManagerComponents/FileManager.razor b/LANCommander/Components/FileManagerComponents/FileManager.razor index 4f23ba3..52a40b0 100644 --- a/LANCommander/Components/FileManagerComponents/FileManager.razor +++ b/LANCommander/Components/FileManagerComponents/FileManager.razor @@ -126,7 +126,6 @@ Loading="Entries == null" OnRow="OnRow" SelectedRowsChanged="SelectedChanged" - RowSelectable="EntrySelectable" Size="@TableSize.Small"> diff --git a/LANCommander/Controllers/ServerController.cs b/LANCommander/Controllers/ServerController.cs index c7c3d6a..39cee89 100644 --- a/LANCommander/Controllers/ServerController.cs +++ b/LANCommander/Controllers/ServerController.cs @@ -41,7 +41,7 @@ namespace LANCommander.Controllers var relativePath = path.Substring(httpPath.Path.TrimStart('/').Length).Replace('/', Path.DirectorySeparatorChar).TrimStart('\\'); - var localPath = Path.Combine(httpPath.LocalPath, relativePath).TrimEnd('\\'); + var localPath = Path.Combine(httpPath.LocalPath, relativePath).TrimEnd(Path.DirectorySeparatorChar); var attrs = System.IO.File.GetAttributes(localPath); if ((attrs & FileAttributes.Directory) == FileAttributes.Directory) diff --git a/LANCommander/LANCommander.csproj b/LANCommander/LANCommander.csproj index 9829d0b..71dcfc6 100644 --- a/LANCommander/LANCommander.csproj +++ b/LANCommander/LANCommander.csproj @@ -22,17 +22,17 @@ - - - + + + - + - + @@ -45,13 +45,13 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -59,7 +59,7 @@ - + diff --git a/LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor b/LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor deleted file mode 100644 index 665c16b..0000000 --- a/LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor +++ /dev/null @@ -1,94 +0,0 @@ -@using System.Diagnostics; -@using LANCommander.Extensions; -@using AntDesign.Charts; -@using System.Collections.Concurrent; - - - - - -@code { - [Parameter] public int TimerHistory { get; set; } - [Parameter] public int TimerInterval { get; set; } - - IChartComponent? Chart; - System.Timers.Timer Timer; - bool Loading = true; - - Dictionary Data = new Dictionary(); - - ConcurrentDictionary PerformanceCounters = new ConcurrentDictionary(); - - string JsConfig = @"{ - meta: { - value: { - alias: 'Speed', - formatter: (v) => humanFileSize(v, true) + '/s' - } - } - }"; - - AreaConfig Config = new AreaConfig - { - Name = "Network Download Rate", - Padding = "auto", - SeriesField = "series", - YField = "value", - XField = "index", - Animation = false, - XAxis = new ValueCatTimeAxis - { - Visible = false - } - }; - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - if (Timer == null) - { - Timer = new System.Timers.Timer(); - - Timer.Interval = TimerInterval; - - Timer.Elapsed += async (s, e) => - { - await RefreshData(); - }; - } - - await Chart.UpdateChart(Config, null, null, JsConfig); - - Timer.Start(); - - Loading = false; - - StateHasChanged(); - } - } - - private async Task RefreshData() - { - #if WINDOWS - var category = new PerformanceCounterCategory("Network Interface"); - - foreach (var instance in category.GetInstanceNames()) - { - if (!Data.ContainsKey(instance)) - Data[instance] = new double[TimerHistory]; - - if (!PerformanceCounters.ContainsKey(instance)) - PerformanceCounters[instance] = new PerformanceCounter("Network Interface", "Bytes Received/sec", instance); - - Data[instance] = Data[instance].ShiftArrayAndInsert((double)PerformanceCounters[instance].NextValue(), TimerHistory); - } - - try - { - await Chart.ChangeData(Data.SelectMany(x => x.Value.Select((y, i) => new { value = y, index = i, series = x.Key })), true); - } - catch { } - #endif - } -} diff --git a/LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor b/LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor deleted file mode 100644 index 5ed24a4..0000000 --- a/LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor +++ /dev/null @@ -1,93 +0,0 @@ -@using System.Diagnostics; -@using LANCommander.Extensions; -@using AntDesign.Charts; -@using System.Collections.Concurrent; - - - - - -@code { - [Parameter] public int TimerHistory { get; set; } - [Parameter] public int TimerInterval { get; set; } - - IChartComponent? Chart; - System.Timers.Timer Timer; - bool Loading = true; - - Dictionary Data = new Dictionary(); - - ConcurrentDictionary PerformanceCounters = new ConcurrentDictionary(); - - string JsConfig = @"{ - meta: { - value: { - alias: 'Speed', - formatter: (v) => humanFileSize(v, true) + '/s' - } - } - }"; - - AreaConfig Config = new AreaConfig - { - Name = "Network Upload Rate", - Padding = "auto", - SeriesField = "series", - YField = "value", - XField = "index", - Animation = false, - XAxis = new ValueCatTimeAxis - { - Visible = false - } - }; - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - if (Timer == null) - { - Timer = new System.Timers.Timer(); - - Timer.Interval = TimerInterval; - - Timer.Elapsed += async (s, e) => - { - await RefreshData(); - }; - } - - await Chart.UpdateChart(Config, null, null, JsConfig); - Timer.Start(); - - Loading = false; - - StateHasChanged(); - } - } - - private async Task RefreshData() - { - #if WINDOWS - var category = new PerformanceCounterCategory("Network Interface"); - - foreach (var instance in category.GetInstanceNames()) - { - if (!Data.ContainsKey(instance)) - Data[instance] = new double[TimerHistory]; - - if (!PerformanceCounters.ContainsKey(instance)) - PerformanceCounters[instance] = new PerformanceCounter("Network Interface", "Bytes Sent/sec", instance); - - Data[instance] = Data[instance].ShiftArrayAndInsert((double)PerformanceCounters[instance].NextValue(), TimerHistory); - } - - try - { - await Chart.ChangeData(Data.SelectMany(x => x.Value.Select((y, i) => new { value = y, index = i, series = x.Key })), true); - } - catch { } - #endif - } -} diff --git a/LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor b/LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor deleted file mode 100644 index c4ccf52..0000000 --- a/LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor +++ /dev/null @@ -1,85 +0,0 @@ -@using System.Diagnostics; -@using LANCommander.Extensions; -@using AntDesign.Charts; - - - - - -@code { - [Parameter] public int TimerHistory { get; set; } - [Parameter] public int TimerInterval { get; set; } - IChartComponent? Chart; - System.Timers.Timer Timer; - bool Loading = true; - - double[] Data; - - PerformanceCounter PerformanceCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); - - string JsConfig = @"{ - meta: { - value: { - alias: '% Usage', - formatter: (v) => v + '%' - } - } - }"; - - AreaConfig Config = new AreaConfig - { - Name = "Processor Utilization", - Padding = "auto", - YField = "value", - XField = "index", - Animation = false, - IsPercent = true, - YAxis = new ValueAxis - { - Min = 0, - Max = 100 - }, - XAxis = new ValueCatTimeAxis - { - Visible = false - } - }; - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - if (Timer == null) - { - Timer = new System.Timers.Timer(); - - Timer.Interval = TimerInterval; - - Timer.Elapsed += async (s, e) => - { - await RefreshData(); - }; - } - - await Chart.UpdateChart(Config, null, null, JsConfig); - Timer.Start(); - - Loading = false; - - StateHasChanged(); - } - } - - private async Task RefreshData() - { - #if WINDOWS - Data = Data.ShiftArrayAndInsert((double)Math.Ceiling(PerformanceCounter.NextValue()), TimerHistory); - - try - { - await Chart.ChangeData(Data.Select((x, i) => new { value = x, index = i }), true); - } - catch { } - #endif - } -} diff --git a/LANCommander/Pages/Dashboard/Index.razor b/LANCommander/Pages/Dashboard/Index.razor index 57ed517..ac9f51b 100644 --- a/LANCommander/Pages/Dashboard/Index.razor +++ b/LANCommander/Pages/Dashboard/Index.razor @@ -6,30 +6,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LANCommander/Pages/Files.razor b/LANCommander/Pages/Files.razor index 7a40fa1..3a95258 100644 --- a/LANCommander/Pages/Files.razor +++ b/LANCommander/Pages/Files.razor @@ -1,9 +1,10 @@ @page "/Files" @using LANCommander.Components.FileManagerComponents +@inject IHostEnvironment Env @attribute [Authorize(Roles = "Administrator")] @code { - string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory()); + string RootPath => Env.ContentRootPath; } diff --git a/LANCommander/Pages/Servers/Edit.razor b/LANCommander/Pages/Servers/Edit.razor index 35c8b23..2420893 100644 --- a/LANCommander/Pages/Servers/Edit.razor +++ b/LANCommander/Pages/Servers/Edit.razor @@ -10,6 +10,7 @@ @inject ServerProcessService ServerProcessService @inject IMessageService MessageService @inject NavigationManager NavigationManager +@inject IHostEnvironment Env @@ -164,7 +165,7 @@ IEnumerable Games = new List(); - string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory()); + string RootPath => Env.ContentRootPath; Server Server; Guid GameId; diff --git a/LANCommander/Pages/Settings/Archives.razor b/LANCommander/Pages/Settings/Archives.razor index 72a9461..1ad136f 100644 --- a/LANCommander/Pages/Settings/Archives.razor +++ b/LANCommander/Pages/Settings/Archives.razor @@ -4,6 +4,7 @@ @layout SettingsLayout @inject SettingService SettingService @inject IMessageService MessageService +@inject IHostEnvironment Env @attribute [Authorize(Roles = "Administrator")] @@ -27,7 +28,7 @@ @code { LANCommanderSettings Settings; - string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory()); + string RootPath => Env.ContentRootPath; protected override async Task OnInitializedAsync() { diff --git a/LANCommander/Pages/Settings/Media.razor b/LANCommander/Pages/Settings/Media.razor index 005c393..15f7806 100644 --- a/LANCommander/Pages/Settings/Media.razor +++ b/LANCommander/Pages/Settings/Media.razor @@ -4,6 +4,7 @@ @layout SettingsLayout @inject SettingService SettingService @inject IMessageService MessageService +@inject IHostEnvironment Env @attribute [Authorize(Roles = "Administrator")] @@ -35,7 +36,7 @@ @code { LANCommanderSettings Settings; - string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory()); + string RootPath => Env.ContentRootPath; protected override async Task OnInitializedAsync() { diff --git a/LANCommander/Pages/Settings/UserSaves.razor b/LANCommander/Pages/Settings/UserSaves.razor index e00e81f..3bc5093 100644 --- a/LANCommander/Pages/Settings/UserSaves.razor +++ b/LANCommander/Pages/Settings/UserSaves.razor @@ -4,6 +4,7 @@ @layout SettingsLayout @inject SettingService SettingService @inject IMessageService MessageService +@inject IHostEnvironment Env @attribute [Authorize(Roles = "Administrator")] @@ -27,7 +28,7 @@ @code { LANCommanderSettings Settings; - string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory()); + string RootPath => Env.ContentRootPath; protected override async Task OnInitializedAsync() { diff --git a/LANCommander/Services/ScriptService.cs b/LANCommander/Services/ScriptService.cs index ca6db0b..95ac2fc 100644 --- a/LANCommander/Services/ScriptService.cs +++ b/LANCommander/Services/ScriptService.cs @@ -17,7 +17,7 @@ namespace LANCommander.Services return files.Select(f => { - var split = f.Split('\\'); + var split = f.Split(Path.DirectorySeparatorChar); return new Snippet() {