/
VM_AniDB_Character.cs
97 lines (80 loc) · 3.41 KB
/
VM_AniDB_Character.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
using System;
using System.ComponentModel;
using System.IO;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using Newtonsoft.Json;
using Shoko.Commons.Notification;
using Shoko.Models.Enums;
using Shoko.Desktop.ImageDownload;
using Shoko.Desktop.Utilities;
using Shoko.Desktop.ViewModel.Helpers;
using Shoko.Models.Client;
// ReSharper disable InconsistentNaming
namespace Shoko.Desktop.ViewModel.Server
{
public class VM_AniDB_Character : CL_AniDB_Character, INotifyPropertyChanged, INotifyPropertyChangedExt
{
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propname)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propname));
}
public new VM_AniDB_Seiyuu Seiyuu
{
get { return (VM_AniDB_Seiyuu) base.Seiyuu; }
set { base.Seiyuu = value; }
}
[ScriptIgnore, JsonIgnore, XmlIgnore]
public string ImagePathPlain => string.Intern(Path.Combine(Utils.GetAniDBCharacterImagePath(CharID), PicName));
[ScriptIgnore, JsonIgnore, XmlIgnore]
public string CharNameShort => CharName.Length <= 25 ? CharName : string.Intern(CharName.Substring(0, 24) + "...");
[ScriptIgnore, JsonIgnore, XmlIgnore]
public string ImagePath
{
get
{
string fileName = string.Intern(Path.Combine(Utils.GetAniDBCharacterImagePath(CharID), PicName));
if (!File.Exists(fileName))
{
ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.AniDB_Character, this, false);
MainWindow.imageHelper.DownloadImage(req);
if (File.Exists(fileName)) return fileName;
string packUriBlank = string.Intern($"pack://application:,,,/{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name};component/Images/blankposter.png");
return packUriBlank;
}
return fileName;
}
}
public new string PicName
{
get => base.PicName == null ? null : string.Intern(base.PicName);
set => base.PicName = value == null ? null : string.Intern(value);
}
public new string CreatorListRaw
{
get => base.CreatorListRaw == null ? null : string.Intern(base.CreatorListRaw);
set => base.CreatorListRaw = value == null ? null : string.Intern(value);
}
public new string CharName
{
get => base.CharName == null ? null : string.Intern(base.CharName);
set => base.CharName = value == null ? null : string.Intern(value);
}
public new string CharKanjiName
{
get => base.CharKanjiName == null ? null : string.Intern(base.CharKanjiName);
set => base.CharKanjiName = value == null ? null : string.Intern(value);
}
public new string CharDescription
{
get => base.CharDescription == null ? null : string.Intern(base.CharDescription);
set => base.CharDescription = value == null ? null : string.Intern(value);
}
public new string CharType
{
get => base.CharType == null ? null : string.Intern(base.CharType);
set => base.CharType = value == null ? null : string.Intern(value);
}
}
}