33 lines
901 B
C#
33 lines
901 B
C#
using Livia.Models.Data;
|
|
using Livia.ViewModels;
|
|
using System.IO;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
namespace iBrain.ViewModels;
|
|
|
|
public class BuptIBrainScoreViewModel : ObservableObject, ILiviaModuleViewModel
|
|
{
|
|
public string LoadPath { get; set; } = string.Empty;
|
|
|
|
public float Score { get => _score; private set => SetProperty(ref _score, value); }
|
|
|
|
private float _score;
|
|
|
|
public void Init()
|
|
{
|
|
}
|
|
|
|
public async Task LoadData(DataBlock dataBlock)
|
|
{
|
|
if (string.IsNullOrEmpty(LoadPath))
|
|
return;
|
|
|
|
string file = Path.Combine(dataBlock.ResultPath, LoadPath);
|
|
using StreamReader reader = new(file);
|
|
_ = await reader.ReadLineAsync() ?? string.Empty;
|
|
string dataLine = await reader.ReadLineAsync() ?? string.Empty;
|
|
string[] data = dataLine.Split(',');
|
|
|
|
Score = 30 * float.Parse(data[0]);
|
|
}
|
|
} |