You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
using connor_zwcadm.util;
|
|
|
|
namespace connor_zwcadm.model {
|
|
public class PlotData {
|
|
|
|
public string TitleBlockName { get; }
|
|
public string MediaName { get; }
|
|
public bool Rotate { get; }
|
|
|
|
private PlotData(string titleBlockName, string mediaName, bool rotate) {
|
|
TitleBlockName = titleBlockName;
|
|
MediaName = mediaName;
|
|
Rotate = rotate;
|
|
}
|
|
|
|
public static PlotData Parse(int index, string[] titleBlockNames, string[] mediaNames, string[] rotates) {
|
|
if (index < 0) {
|
|
return null;
|
|
}
|
|
string titleBlockName = KUtil.GetLen(titleBlockNames) > index ? titleBlockNames[index] : null;
|
|
string mediaName = KUtil.GetLen(mediaNames) > index ? mediaNames[index] : null;
|
|
string rotate = KUtil.GetLen(rotates) > index ? rotates[index] : null;
|
|
if (string.IsNullOrWhiteSpace(titleBlockName)
|
|
|| string.IsNullOrWhiteSpace(mediaName)
|
|
|| string.IsNullOrWhiteSpace(rotate)) {
|
|
return null;
|
|
}
|
|
return new PlotData(titleBlockName, mediaName, "true".Equals(rotate.ToLower()));
|
|
}
|
|
}
|
|
}
|