-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
GdItem.cs
108 lines (89 loc) · 2.85 KB
/
GdItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using ByteSizeLib;
namespace GDMENUCardManager.Core
{
public sealed class GdItem : INotifyPropertyChanged
{
private const int namemaxlen = 40;
public string Guid { get; set; }
private ByteSize _Length;
public ByteSize Length
{
get { return _Length; }
set { _Length = value; RaisePropertyChanged(); }
}
//public long CdiTarget { get; set; }
private string _Name;
public string Name
{
get { return _Name; }
set
{
_Name = value;
if (_Name != null)
{
if (_Name.Length > namemaxlen)
_Name = _Name.Substring(0, namemaxlen);
_Name = Helper.RemoveDiacritics(_Name).ToUpperInvariant().Trim();
}
RaisePropertyChanged();
}
}
//private string _ImageFile;
public string ImageFile
{
get { return ImageFiles.FirstOrDefault(); }
//set { _ImageFile = value; RaisePropertyChanged(); }
}
public readonly System.Collections.Generic.List<string> ImageFiles = new System.Collections.Generic.List<string>();
private string _FullFolderPath;
public string FullFolderPath
{
get { return _FullFolderPath; }
set { _FullFolderPath = value; RaisePropertyChanged(); }
}
private IpBin _Ip;
public IpBin Ip
{
get { return _Ip; }
set { _Ip = value; RaisePropertyChanged(); }
}
private int _SdNumber;
public int SdNumber
{
get { return _SdNumber; }
set { _SdNumber = value; RaisePropertyChanged(); RaisePropertyChanged(nameof(Location)); }
}
private WorkMode _Work;
public WorkMode Work
{
get { return _Work; }
set { _Work = value; RaisePropertyChanged(); }
}
public string Location
{
get { return SdNumber == 0 ? "Other" : "SD Card"; }
}
public bool CanApplyGDIShrink { get; set; }
private FileFormat _FileFormat;
public FileFormat FileFormat
{
get { return _FileFormat; }
set { _FileFormat = value; RaisePropertyChanged(); }
}
#if DEBUG
public override string ToString()
{
return $"{Location} {SdNumber} {Name}";
}
#endif
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}