mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-13 04:55:43 +08:00
chore: 优化项目结构
This commit is contained in:
265
CRSim.ScreenSimulator/Models/StylesInfoData.json
Normal file
265
CRSim.ScreenSimulator/Models/StylesInfoData.json
Normal file
@@ -0,0 +1,265 @@
|
||||
[
|
||||
{
|
||||
"UniqueId": "ChengduDong.SecondaryScreen",
|
||||
"Title": "成都东站次要看板",
|
||||
"Station": "成都东",
|
||||
"Author": "电排骨",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "ChengduDong.PrimaryTicketCheckScreen",
|
||||
"Title": "成都东站检票口主要看板",
|
||||
"Station": "成都东",
|
||||
"Author": "电排骨",
|
||||
"Type": "检票口屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"TicketCheck",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Fuzhou.TicketCheckScreen",
|
||||
"Title": "福州站检票口看板",
|
||||
"Station": "福州",
|
||||
"Author": "电排骨",
|
||||
"Type": "检票口屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"TicketCheck",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "FuzhouNan.TicketCheckScreen",
|
||||
"Title": "福州南站检票口看板",
|
||||
"Station": "福州南",
|
||||
"Author": "电排骨",
|
||||
"Type": "检票口屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"TicketCheck",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "BeijingXi.PrimaryScreen",
|
||||
"Title": "北京西站主要看板",
|
||||
"Station": "北京西",
|
||||
"Author": "电排骨",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Harbin.PrimaryScreen",
|
||||
"Title": "哈尔滨站主要看板",
|
||||
"Station": "哈尔滨",
|
||||
"Author": "电排骨",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "ChengduMetro.PlatformScreen",
|
||||
"Title": "成都地铁站台看板",
|
||||
"Station": "成都地铁",
|
||||
"Author": "电排骨",
|
||||
"Type": "站台屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text",
|
||||
"Video",
|
||||
"Platform"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "XuzhouMetro.PlatformScreen",
|
||||
"Title": "徐州地铁站台看板",
|
||||
"Station": "徐州地铁",
|
||||
"Author": "电排骨",
|
||||
"Type": "站台屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text",
|
||||
"Video",
|
||||
"Platform"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Guangyuan.PrimaryScreen",
|
||||
"Title": "广元站主要看板",
|
||||
"Station": "广元",
|
||||
"Author": "电排骨",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Shanghai.OutsideScreen",
|
||||
"Title": "上海站站外看板",
|
||||
"Station": "上海",
|
||||
"Author": "电排骨",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Hanzhong.PlatformScreen",
|
||||
"Title": "汉中站站台看板",
|
||||
"Station": "汉中",
|
||||
"Author": "电排骨",
|
||||
"Type": "站台屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Tianjin.PlatformScreen",
|
||||
"Title": "天津站站台看板",
|
||||
"Station": "天津",
|
||||
"Author": "电排骨",
|
||||
"Type": "站台屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Location"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Mianyang.PlatformScreen",
|
||||
"Title": "绵阳站站台看板",
|
||||
"Station": "绵阳",
|
||||
"Author": "电排骨",
|
||||
"Type": "站台屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Location"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo.PrimaryScreen",
|
||||
"Title": "淄博站主要看板",
|
||||
"Station": "淄博",
|
||||
"Author": "wxl0430",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo.SecondaryScreen",
|
||||
"Title": "淄博站次要看板",
|
||||
"Station": "淄博",
|
||||
"Author": "wxl0430",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo.TicketCheckScreen",
|
||||
"Title": "淄博站检票口看板",
|
||||
"Station": "淄博",
|
||||
"Author": "wxl0430",
|
||||
"Type": "检票口屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"TicketCheck",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo.PlatformScreen",
|
||||
"Title": "淄博站站台看板",
|
||||
"Station": "淄博",
|
||||
"Author": "wxl0430",
|
||||
"Type": "站台屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Location",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo.ConcourseBridgeScreen",
|
||||
"Title": "淄博站廊桥看板",
|
||||
"Station": "淄博",
|
||||
"Author": "wxl0430",
|
||||
"Type": "走廊出发屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Location"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Jinanxi.SmallScreen",
|
||||
"Title": "济南西站小屏看板",
|
||||
"Station": "济南西",
|
||||
"Author": "wxl0430",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "GuangdongIntercity.SecondaryScreen",
|
||||
"Title": "广东城际次要看板",
|
||||
"Station": "广东城际",
|
||||
"Author": "电排骨",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Ankang.ExitScreen",
|
||||
"Title": "安康站出站口看板",
|
||||
"Station": "安康",
|
||||
"Author": "电排骨",
|
||||
"Type": "出站口屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Beijing.ArrivalScreen",
|
||||
"Title": "北京站地道到达看板",
|
||||
"Station": "北京",
|
||||
"Author": "wxl0430",
|
||||
"Type": "走廊到达屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "DaqingDong.ConcourseBridgeScreen",
|
||||
"Title": "大庆东站廊桥看板",
|
||||
"Station": "大庆东",
|
||||
"Author": "wxl0430",
|
||||
"Type": "走廊出发屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Location"
|
||||
]
|
||||
}
|
||||
]
|
||||
88
CRSim.ScreenSimulator/Models/StylesInfoDataSource.cs
Normal file
88
CRSim.ScreenSimulator/Models/StylesInfoDataSource.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Models
|
||||
{
|
||||
public class StylesInfoDataItem
|
||||
{
|
||||
public string UniqueId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Station { get; set; }
|
||||
public string Author { get; set; }
|
||||
public string Type { get; set; }
|
||||
public Type ViewType
|
||||
{
|
||||
get
|
||||
{
|
||||
string type = $"CRSim.ScreenSimulator.Views.{UniqueId}View";
|
||||
return Assembly.Load("CRSim.ScreenSimulator").GetType(type);
|
||||
}
|
||||
}
|
||||
|
||||
public Uri ImageSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Uri($"pack://application:,,,/CRSim.ScreenSimulator;component/Assets/{UniqueId.Replace('.', '/')}.png");
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> Parameters { get; set; } = [];
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Title;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class StylesInfoDataSource
|
||||
{
|
||||
|
||||
#region Singleton
|
||||
|
||||
private static readonly StylesInfoDataSource _instance;
|
||||
|
||||
public static StylesInfoDataSource Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
static StylesInfoDataSource()
|
||||
{
|
||||
_instance = new StylesInfoDataSource();
|
||||
}
|
||||
|
||||
private StylesInfoDataSource()
|
||||
{
|
||||
var jsonText = ReadStylesData();
|
||||
StylesInfo = JsonSerializer.Deserialize<List<StylesInfoDataItem>>(jsonText);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ICollection<StylesInfoDataItem> StylesInfo { get; }
|
||||
|
||||
private static string ReadStylesData()
|
||||
{
|
||||
var assembly = typeof(StylesInfoDataSource).Assembly;
|
||||
var resourceName = "CRSim.ScreenSimulator.Models.StylesInfoData.json";
|
||||
|
||||
using var stream = assembly.GetManifestResourceStream(resourceName);
|
||||
using var reader = new System.IO.StreamReader(stream);
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
|
||||
public ICollection<string> GetParametersInfo(Type type)
|
||||
{
|
||||
return StylesInfo.FirstOrDefault(x => x.ViewType == type)?.Parameters;
|
||||
}
|
||||
|
||||
public string GetStyleName(Type type)
|
||||
{
|
||||
return StylesInfo.FirstOrDefault(x => x.ViewType == type)?.Title;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user