Commit bd1be4c2 by liulongfei

插件配置文件

登录界面节目选择
parent 9ebdbbc0
ID,PluginID,Group,DisplayName,Type
1,1,CBA,CBA,Plugin
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
...@@ -15,5 +15,10 @@ namespace VIZ.TVP.Domain ...@@ -15,5 +15,10 @@ namespace VIZ.TVP.Domain
/// 项目文件后缀 /// 项目文件后缀
/// </summary> /// </summary>
public const string PROJECT_FILE_SUFFIX = ".viz_tvp"; public const string PROJECT_FILE_SUFFIX = ".viz_tvp";
/// <summary>
/// VIZ层枚举
/// </summary>
public readonly static List<string> VIZ_LAYERS = new List<string> { "FRONT_LAYER", "MAIN_LAYER", "BACK_LAYER" };
} }
} }
...@@ -23,6 +23,11 @@ namespace VIZ.TVP.Domain ...@@ -23,6 +23,11 @@ namespace VIZ.TVP.Domain
public LiteDbContext LiteDbContext { get; set; } public LiteDbContext LiteDbContext { get; set; }
/// <summary> /// <summary>
/// CSV数据上下文
/// </summary>
public CsvContext CsvContext { get; set; }
/// <summary>
/// 销毁 /// 销毁
/// </summary> /// </summary>
public void Dispose() public void Dispose()
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Domain
{
/// <summary>
/// 插件配置模型
/// </summary>
public class PluginConfigModel : ModelBase
{
#region ID -- 编号
private string id;
/// <summary>
/// 编号
/// </summary>
public string ID
{
get { return id; }
set { id = value; this.RaisePropertyChanged(nameof(ID)); }
}
#endregion
#region PluginID -- 插件ID
private string pluginID;
/// <summary>
/// 插件ID
/// </summary>
public string PluginID
{
get { return pluginID; }
set { pluginID = value; this.RaisePropertyChanged(nameof(PluginID)); }
}
#endregion
#region Group -- 分组
private string group;
/// <summary>
/// 分组
/// </summary>
public string Group
{
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
#region DisplayName -- 显示名称
private string displayName;
/// <summary>
/// 显示名称
/// </summary>
public string DisplayName
{
get { return displayName; }
set { displayName = value; this.RaisePropertyChanged(nameof(DisplayName)); }
}
#endregion
#region Type -- 插件类型
private PluginTypeEnum type;
/// <summary>
/// 类型 Plguin | TemplatePlugin
/// </summary>
public PluginTypeEnum Type
{
get { return type; }
set { type = value; this.RaisePropertyChanged(nameof(Type)); }
}
#endregion
/// <summary>
/// 从配置文件中获取属性
/// </summary>
/// <param name="config">配置文件项</param>
public void PropertyFromConfig(PluginConfig config)
{
this.ID = config.ID;
this.PluginID = config.PluginID;
this.Group = config.Group;
this.DisplayName = config.DisplayName;
this.Type = config.Type;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Domain
{
/// <summary>
/// 插件分组模型
/// </summary>
public class PluginGroupModel : ModelBase
{
#region Group -- 分组
private string group;
/// <summary>
/// 分组
/// </summary>
public string Group
{
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
#region Items -- 插件项集合
private List<PluginConfigModel> items = new List<PluginConfigModel>();
/// <summary>
/// 插件项集合
/// </summary>
public List<PluginConfigModel> Items
{
get { return items; }
set { items = value; this.RaisePropertyChanged(nameof(Items)); }
}
#endregion
}
}
...@@ -179,6 +179,7 @@ namespace VIZ.TVP.Domain ...@@ -179,6 +179,7 @@ namespace VIZ.TVP.Domain
this.TemplateID = this.Entity.TemplateID; this.TemplateID = this.Entity.TemplateID;
this.TemplateType = this.Entity.TemplateType; this.TemplateType = this.Entity.TemplateType;
this.SceneName = this.Entity.SceneName; this.SceneName = this.Entity.SceneName;
this.Path = this.Entity.Path;
this.Thumbnail = this.Entity.Thumbnail; this.Thumbnail = this.Entity.Thumbnail;
this.Remark = this.Entity.Remark; this.Remark = this.Entity.Remark;
this.Layer = this.Entity.Layer; this.Layer = this.Entity.Layer;
...@@ -194,6 +195,7 @@ namespace VIZ.TVP.Domain ...@@ -194,6 +195,7 @@ namespace VIZ.TVP.Domain
this.Entity.TemplateID = this.TemplateID; this.Entity.TemplateID = this.TemplateID;
this.Entity.TemplateType = this.TemplateType; this.Entity.TemplateType = this.TemplateType;
this.Entity.SceneName = this.SceneName; this.Entity.SceneName = this.SceneName;
this.Entity.Path = this.Path;
this.Entity.Thumbnail = this.Thumbnail; this.Entity.Thumbnail = this.Thumbnail;
this.Entity.Remark = this.Remark; this.Entity.Remark = this.Remark;
this.Entity.Layer = this.Layer; this.Entity.Layer = this.Layer;
......
...@@ -12,6 +12,10 @@ namespace VIZ.TVP.Domain ...@@ -12,6 +12,10 @@ namespace VIZ.TVP.Domain
public enum ResourceFileType public enum ResourceFileType
{ {
/// <summary> /// <summary>
/// 未指定
/// </summary>
None,
/// <summary>
/// 未知 /// 未知
/// </summary> /// </summary>
Unknow, Unknow,
......
...@@ -82,6 +82,8 @@ ...@@ -82,6 +82,8 @@
<Compile Include="Message\Program\ProgramListItemChangedMessage.cs" /> <Compile Include="Message\Program\ProgramListItemChangedMessage.cs" />
<Compile Include="Message\Project\ProjectChangedMessage.cs" /> <Compile Include="Message\Project\ProjectChangedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" /> <Compile Include="Message\Project\ProjectSaveMessage.cs" />
<Compile Include="Model\Plugin\PluginConfigModel.cs" />
<Compile Include="Model\Plugin\PluginGroupModel.cs" />
<Compile Include="Model\Project\Program\ProgramListItemModel.cs" /> <Compile Include="Model\Project\Program\ProgramListItemModel.cs" />
<Compile Include="Model\Project\Program\ProgramListModel.cs" /> <Compile Include="Model\Project\Program\ProgramListModel.cs" />
<Compile Include="Model\Project\Program\ProgramTemplateModel.cs" /> <Compile Include="Model\Project\Program\ProgramTemplateModel.cs" />
...@@ -128,6 +130,7 @@ ...@@ -128,6 +130,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
...@@ -5,6 +5,7 @@ using System.Linq; ...@@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.TVP.Domain;
namespace VIZ.TVP.Module namespace VIZ.TVP.Module
{ {
...@@ -47,5 +48,10 @@ namespace VIZ.TVP.Module ...@@ -47,5 +48,10 @@ namespace VIZ.TVP.Module
/// 当前选择的引擎类型 /// 当前选择的引擎类型
/// </summary> /// </summary>
EnumModel SelectedLocalEngineType { get; set; } EnumModel SelectedLocalEngineType { get; set; }
/// <summary>
/// 选中的插件分组
/// </summary>
PluginGroupModel SelectedPluginGroup { get; set; }
} }
} }
...@@ -65,6 +65,7 @@ namespace VIZ.TVP.Module ...@@ -65,6 +65,7 @@ namespace VIZ.TVP.Module
info.VIZ_UserName = this.Support.VIZ_UserName; info.VIZ_UserName = this.Support.VIZ_UserName;
info.VIZ_Password = this.Support.VIZ_Password; info.VIZ_Password = this.Support.VIZ_Password;
info.LocalEngineType = (LocalEngineType)this.Support.SelectedLocalEngineType.Key; info.LocalEngineType = (LocalEngineType)this.Support.SelectedLocalEngineType.Key;
info.PluginGroup = this.Support.SelectedPluginGroup?.Group;
ApplicationDomainEx.DataBaseManager.LiteDbContext.LocalInfo.Update(info); ApplicationDomainEx.DataBaseManager.LiteDbContext.LocalInfo.Update(info);
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VIZ.TVP.Domain;
namespace VIZ.TVP.Module namespace VIZ.TVP.Module
{ {
...@@ -11,5 +12,14 @@ namespace VIZ.TVP.Module ...@@ -11,5 +12,14 @@ namespace VIZ.TVP.Module
/// </summary> /// </summary>
public interface IPluginSupport public interface IPluginSupport
{ {
/// <summary>
/// 插件分组集合
/// </summary>
List<PluginGroupModel> PluginGroups { get; set; }
/// <summary>
/// 选中的插件分组
/// </summary>
PluginGroupModel SelectedPluginGroup { get; set; }
} }
} }
...@@ -8,6 +8,7 @@ using System.Threading.Tasks; ...@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using VIZ.Framework.Plugin; using VIZ.Framework.Plugin;
using VIZ.TVP.Domain; using VIZ.TVP.Domain;
using VIZ.TVP.Plugin; using VIZ.TVP.Plugin;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module namespace VIZ.TVP.Module
{ {
...@@ -45,6 +46,43 @@ namespace VIZ.TVP.Module ...@@ -45,6 +46,43 @@ namespace VIZ.TVP.Module
public IPluginSupport Support { get; private set; } public IPluginSupport Support { get; private set; }
/// <summary> /// <summary>
/// 加载插件配置
/// </summary>
public void LoadPluginConfig()
{
Dictionary<string, PluginGroupModel> groupModels = new Dictionary<string, PluginGroupModel>();
foreach (var item in ApplicationDomainEx.DataBaseManager.CsvContext.PluginConfig)
{
if (!groupModels.TryGetValue(item.Group, out PluginGroupModel groupModel))
{
groupModel = new PluginGroupModel();
groupModel.Group = item.Group;
groupModels.Add(groupModel.Group, groupModel);
}
PluginConfigModel model = new PluginConfigModel();
model.PropertyFromConfig(item);
groupModel.Items.Add(model);
}
this.Support.PluginGroups = groupModels.Values.ToList();
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
if (string.IsNullOrWhiteSpace(info.PluginGroup))
{
this.Support.SelectedPluginGroup = this.Support.PluginGroups.FirstOrDefault();
}
else
{
this.Support.SelectedPluginGroup = this.Support.PluginGroups.FirstOrDefault(p => p.Group == info.PluginGroup) ?? this.Support.PluginGroups.FirstOrDefault();
}
}
/// <summary>
/// 加载插件 /// 加载插件
/// </summary> /// </summary>
public void LoadPlugins() public void LoadPlugins()
...@@ -52,8 +90,11 @@ namespace VIZ.TVP.Module ...@@ -52,8 +90,11 @@ namespace VIZ.TVP.Module
// 加载插件 // 加载插件
this.executeLoadPlugins(); this.executeLoadPlugins();
// 加载模板插件 if (this.Support.SelectedPluginGroup != null)
this.executeLoadTemplatePlugins(); {
// 加载外置插件
this.executeLoadFilePlugins();
}
} }
/// <summary> /// <summary>
...@@ -88,12 +129,15 @@ namespace VIZ.TVP.Module ...@@ -88,12 +129,15 @@ namespace VIZ.TVP.Module
} }
/// <summary> /// <summary>
/// 执行加载模板插件 /// 执行加载外置插件
/// </summary> /// </summary>
private void executeLoadTemplatePlugins() private void executeLoadFilePlugins()
{ {
string[] files = System.IO.Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory); string[] files = System.IO.Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory);
Type templateLifeCycleType = typeof(ITemplatePluginLifeCycle);
Type pluginLifeCycleType = typeof(IPluginLifeCycle);
foreach (string file in files) foreach (string file in files)
{ {
string fileName = System.IO.Path.GetFileName(file); string fileName = System.IO.Path.GetFileName(file);
...@@ -105,13 +149,14 @@ namespace VIZ.TVP.Module ...@@ -105,13 +149,14 @@ namespace VIZ.TVP.Module
string version = assembly.GetCustomAttribute<AssemblyVersionAttribute>()?.Version; string version = assembly.GetCustomAttribute<AssemblyVersionAttribute>()?.Version;
Type[] types = assembly.GetTypes(); Type[] types = assembly.GetTypes();
Type lifeCycleType = typeof(ITemplatePluginLifeCycle);
foreach (Type type in types) foreach (Type type in types)
{ {
if (!type.IsClass || !lifeCycleType.IsAssignableFrom(type)) if (!type.IsClass)
continue; continue;
// 模板插件
if (templateLifeCycleType.IsAssignableFrom(type))
{
ITemplatePluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as ITemplatePluginLifeCycle; ITemplatePluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as ITemplatePluginLifeCycle;
if (lifeCycle == null) if (lifeCycle == null)
{ {
...@@ -120,10 +165,42 @@ namespace VIZ.TVP.Module ...@@ -120,10 +165,42 @@ namespace VIZ.TVP.Module
} }
PluginInfo info = lifeCycle.Register(); PluginInfo info = lifeCycle.Register();
if (!this.Support.SelectedPluginGroup.Items.Any(p => p.PluginID == info.ID && p.Type == PluginTypeEnum.TemplatePlugin))
{
continue;
}
info.LifeCycle = lifeCycle; info.LifeCycle = lifeCycle;
info.Version = version; info.Version = version;
lifeCycle.Initialize(); lifeCycle.Initialize();
ApplicationDomainEx.PluginManager.TemplatePlugins.Add(info); ApplicationDomainEx.PluginManager.TemplatePlugins.Add(info);
continue;
}
// 插件
if (pluginLifeCycleType.IsAssignableFrom(type))
{
IPluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as IPluginLifeCycle;
if (lifeCycle == null)
{
log.Error($"init plugin type: {type.FullName} error.");
continue;
}
PluginInfo info = lifeCycle.Register();
if (!this.Support.SelectedPluginGroup.Items.Any(p => p.PluginID == info.ID && p.Type == PluginTypeEnum.Plugin))
{
continue;
}
info.LifeCycle = lifeCycle;
info.Version = version;
lifeCycle.Initialize();
ApplicationDomainEx.PluginManager.Plugins.Add(info);
continue;
}
} }
} }
} }
......
...@@ -24,45 +24,56 @@ ...@@ -24,45 +24,56 @@
<RowDefinition Height="50"></RowDefinition> <RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition> <RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition> <RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition> <ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- 节目 -->
<TextBlock Text="节目:" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Row="0" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=PluginGroups}"
SelectedItem="{Binding Path=SelectedPluginGroup,Mode=TwoWay}"
DisplayMember="Group">
</dxe:ComboBoxEdit>
<!-- 引擎 --> <!-- 引擎 -->
<TextBlock Text="引擎:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="引擎:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Column="1" Height="30" ItemsSource="{Binding Path=LocalEngineTypes}" <dxe:ComboBoxEdit Grid.Row="1" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=LocalEngineTypes}"
SelectedItem="{Binding Path=SelectedLocalEngineType,Mode=TwoWay}" SelectedItem="{Binding Path=SelectedLocalEngineType,Mode=TwoWay}"
DisplayMember="Description"> DisplayMember="Description">
</dxe:ComboBoxEdit> </dxe:ComboBoxEdit>
<!-- IP --> <!-- IP -->
<TextBlock Text="IP:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="IP:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="1" Grid.Column="1" Height="30" <dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30"
EditValue="{Binding GH_IP,Mode=TwoWay}"></dxe:TextEdit> EditValue="{Binding GH_IP,Mode=TwoWay}"></dxe:TextEdit>
<!-- 端口 --> <!-- 端口 -->
<TextBlock Text="端口:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="端口:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30" MaskType="RegEx" <dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30" MaskType="RegEx"
Mask="[0-9]{0,7}" Mask="[0-9]{0,7}"
EditValue="{Binding GH_Port,Mode=TwoWay}"></dxe:TextEdit> EditValue="{Binding GH_Port,Mode=TwoWay}"></dxe:TextEdit>
<!-- ServerName --> <!-- ServerName -->
<TextBlock Text="服务名:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="服务名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30" <dxe:TextEdit Grid.Row="4" Grid.Column="1" Height="30"
EditValue="{Binding GH_ServerName,Mode=TwoWay}"></dxe:TextEdit> EditValue="{Binding GH_ServerName,Mode=TwoWay}"></dxe:TextEdit>
<!-- UserName --> <!-- UserName -->
<TextBlock Text="用户名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="用户名:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="4" Grid.Column="1" Height="30" <dxe:TextEdit Grid.Row="5" Grid.Column="1" Height="30"
EditValue="{Binding VIZ_UserName,Mode=TwoWay}"></dxe:TextEdit> EditValue="{Binding VIZ_UserName,Mode=TwoWay}"></dxe:TextEdit>
<!-- Password --> <!-- Password -->
<TextBlock Text="密码:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="密码:" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="5" Grid.Column="1" Height="30" <dxe:TextEdit Grid.Row="6" Grid.Column="1" Height="30"
EditValue="{Binding VIZ_Password,Mode=TwoWay}"></dxe:TextEdit> EditValue="{Binding VIZ_Password,Mode=TwoWay}"></dxe:TextEdit>
<!-- 按钮组 --> <!-- 按钮组 -->
<Button Grid.Row="6" Width="120" Height="40" Grid.Column="1" Content="登录" HorizontalAlignment="Right" <Button Grid.Row="7" Width="120" Height="40" Grid.Column="1" Content="登录" HorizontalAlignment="Right"
Command="{Binding Path=LoginCommand}"></Button> Command="{Binding Path=LoginCommand}"></Button>
</Grid> </Grid>
......
...@@ -64,6 +64,35 @@ namespace VIZ.TVP.Module ...@@ -64,6 +64,35 @@ namespace VIZ.TVP.Module
// Property // Property
// ================================================================================== // ==================================================================================
#region PluginGroups -- 插件分组集合
private List<PluginGroupModel> pluginGroups;
/// <summary>
/// 插件分组集合
/// </summary>
public List<PluginGroupModel> PluginGroups
{
get { return pluginGroups; }
set { pluginGroups = value; this.RaisePropertyChanged(nameof(PluginGroups)); }
}
#endregion
#region SelectedPluginGroup -- 选中的插件分组
private PluginGroupModel selectedPluginGroup;
/// <summary>
/// 选中的插件分组
/// </summary>
public PluginGroupModel SelectedPluginGroup
{
get { return selectedPluginGroup; }
set { selectedPluginGroup = value; this.RaisePropertyChanged(nameof(SelectedPluginGroup)); }
}
#endregion
#region GH_IP -- GH IP #region GH_IP -- GH IP
private string gh_ip; private string gh_ip;
...@@ -214,6 +243,9 @@ namespace VIZ.TVP.Module ...@@ -214,6 +243,9 @@ namespace VIZ.TVP.Module
// 加载登录信息 // 加载登录信息
this.loginController.LoadedLoginInfo(); this.loginController.LoadedLoginInfo();
// 加载插件配置信息
this.pluginController.LoadPluginConfig();
// 加载插件 // 加载插件
this.pluginController.LoadPlugins(); this.pluginController.LoadPlugins();
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
xmlns:storage="clr-namespace:VIZ.TVP.Storage;assembly=VIZ.TVP.Storage" xmlns:storage="clr-namespace:VIZ.TVP.Storage;assembly=VIZ.TVP.Storage"
xmlns:resource="clr-namespace:VIZ.TVP.Module.Resource;assembly=VIZ.TVP.Module.Resource" xmlns:resource="clr-namespace:VIZ.TVP.Module.Resource;assembly=VIZ.TVP.Module.Resource"
xmlns:local="clr-namespace:VIZ.TVP.Module" xmlns:local="clr-namespace:VIZ.TVP.Module"
xmlns:domain="clr-namespace:VIZ.TVP.Domain;assembly=VIZ.TVP.Domain"
d:DataContext="{d:DesignInstance Type=local:ProgramListViewModel}" d:DataContext="{d:DesignInstance Type=local:ProgramListViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800"> d:DesignHeight="600" d:DesignWidth="800">
...@@ -66,7 +67,12 @@ ...@@ -66,7 +67,12 @@
<dxe:TextEditSettings TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLength="50"></dxe:TextEditSettings> <dxe:TextEditSettings TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLength="50"></dxe:TextEditSettings>
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</dxg:GridColumn> </dxg:GridColumn>
<dxg:GridColumn Header="层" FieldName="Layer" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn> <dxg:GridColumn Header="层" FieldName="Layer" AllowSorting="False" AllowColumnFiltering="False">
<dxg:GridColumn.EditSettings>
<dxe:ComboBoxEditSettings ItemsSource="{Binding Source={x:Static domain:ApplicationConstants.VIZ_LAYERS}}"
IsTextEditable="False"></dxe:ComboBoxEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="引擎类型" FieldName="EngineType" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn> <dxg:GridColumn Header="引擎类型" FieldName="EngineType" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
</dxg:GridControl.Columns> </dxg:GridControl.Columns>
<dxg:GridControl.View> <dxg:GridControl.View>
...@@ -139,6 +145,7 @@ ...@@ -139,6 +145,7 @@
<MenuItem Header="重命名分组" Command="{Binding Path=PlacementTarget.DataContext.RenameGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/> <MenuItem Header="重命名分组" Command="{Binding Path=PlacementTarget.DataContext.RenameGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<Separator></Separator> <Separator></Separator>
<MenuItem Header="删除分组" Command="{Binding Path=PlacementTarget.DataContext.DeleteGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/> <MenuItem Header="删除分组" Command="{Binding Path=PlacementTarget.DataContext.DeleteGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="删除节目单项" Command="{Binding Path=PlacementTarget.DataContext.DeleteItemCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu> </ContextMenu>
</dx:DXTabControl.ContextMenu> </dx:DXTabControl.ContextMenu>
<dx:DXTabControl.View> <dx:DXTabControl.View>
...@@ -183,7 +190,12 @@ ...@@ -183,7 +190,12 @@
<dxe:TextEditSettings TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLength="50"></dxe:TextEditSettings> <dxe:TextEditSettings TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLength="50"></dxe:TextEditSettings>
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</dxg:GridColumn> </dxg:GridColumn>
<dxg:GridColumn Header="层" FieldName="Layer" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="false"></dxg:GridColumn> <dxg:GridColumn Header="层" FieldName="Layer" AllowSorting="False" AllowColumnFiltering="false">
<dxg:GridColumn.EditSettings>
<dxe:ComboBoxEditSettings ItemsSource="{Binding Source={x:Static domain:ApplicationConstants.VIZ_LAYERS}}"
IsTextEditable="False"></dxe:ComboBoxEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="引擎类型" FieldName="EngineType" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn> <dxg:GridColumn Header="引擎类型" FieldName="EngineType" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
<dxg:GridColumn Header="模板类型" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" <dxg:GridColumn Header="模板类型" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
Binding="{Binding Path=TemplateType,Converter={StaticResource Enum2EnumDescriptionConverter}}"> Binding="{Binding Path=TemplateType,Converter={StaticResource Enum2EnumDescriptionConverter}}">
......
...@@ -12,6 +12,7 @@ using VIZ.Framework.Core; ...@@ -12,6 +12,7 @@ using VIZ.Framework.Core;
using VIZ.Framework.Plugin; using VIZ.Framework.Plugin;
using VIZ.TVP.Domain; using VIZ.TVP.Domain;
using VIZ.TVP.Service; using VIZ.TVP.Service;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module namespace VIZ.TVP.Module
{ {
...@@ -42,6 +43,7 @@ namespace VIZ.TVP.Module ...@@ -42,6 +43,7 @@ namespace VIZ.TVP.Module
this.AddGroupCommand = new VCommand(this.AddGroup); this.AddGroupCommand = new VCommand(this.AddGroup);
this.RenameGroupCommand = new VCommand(this.RenameGroup); this.RenameGroupCommand = new VCommand(this.RenameGroup);
this.DeleteGroupCommand = new VCommand(this.DeleteGroup); this.DeleteGroupCommand = new VCommand(this.DeleteGroup);
this.DeleteItemCommand = new VCommand(this.DeleteItem);
this.SceneTemplateAddToListCommand = new VCommand(this.SceneTemplateAddToList); this.SceneTemplateAddToListCommand = new VCommand(this.SceneTemplateAddToList);
this.OtherTemplateAddToListCommand = new VCommand(this.OtherTemplateAddToList); this.OtherTemplateAddToListCommand = new VCommand(this.OtherTemplateAddToList);
this.SceneTemplateUpdateCommand = new VCommand(this.SceneTemplateUpdate); this.SceneTemplateUpdateCommand = new VCommand(this.SceneTemplateUpdate);
...@@ -312,6 +314,27 @@ namespace VIZ.TVP.Module ...@@ -312,6 +314,27 @@ namespace VIZ.TVP.Module
#endregion #endregion
#region DeleteItemCommand -- 删除分组项命令
/// <summary>
/// 删除分组项命令
/// </summary>
public VCommand DeleteItemCommand { get; set; }
/// <summary>
/// 删除分组项
/// </summary>
private void DeleteItem()
{
if (this.SelectedProgramListModel == null || this.SelectedProgramListModel.SelectedItem == null)
return;
this.SelectedProgramListModel.Items.Remove(this.SelectedProgramListModel.SelectedItem);
this.SelectedProgramListModel.SelectedItem = null;
}
#endregion
#region SceneTemplateAddToListCommand -- 场景模板添加至节目单命令 #region SceneTemplateAddToListCommand -- 场景模板添加至节目单命令
/// <summary> /// <summary>
...@@ -570,6 +593,7 @@ namespace VIZ.TVP.Module ...@@ -570,6 +593,7 @@ namespace VIZ.TVP.Module
model.TemplateID = Guid.NewGuid().ToString(); model.TemplateID = Guid.NewGuid().ToString();
model.SceneName = fileModel.Name; model.SceneName = fileModel.Name;
model.Path = fileModel.Path; model.Path = fileModel.Path;
model.Layer = VizLayerEnum.MAIN_LAYER.ToString();
model.TemplateType = Storage.ProgramTemplateType.Scene; model.TemplateType = Storage.ProgramTemplateType.Scene;
model.Thumbnail = fileModel.Thumbnail; model.Thumbnail = fileModel.Thumbnail;
model.ThumbnailBitmap = fileModel.ThumbnailBitmap; model.ThumbnailBitmap = fileModel.ThumbnailBitmap;
......
...@@ -32,8 +32,12 @@ ...@@ -32,8 +32,12 @@
<ColumnDefinition Width="*" MinWidth="240" MaxWidth="400"></ColumnDefinition> <ColumnDefinition Width="*" MinWidth="240" MaxWidth="400"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 资源文件夹 --> <!-- 资源文件夹 -->
<dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,6,0" <dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,6,0" Grid.Row="1"
SelectedItem="{Binding Path=SelectedFolderModel,Mode=TwoWay}" SelectedItem="{Binding Path=SelectedFolderModel,Mode=TwoWay}"
SelectionMode="Row" ShowNodeImages="True" ShowSearchPanel="False" SelectionMode="Row" ShowNodeImages="True" ShowSearchPanel="False"
ExpandStateFieldName="IsExpand" ExpandStateFieldName="IsExpand"
...@@ -53,11 +57,34 @@ ...@@ -53,11 +57,34 @@
</dxg:TreeViewControl> </dxg:TreeViewControl>
<!-- 文件夹等待 --> <!-- 文件夹等待 -->
<dx:WaitIndicator DeferedVisibility="{Binding IsFolderLoading}" Content="Loading..." Margin="0,0,6,0" /> <dx:WaitIndicator DeferedVisibility="{Binding IsFolderLoading}" Content="Loading..." Grid.Row="1" Margin="0,0,6,0" />
<GridSplitter HorizontalAlignment="Right" Width="4"></GridSplitter> <GridSplitter HorizontalAlignment="Right" Width="4" Grid.Row="1"></GridSplitter>
<!-- 资源文件 --> <!-- 资源文件 -->
<dxg:GridControl Grid.Column="1" ShowBorder="False" <StackPanel Grid.Column="1" Orientation="Horizontal">
<RadioButton Height="30" Width="60" Content="All" IsChecked="True">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.None}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Height="30" Width="60" Content="场景">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.SCENE}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Height="30" Width="60" Content="图片">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.IMAGE}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Height="30" Width="60" Content="视频">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.Video}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
</StackPanel>
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False" Grid.Row="1"
CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}"
ItemsSource="{Binding Path=FileModels}" ItemsSource="{Binding Path=FileModels}"
SelectedItem="{Binding Path=SelectedFileModel,Mode=TwoWay}"> SelectedItem="{Binding Path=SelectedFileModel,Mode=TwoWay}">
<dxg:GridControl.Resources> <dxg:GridControl.Resources>
...@@ -107,6 +134,6 @@ ...@@ -107,6 +134,6 @@
</dxg:GridControl> </dxg:GridControl>
<!-- 文件等待 --> <!-- 文件等待 -->
<dx:WaitIndicator DeferedVisibility="{Binding IsFileLoading}" Content="Loading..." Grid.Column="1" /> <dx:WaitIndicator DeferedVisibility="{Binding IsFileLoading}" Content="Loading..." Grid.Column="1" Grid.Row="1" />
</Grid> </Grid>
</UserControl> </UserControl>
using DevExpress.Mvvm.POCO; using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.UI.Native.ViewGenerator; using DevExpress.Mvvm.UI.Native.ViewGenerator;
using DevExpress.Mvvm.Xpf;
using DevExpress.Xpf.Core.Native; using DevExpress.Xpf.Core.Native;
using log4net; using log4net;
using System; using System;
...@@ -44,6 +45,8 @@ namespace VIZ.TVP.Module ...@@ -44,6 +45,8 @@ namespace VIZ.TVP.Module
this.RefreshFolderCommand = new VCommand(this.RefreshFolder); this.RefreshFolderCommand = new VCommand(this.RefreshFolder);
this.RefreshFileCommand = new VCommand(this.RefreshFile); this.RefreshFileCommand = new VCommand(this.RefreshFile);
this.FolderExpandCommand = new VCommand<DevExpress.Xpf.Grid.TreeList.NodeDoubleClickEventArgs>(this.FolderExpand); this.FolderExpandCommand = new VCommand<DevExpress.Xpf.Grid.TreeList.NodeDoubleClickEventArgs>(this.FolderExpand);
this.FileFilterCommand = new VCommand<ResourceFileType>(this.FileFilter);
this.FileRowFilterCommand = new DevExpress.Mvvm.DelegateCommand<RowFilterArgs>(this.FileRowFilter);
this.FileContextMenuOpendCommand = new VCommand(this.FileContextMenuOpend); this.FileContextMenuOpendCommand = new VCommand(this.FileContextMenuOpend);
this.AddProgramTemplateCommand = new VCommand(this.AddProgramTemplate, this.CanAddProgramTemplate); this.AddProgramTemplateCommand = new VCommand(this.AddProgramTemplate, this.CanAddProgramTemplate);
...@@ -151,6 +154,20 @@ namespace VIZ.TVP.Module ...@@ -151,6 +154,20 @@ namespace VIZ.TVP.Module
#endregion #endregion
#region FilterResourceFileType -- 资源文件类型
private ResourceFileType filterResourceFileType;
/// <summary>
/// 资源文件类型
/// </summary>
public ResourceFileType FilterResourceFileType
{
get { return filterResourceFileType; }
set { filterResourceFileType = value; this.RaisePropertySaveChanged(nameof(FilterResourceFileType)); }
}
#endregion
// ================================================================================== // ==================================================================================
// Service & Controller // Service & Controller
// ================================================================================== // ==================================================================================
...@@ -279,6 +296,30 @@ namespace VIZ.TVP.Module ...@@ -279,6 +296,30 @@ namespace VIZ.TVP.Module
#endregion #endregion
#region FileFilterCommand -- 文件过滤命令
/// <summary>
/// 文件过滤命令
/// </summary>
public VCommand<ResourceFileType> FileFilterCommand { get; set; }
/// <summary>
/// 文件过滤
/// </summary>
/// <param name="type"></param>
private void FileFilter(ResourceFileType type)
{
this.FilterResourceFileType = type;
VizResourceView view = this.GetView<VizResourceView>();
if (view == null)
return;
view.fileGrid.RefreshData();
}
#endregion
#region FileContextMenuOpendCommand -- 文件右键菜单打开命令 #region FileContextMenuOpendCommand -- 文件右键菜单打开命令
/// <summary> /// <summary>
...@@ -329,6 +370,37 @@ namespace VIZ.TVP.Module ...@@ -329,6 +370,37 @@ namespace VIZ.TVP.Module
#endregion #endregion
#region FileRowFilterCommand -- 文件行筛选命令
/// <summary>
/// 文件行筛选命令, 该命令必须使用Dev的命令基类
/// </summary>
public DevExpress.Mvvm.DelegateCommand<RowFilterArgs> FileRowFilterCommand { get; set; }
/// <summary>
/// 文件行筛选
/// </summary>
/// <param name="e">赛选参数</param>
private void FileRowFilter(RowFilterArgs e)
{
GHResourceFileModel fileModel = e.Item as GHResourceFileModel;
if (fileModel == null)
{
e.Visible = false;
return;
}
if (this.FilterResourceFileType == ResourceFileType.None)
{
e.Visible = true;
return;
}
e.Visible = fileModel.FileType == this.FilterResourceFileType;
}
#endregion
// ================================================================================== // ==================================================================================
// Public Function // Public Function
// ================================================================================== // ==================================================================================
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
using VIZ.Framework.Connection;
using VIZ.Framework.Storage;
using VIZ.Framework.Module;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
namespace VIZ.TVP.Module
{
/// <summary>
/// 应用程序启动 -- 初始化CSV
/// </summary>
public class AppSetup_InitCSV : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_InitCSV));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 初始化CSV";
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
ApplicationDomainEx.DataBaseManager.CsvContext = new Storage.CsvContext();
// 加载插件配置
this.LoadPluginConfig();
return true;
}
/// <summary>
/// 加载插件配置
/// </summary>
private void LoadPluginConfig()
{
string folder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config");
if (!System.IO.Directory.Exists(folder))
{
System.IO.Directory.CreateDirectory(folder);
}
string path = System.IO.Path.Combine(folder, "plugin_config.csv");
ApplicationDomainEx.DataBaseManager.CsvContext.LoadPluginConfig(path);
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
}
}
}
...@@ -275,6 +275,7 @@ ...@@ -275,6 +275,7 @@
<Compile Include="Setting\View\SettingView.xaml.cs"> <Compile Include="Setting\View\SettingView.xaml.cs">
<DependentUpon>SettingView.xaml</DependentUpon> <DependentUpon>SettingView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" /> <Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" />
<Compile Include="Common\View\TextInputView.xaml.cs"> <Compile Include="Common\View\TextInputView.xaml.cs">
<DependentUpon>TextInputView.xaml</DependentUpon> <DependentUpon>TextInputView.xaml</DependentUpon>
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>
\ No newline at end of file
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
<Compile Include="VIZ\Interface\IVizCommandService.cs" /> <Compile Include="VIZ\Interface\IVizCommandService.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
using CsvHelper;
using log4net;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Storage;
namespace VIZ.TVP.Storage
{
/// <summary>
/// CSV上下文
/// </summary>
public class CsvContext
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(CsvContext));
/// <summary>
/// 插件配置
/// </summary>
[Csv(Scene = CsvScene.Read)]
public List<PluginConfig> PluginConfig { get; private set; }
/// <summary>
/// 加载插件配置
/// </summary>
/// <param name="path">文件路径</param>
public void LoadPluginConfig(string path)
{
using (StreamReader sr = new StreamReader(path, Encoding.Default))
using (CsvReader reader = new CsvReader(sr, CultureInfo.InvariantCulture))
{
this.PluginConfig = reader.GetRecords<PluginConfig>()?.ToList();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// 插件类型
/// </summary>
public enum PluginTypeEnum
{
/// <summary>
/// 普通插件
/// </summary>
Plugin,
/// <summary>
/// 模板插件
/// </summary>
TemplatePlugin
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// 插件配置
/// </summary>
public class PluginConfig
{
/// <summary>
/// 编号
/// </summary>
public string ID { get; set; }
/// <summary>
/// 插件ID
/// </summary>
public string PluginID { get; set; }
/// <summary>
/// 分组
/// </summary>
public string Group { get; set; }
/// <summary>
/// 显示名称
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 类型
/// </summary>
public PluginTypeEnum Type { get; set; }
}
}
...@@ -76,5 +76,10 @@ namespace VIZ.TVP.Storage ...@@ -76,5 +76,10 @@ namespace VIZ.TVP.Storage
/// VIZ 引擎4路径 /// VIZ 引擎4路径
/// </summary> /// </summary>
public string VIZ_Eng4Path { get; set; } = @"D:\Program Files (x86)\Vizrt\Viz3\viz.exe"; public string VIZ_Eng4Path { get; set; } = @"D:\Program Files (x86)\Vizrt\Viz3\viz.exe";
/// <summary>
/// 插件分组
/// </summary>
public string PluginGroup { get; set; }
} }
} }
...@@ -49,18 +49,43 @@ ...@@ -49,18 +49,43 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CsvHelper, Version=30.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
<HintPath>..\packages\CsvHelper.30.0.1\lib\net47\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="LiteDB, Version=5.0.13.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL"> <Reference Include="LiteDB, Version=5.0.13.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.13\lib\net45\LiteDB.dll</HintPath> <HintPath>..\packages\LiteDB.5.0.13\lib\net45\LiteDB.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.HashCode.1.0.0\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.0\lib\netstandard2.0\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
...@@ -70,6 +95,9 @@ ...@@ -70,6 +95,9 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CSV\CsvContext.cs" />
<Compile Include="CSV\Plugin\Enum\PluginTypeEnum.cs" />
<Compile Include="CSV\Plugin\PluginConfig.cs" />
<Compile Include="LiteDB\Application\LocalInfo\Enum\LocalEngineType.cs" /> <Compile Include="LiteDB\Application\LocalInfo\Enum\LocalEngineType.cs" />
<Compile Include="LiteDB\Application\LocalInfo\LocalInfoEntity.cs" /> <Compile Include="LiteDB\Application\LocalInfo\LocalInfoEntity.cs" />
<Compile Include="LiteDB\Application\TVPConnection\Enum\TVPEngineType.cs" /> <Compile Include="LiteDB\Application\TVPConnection\Enum\TVPEngineType.cs" />
...@@ -110,6 +138,7 @@ ...@@ -110,6 +138,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CsvHelper" version="30.0.1" targetFramework="net48" />
<package id="LiteDB" version="5.0.13" targetFramework="net48" /> <package id="LiteDB" version="5.0.13" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" /> <package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net48" />
<package id="Microsoft.Bcl.HashCode" version="1.0.0" targetFramework="net48" />
<package id="Microsoft.CSharp" version="4.3.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" /> <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="System.Buffers" version="4.4.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
</packages> </packages>
\ No newline at end of file
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>
\ No newline at end of file
...@@ -7,6 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{751737 ...@@ -7,6 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{751737
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
Doc\GH资源接口返回结果_文件.xml = Doc\GH资源接口返回结果_文件.xml Doc\GH资源接口返回结果_文件.xml = Doc\GH资源接口返回结果_文件.xml
Doc\GH资源接口返回结果_文件夹或项目.xml = Doc\GH资源接口返回结果_文件夹或项目.xml Doc\GH资源接口返回结果_文件夹或项目.xml = Doc\GH资源接口返回结果_文件夹或项目.xml
Doc\plugin_config.csv = Doc\plugin_config.csv
EndProjectSection EndProjectSection
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "05-Lib", "05-Lib", "{39CED10E-394F-46A3-8571-948E126F9EC2}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "05-Lib", "05-Lib", "{39CED10E-394F-46A3-8571-948E126F9EC2}"
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>
\ No newline at end of file
...@@ -23,8 +23,10 @@ namespace VIZ.TVP ...@@ -23,8 +23,10 @@ namespace VIZ.TVP
// 设置DevExpress主推 // 设置DevExpress主推
ApplicationThemeHelper.ApplicationThemeName = Theme.VS2019DarkName; ApplicationThemeHelper.ApplicationThemeName = Theme.VS2019DarkName;
// TODO: AppSetup // 初始化LiteDB
AppSetup.AppendSetup(new AppSetup_InitLiteDB()); AppSetup.AppendSetup(new AppSetup_InitLiteDB());
// 初始化CSV
AppSetup.AppendSetup(new AppSetup_InitCSV());
// 执行启动流程 // 执行启动流程
AppSetupContext context = AppSetup.Setup(); AppSetupContext context = AppSetup.Setup();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:module="clr-namespace:VIZ.TVP.Module;assembly=VIZ.TVP.Module" xmlns:module="clr-namespace:VIZ.TVP.Module;assembly=VIZ.TVP.Module"
Title="咪咕播控系统" Height="420" Width="500" WindowStartupLocation="CenterScreen" Title="咪咕播控系统" Height="480" Width="500" WindowStartupLocation="CenterScreen"
WindowStyle="SingleBorderWindow"> WindowStyle="SingleBorderWindow">
<Grid> <Grid>
......
...@@ -122,6 +122,9 @@ ...@@ -122,6 +122,9 @@
<None Include="config\log.config"> <None Include="config\log.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="config\plugin_config.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
......
ID,PluginID,Group,DisplayName,Type
1,1,CBA,CBA,Plugin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment