mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move views and viewmodels to folders.
This commit is contained in:
71
Aaru.Gui/ViewModels/Windows/ViewSectorViewModel.cs
Normal file
71
Aaru.Gui/ViewModels/Windows/ViewSectorViewModel.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class ViewSectorViewModel : ViewModelBase
|
||||
{
|
||||
const int HEX_COLUMNS = 32;
|
||||
readonly IMediaImage inputFormat;
|
||||
bool _longSectorChecked;
|
||||
bool _longSectorVisible;
|
||||
string _printHexText;
|
||||
double _sectorNumber;
|
||||
string _title;
|
||||
string _totalSectorsText;
|
||||
|
||||
public ViewSectorViewModel(IMediaImage inputFormat)
|
||||
{
|
||||
this.inputFormat = inputFormat;
|
||||
|
||||
try
|
||||
{
|
||||
inputFormat.ReadSectorLong(0);
|
||||
LongSectorChecked = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
LongSectorVisible = false;
|
||||
}
|
||||
|
||||
TotalSectorsText = $"of {inputFormat.Info.Sectors}";
|
||||
SectorNumber = 0;
|
||||
}
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
set => this.RaiseAndSetIfChanged(ref _title, value);
|
||||
}
|
||||
|
||||
public double SectorNumber
|
||||
{
|
||||
get => _sectorNumber;
|
||||
set
|
||||
{
|
||||
this.RaiseAndSetIfChanged(ref _sectorNumber, value);
|
||||
|
||||
PrintHexText =
|
||||
PrintHex.
|
||||
ByteArrayToHexArrayString(LongSectorChecked ? inputFormat.ReadSectorLong((ulong)SectorNumber) : inputFormat.ReadSector((ulong)SectorNumber),
|
||||
HEX_COLUMNS);
|
||||
}
|
||||
}
|
||||
|
||||
public string TotalSectorsText { get; }
|
||||
|
||||
public bool LongSectorChecked
|
||||
{
|
||||
get => _longSectorChecked;
|
||||
set => this.RaiseAndSetIfChanged(ref _longSectorChecked, value);
|
||||
}
|
||||
|
||||
public bool LongSectorVisible { get; }
|
||||
|
||||
public string PrintHexText
|
||||
{
|
||||
get => _printHexText;
|
||||
set => this.RaiseAndSetIfChanged(ref _printHexText, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user