2025-12-04 18:21:32 +00:00
|
|
|
|
using AIStudio.Components;
|
2025-12-04 13:06:32 +00:00
|
|
|
|
using AIStudio.Tools.Services;
|
2025-11-24 11:37:18 +00:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Dialogs;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-12-04 14:33:20 +00:00
|
|
|
|
/// Check how your file will be loaded.
|
2025-11-24 11:37:18 +00:00
|
|
|
|
/// </summary>
|
2025-12-04 14:33:20 +00:00
|
|
|
|
public partial class DocumentCheckDialog : MSGComponentBase
|
2025-11-24 11:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
|
[CascadingParameter]
|
|
|
|
|
|
private IMudDialogInstance MudDialog { get; set; } = null!;
|
|
|
|
|
|
|
2025-12-04 13:06:32 +00:00
|
|
|
|
[Parameter]
|
|
|
|
|
|
public string FilePath { get; set; } = string.Empty;
|
2025-11-24 11:37:18 +00:00
|
|
|
|
|
2025-12-04 15:56:14 +00:00
|
|
|
|
private void Close() => this.MudDialog.Cancel();
|
2025-12-04 13:06:32 +00:00
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
|
public string FileContent { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
|
private RustService RustService { get; init; } = null!;
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
|
private IDialogService DialogService { get; init; } = null!;
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
|
private ILogger<ReadFileContent> Logger { get; init; } = null!;
|
|
|
|
|
|
|
|
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (firstRender && !string.IsNullOrEmpty(this.FilePath))
|
|
|
|
|
|
{
|
2025-12-04 14:33:20 +00:00
|
|
|
|
var fileContent = await UserFile.LoadFileData(this.FilePath, this.RustService, this.DialogService);
|
2025-12-04 13:06:32 +00:00
|
|
|
|
this.FileContent = fileContent;
|
|
|
|
|
|
this.StateHasChanged();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-24 11:37:18 +00:00
|
|
|
|
}
|