Compare commits
58 Commits
Author | SHA1 | Date |
---|---|---|
Pat Hartl | 5ef16fc4cc | |
Pat Hartl | db8d3e4bf6 | |
Pat Hartl | f2462c0d20 | |
Pat Hartl | b87fe92c63 | |
Pat Hartl | c735556281 | |
Pat Hartl | d4bcde9d28 | |
Pat Hartl | 920b6b26f7 | |
Pat Hartl | d31fccc9f3 | |
Pat Hartl | c48d5b5d59 | |
Pat Hartl | dfb9f51acd | |
Pat Hartl | 03b0d9da93 | |
Pat Hartl | e2883322e6 | |
Pat Hartl | 50eff6784f | |
Pat Hartl | 171f82df3e | |
Pat Hartl | 8b7be9157e | |
Pat Hartl | 96c6d58486 | |
Pat Hartl | fd6e3e56a4 | |
Pat Hartl | d4fe8db48d | |
Pat Hartl | 281353b86c | |
Pat Hartl | ba46970406 | |
Pat Hartl | 6fb77adb63 | |
Pat Hartl | b38f2b6cef | |
Pat Hartl | 7568688c97 | |
Pat Hartl | a8c62151f3 | |
Pat Hartl | 32e135de7b | |
Pat Hartl | c37095d4c4 | |
Pat Hartl | a716bafc4d | |
Pat Hartl | e4531321b1 | |
Pat Hartl | 78168e94a5 | |
Pat Hartl | 82779bcc72 | |
Pat Hartl | 7b625b2f60 | |
Pat Hartl | 74d8790ee2 | |
Pat Hartl | 745cf0cce6 | |
Pat Hartl | 7c22aaa139 | |
Pat Hartl | eb73885991 | |
Pat Hartl | ce80dfa51f | |
Pat Hartl | 349001d8f6 | |
Pat Hartl | d705b34f84 | |
Pat Hartl | 0246ee017c | |
Pat Hartl | 818160d658 | |
Pat Hartl | 035c98cd18 | |
Pat Hartl | d3e13aee9e | |
Pat Hartl | ce402cf5c1 | |
Pat Hartl | 3dbee36886 | |
Pat Hartl | 7793c9a1e8 | |
Pat Hartl | c4c25ad85b | |
Pat Hartl | 1d2f82fdef | |
Pat Hartl | a533e9ad8c | |
Pat Hartl | c3a5edbe46 | |
Pat Hartl | 8cc97f9bdb | |
Pat Hartl | 875b7b7caa | |
Pat Hartl | 6cc947b47e | |
Pat Hartl | a450ac4a18 | |
Pat Hartl | ffa24dbecc | |
Pat Hartl | d0d6701380 | |
Pat Hartl | ab67092c2f | |
Pat Hartl | d97e1f48b3 | |
Pat Hartl | 5d5e137e18 |
|
@ -38,11 +38,14 @@
|
|||
<Reference Include="ByteSize, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ByteSize.2.1.1\lib\net45\ByteSize.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Playnite.SDK, Version=6.10.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\PlayniteSDK.6.10.0\lib\net462\Playnite.SDK.dll</HintPath>
|
||||
|
@ -52,8 +55,8 @@
|
|||
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpCompress, Version=0.34.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.34.1\lib\net462\SharpCompress.dll</HintPath>
|
||||
<Reference Include="SharpCompress, Version=0.34.2.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.34.2\lib\net462\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
|
@ -74,14 +77,14 @@
|
|||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encoding.CodePages, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encoding.CodePages.7.0.0\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
|
||||
<Reference Include="System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encoding.CodePages.8.0.0\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll</HintPath>
|
||||
<Reference Include="System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.8.0.0\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
|
@ -100,6 +103,7 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="YamlDotNet, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.5.4.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ZstdSharp, Version=0.7.2.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ZstdSharp.Port.0.7.2\lib\net461\ZstdSharp.dll</HintPath>
|
||||
|
|
|
@ -339,6 +339,7 @@ namespace LANCommander.PlaynitePlugin
|
|||
|
||||
try
|
||||
{
|
||||
SaveController = new LANCommanderSaveController(this, args.Game);
|
||||
SaveController.Download(args.Game);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -358,6 +359,7 @@ namespace LANCommander.PlaynitePlugin
|
|||
|
||||
try
|
||||
{
|
||||
SaveController = new LANCommanderSaveController(this, args.Game);
|
||||
SaveController.Upload(args.Game);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -37,4 +37,14 @@ Packages:
|
|||
- Installation progress dialog now shows the download percentage and transfer speed
|
||||
- Full game download will be skipped if the game files already exist, see full release notes for more details
|
||||
- Play sessions are now recorded to the server with user ID, start time, and end time
|
||||
- Connection status now updates correctly when authenticating through addon settings
|
||||
- Connection status now updates correctly when authenticating through addon settings
|
||||
- Version: 0.3.0
|
||||
RequiredApiVersion: 6.0.0
|
||||
ReleaseDate: 2023-12-03
|
||||
PackageUrl: https://github.com/LANCommander/LANCommander/releases/download/v0.3.0/LANCommander.PlaynitePlugin_48e1bac7-e0a0-45d7-ba83-36f5e9e959fc_0_3_0.pext
|
||||
Changelog:
|
||||
- Save paths now support regex patterns (experimental)
|
||||
- Fixed redistributable archive downloading
|
||||
- Fixed redistributable scripts not being able to run as admin if marked as such
|
||||
- Fixed game save downloading
|
||||
- Fixed addon loading of YamlDotNet library
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ByteSize" version="2.1.1" targetFramework="net462" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net462" />
|
||||
<package id="NuGet.CommandLine" version="6.7.0" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.0" targetFramework="net462" />
|
||||
<package id="NuGet.CommandLine" version="6.8.0" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="PlayniteSDK" version="6.10.0" targetFramework="net462" />
|
||||
<package id="PowerShellStandard.Library" version="5.1.1" targetFramework="net462" />
|
||||
<package id="RestSharp" version="106.15.0" targetFramework="net462" />
|
||||
<package id="rix0rrr.BeaconLib" version="1.0.2" targetFramework="net462" />
|
||||
<package id="SharpCompress" version="0.34.1" targetFramework="net462" />
|
||||
<package id="SharpCompress" version="0.34.2" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Encoding.CodePages" version="7.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Json" version="7.0.3" targetFramework="net462" />
|
||||
<package id="System.Text.Encoding.CodePages" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Json" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
<package id="YamlDotNet" version="5.4.0" targetFramework="net462" />
|
||||
|
|
|
@ -39,21 +39,57 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpCompress, Version=0.34.2.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.34.2\lib\net462\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encoding.CodePages.8.0.0\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="YamlDotNet, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.5.4.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ZstdSharp, Version=0.7.4.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ZstdSharp.Port.0.7.4\lib\net462\ZstdSharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Cmdlets.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -61,6 +97,10 @@
|
|||
<Project>{807943bf-0c7d-4ed3-8393-cfee64e3138c}</Project>
|
||||
<Name>LANCommander.PowerShell</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LANCommander.SDK\LANCommander.SDK.csproj">
|
||||
<Project>{4c2a71fd-a30b-4d62-888a-4ef843d8e506}</Project>
|
||||
<Name>LANCommander.SDK</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net462" />
|
||||
<package id="MSTest.TestAdapter" version="2.2.10" targetFramework="net462" />
|
||||
<package id="MSTest.TestFramework" version="2.2.10" targetFramework="net462" />
|
||||
<package id="RestSharp" version="106.15.0" targetFramework="net462" />
|
||||
<package id="SharpCompress" version="0.34.2" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Encoding.CodePages" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="YamlDotNet" version="5.4.0" targetFramework="net462" />
|
||||
<package id="ZstdSharp.Port" version="0.7.4" targetFramework="net462" />
|
||||
</packages>
|
|
@ -20,6 +20,9 @@ namespace LANCommander.PowerShell.Cmdlets
|
|||
[Parameter]
|
||||
public int MaxLength { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public int MinLength { get; set; } = 0;
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
byte[] output;
|
||||
|
@ -27,6 +30,11 @@ namespace LANCommander.PowerShell.Cmdlets
|
|||
if (MaxLength > 0 && Input.Length > MaxLength)
|
||||
Input = Input.Substring(0, MaxLength);
|
||||
|
||||
if (MinLength > 0 && MinLength < MaxLength)
|
||||
Input = Input.PadRight(MinLength, '\0');
|
||||
else if (MinLength > 0)
|
||||
Input = Input.PadRight(MaxLength, '\0');
|
||||
|
||||
if (Utf16 && BigEndian)
|
||||
output = System.Text.Encoding.BigEndianUnicode.GetBytes(Input);
|
||||
else if (Utf16)
|
||||
|
|
Binary file not shown.
|
@ -179,34 +179,31 @@ namespace LANCommander.SDK
|
|||
Reader.Dispose();
|
||||
Stream.Dispose();
|
||||
}
|
||||
catch (ReaderCancelledException ex)
|
||||
{
|
||||
Logger?.LogTrace("User cancelled the download");
|
||||
|
||||
extractionResult.Canceled = true;
|
||||
|
||||
if (Directory.Exists(destination))
|
||||
{
|
||||
Logger?.LogTrace("Cleaning up orphaned files after cancelled install");
|
||||
|
||||
Directory.Delete(destination, true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (Reader.Cancelled)
|
||||
Logger?.LogError(ex, "Could not extract to path {Destination}", destination);
|
||||
|
||||
if (Directory.Exists(destination))
|
||||
{
|
||||
Logger?.LogTrace("User cancelled the download");
|
||||
Logger?.LogTrace("Cleaning up orphaned install files after bad install");
|
||||
|
||||
extractionResult.Canceled = true;
|
||||
|
||||
if (Directory.Exists(destination))
|
||||
{
|
||||
Logger?.LogTrace("Cleaning up orphaned files after cancelled install");
|
||||
|
||||
Directory.Delete(destination, true);
|
||||
}
|
||||
Directory.Delete(destination, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger?.LogError(ex, "Could not extract to path {Destination}", destination);
|
||||
|
||||
if (Directory.Exists(destination))
|
||||
{
|
||||
Logger?.LogTrace("Cleaning up orphaned install files after bad install");
|
||||
|
||||
Directory.Delete(destination, true);
|
||||
}
|
||||
|
||||
throw new Exception("The game archive could not be extracted, is it corrupted? Please try again");
|
||||
}
|
||||
throw new Exception("The game archive could not be extracted, is it corrupted? Please try again");
|
||||
}
|
||||
|
||||
if (!extractionResult.Canceled)
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
|
||||
|
@ -60,40 +61,35 @@ namespace LANCommander.SDK
|
|||
|
||||
ExtractFilesFromZip(tempFile, tempLocation);
|
||||
|
||||
var deserializer = new DeserializerBuilder()
|
||||
.WithNamingConvention(new PascalCaseNamingConvention())
|
||||
.Build();
|
||||
|
||||
#region Move files
|
||||
foreach (var savePath in manifest.SavePaths.Where(sp => sp.Type == "File"))
|
||||
{
|
||||
bool inInstallDir = savePath.Path.StartsWith("{InstallDir}");
|
||||
string tempSavePath = Path.Combine(tempLocation, savePath.Id.ToString());
|
||||
|
||||
var tempSavePathFile = Path.Combine(tempSavePath, savePath.Path.Replace('/', '\\').Replace("{InstallDir}\\", ""));
|
||||
|
||||
destination = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', '\\').Replace("{InstallDir}", installDirectory));
|
||||
|
||||
if (File.Exists(tempSavePathFile))
|
||||
foreach (var entry in savePath.Entries)
|
||||
{
|
||||
// Is file, move file
|
||||
if (File.Exists(destination))
|
||||
File.Delete(destination);
|
||||
var tempSavePathFile = Path.Combine(tempSavePath, entry.ArchivePath);
|
||||
|
||||
File.Move(tempSavePathFile, destination);
|
||||
}
|
||||
else if (Directory.Exists(tempSavePath))
|
||||
{
|
||||
var files = Directory.GetFiles(tempSavePath, "*", SearchOption.AllDirectories);
|
||||
destination = Environment.ExpandEnvironmentVariables(entry.ActualPath).Replace("{InstallDir}", installDirectory);
|
||||
|
||||
if (inInstallDir)
|
||||
if (File.Exists(tempSavePathFile))
|
||||
{
|
||||
if (File.Exists(destination))
|
||||
File.Delete(destination);
|
||||
|
||||
File.Move(tempSavePathFile, destination);
|
||||
}
|
||||
else if (Directory.Exists(tempSavePath))
|
||||
{
|
||||
var files = Directory.GetFiles(tempSavePath, "*", SearchOption.AllDirectories);
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
if (inInstallDir)
|
||||
{
|
||||
// Files are in the game's install directory. Move them there from the save path.
|
||||
destination = file.Replace(tempSavePath, savePath.Path.Replace('/', '\\').TrimEnd('\\').Replace("{InstallDir}", installDirectory));
|
||||
destination = file.Replace(tempSavePath, savePath.Path.Replace('/', Path.DirectorySeparatorChar).TrimEnd(Path.DirectorySeparatorChar).Replace("{InstallDir}", installDirectory));
|
||||
|
||||
if (File.Exists(destination))
|
||||
File.Delete(destination);
|
||||
|
@ -103,7 +99,7 @@ namespace LANCommander.SDK
|
|||
else
|
||||
{
|
||||
// Specified path is probably an absolute path, maybe with environment variables.
|
||||
destination = Environment.ExpandEnvironmentVariables(file.Replace(tempSavePathFile, savePath.Path.Replace('/', '\\')));
|
||||
destination = Environment.ExpandEnvironmentVariables(file.Replace(tempSavePathFile, savePath.Path.Replace('/', Path.DirectorySeparatorChar)));
|
||||
|
||||
if (File.Exists(destination))
|
||||
File.Delete(destination);
|
||||
|
@ -112,10 +108,6 @@ namespace LANCommander.SDK
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -163,31 +155,42 @@ namespace LANCommander.SDK
|
|||
#region Add files from defined paths
|
||||
foreach (var savePath in manifest.SavePaths.Where(sp => sp.Type == "File"))
|
||||
{
|
||||
var localPath = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', '\\').Replace("{InstallDir}", installDirectory));
|
||||
IEnumerable<string> localPaths;
|
||||
|
||||
if (Directory.Exists(localPath))
|
||||
if (savePath.IsRegex)
|
||||
{
|
||||
AddDirectoryToZip(archive, localPath, localPath, savePath.Id);
|
||||
var regex = new Regex(Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', '\\').Replace("{InstallDir}", installDirectory)));
|
||||
|
||||
localPaths = Directory.GetFiles(installDirectory, "*", SearchOption.AllDirectories)
|
||||
.Where(p => regex.IsMatch(p))
|
||||
.ToList();
|
||||
}
|
||||
else if (File.Exists(localPath))
|
||||
{
|
||||
archive.AddEntry(Path.Combine(savePath.Id.ToString(), savePath.Path.Replace("{InstallDir}/", "")), localPath);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
else
|
||||
localPaths = new string[] { savePath.Path };
|
||||
|
||||
#region Add files from defined paths
|
||||
foreach (var savePath in manifest.SavePaths.Where(sp => sp.Type == "File"))
|
||||
{
|
||||
var localPath = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', '\\').Replace("{InstallDir}", installDirectory));
|
||||
var entries = new List<SavePathEntry>();
|
||||
|
||||
if (Directory.Exists(localPath))
|
||||
foreach (var localPath in localPaths)
|
||||
{
|
||||
AddDirectoryToZip(archive, localPath, localPath, savePath.Id);
|
||||
}
|
||||
else if (File.Exists(localPath))
|
||||
{
|
||||
archive.AddEntry(Path.Combine(savePath.Id.ToString(), savePath.Path.Replace("{InstallDir}/", "")), localPath);
|
||||
var actualPath = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}", installDirectory));
|
||||
var relativePath = actualPath.Replace(installDirectory + Path.DirectorySeparatorChar, "");
|
||||
|
||||
if (Directory.Exists(actualPath))
|
||||
{
|
||||
AddDirectoryToZip(archive, relativePath, actualPath, savePath.Id);
|
||||
}
|
||||
else if (File.Exists(actualPath))
|
||||
{
|
||||
archive.AddEntry(Path.Combine(savePath.Id.ToString(), relativePath), actualPath);
|
||||
}
|
||||
|
||||
entries.Add(new SavePathEntry
|
||||
{
|
||||
ArchivePath = relativePath,
|
||||
ActualPath = actualPath.Replace(installDirectory, "{InstallDir}")
|
||||
});
|
||||
|
||||
savePath.Entries = entries;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -225,7 +228,11 @@ namespace LANCommander.SDK
|
|||
}
|
||||
#endregion
|
||||
|
||||
archive.AddEntry("_manifest.yml", ManifestHelper.GetPath(installDirectory));
|
||||
var tempManifest = Path.GetTempFileName();
|
||||
|
||||
File.WriteAllText(tempManifest, ManifestHelper.Serialize(manifest));
|
||||
|
||||
archive.AddEntry("_manifest.yml", tempManifest);
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
|
|
|
@ -43,13 +43,7 @@ namespace LANCommander.SDK.Helpers
|
|||
|
||||
Logger?.LogTrace("Attempting to write manifest to path {Destination}", destination);
|
||||
|
||||
var serializer = new SerializerBuilder()
|
||||
.WithNamingConvention(new PascalCaseNamingConvention())
|
||||
.Build();
|
||||
|
||||
Logger?.LogTrace("Serializing manifest");
|
||||
|
||||
var yaml = serializer.Serialize(manifest);
|
||||
var yaml = Serialize(manifest);
|
||||
|
||||
Logger?.LogTrace("Writing manifest file");
|
||||
|
||||
|
@ -58,6 +52,19 @@ namespace LANCommander.SDK.Helpers
|
|||
return destination;
|
||||
}
|
||||
|
||||
public static string Serialize(GameManifest manifest)
|
||||
{
|
||||
var serializer = new SerializerBuilder()
|
||||
.WithNamingConvention(new PascalCaseNamingConvention())
|
||||
.Build();
|
||||
|
||||
Logger?.LogTrace("Serializing manifest");
|
||||
|
||||
var yaml = serializer.Serialize(manifest);
|
||||
|
||||
return yaml;
|
||||
}
|
||||
|
||||
public static string GetPath(string installDirectory)
|
||||
{
|
||||
return Path.Combine(installDirectory, ManifestFilename);
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" />
|
||||
<PackageReference Include="RestSharp" Version="106.15.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.34.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.34.2" />
|
||||
<PackageReference Include="YamlDotNet" Version="5.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -47,5 +47,13 @@ namespace LANCommander.SDK
|
|||
public Guid Id { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Path { get; set; }
|
||||
public bool IsRegex { get; set; }
|
||||
public IEnumerable<SavePathEntry> Entries { get; set; }
|
||||
}
|
||||
|
||||
public class SavePathEntry
|
||||
{
|
||||
public string ArchivePath { get; set; }
|
||||
public string ActualPath { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace LANCommander.SDK.Models
|
|||
{
|
||||
public SavePathType Type { get; set; }
|
||||
public string Path { get; set; }
|
||||
public bool IsRegex { get; set; }
|
||||
public virtual Game Game { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace LANCommander.SDK
|
|||
var detectionScript = redistributable.Scripts.FirstOrDefault(s => s.Type == ScriptType.DetectInstall);
|
||||
detectionScriptTempFile = ScriptHelper.SaveTempScript(detectionScript);
|
||||
|
||||
var detectionResult = RunScript(detectionScriptTempFile, redistributable);
|
||||
var detectionResult = RunScript(detectionScriptTempFile, redistributable, detectionScript.RequiresAdmin);
|
||||
|
||||
// Redistributable is not installed
|
||||
if (detectionResult == 0)
|
||||
|
|
|
@ -46,15 +46,14 @@
|
|||
</SpaceItem>
|
||||
</Space>
|
||||
|
||||
<ArchiveUploader @ref="Uploader" OnArchiveUploaded="AddArchive" />
|
||||
<ArchiveUploader @ref="Uploader" GameId="GameId" RedistributableId="RedistributableId" OnArchiveUploaded="LoadData" />
|
||||
|
||||
@code {
|
||||
[Parameter] public Guid GameId { get; set; }
|
||||
[Parameter] public Guid RedistributableId { get; set; }
|
||||
[Parameter] public ICollection<Archive> Archives { get; set; }
|
||||
[Parameter] public EventCallback<ICollection<Archive>> ArchivesChanged { get; set; }
|
||||
|
||||
Archive Archive;
|
||||
ICollection<Archive> Archives { get; set; }
|
||||
|
||||
ArchiveUploader Uploader;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
@ -66,7 +65,10 @@
|
|||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Archives = await ArchiveService.Get(a => a.GameId == GameId).ToListAsync();
|
||||
if (GameId != Guid.Empty)
|
||||
Archives = await ArchiveService.Get(a => a.GameId == GameId).ToListAsync();
|
||||
else if (RedistributableId != Guid.Empty)
|
||||
Archives = await ArchiveService.Get(a => a.RedistributableId == RedistributableId).ToListAsync();
|
||||
}
|
||||
|
||||
private async Task Download(Archive archive)
|
||||
|
@ -78,27 +80,7 @@
|
|||
|
||||
private async Task UploadArchive()
|
||||
{
|
||||
if (GameId != Guid.Empty)
|
||||
Archive = new Archive() { GameId = GameId, Id = Guid.NewGuid() };
|
||||
|
||||
if (RedistributableId != Guid.Empty)
|
||||
Archive = new Archive() { RedistributableId = RedistributableId, Id = Guid.NewGuid() };
|
||||
|
||||
await Uploader.Open(Archive);
|
||||
}
|
||||
|
||||
private async Task AddArchive(Archive archive)
|
||||
{
|
||||
var lastArchive = Archives.OrderByDescending(a => a.CreatedOn).FirstOrDefault();
|
||||
|
||||
Archive = await ArchiveService.Add(archive);
|
||||
|
||||
await LoadData();
|
||||
|
||||
var settings = SettingService.GetSettings();
|
||||
|
||||
if (lastArchive != null && settings.Archives.EnablePatching)
|
||||
BackgroundJob.Enqueue<PatchArchiveBackgroundJob>(x => x.Execute(lastArchive.Id, Archive.Id));
|
||||
await Uploader.Open();
|
||||
}
|
||||
|
||||
private async Task Delete(Archive archive)
|
||||
|
@ -107,6 +89,8 @@
|
|||
{
|
||||
await ArchiveService.Delete(archive);
|
||||
|
||||
await LoadData();
|
||||
|
||||
await MessageService.Success("Archive deleted!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
@using System.Diagnostics;
|
||||
@using Hangfire;
|
||||
@using LANCommander.Jobs.Background;
|
||||
@using Microsoft.EntityFrameworkCore;
|
||||
@inject HttpClient HttpClient
|
||||
@inject NavigationManager Navigator
|
||||
@inject ArchiveService ArchiveService
|
||||
|
@ -62,7 +63,9 @@
|
|||
</Modal>
|
||||
|
||||
@code {
|
||||
[Parameter] public EventCallback<Archive> OnArchiveUploaded { get; set; }
|
||||
[Parameter] public Guid GameId { get; set; }
|
||||
[Parameter] public Guid RedistributableId { get; set; }
|
||||
[Parameter] public EventCallback<Guid> OnArchiveUploaded { get; set; }
|
||||
|
||||
Archive Archive;
|
||||
|
||||
|
@ -113,9 +116,21 @@
|
|||
File = args.File;
|
||||
}
|
||||
|
||||
public async Task Open(Archive archive)
|
||||
public async Task Open(Guid? archiveId = null)
|
||||
{
|
||||
Archive = archive;
|
||||
if (archiveId.HasValue && archiveId != Guid.Empty)
|
||||
{
|
||||
Archive = await ArchiveService.Get(archiveId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Archive = new Archive();
|
||||
|
||||
if (GameId != Guid.Empty)
|
||||
Archive.GameId = GameId;
|
||||
else if (RedistributableId != Guid.Empty)
|
||||
Archive.RedistributableId = RedistributableId;
|
||||
}
|
||||
|
||||
Visible = true;
|
||||
|
||||
|
@ -128,8 +143,8 @@
|
|||
{
|
||||
if (FileInput != null)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(archive.ObjectKey) && archive.ObjectKey != Guid.Empty.ToString())
|
||||
await JS.InvokeVoidAsync("Uploader.Init", "FileInput", archive.ObjectKey.ToString());
|
||||
if (!String.IsNullOrWhiteSpace(Archive.ObjectKey) && Archive.ObjectKey != Guid.Empty.ToString())
|
||||
await JS.InvokeVoidAsync("Uploader.Init", "FileInput", Archive.ObjectKey.ToString());
|
||||
else
|
||||
await JS.InvokeVoidAsync("Uploader.Init", "FileInput", "");
|
||||
|
||||
|
@ -163,12 +178,32 @@
|
|||
Archive.ObjectKey = objectKey.ToString();
|
||||
Archive.CompressedSize = File.Size;
|
||||
|
||||
if (Archive.Id != Guid.Empty)
|
||||
Archive = await ArchiveService.Update(Archive);
|
||||
else
|
||||
Archive = await ArchiveService.Add(Archive);
|
||||
|
||||
Visible = false;
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
Archive? lastArchive = null;
|
||||
|
||||
var settings = SettingService.GetSettings();
|
||||
|
||||
if (settings.Archives.EnablePatching)
|
||||
{
|
||||
if (Archive.GameId != Guid.Empty)
|
||||
lastArchive = await ArchiveService.Get(a => a.Id != Archive.Id && a.GameId == Archive.GameId).OrderByDescending(a => a.CreatedOn).FirstOrDefaultAsync();
|
||||
else if (Archive.RedistributableId != Guid.Empty)
|
||||
lastArchive = await ArchiveService.Get(a => a.Id != Archive.Id && a.RedistributableId == Archive.RedistributableId).OrderByDescending(a => a.CreatedOn).FirstOrDefaultAsync();
|
||||
|
||||
if (lastArchive != null && settings.Archives.EnablePatching)
|
||||
BackgroundJob.Enqueue<PatchArchiveBackgroundJob>(x => x.Execute(lastArchive.Id, Archive.Id));
|
||||
}
|
||||
|
||||
if (OnArchiveUploaded.HasDelegate)
|
||||
await OnArchiveUploaded.InvokeAsync(Archive);
|
||||
await OnArchiveUploaded.InvokeAsync(Archive.Id);
|
||||
|
||||
await MessageService.Success("Archive uploaded!");
|
||||
}
|
||||
|
|
|
@ -239,24 +239,37 @@
|
|||
|
||||
async Task<HashSet<FileManagerDirectory>> GetArchiveDirectoriesAsync(Guid archiveId)
|
||||
{
|
||||
var entries = await ArchiveService.GetContents(archiveId);
|
||||
var directories = new HashSet<FileManagerDirectory>();
|
||||
|
||||
var root = new FileManagerDirectory
|
||||
try
|
||||
{
|
||||
Name = "Root",
|
||||
Path = "",
|
||||
IsExpanded = true
|
||||
};
|
||||
var entries = await ArchiveService.GetContents(archiveId);
|
||||
var directories = new HashSet<FileManagerDirectory>();
|
||||
|
||||
root.PopulateChildren(entries);
|
||||
var root = new FileManagerDirectory
|
||||
{
|
||||
Name = "Root",
|
||||
Path = "",
|
||||
IsExpanded = true
|
||||
};
|
||||
|
||||
await ChangeDirectory(root, true);
|
||||
root.PopulateChildren(entries);
|
||||
|
||||
return new HashSet<FileManagerDirectory>
|
||||
await ChangeDirectory(root, true);
|
||||
|
||||
return new HashSet<FileManagerDirectory>
|
||||
{
|
||||
root
|
||||
};
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
root
|
||||
};
|
||||
MessageService.Error("Could not open archive! Is it missing?");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageService.Error("An unknown error occurred trying to open the archive");
|
||||
}
|
||||
|
||||
return new HashSet<FileManagerDirectory>();
|
||||
}
|
||||
|
||||
string GetEntryName(IFileManagerEntry entry)
|
||||
|
|
|
@ -4,75 +4,12 @@
|
|||
@using LANCommander.Models
|
||||
@using LANCommander.Services
|
||||
@using System.IO.Compression;
|
||||
@using Microsoft.EntityFrameworkCore;
|
||||
@inject ScriptService ScriptService
|
||||
@inject ModalService ModalService
|
||||
@inject IMessageService MessageService
|
||||
|
||||
@{
|
||||
RenderFragment Footer =
|
||||
@<Template>
|
||||
<Button OnClick="Save" Disabled="@(String.IsNullOrWhiteSpace(Script.Name))" Type="@ButtonType.Primary">Save</Button>
|
||||
<Button OnClick="Close">Close</Button>
|
||||
</Template>;
|
||||
}
|
||||
|
||||
<Modal Visible="ModalVisible" Footer="@Footer" Title="@(Script == null ? "Add Script" : "Edit Script")" OkText="@("Save")" Maximizable="false" DefaultMaximized="true" Closable="true" OnCancel="Close">
|
||||
<Form Model="@Script" Layout="@FormLayout.Vertical">
|
||||
<FormItem>
|
||||
@foreach (var group in Snippets.Select(s => s.Group).Distinct())
|
||||
{
|
||||
<Dropdown>
|
||||
<Overlay>
|
||||
<Menu>
|
||||
@foreach (var snippet in Snippets.Where(s => s.Group == group))
|
||||
{
|
||||
<MenuItem OnClick="() => InsertSnippet(snippet)">
|
||||
@snippet.Name
|
||||
</MenuItem>
|
||||
}
|
||||
</Menu>
|
||||
</Overlay>
|
||||
|
||||
<ChildContent>
|
||||
<Button Type="@ButtonType.Primary">@group</Button>
|
||||
</ChildContent>
|
||||
</Dropdown>
|
||||
}
|
||||
|
||||
@if (ArchiveId != Guid.Empty)
|
||||
{
|
||||
<Button Icon="@IconType.Outline.FolderOpen" OnClick="BrowseForPath" Type="@ButtonType.Text">Browse</Button>
|
||||
}
|
||||
|
||||
<Button Icon="@IconType.Outline.Build" OnClick="() => RegToPowerShell.Open()" Type="@ButtonType.Text">Import .reg</Button>
|
||||
</FormItem>
|
||||
|
||||
<FormItem>
|
||||
<StandaloneCodeEditor @ref="Editor" Id="editor" ConstructionOptions="EditorConstructionOptions" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="Name">
|
||||
<Input @bind-Value="@context.Name" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="Type">
|
||||
<Select @bind-Value="context.Type" TItem="ScriptType" TItemValue="ScriptType" DataSource="Enum.GetValues<ScriptType>().Where(st => AllowedTypes == null || AllowedTypes.Contains(st))">
|
||||
<LabelTemplate Context="Value">@Value.GetDisplayName()</LabelTemplate>
|
||||
<ItemTemplate Context="Value">@Value.GetDisplayName()</ItemTemplate>
|
||||
</Select>
|
||||
</FormItem>
|
||||
|
||||
<FormItem>
|
||||
<Checkbox @bind-Checked="context.RequiresAdmin">Requires Admin</Checkbox>
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="Description">
|
||||
<TextArea @bind-Value="context.Description" MaxLength=500 ShowCount />
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
<RegToPowerShell @ref="RegToPowerShell" OnParsed="(text) => InsertText(text)" />
|
||||
|
||||
<Space Direction="DirectionVHType.Vertical" Size="@("large")" Style="width: 100%">
|
||||
<SpaceItem>
|
||||
|
@ -85,8 +22,9 @@
|
|||
<ActionColumn Title="">
|
||||
<Space Style="display: flex; justify-content: end">
|
||||
<SpaceItem>
|
||||
<Button OnClick="() => Edit(context)" Icon="@IconType.Outline.Edit" Type="@ButtonType.Text" />
|
||||
|
||||
<Button OnClick="() => Edit(context.Id)" Icon="@IconType.Outline.Edit" Type="@ButtonType.Text" />
|
||||
</SpaceItem>
|
||||
<SpaceItem>
|
||||
<Popconfirm OnConfirm="() => Delete(context)" Title="Are you sure you want to delete this script?">
|
||||
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger />
|
||||
</Popconfirm>
|
||||
|
@ -115,61 +53,51 @@
|
|||
[Parameter] public Guid GameId { get; set; }
|
||||
[Parameter] public Guid RedistributableId { get; set; }
|
||||
[Parameter] public Guid ArchiveId { get; set; }
|
||||
[Parameter] public ICollection<Script> Scripts { get; set; }
|
||||
[Parameter] public EventCallback<ICollection<Script>> ScriptsChanged { get; set; }
|
||||
[Parameter] public IEnumerable<ScriptType> AllowedTypes { get; set; }
|
||||
|
||||
Script Script;
|
||||
ICollection<Script> Scripts { get; set; } = new List<Script>();
|
||||
|
||||
bool ModalVisible = false;
|
||||
|
||||
IEnumerable<Snippet> Snippets { get; set; }
|
||||
StandaloneCodeEditor? Editor;
|
||||
RegToPowerShell RegToPowerShell;
|
||||
|
||||
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
return new StandaloneEditorConstructionOptions
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (GameId != Guid.Empty)
|
||||
Scripts = await ScriptService.Get(s => s.GameId == GameId).ToListAsync();
|
||||
else if (RedistributableId != Guid.Empty)
|
||||
Scripts = await ScriptService.Get(s => s.RedistributableId == RedistributableId).ToListAsync();
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async void Edit(Guid? scriptId = null)
|
||||
{
|
||||
var modalOptions = new ModalOptions()
|
||||
{
|
||||
AutomaticLayout = true,
|
||||
Language = "powershell",
|
||||
Value = Script.Contents,
|
||||
Theme = "vs-dark",
|
||||
Title = scriptId == null ? "Add Script" : "Edit Script",
|
||||
Maximizable = false,
|
||||
DefaultMaximized = true,
|
||||
Closable = true,
|
||||
OkText = "Save"
|
||||
};
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Scripts == null)
|
||||
Scripts = new List<Script>();
|
||||
var options = new ScriptEditorOptions()
|
||||
{
|
||||
ScriptId = scriptId ?? default,
|
||||
AllowedTypes = AllowedTypes,
|
||||
ArchiveId = ArchiveId,
|
||||
GameId = GameId,
|
||||
RedistributableId = RedistributableId
|
||||
};
|
||||
|
||||
Snippets = ScriptService.GetSnippets();
|
||||
var modalRef = await ModalService.CreateModalAsync<ScriptEditorDialog, ScriptEditorOptions, Script>(modalOptions, options);
|
||||
|
||||
if (Script == null)
|
||||
Script = new Script();
|
||||
}
|
||||
|
||||
private async void Edit(Script script = null)
|
||||
{
|
||||
if (script == null) {
|
||||
if (GameId != Guid.Empty)
|
||||
Script = new Script() { GameId = GameId };
|
||||
|
||||
if (RedistributableId != Guid.Empty)
|
||||
Script = new Script() { RedistributableId = RedistributableId };
|
||||
|
||||
if (Editor != null)
|
||||
await Editor.SetValue("");
|
||||
}
|
||||
else
|
||||
Script = script;
|
||||
|
||||
if (Editor != null && Script != null)
|
||||
await Editor.SetValue(Script.Contents);
|
||||
|
||||
ModalVisible = true;
|
||||
|
||||
StateHasChanged();
|
||||
modalRef.OnOk = async (script) =>
|
||||
{
|
||||
await LoadData();
|
||||
};
|
||||
}
|
||||
|
||||
private async void Delete(Script script = null)
|
||||
|
@ -179,81 +107,4 @@
|
|||
|
||||
await MessageService.Success("Script deleted!");
|
||||
}
|
||||
|
||||
private void Close()
|
||||
{
|
||||
ModalVisible = false;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
var value = await Editor.GetValue();
|
||||
|
||||
Script.Contents = value;
|
||||
|
||||
if (Script.Id == Guid.Empty)
|
||||
Script = await ScriptService.Add(Script);
|
||||
else
|
||||
Script = await ScriptService.Update(Script);
|
||||
|
||||
Close();
|
||||
|
||||
StateHasChanged();
|
||||
|
||||
await MessageService.Success("Script saved!");
|
||||
}
|
||||
|
||||
private async Task InsertText(string text)
|
||||
{
|
||||
var line = await Editor.GetPosition();
|
||||
var range = new BlazorMonaco.Range(line.LineNumber, 1, line.LineNumber, 1);
|
||||
|
||||
var currentSelections = await Editor.GetSelections();
|
||||
|
||||
await Editor.ExecuteEdits("ScriptEditor", new List<IdentifiedSingleEditOperation>()
|
||||
{
|
||||
new IdentifiedSingleEditOperation
|
||||
{
|
||||
Range = range,
|
||||
Text = text,
|
||||
ForceMoveMarkers = true
|
||||
}
|
||||
}, currentSelections);
|
||||
}
|
||||
|
||||
private async Task InsertSnippet(Snippet snippet)
|
||||
{
|
||||
await InsertText(snippet.Content);
|
||||
}
|
||||
|
||||
private async void BrowseForPath()
|
||||
{
|
||||
var modalOptions = new ModalOptions()
|
||||
{
|
||||
Title = "Choose Reference",
|
||||
Maximizable = false,
|
||||
DefaultMaximized = true,
|
||||
Closable = true,
|
||||
OkText = "Insert File Path"
|
||||
};
|
||||
|
||||
var browserOptions = new FilePickerOptions()
|
||||
{
|
||||
ArchiveId = ArchiveId,
|
||||
Select = true,
|
||||
Multiple = false
|
||||
};
|
||||
|
||||
var modalRef = await ModalService.CreateModalAsync<FilePickerDialog, FilePickerOptions, IEnumerable<IFileManagerEntry>>(modalOptions, browserOptions);
|
||||
|
||||
modalRef.OnOk = (results) =>
|
||||
{
|
||||
var path = results.FirstOrDefault().Path;
|
||||
|
||||
InsertText($"$InstallDir\\{path.Replace('/', '\\')}");
|
||||
|
||||
StateHasChanged();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
@using LANCommander.Components.FileManagerComponents;
|
||||
@using LANCommander.Extensions;
|
||||
@using LANCommander.Data.Enums;
|
||||
@using LANCommander.Models;
|
||||
@inherits FeedbackComponent<ScriptEditorOptions, Script>
|
||||
@inject ScriptService ScriptService
|
||||
@inject ModalService ModalService
|
||||
@inject IMessageService MessageService
|
||||
|
||||
<Form Model="@Script" Layout="@FormLayout.Vertical">
|
||||
<FormItem>
|
||||
@foreach (var group in Snippets.Select(s => s.Group).Distinct())
|
||||
{
|
||||
<Dropdown>
|
||||
<Overlay>
|
||||
<Menu>
|
||||
@foreach (var snippet in Snippets.Where(s => s.Group == group))
|
||||
{
|
||||
<MenuItem OnClick="() => InsertSnippet(snippet)">
|
||||
@snippet.Name
|
||||
</MenuItem>
|
||||
}
|
||||
</Menu>
|
||||
</Overlay>
|
||||
|
||||
<ChildContent>
|
||||
<Button Type="@ButtonType.Primary">@group</Button>
|
||||
</ChildContent>
|
||||
</Dropdown>
|
||||
}
|
||||
|
||||
@if (Options.ArchiveId != Guid.Empty)
|
||||
{
|
||||
<Button Icon="@IconType.Outline.FolderOpen" OnClick="BrowseForPath" Type="@ButtonType.Text">Browse</Button>
|
||||
}
|
||||
|
||||
<Button Icon="@IconType.Outline.Build" OnClick="() => RegToPowerShell.Open()" Type="@ButtonType.Text">Import .reg</Button>
|
||||
</FormItem>
|
||||
|
||||
<FormItem>
|
||||
<StandaloneCodeEditor @ref="Editor" Id="@("editor-" + Id.ToString())" ConstructionOptions="EditorConstructionOptions" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="Name">
|
||||
<Input @bind-Value="@context.Name" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="Type">
|
||||
<Select @bind-Value="context.Type" TItem="ScriptType" TItemValue="ScriptType" DataSource="Enum.GetValues<ScriptType>().Where(st => Options.AllowedTypes == null || Options.AllowedTypes.Contains(st))">
|
||||
<LabelTemplate Context="Value">@Value.GetDisplayName()</LabelTemplate>
|
||||
<ItemTemplate Context="Value">@Value.GetDisplayName()</ItemTemplate>
|
||||
</Select>
|
||||
</FormItem>
|
||||
|
||||
<FormItem>
|
||||
<Checkbox @bind-Checked="context.RequiresAdmin">Requires Admin</Checkbox>
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="Description">
|
||||
<TextArea @bind-Value="context.Description" MaxLength=500 ShowCount />
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
||||
<RegToPowerShell @ref="RegToPowerShell" OnParsed="(text) => InsertText(text)" />
|
||||
|
||||
@code {
|
||||
Guid Id = Guid.NewGuid();
|
||||
Script Script;
|
||||
StandaloneCodeEditor? Editor;
|
||||
RegToPowerShell RegToPowerShell;
|
||||
IEnumerable<Snippet> Snippets { get; set; }
|
||||
|
||||
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
|
||||
{
|
||||
return new StandaloneEditorConstructionOptions
|
||||
{
|
||||
AutomaticLayout = true,
|
||||
Language = "powershell",
|
||||
Value = Script.Contents,
|
||||
Theme = "vs-dark",
|
||||
};
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Options.ScriptId != Guid.Empty)
|
||||
Script = await ScriptService.Get(Options.ScriptId);
|
||||
else if (Options.GameId != Guid.Empty)
|
||||
Script = new Script()
|
||||
{
|
||||
GameId = Options.GameId
|
||||
};
|
||||
else if (Options.RedistributableId != Guid.Empty)
|
||||
Script = new Script()
|
||||
{
|
||||
RedistributableId = Options.RedistributableId
|
||||
};
|
||||
|
||||
Snippets = ScriptService.GetSnippets();
|
||||
}
|
||||
|
||||
public override async Task OnFeedbackOkAsync(ModalClosingEventArgs args)
|
||||
{
|
||||
await Save();
|
||||
|
||||
Editor.Dispose();
|
||||
|
||||
await base.OkCancelRefWithResult!.OnOk(Script);
|
||||
}
|
||||
|
||||
public override async Task CancelAsync(ModalClosingEventArgs args)
|
||||
{
|
||||
Editor.Dispose();
|
||||
|
||||
await base.CancelAsync(args);
|
||||
}
|
||||
|
||||
private async void BrowseForPath()
|
||||
{
|
||||
|
||||
var modalOptions = new ModalOptions()
|
||||
{
|
||||
Title = "Choose Reference",
|
||||
Maximizable = false,
|
||||
DefaultMaximized = true,
|
||||
Closable = true,
|
||||
OkText = "Insert File Path"
|
||||
};
|
||||
|
||||
var browserOptions = new FilePickerOptions()
|
||||
{
|
||||
ArchiveId = Options.ArchiveId,
|
||||
Select = true,
|
||||
Multiple = false
|
||||
};
|
||||
|
||||
var modalRef = await ModalService.CreateModalAsync<FilePickerDialog, FilePickerOptions, IEnumerable<IFileManagerEntry>>(modalOptions, browserOptions);
|
||||
|
||||
modalRef.OnOk = (results) =>
|
||||
{
|
||||
var path = results.FirstOrDefault().Path;
|
||||
|
||||
InsertText($"$InstallDir\\{path.Replace('/', '\\')}");
|
||||
|
||||
StateHasChanged();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
}
|
||||
|
||||
private async Task InsertText(string text)
|
||||
{
|
||||
var line = await Editor.GetPosition();
|
||||
var range = new BlazorMonaco.Range(line.LineNumber, 1, line.LineNumber, 1);
|
||||
|
||||
var currentSelections = await Editor.GetSelections();
|
||||
|
||||
await Editor.ExecuteEdits("ScriptEditor", new List<IdentifiedSingleEditOperation>()
|
||||
{
|
||||
new IdentifiedSingleEditOperation
|
||||
{
|
||||
Range = range,
|
||||
Text = text,
|
||||
ForceMoveMarkers = true
|
||||
}
|
||||
}, currentSelections);
|
||||
}
|
||||
|
||||
private async Task InsertSnippet(Snippet snippet)
|
||||
{
|
||||
await InsertText(snippet.Content);
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
var value = await Editor.GetValue();
|
||||
|
||||
Script.Contents = value;
|
||||
|
||||
if (Script.Id == Guid.Empty)
|
||||
Script = await ScriptService.Add(Script);
|
||||
else
|
||||
Script = await ScriptService.Update(Script);
|
||||
|
||||
MessageService.Success("Script saved!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageService.Error("Script could not be saved!");
|
||||
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<Select Mode="tags" TItem="Guid" TItemValue="Guid" @bind-Values="@SelectedValues" OnSelectedItemsChanged="OnSelectedItemsChanged" EnableSearch>
|
||||
<SelectOptions>
|
||||
@foreach (var entity in Entities)
|
||||
@foreach (var entity in Entities.OrderBy(OptionLabelSelector))
|
||||
{
|
||||
<SelectOption TItemValue="Guid" TItem="Guid" Value="@entity.Id" Label="@OptionLabelSelector.Invoke(entity)" />
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
|
||||
if (ValuesChanged.HasDelegate)
|
||||
await ValuesChanged.InvokeAsync();
|
||||
await ValuesChanged.InvokeAsync(Values);
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,14 @@ namespace LANCommander.Controllers
|
|||
if (!System.IO.File.Exists(filename))
|
||||
return NotFound();
|
||||
|
||||
return File(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read), "application/octet-stream", $"{archive.Game.Title.SanitizeFilename()}.zip");
|
||||
string name = "";
|
||||
|
||||
if (archive.GameId != null && archive.GameId != Guid.Empty)
|
||||
name = $"{archive.Game.Title.SanitizeFilename()}.zip";
|
||||
else if (archive.RedistributableId != null && archive.RedistributableId != Guid.Empty)
|
||||
name = $"{archive.Redistributable.Name.SanitizeFilename()}.zip";
|
||||
|
||||
return File(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read), "application/octet-stream", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace LANCommander.Controllers
|
|||
if (!System.IO.File.Exists(filename))
|
||||
return NotFound();
|
||||
|
||||
return File(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read), "application/zip", $"{save.User?.UserName} - {save.Game?.Title} - {save.CreatedOn.ToString("MM-dd-yyyy.hh-mm")}");
|
||||
return File(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read), "application/zip", $"{save.User?.UserName} - {(save.Game == null ? "Unknown" : save.Game?.Title)} - {save.CreatedOn.ToString("MM-dd-yyyy.hh-mm")}.zip");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,26 @@ namespace LANCommander.Data
|
|||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.ConfigureBaseRelationships<Data.Models.Action>();
|
||||
builder.ConfigureBaseRelationships<Archive>();
|
||||
builder.ConfigureBaseRelationships<Category>();
|
||||
builder.ConfigureBaseRelationships<Collection>();
|
||||
builder.ConfigureBaseRelationships<Company>();
|
||||
builder.ConfigureBaseRelationships<Game>();
|
||||
builder.ConfigureBaseRelationships<GameSave>();
|
||||
builder.ConfigureBaseRelationships<Genre>();
|
||||
builder.ConfigureBaseRelationships<Key>();
|
||||
builder.ConfigureBaseRelationships<Media>();
|
||||
builder.ConfigureBaseRelationships<MultiplayerMode>();
|
||||
builder.ConfigureBaseRelationships<PlaySession>();
|
||||
builder.ConfigureBaseRelationships<Redistributable>();
|
||||
builder.ConfigureBaseRelationships<SavePath>();
|
||||
builder.ConfigureBaseRelationships<Script>();
|
||||
builder.ConfigureBaseRelationships<Server>();
|
||||
builder.ConfigureBaseRelationships<ServerConsole>();
|
||||
builder.ConfigureBaseRelationships<ServerHttpPath>();
|
||||
builder.ConfigureBaseRelationships<Tag>();
|
||||
|
||||
builder.Entity<Genre>()
|
||||
.HasMany(g => g.Games)
|
||||
.WithMany(g => g.Genres);
|
||||
|
@ -34,6 +54,7 @@ namespace LANCommander.Data
|
|||
.HasMany(t => t.Games)
|
||||
.WithMany(g => g.Tags);
|
||||
|
||||
#region Game Relationships
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Archives)
|
||||
.WithOne(g => g.Game)
|
||||
|
@ -63,6 +84,28 @@ namespace LANCommander.Data
|
|||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Media)
|
||||
.WithOne(m => m.Game)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.SavePaths)
|
||||
.WithOne(p => p.Game)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.PlaySessions)
|
||||
.WithOne(ps => ps.Game)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.GameSaves)
|
||||
.WithOne(gs => gs.Game)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Developers)
|
||||
.WithMany(c => c.DevelopedGames)
|
||||
|
@ -89,41 +132,28 @@ namespace LANCommander.Data
|
|||
gr => gr.HasOne<Redistributable>().WithMany().HasForeignKey("RedistributableId"),
|
||||
gr => gr.HasOne<Game>().WithMany().HasForeignKey("GameId")
|
||||
);
|
||||
#endregion
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Media)
|
||||
.WithOne(m => m.Game)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
#region User Relationships
|
||||
builder.Entity<User>()
|
||||
.HasMany(u => u.GameSaves)
|
||||
.WithOne(gs => gs.User)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.GameSaves)
|
||||
.WithOne(gs => gs.Game)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.Entity<User>()
|
||||
.HasMany(u => u.PlaySessions)
|
||||
.WithOne(ps => ps.User)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
#endregion
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.PlaySessions)
|
||||
.WithOne(ps => ps.Game)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
#region Server Relationships
|
||||
builder.Entity<Server>()
|
||||
.HasOne(s => s.Game)
|
||||
.WithMany(g => g.Servers)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
builder.Entity<Server>()
|
||||
.HasMany<ServerConsole>()
|
||||
|
@ -136,7 +166,9 @@ namespace LANCommander.Data
|
|||
.WithOne(s => s.Server)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
#endregion
|
||||
|
||||
#region Redistributable Relationships
|
||||
builder.Entity<Redistributable>()
|
||||
.HasMany(r => r.Archives)
|
||||
.WithOne(a => a.Redistributable)
|
||||
|
@ -148,6 +180,29 @@ namespace LANCommander.Data
|
|||
.WithOne(s => s.Redistributable)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
#endregion
|
||||
|
||||
#region Collection Relationships
|
||||
builder.Entity<Collection>()
|
||||
.HasMany(c => c.Games)
|
||||
.WithMany(g => g.Collections)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"CollectionGame",
|
||||
cg => cg.HasOne<Game>().WithMany().HasForeignKey("GameId"),
|
||||
cg => cg.HasOne<Collection>().WithMany().HasForeignKey("CollectionId")
|
||||
);
|
||||
#endregion
|
||||
|
||||
#region Role Relationships
|
||||
builder.Entity<Role>()
|
||||
.HasMany(r => r.Collections)
|
||||
.WithMany(c => c.Roles)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"RoleCollection",
|
||||
rc => rc.HasOne<Collection>().WithMany().HasForeignKey("CollectionId"),
|
||||
rc => rc.HasOne<Role>().WithMany().HasForeignKey("RoleId")
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
|
||||
public DbSet<Game>? Games { get; set; }
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using LANCommander.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LANCommander.Data
|
||||
{
|
||||
public static class ModelBuilderExtensions
|
||||
{
|
||||
public static void ConfigureBaseRelationships<T>(this ModelBuilder modelBuilder) where T : BaseModel
|
||||
{
|
||||
modelBuilder.Entity<T>()
|
||||
.HasOne(x => x.CreatedBy)
|
||||
.WithMany()
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
modelBuilder.Entity<T>()
|
||||
.HasOne(x => x.UpdatedBy)
|
||||
.WithMany()
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,10 +10,13 @@ namespace LANCommander.Data.Models
|
|||
|
||||
[Display(Name = "Created On")]
|
||||
public DateTime CreatedOn { get; set; }
|
||||
|
||||
[Display(Name = "Created By")]
|
||||
public virtual User? CreatedBy { get; set; }
|
||||
|
||||
[Display(Name = "Updated On")]
|
||||
public DateTime UpdatedOn { get; set; }
|
||||
|
||||
[Display(Name = "Updated By")]
|
||||
public virtual User? UpdatedBy { get; set; }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace LANCommander.Data.Models
|
||||
{
|
||||
[Table("Collections")]
|
||||
public class Collection : BaseModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Game> Games { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Role> Roles { get; set; }
|
||||
}
|
||||
}
|
|
@ -39,5 +39,6 @@ namespace LANCommander.Data.Models
|
|||
|
||||
public string? ValidKeyRegex { get; set; }
|
||||
public virtual ICollection<Key>? Keys { get; set; }
|
||||
public virtual ICollection<Collection> Collections { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace LANCommander.Data.Models
|
|||
[Table("GameSaves")]
|
||||
public class GameSave : BaseModel
|
||||
{
|
||||
public Guid GameId { get; set; }
|
||||
public Guid? GameId { get; set; }
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(GameId))]
|
||||
[InverseProperty("GameSaves")]
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace LANCommander.Data.Models
|
|||
[Table("PlaySessions")]
|
||||
public class PlaySession : BaseModel
|
||||
{
|
||||
public Guid GameId { get; set; }
|
||||
public Guid? GameId { get; set; }
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(GameId))]
|
||||
[InverseProperty("PlaySessions")]
|
||||
|
|
|
@ -6,5 +6,6 @@ namespace LANCommander.Data.Models
|
|||
[Table("Roles")]
|
||||
public class Role : IdentityRole<Guid>
|
||||
{
|
||||
public virtual ICollection<Collection> Collections { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace LANCommander.Data.Models
|
|||
{
|
||||
public SavePathType Type { get; set; }
|
||||
public string Path { get; set; }
|
||||
public bool IsRegex { get; set; }
|
||||
|
||||
public Guid? GameId { get; set; }
|
||||
[JsonIgnore]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-LANCommander-C1F79CFA-9767-4AD7-BD5A-2549F8328A2D</UserSecretsId>
|
||||
|
@ -34,14 +34,14 @@
|
|||
<PackageReference Include="Hangfire.InMemory" Version="0.6.0" />
|
||||
<PackageReference Include="IGDB" Version="2.3.2" />
|
||||
<PackageReference Include="IPXRelayDotNet" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.13">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
@ -50,14 +50,14 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
|
||||
<PackageReference Include="NLog" Version="5.2.5" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.5" />
|
||||
<PackageReference Include="RegParserDotNet" Version="1.0.4" />
|
||||
<PackageReference Include="rix0rrr.BeaconLib" Version="1.0.2" />
|
||||
<PackageReference Include="swashbuckle" Version="5.6.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="7.0.0" />
|
||||
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
|
||||
<PackageReference Include="XtermBlazor" Version="1.10.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="13.3.1" />
|
||||
</ItemGroup>
|
||||
|
@ -66,7 +66,6 @@
|
|||
<Folder Include="bin\Debug\net6.0\" />
|
||||
<Folder Include="Data\Migrations\" />
|
||||
<Folder Include="Migrations\" />
|
||||
<Folder Include="Pages\Games\Archives\" />
|
||||
<Folder Include="Scripts\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,975 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LANCommander.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixDeletionBehaviors : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "PlaySessions",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "GameSaves",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "PlaySessions",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "GameSaves",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,29 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LANCommander.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddSavePathRegexFlag : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsRegex",
|
||||
table: "SavePaths",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsRegex",
|
||||
table: "SavePaths");
|
||||
}
|
||||
}
|
||||
}
|
1807
LANCommander/Migrations/20231203202813_FixScriptDisplayBounds.Designer.cs
generated
Normal file
1807
LANCommander/Migrations/20231203202813_FixScriptDisplayBounds.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LANCommander.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixScriptDisplayBounds : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql("UPDATE Scripts SET Contents = REPLACE(Contents, '$Display.Width', '$Display.Bounds.Width')");
|
||||
migrationBuilder.Sql("UPDATE Scripts SET Contents = REPLACE(Contents, '$Display.Height', '$Display.Bounds.Height')");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,124 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LANCommander.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddCollections : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Collections",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedById = table.Column<Guid>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Collections", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Collections_AspNetUsers_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_Collections_AspNetUsers_UpdatedById",
|
||||
column: x => x.UpdatedById,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CollectionGame",
|
||||
columns: table => new
|
||||
{
|
||||
CollectionId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
GameId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CollectionGame", x => new { x.CollectionId, x.GameId });
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionGame_Collections_CollectionId",
|
||||
column: x => x.CollectionId,
|
||||
principalTable: "Collections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionGame_Games_GameId",
|
||||
column: x => x.GameId,
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RoleCollection",
|
||||
columns: table => new
|
||||
{
|
||||
CollectionId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
RoleId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RoleCollection", x => new { x.CollectionId, x.RoleId });
|
||||
table.ForeignKey(
|
||||
name: "FK_RoleCollection_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RoleCollection_Collections_CollectionId",
|
||||
column: x => x.CollectionId,
|
||||
principalTable: "Collections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionGame_GameId",
|
||||
table: "CollectionGame",
|
||||
column: "GameId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Collections_CreatedById",
|
||||
table: "Collections",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Collections_UpdatedById",
|
||||
table: "Collections",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RoleCollection_RoleId",
|
||||
table: "RoleCollection",
|
||||
column: "RoleId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CollectionGame");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RoleCollection");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Collections");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.13")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||
.HasAnnotation("Proxies:CheckEquality", false)
|
||||
.HasAnnotation("Proxies:LazyLoading", true);
|
||||
|
@ -36,6 +36,21 @@ namespace LANCommander.Migrations
|
|||
b.ToTable("CategoryGame");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CollectionGame", b =>
|
||||
{
|
||||
b.Property<Guid>("CollectionId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("CollectionId", "GameId");
|
||||
|
||||
b.HasIndex("GameId");
|
||||
|
||||
b.ToTable("CollectionGame");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDeveloper", b =>
|
||||
{
|
||||
b.Property<Guid>("DeveloperId")
|
||||
|
@ -257,6 +272,37 @@ namespace LANCommander.Migrations
|
|||
b.ToTable("Categories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Collection", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("CreatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedById");
|
||||
|
||||
b.HasIndex("UpdatedById");
|
||||
|
||||
b.ToTable("Collections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Company", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
@ -355,7 +401,7 @@ namespace LANCommander.Migrations
|
|||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
b.Property<Guid?>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
|
@ -585,7 +631,7 @@ namespace LANCommander.Migrations
|
|||
b.Property<DateTime?>("End")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
b.Property<Guid?>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("Start")
|
||||
|
@ -692,6 +738,9 @@ namespace LANCommander.Migrations
|
|||
b.Property<Guid?>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsRegex")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
@ -1154,6 +1203,21 @@ namespace LANCommander.Migrations
|
|||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RoleCollection", b =>
|
||||
{
|
||||
b.Property<Guid>("CollectionId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("CollectionId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("RoleCollection");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CategoryGame", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.Category", null)
|
||||
|
@ -1169,6 +1233,21 @@ namespace LANCommander.Migrations
|
|||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CollectionGame", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.Collection", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDeveloper", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.Company", null)
|
||||
|
@ -1248,7 +1327,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Actions")
|
||||
|
@ -1258,7 +1338,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1271,7 +1352,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Archives")
|
||||
|
@ -1289,7 +1371,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1306,7 +1389,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Category", "Parent")
|
||||
.WithMany("Children")
|
||||
|
@ -1314,7 +1398,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1323,15 +1408,34 @@ namespace LANCommander.Migrations
|
|||
b.Navigation("UpdatedBy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Collection", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("UpdatedBy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Company", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1342,11 +1446,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1357,17 +1463,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("GameSaves")
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "User")
|
||||
.WithMany("GameSaves")
|
||||
|
@ -1388,11 +1495,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1407,7 +1516,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Keys")
|
||||
|
@ -1417,7 +1527,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("ClaimedByUser");
|
||||
|
||||
|
@ -1432,7 +1543,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Media")
|
||||
|
@ -1442,7 +1554,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1455,7 +1568,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("MultiplayerModes")
|
||||
|
@ -1465,7 +1579,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1478,17 +1593,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("PlaySessions")
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "User")
|
||||
.WithMany("PlaySessions")
|
||||
|
@ -1509,11 +1625,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1524,15 +1642,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("SavePaths")
|
||||
.HasForeignKey("GameId");
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1545,7 +1666,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Scripts")
|
||||
|
@ -1559,7 +1681,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1574,16 +1697,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Servers")
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1596,7 +1721,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Server", "Server")
|
||||
.WithMany()
|
||||
|
@ -1610,7 +1736,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1623,7 +1750,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Server", "Server")
|
||||
.WithMany()
|
||||
|
@ -1637,7 +1765,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1650,11 +1779,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1712,6 +1843,21 @@ namespace LANCommander.Migrations
|
|||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RoleCollection", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.Collection", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Role", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Category", b =>
|
||||
{
|
||||
b.Navigation("Children");
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace LANCommander.Models
|
||||
{
|
||||
public class AddToCollectionOptions
|
||||
{
|
||||
public IEnumerable<Guid> GameIds { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
namespace LANCommander.Models
|
||||
{
|
||||
public class RoleViewModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Users { get; set; }
|
||||
public int Collections { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using LANCommander.Data.Enums;
|
||||
|
||||
namespace LANCommander.Models
|
||||
{
|
||||
public class ScriptEditorOptions
|
||||
{
|
||||
public Guid ScriptId { get; set; }
|
||||
public Guid GameId { get; set; }
|
||||
public Guid RedistributableId { get; set; }
|
||||
public Guid ArchiveId { get; set; }
|
||||
public IEnumerable<ScriptType> AllowedTypes { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
@page "/Collections/{id:guid}"
|
||||
@page "/Collections/Add"
|
||||
@using LANCommander.Data.Enums;
|
||||
@using LANCommander.Extensions
|
||||
@attribute [Authorize(Roles = "Administrator")]
|
||||
@inject CollectionService CollectionService
|
||||
@inject IMessageService MessageService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageHeader>
|
||||
<PageHeaderTitle>
|
||||
<Input Size="@InputSize.Large" @bind-Value="@Collection.Name" />
|
||||
</PageHeaderTitle>
|
||||
<PageHeaderExtra>
|
||||
<Button Type="@ButtonType.Primary" OnClick="Save">Save</Button>
|
||||
</PageHeaderExtra>
|
||||
</PageHeader>
|
||||
|
||||
<Table TItem="Game" DataSource="@Collection.Games" Responsive>
|
||||
<Column TData="string" Title="Icon">
|
||||
<Image Src="@GetIcon(context)" Height="32" Width="32" Preview="false"></Image>
|
||||
</Column>
|
||||
|
||||
<PropertyColumn Property="g => g.Title" Sortable Filterable />
|
||||
|
||||
<PropertyColumn Property="g => g.ReleasedOn" Format="MM/dd/yyyy" Sortable Filterable />
|
||||
|
||||
<PropertyColumn Property="g => g.Singleplayer" Sortable Filterable>
|
||||
<Checkbox Disabled="true" Checked="context.Singleplayer" />
|
||||
</PropertyColumn>
|
||||
|
||||
<Column TData="bool" Title="Multiplayer">
|
||||
<Checkbox Disabled="true" Checked="context.MultiplayerModes?.Count > 0" />
|
||||
</Column>
|
||||
|
||||
<Column TData="string[]" Title="Developers">
|
||||
@foreach (var dev in context.Developers)
|
||||
{
|
||||
<Tag>@dev.Name</Tag>
|
||||
}
|
||||
</Column>
|
||||
|
||||
<Column TData="string[]" Title="Publishers">
|
||||
@foreach (var pub in context.Publishers)
|
||||
{
|
||||
<Tag>@pub.Name</Tag>
|
||||
}
|
||||
</Column>
|
||||
|
||||
<Column TData="string[]" Title="Genres">
|
||||
@foreach (var genre in context.Genres)
|
||||
{
|
||||
<Tag>@genre.Name</Tag>
|
||||
}
|
||||
</Column>
|
||||
|
||||
<Column TData="Data.Enums.MultiplayerType[]" Title="Multiplayer Modes">
|
||||
@foreach (var mode in context.MultiplayerModes.Select(mm => mm.Type).Distinct())
|
||||
{
|
||||
<Tag>@mode.GetDisplayName()</Tag>
|
||||
}
|
||||
</Column>
|
||||
|
||||
<ActionColumn Title="" Style="text-align: right">
|
||||
<ChildContent>
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
<SpaceItem>
|
||||
<Popconfirm OnConfirm="() => RemoveGame(context)" Title="Are you sure you want to remove this game from the collection?">
|
||||
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger />
|
||||
</Popconfirm>
|
||||
</SpaceItem>
|
||||
</Space>
|
||||
</ChildContent>
|
||||
</ActionColumn>
|
||||
</Table>
|
||||
|
||||
@code {
|
||||
[Parameter] public Guid Id { get; set; }
|
||||
|
||||
Collection Collection;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Id == Guid.Empty)
|
||||
Collection = new Collection();
|
||||
else
|
||||
Collection = await CollectionService.Get(Id);
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Collection.Id != Guid.Empty)
|
||||
{
|
||||
Collection = await CollectionService.Update(Collection);
|
||||
|
||||
await MessageService.Success("Collection updated!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Collection = await CollectionService.Add(Collection);
|
||||
|
||||
NavigationManager.LocationChanged += NotifyCollectionAdded;
|
||||
|
||||
NavigationManager.NavigateTo($"/Collections/{Collection.Id}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await MessageService.Error("Could not save!");
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyCollectionAdded(object? sender, LocationChangedEventArgs e)
|
||||
{
|
||||
NavigationManager.LocationChanged -= NotifyCollectionAdded;
|
||||
|
||||
MessageService.Success("Collection added!");
|
||||
}
|
||||
|
||||
private async Task RemoveGame(Game game)
|
||||
{
|
||||
try
|
||||
{
|
||||
Collection.Games.Remove(game);
|
||||
|
||||
await CollectionService.Update(Collection);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageService.Error("Game could not be removed from the collection!");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetIcon(Game game)
|
||||
{
|
||||
var media = game?.Media?.FirstOrDefault(m => m.Type == Data.Enums.MediaType.Icon);
|
||||
|
||||
if (media != null)
|
||||
return $"/api/Media/{media.Id}/Download?fileId={media.FileId}";
|
||||
else
|
||||
return "/favicon.ico";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
@page "/Collections"
|
||||
@using Microsoft.EntityFrameworkCore;
|
||||
@attribute [Authorize(Roles = "Administrator")]
|
||||
@inject CollectionService CollectionService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IMessageService MessageService
|
||||
|
||||
<PageHeader Title="Collections">
|
||||
<PageHeaderExtra>
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
<SpaceItem>
|
||||
<Search Placeholder="Search" @bind-Value="Search" BindOnInput DebounceMilliseconds="150" OnChange="() => LoadData()" />
|
||||
</SpaceItem>
|
||||
</Space>
|
||||
</PageHeaderExtra>
|
||||
</PageHeader>
|
||||
|
||||
<TableColumnPicker @ref="Picker" Key="Collections" @bind-Visible="ColumnPickerVisible" />
|
||||
|
||||
<Table TItem="Collection" DataSource="@Collections" Loading="@Loading" PageSize="25" Responsive>
|
||||
<PropertyColumn Property="r => r.Name" Sortable Hidden="@(Picker.IsColumnHidden("Name"))" />
|
||||
<PropertyColumn Property="s => s.CreatedOn" Format="MM/dd/yyyy hh:mm tt" Sortable Hidden="@(Picker.IsColumnHidden("Created On"))" />
|
||||
<PropertyColumn Property="s => s.CreatedBy" Sortable Hidden="@(Picker.IsColumnHidden("Created By"))">
|
||||
@context.CreatedBy?.UserName
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="g => g.UpdatedOn" Format="MM/dd/yyyy hh:mm tt" Sortable Hidden="@(Picker.IsColumnHidden("Updated On"))" />
|
||||
<PropertyColumn Property="g => g.UpdatedBy" Sortable Hidden="@(Picker.IsColumnHidden("Updated By"))">
|
||||
@context.UpdatedBy?.UserName
|
||||
</PropertyColumn>
|
||||
<Column Title="Games" TData="int">
|
||||
@context.Games.Count
|
||||
</Column>
|
||||
<ActionColumn Title="" Style="text-align: right; white-space: nowrap">
|
||||
<TitleTemplate>
|
||||
<div style="text-align: right">
|
||||
<Button Icon="@IconType.Outline.Edit" Type="@ButtonType.Text" OnClick="() => OpenColumnPicker()" />
|
||||
</div>
|
||||
</TitleTemplate>
|
||||
<ChildContent>
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
<SpaceItem>
|
||||
<a href="/Collections/@(context.Id)" class="ant-btn ant-btn-primary">Edit</a>
|
||||
</SpaceItem>
|
||||
<SpaceItem>
|
||||
<Popconfirm OnConfirm="() => Delete(context)" Title="Are you sure you want to delete this Collection?">
|
||||
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger />
|
||||
</Popconfirm>
|
||||
</SpaceItem>
|
||||
</Space>
|
||||
</ChildContent>
|
||||
</ActionColumn>
|
||||
</Table>
|
||||
|
||||
@code {
|
||||
IEnumerable<Collection> Collections { get; set; } = new List<Collection>();
|
||||
|
||||
bool Loading = true;
|
||||
|
||||
string Search = "";
|
||||
|
||||
TableColumnPicker Picker;
|
||||
bool ColumnPickerVisible = false;
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
LoadData();
|
||||
|
||||
Loading = false;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
var fuzzySearch = Search.ToLower().Trim();
|
||||
|
||||
Collections = await CollectionService.Get(r => r.Name.ToLower().Contains(fuzzySearch)).OrderBy(r => r.Name).ToListAsync();
|
||||
}
|
||||
|
||||
private void Add()
|
||||
{
|
||||
NavigationManager.NavigateTo("/Collections/Add");
|
||||
}
|
||||
|
||||
private async Task Delete(Collection Collection)
|
||||
{
|
||||
Collections = new List<Collection>();
|
||||
|
||||
Loading = true;
|
||||
|
||||
await CollectionService.Delete(Collection);
|
||||
|
||||
Collections = await CollectionService.Get(x => true).OrderBy(r => r.Name).ToListAsync();
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private async Task OpenColumnPicker()
|
||||
{
|
||||
ColumnPickerVisible = true;
|
||||
}
|
||||
|
||||
private async Task CloseColumnPicker()
|
||||
{
|
||||
ColumnPickerVisible = false;
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
@using System.Diagnostics;
|
||||
@using LANCommander.Extensions;
|
||||
@using AntDesign.Charts;
|
||||
@using System.Collections.Concurrent;
|
||||
|
||||
<Spin Spinning="Loading">
|
||||
<Area @ref="Chart" Config="Config" />
|
||||
</Spin>
|
||||
|
||||
@code {
|
||||
[Parameter] public int TimerHistory { get; set; }
|
||||
[Parameter] public int TimerInterval { get; set; }
|
||||
|
||||
IChartComponent? Chart;
|
||||
System.Timers.Timer Timer;
|
||||
bool Loading = true;
|
||||
|
||||
Dictionary<string, double[]> Data = new Dictionary<string, double[]>();
|
||||
|
||||
ConcurrentDictionary<string, PerformanceCounter> PerformanceCounters = new ConcurrentDictionary<string, PerformanceCounter>();
|
||||
|
||||
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
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
@using System.Diagnostics;
|
||||
@using LANCommander.Extensions;
|
||||
@using AntDesign.Charts;
|
||||
@using System.Collections.Concurrent;
|
||||
|
||||
<Spin Spinning="Loading">
|
||||
<Area @ref="Chart" Config="Config" />
|
||||
</Spin>
|
||||
|
||||
@code {
|
||||
[Parameter] public int TimerHistory { get; set; }
|
||||
[Parameter] public int TimerInterval { get; set; }
|
||||
|
||||
IChartComponent? Chart;
|
||||
System.Timers.Timer Timer;
|
||||
bool Loading = true;
|
||||
|
||||
Dictionary<string, double[]> Data = new Dictionary<string, double[]>();
|
||||
|
||||
ConcurrentDictionary<string, PerformanceCounter> PerformanceCounters = new ConcurrentDictionary<string, PerformanceCounter>();
|
||||
|
||||
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
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
@using AntDesign.Charts
|
||||
@using ByteSizeLib
|
||||
@inject PlaySessionService PlaySessionService
|
||||
|
||||
<Spin Spinning="Loading">
|
||||
<Pie Data="Data" Config="Config" JsConfig="@JsConfig" />
|
||||
</Spin>
|
||||
|
||||
@code {
|
||||
object[] Data;
|
||||
|
||||
bool Loading = true;
|
||||
|
||||
string JsConfig = @"{
|
||||
meta: {
|
||||
value: {
|
||||
alias: 'Overall Playtime',
|
||||
formatter: (v) => new Date(v * 1000).toISOString().slice(11, 19)
|
||||
}
|
||||
},
|
||||
label: {
|
||||
visible: true,
|
||||
type: 'outer-center'
|
||||
}
|
||||
}";
|
||||
|
||||
PieConfig Config = new PieConfig
|
||||
{
|
||||
Radius = 0.8,
|
||||
AngleField = "value",
|
||||
ColorField = "type",
|
||||
};
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
Dictionary<string, TimeSpan> playtimes = new Dictionary<string, TimeSpan>();
|
||||
|
||||
var sessions = await PlaySessionService.Get();
|
||||
|
||||
foreach (var gameSessions in sessions.Where(s => s.GameId.HasValue && s.GameId.Value != Guid.Empty).GroupBy(s => s.GameId))
|
||||
{
|
||||
var total = new TimeSpan();
|
||||
|
||||
foreach (var session in gameSessions.Where(gs => gs.Start != null && gs.End != null))
|
||||
{
|
||||
total = total.Add(session.End.Value.Subtract(session.Start.Value));
|
||||
}
|
||||
|
||||
playtimes[gameSessions.First().Game.Title] = total;
|
||||
}
|
||||
|
||||
Data = playtimes.Select(pt => new
|
||||
{
|
||||
type = pt.Key,
|
||||
value = (int)pt.Value.TotalSeconds
|
||||
}).ToArray();
|
||||
|
||||
Loading = false;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
@using System.Diagnostics;
|
||||
@using LANCommander.Extensions;
|
||||
@using AntDesign.Charts;
|
||||
|
||||
<Spin Spinning="Loading">
|
||||
<Area @ref="Chart" Config="Config" />
|
||||
</Spin>
|
||||
|
||||
@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
|
||||
}
|
||||
}
|
|
@ -7,25 +7,9 @@
|
|||
|
||||
<GridRow Gutter="(16, 16)">
|
||||
<GridCol Xs="24" Md="12">
|
||||
<Card Title="Network Download Rate">
|
||||
<Card Title="Overall Playtime">
|
||||
<Body>
|
||||
<NetworkDownloadRate TimerHistory="60" TimerInterval="1000" />
|
||||
</Body>
|
||||
</Card>
|
||||
</GridCol>
|
||||
|
||||
<GridCol Xs="24" Md="12">
|
||||
<Card Title="Network Upload Rate">
|
||||
<Body>
|
||||
<NetworkUploadRate TimerHistory="60" TimerInterval="1000" />
|
||||
</Body>
|
||||
</Card>
|
||||
</GridCol>
|
||||
|
||||
<GridCol Xs="24" Md="12">
|
||||
<Card Title="CPU Usage (%)">
|
||||
<Body>
|
||||
<ProcessorUtilization TimerHistory="60" TimerInterval="1000" />
|
||||
<OverallPlaytime />
|
||||
</Body>
|
||||
</Card>
|
||||
</GridCol>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<Input Type="text" @bind-Value="context.Name" />
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="a => a.Path">
|
||||
<FilePicker @bind-Value="context.Path" ArchiveId="@ArchiveId" AllowDirectories="true" />
|
||||
<FilePicker @bind-Value="context.Path" ArchiveId="@ArchiveId" AllowDirectories="true" Prefix="{InstallDir}\" Title="Select Action Executable" />
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="a => a.Arguments">
|
||||
<Input Type="text" @bind-Value="context.Arguments" />
|
||||
|
@ -90,43 +90,6 @@
|
|||
Move(action.SortOrder, action.SortOrder + 1);
|
||||
}
|
||||
|
||||
private async void BrowseForActionPath(Data.Models.Action action)
|
||||
{
|
||||
var modalOptions = new ModalOptions()
|
||||
{
|
||||
Title = "Choose Action Executable",
|
||||
Maximizable = false,
|
||||
DefaultMaximized = true,
|
||||
Closable = true,
|
||||
OkText = "Select File"
|
||||
};
|
||||
|
||||
var browserOptions = new FilePickerOptions()
|
||||
{
|
||||
ArchiveId = ArchiveId,
|
||||
Select = true,
|
||||
Multiple = false
|
||||
};
|
||||
|
||||
var modalRef = await ModalService.CreateModalAsync<FilePickerDialog, FilePickerOptions, IEnumerable<IFileManagerEntry>>(modalOptions, browserOptions);
|
||||
|
||||
modalRef.OnOk = (results) =>
|
||||
{
|
||||
action.Path = results.FirstOrDefault().Path;
|
||||
|
||||
var parts = action.Path.Split('/');
|
||||
|
||||
if (parts.Length > 1)
|
||||
{
|
||||
action.Path = parts.Last();
|
||||
action.WorkingDirectory = "{InstallDir}/" + String.Join('/', parts.Take(parts.Length - 1));
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
}
|
||||
|
||||
private void Move(int oldIndex, int newIndex)
|
||||
{
|
||||
foreach (var action in Actions)
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
@using LANCommander.Models
|
||||
@inherits FeedbackComponent<AddToCollectionOptions, Collection>
|
||||
@inject CollectionService CollectionService
|
||||
@inject GameService GameService
|
||||
@inject IMessageService MessageService
|
||||
|
||||
<Select
|
||||
TItem="Collection"
|
||||
TItemValue="Guid"
|
||||
DataSource="@Collections"
|
||||
@bind-Value="SelectedCollection"
|
||||
LabelName="@nameof(Collection.Name)"
|
||||
ValueName="@nameof(Collection.Id)"
|
||||
Placeholder="Select a Collection"
|
||||
DropdownRender="@DropdownRender"
|
||||
OnSelectedItemChanged="OnSelectedItemChanged" />
|
||||
|
||||
@code {
|
||||
ICollection<Collection> Collections = new List<Collection>();
|
||||
|
||||
Guid SelectedCollection;
|
||||
|
||||
string NewCollectionName;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Collections = (await CollectionService.Get()).OrderBy(c => c.Name).ToList();
|
||||
}
|
||||
|
||||
private RenderFragment DropdownRender(RenderFragment originNode)
|
||||
{
|
||||
RenderFragment customDropdownRender =
|
||||
@<Template>
|
||||
<div>
|
||||
@originNode
|
||||
<Divider Style="margin: 4px 0"></Divider>
|
||||
<div style="display: flex; flex-wrap: nowrap; padding: 8px">
|
||||
<Input Style="flex: auto" @bind-Value="@NewCollectionName" />
|
||||
<a style="flex: none; padding: 8px; display: block; cursor: pointer" @onclick="AddCollection">
|
||||
<Icon Type="plus" Theme="outline"></Icon>
|
||||
Add New Collection
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</Template>
|
||||
;
|
||||
|
||||
return customDropdownRender;
|
||||
}
|
||||
|
||||
private async Task AddCollection(MouseEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(NewCollectionName))
|
||||
{
|
||||
await CollectionService.Add(new Collection()
|
||||
{
|
||||
Name = NewCollectionName
|
||||
});
|
||||
|
||||
await LoadData();
|
||||
|
||||
MessageService.Success("Collection added!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageService.Error("Could not add a new collection!");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectedItemChanged(Collection collection)
|
||||
{
|
||||
SelectedCollection = collection.Id;
|
||||
}
|
||||
|
||||
public override async Task OnFeedbackOkAsync(ModalClosingEventArgs args)
|
||||
{
|
||||
var collection = await CollectionService.Get(SelectedCollection);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var gameId in Options.GameIds.Where(gid => collection.Games != null && !collection.Games.Any(g => g.Id == gid)))
|
||||
{
|
||||
var game = await GameService.Get(gameId);
|
||||
|
||||
collection.Games.Add(game);
|
||||
}
|
||||
|
||||
await CollectionService.Update(collection);
|
||||
|
||||
MessageService.Success("Added to collection!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageService.Error("Could not add to collection!");
|
||||
}
|
||||
|
||||
await base.OkCancelRefWithResult!.OnOk(collection);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
</Template>;
|
||||
}
|
||||
|
||||
<Modal Visible="ModalVisible" Title="Game Metadata Lookup" Footer="@Footer">
|
||||
<Modal Visible="ModalVisible" Title="Game Metadata Lookup" Footer="@Footer" Class="game-metadata-lookup-modal">
|
||||
<Table
|
||||
@ref="ResultsTable"
|
||||
TItem="Game"
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
<FilePicker @bind-Value="context.Path" ArchiveId="@ArchiveId" AllowDirectories="true" />
|
||||
}
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="p => p.IsRegex" Title="Regex">
|
||||
<Checkbox @bind-Checked="context.IsRegex" />
|
||||
</PropertyColumn>
|
||||
<ActionColumn>
|
||||
<Space Style="display: flex; justify-content: end">
|
||||
<SpaceItem>
|
||||
|
|
|
@ -128,11 +128,11 @@
|
|||
</div>
|
||||
|
||||
<div data-panel="Scripts">
|
||||
<ScriptEditor @bind-Scripts="Game.Scripts" GameId="Game.Id" ArchiveId="@LatestArchiveId" AllowedTypes="new ScriptType[] { ScriptType.Install, ScriptType.Uninstall, ScriptType.NameChange, ScriptType.KeyChange }" />
|
||||
<ScriptEditor GameId="Game.Id" ArchiveId="@LatestArchiveId" AllowedTypes="new ScriptType[] { ScriptType.Install, ScriptType.Uninstall, ScriptType.NameChange, ScriptType.KeyChange }" />
|
||||
</div>
|
||||
|
||||
<div data-panel="Archives">
|
||||
<ArchiveEditor @bind-Archives="Game.Archives" GameId="Game.Id" />
|
||||
<ArchiveEditor GameId="Game.Id" />
|
||||
</div>
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,7 @@ else
|
|||
[Parameter] public Guid Id { get; set; }
|
||||
[Parameter] public string Panel { get; set; }
|
||||
|
||||
bool Loaded = false;
|
||||
bool Success;
|
||||
string[] Errors = { };
|
||||
|
||||
|
@ -206,8 +207,13 @@ else
|
|||
});
|
||||
} }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!Loaded)
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData() {
|
||||
if (Id == Guid.Empty)
|
||||
Game = new Game();
|
||||
else
|
||||
|
@ -223,6 +229,8 @@ else
|
|||
Description = r.Description,
|
||||
Key = r.Id.ToString()
|
||||
});
|
||||
|
||||
Loaded = true;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
|
@ -269,7 +277,7 @@ else
|
|||
Game.Tags = new List<Data.Models.Tag>();
|
||||
|
||||
if (result.IGDBMetadata.GameModes != null && result.IGDBMetadata.GameModes.Values != null)
|
||||
Game.Singleplayer = result.IGDBMetadata.GameModes.Values.Any(gm => gm.Name == "Singleplayer");
|
||||
Game.Singleplayer = result.IGDBMetadata.GameModes.Values.Any(gm => gm.Name == "Single player");
|
||||
|
||||
if (result.IGDBMetadata.InvolvedCompanies != null && result.IGDBMetadata.InvolvedCompanies.Values != null)
|
||||
{
|
||||
|
|
|
@ -2,17 +2,28 @@
|
|||
@using AntDesign.TableModels;
|
||||
@using LANCommander.Extensions;
|
||||
@using System.ComponentModel.DataAnnotations;
|
||||
@using LANCommander.Models
|
||||
@using LANCommander.Pages.Games.Components
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
||||
@using Microsoft.EntityFrameworkCore;
|
||||
@using System.Web
|
||||
@attribute [Authorize]
|
||||
@inject GameService GameService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ModalService ModalService
|
||||
@inject IMessageService MessageService
|
||||
|
||||
<PageHeader Title="Games">
|
||||
<PageHeader Title="Games" Subtitle="@Games.Count().ToString()">
|
||||
<PageHeaderExtra>
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
@if (Selected != null && Selected.Count() > 0)
|
||||
{
|
||||
<SpaceItem>
|
||||
<Button OnClick="() => AddToCollection()" Type="@ButtonType.Primary">Add to Collection</Button>
|
||||
</SpaceItem>
|
||||
}
|
||||
<SpaceItem>
|
||||
<Search Placeholder="Search" @bind-Value="Search" BindOnInput DebounceMilliseconds="150" OnChange="() => LoadData()" />
|
||||
<Search Placeholder="Search" @bind-Value="Search" BindOnInput DebounceMilliseconds="250" OnChange="SearchChanged" />
|
||||
</SpaceItem>
|
||||
<SpaceItem>
|
||||
<Button OnClick="() => Add()" Type="@ButtonType.Primary">Add Game</Button>
|
||||
|
@ -23,7 +34,8 @@
|
|||
|
||||
<TableColumnPicker @ref="Picker" Key="Games" @bind-Visible="ColumnPickerVisible" />
|
||||
|
||||
<Table TItem="Game" DataSource="@Games" Loading="@Loading" PageSize="25" Responsive>
|
||||
<Table TItem="Game" DataSource="@Games" @bind-SelectedRows="Selected" Loading="@Loading" PageSize="@PageSize" PageIndex="@PageIndex" OnPageIndexChange="PageIndexChanged" OnPageSizeChange="PageSizeChanged" Responsive>
|
||||
<Selection Key="@(context.Id.ToString())" />
|
||||
<Column TData="string" Title="Icon" Hidden="@(Picker.IsColumnHidden("Icon"))">
|
||||
<Image Src="@GetIcon(context)" Height="32" Width="32" Preview="false"></Image>
|
||||
</Column>
|
||||
|
@ -120,27 +132,69 @@
|
|||
bool Loading = true;
|
||||
|
||||
string Search = "";
|
||||
string Url;
|
||||
|
||||
bool Visibility = false;
|
||||
|
||||
IEnumerable<Game> Selected;
|
||||
|
||||
TableColumnPicker Picker;
|
||||
bool ColumnPickerVisible = false;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
int PageIndex = 1;
|
||||
int PageSize = 25;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
LoadData();
|
||||
Url = NavigationManager.Uri;
|
||||
NavigationManager.LocationChanged += LocationChanged;
|
||||
LoadTableParameter();
|
||||
await LoadData();
|
||||
|
||||
Loading = false;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Games = await GameService.Get(g => g.Title.ToLower().Contains(Search.ToLower().Trim()) || g.SortTitle.ToLower().Contains(Search.ToLower().Trim())).OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToListAsync();
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async void LocationChanged(object sender, LocationChangedEventArgs e)
|
||||
{
|
||||
Url = e.Location;
|
||||
LoadTableParameter();
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private void LoadTableParameter()
|
||||
{
|
||||
var uri = NavigationManager.ToAbsoluteUri(Url);
|
||||
var query = HttpUtility.ParseQueryString(uri.Query);
|
||||
|
||||
PageIndex = int.TryParse(query["Page"], out var index) ? index > 0 ? index : 1 : 1;
|
||||
PageSize = int.TryParse(query["Size"], out var size) ? size > 0 ? size : 25 : 25;
|
||||
|
||||
if (query["Search"] != null)
|
||||
Search = query["Search"];
|
||||
else
|
||||
Search = "";
|
||||
}
|
||||
|
||||
private void PageIndexChanged(PaginationEventArgs args)
|
||||
{
|
||||
NavigationManager.NavigateTo($"Games?Page={args.Page}&Size={args.PageSize}{(Search != "" ? "&Search=" + Search : "")}");
|
||||
}
|
||||
|
||||
private void PageSizeChanged(PaginationEventArgs args)
|
||||
{
|
||||
NavigationManager.NavigateTo($"Games?Page={args.Page}&Size={args.PageSize}{(Search != "" ? "&Search=" + Search : "")}");
|
||||
}
|
||||
|
||||
private void SearchChanged()
|
||||
{
|
||||
NavigationManager.NavigateTo($"Games?Search={Search}");
|
||||
}
|
||||
|
||||
private string GetIcon(Game game)
|
||||
|
@ -174,13 +228,45 @@
|
|||
|
||||
Loading = true;
|
||||
|
||||
await GameService.Delete(game);
|
||||
try
|
||||
{
|
||||
await GameService.Delete(game);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageService.Error("Could not delete the game!");
|
||||
}
|
||||
|
||||
Games = await GameService.Get(x => true).OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToListAsync();
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private async void AddToCollection()
|
||||
{
|
||||
var modalOptions = new ModalOptions()
|
||||
{
|
||||
Title = "Add to Collection",
|
||||
Maximizable = false,
|
||||
DefaultMaximized = false,
|
||||
Closable = true,
|
||||
OkText = "Add"
|
||||
};
|
||||
|
||||
var options = new AddToCollectionOptions()
|
||||
{
|
||||
GameIds = Selected.Select(g => g.Id)
|
||||
};
|
||||
|
||||
var modalRef = await ModalService.CreateModalAsync<AddToCollectionDialog, AddToCollectionOptions, Collection>(modalOptions, options);
|
||||
|
||||
modalRef.OnOk = async (collection) =>
|
||||
{
|
||||
Selected = null;
|
||||
await LoadData();
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OpenColumnPicker()
|
||||
{
|
||||
ColumnPickerVisible = true;
|
||||
|
@ -190,4 +276,9 @@
|
|||
{
|
||||
ColumnPickerVisible = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
NavigationManager.LocationChanged -= LocationChanged;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div style="padding: 0 24px;">
|
||||
<Table TItem="GameSave" DataSource="@GameSaves">
|
||||
<PropertyColumn Property="s => s.Game.Title" Sortable />
|
||||
<PropertyColumn Property="s => (s.Game == null ? String.Empty : s.Game.Title)" Sortable Title="Game" />
|
||||
<PropertyColumn Property="s => s.CreatedOn" Format="MM/dd/yyyy hh:mm tt" Sortable />
|
||||
<ActionColumn Title="" Style="text-align: right; white-space: nowrap">
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
|
@ -45,7 +45,7 @@
|
|||
User = await UserManager.FindByNameAsync(authState.User.Identity.Name);
|
||||
|
||||
if (User != null)
|
||||
GameSaves = User.GameSaves.OrderBy(s => s.Game.Title).ThenBy(s => s.CreatedOn).ToList();
|
||||
GameSaves = User.GameSaves.OrderBy(s => s.Game?.Title).ThenBy(s => s.CreatedOn).ToList();
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
|
|
|
@ -56,11 +56,11 @@
|
|||
@if (Redistributable != null && Redistributable.Id != Guid.Empty)
|
||||
{
|
||||
<div data-panel="Scripts">
|
||||
<ScriptEditor @bind-Scripts="Redistributable.Scripts" RedistributableId="Redistributable.Id" ArchiveId="@LatestArchiveId" AllowedTypes="new ScriptType[] { ScriptType.Install, ScriptType.DetectInstall }" />
|
||||
<ScriptEditor RedistributableId="Redistributable.Id" ArchiveId="@LatestArchiveId" AllowedTypes="new ScriptType[] { ScriptType.Install, ScriptType.DetectInstall }" />
|
||||
</div>
|
||||
|
||||
<div data-panel="Archives">
|
||||
<ArchiveEditor @bind-Archives="Redistributable.Archives" RedistributableId="Redistributable.Id" />
|
||||
<ArchiveEditor RedistributableId="Redistributable.Id" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<ChildContent>
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
<SpaceItem>
|
||||
<Button OnClick="() => Edit(context)">Edit</Button>
|
||||
<a href="/Redistributables/@(context.Id)" class="ant-btn ant-btn-primary">Edit</a>
|
||||
</SpaceItem>
|
||||
<SpaceItem>
|
||||
<Popconfirm OnConfirm="() => Delete(context)" Title="Are you sure you want to delete this redistributable?">
|
||||
|
@ -85,11 +85,6 @@
|
|||
NavigationManager.NavigateTo("/Redistributables/Add");
|
||||
}
|
||||
|
||||
private void Edit(Redistributable redistributable)
|
||||
{
|
||||
NavigationManager.NavigateTo($"/Redistributables/{redistributable.Id}/General");
|
||||
}
|
||||
|
||||
private async Task Delete(Redistributable redistributable)
|
||||
{
|
||||
Redistributables = new List<Redistributable>();
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
@page "/Settings/Roles"
|
||||
@using LANCommander.Models;
|
||||
@layout SettingsLayout
|
||||
@inject RoleManager<Role> RoleManager
|
||||
@inject UserManager<User> UserManager
|
||||
@inject IMessageService MessageService
|
||||
@inject NavigationManager NavigationManager
|
||||
@attribute [Authorize(Roles = "Administrator")]
|
||||
|
||||
<PageHeader Title="Roles" Subtitle="@Roles.Count().ToString()">
|
||||
<PageHeaderExtra>
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
<SpaceItem>
|
||||
<Button OnClick="() => ShowNewRoleDialog()" Type="@ButtonType.Primary">Add Role</Button>
|
||||
</SpaceItem>
|
||||
</Space>
|
||||
</PageHeaderExtra>
|
||||
</PageHeader>
|
||||
|
||||
<div style="padding: 0 24px;">
|
||||
<Table TItem="RoleViewModel" DataSource="@Roles" Loading="@(Loading)" Responsive>
|
||||
<PropertyColumn Property="r => r.Name" Title="Name" />
|
||||
<PropertyColumn Property="r => r.Collections" Title="Collections" />
|
||||
<PropertyColumn Property="r => r.Users" Title="Users" />
|
||||
<ActionColumn>
|
||||
<Space Style="display: flex; justify-content: end">
|
||||
<SpaceItem>
|
||||
@if (context.Name != "Administrator")
|
||||
{
|
||||
<Popconfirm OnConfirm="() => DeleteRole(context)" Title="Are you sure you want to delete this role?">
|
||||
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger />
|
||||
</Popconfirm>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Tooltip Title="The administrator role cannot be deleted.">
|
||||
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Disabled />
|
||||
</Tooltip>
|
||||
}
|
||||
</SpaceItem>
|
||||
</Space>
|
||||
</ActionColumn>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
<Modal Title="Add a Role" @bind-Visible="AddRoleDialogVisible" OnOk="AddRole" OnCancel="() => AddRoleDialogVisible = false">
|
||||
<Form Model="NewRole">
|
||||
<FormItem Label="Name">
|
||||
<Input @bind-Value="@context.Name" />
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
@code {
|
||||
ICollection<RoleViewModel> Roles { get; set; }
|
||||
|
||||
LANCommanderSettings Settings = SettingService.GetSettings();
|
||||
bool Loading = true;
|
||||
bool AddRoleDialogVisible = false;
|
||||
|
||||
RoleViewModel NewRole = new RoleViewModel();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Roles = new List<RoleViewModel>();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Roles = new List<RoleViewModel>();
|
||||
|
||||
foreach (var role in RoleManager.Roles)
|
||||
{
|
||||
var users = await UserManager.GetUsersInRoleAsync(role.Name);
|
||||
|
||||
Roles.Add(new RoleViewModel()
|
||||
{
|
||||
Name = role.Name,
|
||||
Collections = role.Collections != null ? role.Collections.Count : 0,
|
||||
Users = users != null ? users.Count : 0
|
||||
});
|
||||
}
|
||||
|
||||
Loading = false;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task DeleteRole(RoleViewModel roleViewModel)
|
||||
{
|
||||
var role = await RoleManager.FindByNameAsync(roleViewModel.Name);
|
||||
|
||||
if (role.Name == "Administrator")
|
||||
{
|
||||
await MessageService.Error("Cannot delete the administrator role!");
|
||||
}
|
||||
else
|
||||
{
|
||||
await RoleManager.DeleteAsync(role);
|
||||
await LoadData();
|
||||
|
||||
await MessageService.Success($"Deleted {role.Name}!");
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowNewRoleDialog()
|
||||
{
|
||||
NewRole = new RoleViewModel();
|
||||
|
||||
AddRoleDialogVisible = true;
|
||||
}
|
||||
|
||||
private async Task AddRole()
|
||||
{
|
||||
if (await RoleManager.RoleExistsAsync(NewRole.Name))
|
||||
{
|
||||
MessageService.Error("A role with that name already exists!");
|
||||
AddRoleDialogVisible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await RoleManager.CreateAsync(new Role()
|
||||
{
|
||||
Name = NewRole.Name
|
||||
});
|
||||
|
||||
await LoadData();
|
||||
MessageService.Success("Role added!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageService.Error("Could not added role!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
<Menu Mode=@MenuMode.Inline Style="height: 100%">
|
||||
<MenuItem RouterLink="/Settings/General">General</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Users">Users</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Roles">Roles</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Authentication">Authentication</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/UserSaves">User Saves</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Archives">Archives</MenuItem>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</ActionColumn>
|
||||
</Table>
|
||||
|
||||
<ArchiveUploader @ref="Uploader" OnArchiveUploaded="OnArchiveUploaded" />
|
||||
<ArchiveUploader @ref="Uploader" OnArchiveUploaded="LoadData" />
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -78,21 +78,7 @@
|
|||
|
||||
System.IO.File.Create(archiveFilePath).Close();
|
||||
|
||||
await Uploader.Open(archive);
|
||||
}
|
||||
|
||||
async Task OnArchiveUploaded(Archive archive)
|
||||
{
|
||||
try
|
||||
{
|
||||
await ArchiveService.Update(archive);
|
||||
|
||||
await LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await MessageService.Error("Archive could not be updated.");
|
||||
}
|
||||
await Uploader.Open(archive.Id);
|
||||
}
|
||||
|
||||
async Task Delete(Archive archive)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
<SpaceItem>
|
||||
<Tooltip Title="Change Password">
|
||||
<Button Icon="@IconType.Outline.Key" Type="@ButtonType.Text" OnClick="() => ChangePassword(context)" />
|
||||
<Button Icon="@IconType.Outline.Lock" Type="@ButtonType.Text" OnClick="() => ChangePassword(context)" />
|
||||
</Tooltip>
|
||||
</SpaceItem>
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ namespace LANCommander
|
|||
builder.Services.AddScoped<SettingService>();
|
||||
builder.Services.AddScoped<ArchiveService>();
|
||||
builder.Services.AddScoped<CategoryService>();
|
||||
builder.Services.AddScoped<CollectionService>();
|
||||
builder.Services.AddScoped<GameService>();
|
||||
builder.Services.AddScoped<ScriptService>();
|
||||
builder.Services.AddScoped<GenreService>();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using LANCommander.Data;
|
||||
using LANCommander.Data.Models;
|
||||
|
||||
namespace LANCommander.Services
|
||||
{
|
||||
public class CollectionService : BaseDatabaseService<Collection>
|
||||
{
|
||||
public CollectionService(DatabaseContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ namespace LANCommander.Services
|
|||
|
||||
public string GetSavePath(GameSave save)
|
||||
{
|
||||
return Path.Combine(Settings.UserSaves.StoragePath, save.UserId.ToString(), $"{save.Id}.zip");
|
||||
return Path.Combine(Settings.UserSaves.StoragePath, save.UserId.ToString(), $"{save.Id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ namespace LANCommander.Services
|
|||
{
|
||||
Id = p.Id,
|
||||
Path = p.Path,
|
||||
IsRegex = p.IsRegex,
|
||||
Type = p.Type.ToString()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
@if (User != null && User.IsInRole("Administrator"))
|
||||
{
|
||||
<MenuItem RouterLink="/Games">Games</MenuItem>
|
||||
<MenuItem RouterLink="/Collections">Collections</MenuItem>
|
||||
<MenuItem RouterLink="/Redistributables">Redistributables</MenuItem>
|
||||
<MenuItem RouterLink="/Servers">Servers</MenuItem>
|
||||
<MenuItem RouterLink="/Files">Files</MenuItem>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# Bounds are accessible by $Display.Width and $Display.Height
|
||||
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
|
||||
$Display = Get-PrimaryDisplay
|
|
@ -1,2 +1,2 @@
|
|||
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
|
||||
Write-ReplaceContentInFile -Regex '^game.setPlayerName "(.+)"' -Replacement "game.setPlayerName ""$NewName""" -FilePath "$InstallDir\<File Path>"
|
||||
Write-ReplaceContentInFile -Pattern '^game.setPlayerName "(.+)"' -Substitution "game.setPlayerName ""$NewPlayerAlias""" -FilePath "$InstallDirectory\<File Path>"
|
|
@ -1 +1 @@
|
|||
$OldPlayerAlias
|
||||
$InstallDirectory
|
|
@ -1 +1 @@
|
|||
$NewName = $args[0]
|
||||
$NewPlayerAlias
|
|
@ -1,4 +1 @@
|
|||
$OldName = ""
|
||||
if ($args[1]) {
|
||||
$OldName = $args[1]
|
||||
}
|
||||
$OldPlayerAlias
|
|
@ -18,6 +18,11 @@
|
|||
background: #141414;
|
||||
}
|
||||
|
||||
.ant-page-header-heading-title {
|
||||
padding-bottom: 4px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
label.ant-btn-icon-only {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
@ -183,6 +188,14 @@ label.ant-btn-icon-only {
|
|||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.game-metadata-lookup-modal .ant-modal-body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.game-metadata-lookup-modal tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.image-picker-images {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
|
Loading…
Reference in New Issue