45 lines
No EOL
1.3 KiB
Text
45 lines
No EOL
1.3 KiB
Text
@using System.Diagnostics
|
|
@using LANCommander.Launcher.Data.Models
|
|
@using LANCommander.Launcher.Models
|
|
@inherits FeedbackComponent<LibraryItem, string>
|
|
@inject LibraryService LibraryService
|
|
|
|
<RadioGroup @bind-Value="SelectedDirectory" ButtonStyle="RadioButtonStyle.Solid" Size="large" Class="radio-group-vertical radio-group-block">
|
|
@foreach (var directory in Settings.Games.InstallDirectories)
|
|
{
|
|
<Radio RadioButton Value="@directory">
|
|
<GridRow>
|
|
<GridCol Flex="@("auto")">
|
|
@directory
|
|
</GridCol>
|
|
<GridCol>
|
|
@ByteSizeLib.ByteSize.FromBytes(GetFreeSpace(directory))
|
|
</GridCol>
|
|
</GridRow>
|
|
</Radio>
|
|
}
|
|
</RadioGroup>
|
|
|
|
@code {
|
|
Settings Settings = SettingService.GetSettings();
|
|
|
|
string SelectedDirectory = "";
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
SelectedDirectory = Settings.Games.InstallDirectories.First();
|
|
}
|
|
|
|
public override async Task OnFeedbackOkAsync(ModalClosingEventArgs args)
|
|
{
|
|
LibraryService.Install(Options, SelectedDirectory);
|
|
}
|
|
|
|
long GetFreeSpace(string path)
|
|
{
|
|
var root = Path.GetPathRoot(path);
|
|
var drive = new DriveInfo(path);
|
|
|
|
return drive.AvailableFreeSpace;
|
|
}
|
|
} |