Added inputs for archive file browser and registry entries
This commit is contained in:
parent
e2a28a57ea
commit
eb99656c1d
3 changed files with 147 additions and 0 deletions
54
LANCommander/Components/InputArchiveFile.razor
Normal file
54
LANCommander/Components/InputArchiveFile.razor
Normal file
|
@ -0,0 +1,54 @@
|
|||
@using LANCommander.Models;
|
||||
@using System.IO.Compression;
|
||||
@inject ModalService ModalService
|
||||
|
||||
<Space Style="display: flex">
|
||||
<SpaceItem Style="flex-grow: 1">
|
||||
<Input Type="text" @bind-Value="Value" />
|
||||
</SpaceItem>
|
||||
@if (ArchiveId != Guid.Empty) {
|
||||
<SpaceItem>
|
||||
<Button OnClick="() => BrowseForFile()" Type="@ButtonType.Primary" Icon="@IconType.Outline.FolderOpen" />
|
||||
</SpaceItem>
|
||||
}
|
||||
</Space>
|
||||
|
||||
@code {
|
||||
[Parameter] public string Value { get; set; }
|
||||
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
||||
[Parameter] public Guid ArchiveId { get; set; }
|
||||
[Parameter] public string ArchiveBrowserTitle { get; set; } = "Choose File";
|
||||
[Parameter] public bool AllowDirectories { get; set; } = false;
|
||||
|
||||
private async void BrowseForFile()
|
||||
{
|
||||
var modalOptions = new ModalOptions()
|
||||
{
|
||||
Title = ArchiveBrowserTitle,
|
||||
Maximizable = false,
|
||||
DefaultMaximized = true,
|
||||
Closable = true,
|
||||
OkText = "Select File"
|
||||
};
|
||||
|
||||
var browserOptions = new ArchiveBrowserOptions()
|
||||
{
|
||||
ArchiveId = ArchiveId,
|
||||
Select = true,
|
||||
Multiple = false,
|
||||
AllowDirectories = AllowDirectories
|
||||
};
|
||||
|
||||
var modalRef = await ModalService.CreateModalAsync<ArchiveBrowserDialog, ArchiveBrowserOptions, IEnumerable<ZipArchiveEntry>>(modalOptions, browserOptions);
|
||||
|
||||
modalRef.OnOk = async (results) =>
|
||||
{
|
||||
Value = results.FirstOrDefault().FullName;
|
||||
|
||||
if (ValueChanged.HasDelegate)
|
||||
await ValueChanged.InvokeAsync(Value);
|
||||
|
||||
StateHasChanged();
|
||||
};
|
||||
}
|
||||
}
|
31
LANCommander/Components/InputRegistry.razor
Normal file
31
LANCommander/Components/InputRegistry.razor
Normal file
|
@ -0,0 +1,31 @@
|
|||
<AntDesign.Input Type="text" @bind-Value="Path" OnBlur="() => OnChanged()">
|
||||
<AddOnBefore>
|
||||
<SimpleSelect @bind-Value="Hive" Style="width: auto;" OnSelectedItemsChanged="() => OnChanged()">
|
||||
<SelectOptions>
|
||||
<SimpleSelectOption Value="HKCR:\" Label="HKCR:\"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="HKCU:\" Label="HKCU:\"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="HKLM:\" Label="HKLM:\"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="HKU:\" Label="HKU:\"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="HKCC:\" Label="HKCC:\"></SimpleSelectOption>
|
||||
</SelectOptions>
|
||||
</SimpleSelect>
|
||||
</AddOnBefore>
|
||||
</AntDesign.Input>
|
||||
|
||||
@code {
|
||||
[Parameter] public string Value { get; set; } = "";
|
||||
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
||||
|
||||
string Hive = "HKCU:\\";
|
||||
string Path = "SOFTWARE";
|
||||
|
||||
private async void OnChanged()
|
||||
{
|
||||
Value = Hive + Path;
|
||||
|
||||
if (ValueChanged.HasDelegate)
|
||||
await ValueChanged.InvokeAsync(Value);
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
|
@ -525,6 +525,45 @@ namespace LANCommander.Migrations
|
|||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.SavePath", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("CreatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedById");
|
||||
|
||||
b.HasIndex("GameId");
|
||||
|
||||
b.HasIndex("UpdatedById");
|
||||
|
||||
b.ToTable("SavePaths");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Script", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
@ -1110,6 +1149,27 @@ namespace LANCommander.Migrations
|
|||
b.Navigation("UpdatedBy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.SavePath", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("SavePaths")
|
||||
.HasForeignKey("GameId");
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("Game");
|
||||
|
||||
b.Navigation("UpdatedBy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Script", b =>
|
||||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
|
@ -1231,6 +1291,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.Navigation("MultiplayerModes");
|
||||
|
||||
b.Navigation("SavePaths");
|
||||
|
||||
b.Navigation("Scripts");
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue