Commit 35b26a88 by liulongfei

GH数据库访问

parent 9e83e9b9
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>tag:localhost:19398,2022-12-07:/folders/FAF21F2E-AAE6-E349-B265-AC9314B358B5/</id>
<title>Folders</title>
<updated>2022-12-07T09:26:58Z</updated>
<author>
<name>Admin</name>
</author>
<link rel="search" href="http://localhost:19398/opensearchdescription/FAF21F2E-AAE6-E349-B265-AC9314B358B5" type="application/opensearchdescription+xml" title="file and folder search" />
<link href="http://localhost:19398/folder/C7FC16A7-3C53-044C-8D24-29C5BF4AF19D/" rel="up" type="application/atom+xml;type=entry"/>
<entry>
<title>Images</title>
<id>urn:uuid:45295B36-BAA0-A64F-9370-C9D20E006EF8</id>
<updated>2022-11-03T03:59:47Z</updated>
<category scheme="http://www.vizrt.com/types" term="Folder"/>
<link href="http://localhost:19398/folder/45295B36-BAA0-A64F-9370-C9D20E006EF8/" rel="self" type="application/atom+xml;type=entry"/>
<link href="http://localhost:19398/folders/45295B36-BAA0-A64F-9370-C9D20E006EF8/" rel="down" thr:count="1" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/45295B36-BAA0-A64F-9370-C9D20E006EF8/" rel="describedby" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/addons/45295B36-BAA0-A64F-9370-C9D20E006EF8/" rel="addon" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/45295B36-BAA0-A64F-9370-C9D20E006EF8/" rel="alternate" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/files/45295B36-BAA0-A64F-9370-C9D20E006EF8/" rel="related" type="application/atom+xml;type=feed"/>
</entry>
<entry>
<title>ImagesLink</title>
<id>urn:uuid:2A72E33B-286F-F74A-8B03-B3B18C10135E</id>
<updated>2022-11-03T09:32:36Z</updated>
<category scheme="http://www.vizrt.com/types" term="Folder"/>
<link href="http://localhost:19398/folder/2A72E33B-286F-F74A-8B03-B3B18C10135E/" rel="self" type="application/atom+xml;type=entry"/>
<link href="http://localhost:19398/folders/2A72E33B-286F-F74A-8B03-B3B18C10135E/" rel="down" thr:count="0" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/2A72E33B-286F-F74A-8B03-B3B18C10135E/" rel="describedby" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/addons/2A72E33B-286F-F74A-8B03-B3B18C10135E/" rel="addon" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/2A72E33B-286F-F74A-8B03-B3B18C10135E/" rel="alternate" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/files/2A72E33B-286F-F74A-8B03-B3B18C10135E/" rel="related" type="application/atom+xml;type=feed"/>
</entry>
<entry>
<title>Fonts</title>
<id>urn:uuid:31677F71-A52F-C34D-A880-68FB029CB363</id>
<updated>2022-11-03T12:17:13Z</updated>
<category scheme="http://www.vizrt.com/types" term="Folder"/>
<link href="http://localhost:19398/folder/31677F71-A52F-C34D-A880-68FB029CB363/" rel="self" type="application/atom+xml;type=entry"/>
<link href="http://localhost:19398/folders/31677F71-A52F-C34D-A880-68FB029CB363/" rel="down" thr:count="0" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/31677F71-A52F-C34D-A880-68FB029CB363/" rel="describedby" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/addons/31677F71-A52F-C34D-A880-68FB029CB363/" rel="addon" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/31677F71-A52F-C34D-A880-68FB029CB363/" rel="alternate" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/files/31677F71-A52F-C34D-A880-68FB029CB363/" rel="related" type="application/atom+xml;type=feed"/>
</entry>
<entry>
<title>Video</title>
<id>urn:uuid:849860BB-382F-2947-ADD4-807A5DD62DE8</id>
<updated>2022-11-03T12:25:46Z</updated>
<category scheme="http://www.vizrt.com/types" term="Folder"/>
<link href="http://localhost:19398/folder/849860BB-382F-2947-ADD4-807A5DD62DE8/" rel="self" type="application/atom+xml;type=entry"/>
<link href="http://localhost:19398/folders/849860BB-382F-2947-ADD4-807A5DD62DE8/" rel="down" thr:count="0" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/849860BB-382F-2947-ADD4-807A5DD62DE8/" rel="describedby" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/addons/849860BB-382F-2947-ADD4-807A5DD62DE8/" rel="addon" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/849860BB-382F-2947-ADD4-807A5DD62DE8/" rel="alternate" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/files/849860BB-382F-2947-ADD4-807A5DD62DE8/" rel="related" type="application/atom+xml;type=feed"/>
</entry>
<entry>
<title>Scenes</title>
<id>urn:uuid:AE7BAEDA-C139-854F-BB7A-878702BEFB9C</id>
<updated>2022-11-03T11:03:08Z</updated>
<category scheme="http://www.vizrt.com/types" term="Folder"/>
<link href="http://localhost:19398/folder/AE7BAEDA-C139-854F-BB7A-878702BEFB9C/" rel="self" type="application/atom+xml;type=entry"/>
<link href="http://localhost:19398/folders/AE7BAEDA-C139-854F-BB7A-878702BEFB9C/" rel="down" thr:count="0" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/AE7BAEDA-C139-854F-BB7A-878702BEFB9C/" rel="describedby" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/addons/AE7BAEDA-C139-854F-BB7A-878702BEFB9C/" rel="addon" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/AE7BAEDA-C139-854F-BB7A-878702BEFB9C/" rel="alternate" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/files/AE7BAEDA-C139-854F-BB7A-878702BEFB9C/" rel="related" type="application/atom+xml;type=feed"/>
</entry>
<entry>
<title>Audio</title>
<id>urn:uuid:EB35DEED-C32D-A741-BB8E-681C6D1B4737</id>
<updated>2022-11-03T12:25:36Z</updated>
<category scheme="http://www.vizrt.com/types" term="Folder"/>
<link href="http://localhost:19398/folder/EB35DEED-C32D-A741-BB8E-681C6D1B4737/" rel="self" type="application/atom+xml;type=entry"/>
<link href="http://localhost:19398/folders/EB35DEED-C32D-A741-BB8E-681C6D1B4737/" rel="down" thr:count="0" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/EB35DEED-C32D-A741-BB8E-681C6D1B4737/" rel="describedby" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/addons/EB35DEED-C32D-A741-BB8E-681C6D1B4737/" rel="addon" type="application/atom+xml;type=feed"/>
<link href="http://localhost:19398/metadata/folder/EB35DEED-C32D-A741-BB8E-681C6D1B4737/" rel="alternate" type="application/vnd.vizrt.payload+xml"/>
<link href="http://localhost:19398/files/EB35DEED-C32D-A741-BB8E-681C6D1B4737/" rel="related" type="application/atom+xml;type=feed"/>
</entry>
</feed>
...@@ -12,6 +12,11 @@ namespace VIZ.TVP.Domain ...@@ -12,6 +12,11 @@ namespace VIZ.TVP.Domain
public static class ServiceKeys public static class ServiceKeys
{ {
/// <summary> /// <summary>
/// 主视图服务
/// </summary>
public const string MAIN_VIEW_SERVICE = "MAIN_VIEW_SERVICE";
/// <summary>
/// 日志服务 /// 日志服务
/// </summary> /// </summary>
public const string LOG_SERVICE = "LOG_SERVICE"; public const string LOG_SERVICE = "LOG_SERVICE";
......
...@@ -86,5 +86,8 @@ ...@@ -86,5 +86,8 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Model\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -4,9 +4,38 @@ ...@@ -4,9 +4,38 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VIZ.TVP.Module" xmlns:local="clr-namespace:VIZ.TVP.Module"
d:DataContext="{d:DesignInstance Type=local:DebugViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="600" d:DesignWidth="800">
<UserControl.Resources>
<Style TargetType="GroupBox">
<Setter Property="Margin" Value="10"></Setter>
</Style>
<Style TargetType="Button">
<Setter Property="Width" Value="100"></Setter>
<Setter Property="Height" Value="30"></Setter>
<Setter Property="Margin" Value="10"></Setter>
</Style>
</UserControl.Resources>
<Grid> <Grid>
<Button Width="120" Height="40" Command="{Binding TestCommand}"></Button> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<GroupBox Header="Docking测试">
<StackPanel>
<Button Content="保存布局" Command="{Binding SaveLayoutCommand}"></Button>
<Button Content="加载布局" Command="{Binding LoadLayoutCommand}"></Button>
</StackPanel>
</GroupBox>
<GroupBox Header="日志测试" Grid.Column="1">
<StackPanel>
<Button Content="添加日志" Command="{Binding AddLogCommand}"></Button>
<Button Content="清理日志" Command="{Binding ClearLogCommand}"></Button>
</StackPanel>
</GroupBox>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -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:local="clr-namespace:VIZ.TVP.Module" xmlns:local="clr-namespace:VIZ.TVP.Module"
Title="调试窗口" Height="400" Width="600" WindowStartupLocation="CenterScreen"> Title="调试窗口" Height="600" Width="800" WindowStartupLocation="CenterScreen">
<Grid> <Grid>
<local:DebugView Margin="10"></local:DebugView> <local:DebugView Margin="10"></local:DebugView>
......
...@@ -15,30 +15,106 @@ namespace VIZ.TVP.Module ...@@ -15,30 +15,106 @@ namespace VIZ.TVP.Module
{ {
public DebugViewModel() public DebugViewModel()
{ {
this.TestCommand = new VCommand(this.Test); // Docking
this.SaveLayoutCommand = new VCommand(this.SaveLayout);
this.LoadLayoutCommand = new VCommand(this.LoadLayout);
// 日志
this.AddLogCommand = new VCommand(this.AddLog);
this.ClearLogCommand = new VCommand(this.ClearLog);
} }
// ================================================================================== // ==================================================================================
// Command // Command
// ================================================================================== // ==================================================================================
#region TestCommand -- 测试命令 // ---------------------------------------------------------
// Docking
#region SaveLayoutCommand -- 保存布局命令
/// <summary>
/// 保存布局命令
/// </summary>
public VCommand SaveLayoutCommand { get; set; }
/// <summary>
/// 保存布局
/// </summary>
private void SaveLayout()
{
IMainViewService service = ApplicationDomainEx.ServiceManager.GetService<IMainViewService>(ServiceKeys.MAIN_VIEW_SERVICE);
if (service == null)
return;
service.SaveLayout();
}
#endregion
#region LoadLayoutCommand -- 加载布局命令
/// <summary> /// <summary>
/// 测试命令 /// 加载布局命令
/// </summary> /// </summary>
public VCommand TestCommand { get; set; } public VCommand LoadLayoutCommand { get; set; }
/// <summary> /// <summary>
/// 测试 /// 加载布局
/// </summary> /// </summary>
private void Test() private void LoadLayout()
{
IMainViewService service = ApplicationDomainEx.ServiceManager.GetService<IMainViewService>(ServiceKeys.MAIN_VIEW_SERVICE);
if (service == null)
return;
service.LoadLayout();
}
#endregion
// ---------------------------------------------------------
// 日志
#region AddLogCommand -- 添加日志命令
/// <summary>
/// 添加日志命令
/// </summary>
public VCommand AddLogCommand { get; set; }
/// <summary>
/// 添加日志
/// </summary>
private void AddLog()
{ {
ILogService service = ApplicationDomainEx.ServiceManager.GetService<ILogService>(ServiceKeys.LOG_SERVICE); ILogService service = ApplicationDomainEx.ServiceManager.GetService<ILogService>(ServiceKeys.LOG_SERVICE);
if (service == null)
return;
service.AppendLog("this is a try."); service.AppendLog("this is a try.");
} }
#endregion #endregion
#region ClearLogCommand -- 清理日志命令
/// <summary>
/// 清理日志命令
/// </summary>
public VCommand ClearLogCommand { get; set; }
/// <summary>
/// 清理日志
/// </summary>
private void ClearLog()
{
ILogService service = ApplicationDomainEx.ServiceManager.GetService<ILogService>(ServiceKeys.LOG_SERVICE);
if (service == null)
return;
service.ClearLog();
}
#endregion
} }
} }
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<TextBox x:Name="tb" IsReadOnly="True" AcceptsReturn="False"></TextBox> <TextBox x:Name="tb" IsReadOnly="True" AcceptsReturn="False" VerticalScrollBarVisibility="Auto"></TextBox>
</Grid> </Grid>
</UserControl> </UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Module
{
/// <summary>
/// 主视图服务
/// </summary>
public interface IMainViewService : IService
{
/// <summary>
/// 保存布局
/// </summary>
void SaveLayout();
/// <summary>
/// 加载布局
/// </summary>
void LoadLayout();
}
}
...@@ -28,23 +28,7 @@ ...@@ -28,23 +28,7 @@
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop">
<Grid.RowDefinitions> <dxdo:LayoutGroup ItemsSource="{Binding ItemsSource}"></dxdo:LayoutGroup>
<RowDefinition Height="*"></RowDefinition> </dxdo:DockLayoutManager>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop">
<dxdo:LayoutGroup ItemsSource="{Binding ItemsSource}"></dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Content="Save" Click="Button_Click"></Button>
<Button Content="Load" Grid.Column="1" Click="Button_Click_1"></Button>
</Grid>
</Grid>
</UserControl> </UserControl>
...@@ -26,26 +26,6 @@ namespace VIZ.TVP.Module ...@@ -26,26 +26,6 @@ namespace VIZ.TVP.Module
InitializeComponent(); InitializeComponent();
WPFHelper.BindingViewModel(this, new MainViewModel()); WPFHelper.BindingViewModel(this, new MainViewModel());
//this.Loaded += MainView_Loaded;
}
private void MainView_Loaded(object sender, RoutedEventArgs e)
{
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "1.xml");
this.dockLayoutManager.RestoreLayoutFromXml(path);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "1.xml");
this.dockLayoutManager.SaveLayoutToXml(path);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "1.xml");
this.dockLayoutManager.RestoreLayoutFromXml(path);
} }
} }
} }
...@@ -6,6 +6,7 @@ using System.Collections.ObjectModel; ...@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows; using System.Windows;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Framework.Plugin; using VIZ.Framework.Plugin;
...@@ -16,7 +17,7 @@ namespace VIZ.TVP.Module ...@@ -16,7 +17,7 @@ namespace VIZ.TVP.Module
/// <summary> /// <summary>
/// 主视图模型 /// 主视图模型
/// </summary> /// </summary>
public class MainViewModel : ViewModelBase public class MainViewModel : ViewModelBase, IMainViewService
{ {
/// <summary> /// <summary>
/// 日志 /// 日志
...@@ -28,7 +29,9 @@ namespace VIZ.TVP.Module ...@@ -28,7 +29,9 @@ namespace VIZ.TVP.Module
// 包含视图的插件 // 包含视图的插件
this.ItemsSource = ApplicationDomainEx.PluginManager.Plugins.Where(p => p.HasView).ToObservableCollection(); this.ItemsSource = ApplicationDomainEx.PluginManager.Plugins.Where(p => p.HasView).ToObservableCollection();
// //
// 注册服务
ApplicationDomainEx.ServiceManager.AddService(ServiceKeys.MAIN_VIEW_SERVICE, this);
} }
#region ItemsSource -- 视图项 #region ItemsSource -- 视图项
...@@ -45,5 +48,30 @@ namespace VIZ.TVP.Module ...@@ -45,5 +48,30 @@ namespace VIZ.TVP.Module
#endregion #endregion
/// <summary>
/// 保存布局
/// </summary>
public void SaveLayout()
{
MainView view = this.GetView<MainView>();
if (view == null)
return;
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout.xml");
view.dockLayoutManager.SaveLayoutToXml(path);
}
/// <summary>
/// 加载布局
/// </summary>
public void LoadLayout()
{
MainView view = this.GetView<MainView>();
if (view == null)
return;
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout.xml");
view.dockLayoutManager.RestoreLayoutFromXml(path);
}
} }
} }
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
<DependentUpon>LogView.xaml</DependentUpon> <DependentUpon>LogView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Log\LogPluginLifeCycle.cs" /> <Compile Include="Log\LogPluginLifeCycle.cs" />
<Compile Include="MainView\Service\IMainViewService.cs" />
<Compile Include="MainView\ViewModel\MainViewModel.cs" /> <Compile Include="MainView\ViewModel\MainViewModel.cs" />
<Compile Include="MainView\View\MainView.xaml.cs"> <Compile Include="MainView\View\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon> <DependentUpon>MainView.xaml</DependentUpon>
......
...@@ -3,6 +3,8 @@ using System.Collections.Generic; ...@@ -3,6 +3,8 @@ 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.Framework.Core;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Service namespace VIZ.TVP.Service
{ {
...@@ -11,6 +13,32 @@ namespace VIZ.TVP.Service ...@@ -11,6 +13,32 @@ namespace VIZ.TVP.Service
/// </summary> /// </summary>
public class GHService : IGHService public class GHService : IGHService
{ {
/// <summary>
/// 获取请求令牌
/// </summary>
/// <returns>请求令牌</returns>
public string GetAuthorization()
{
string user = "Admin";
string password = "VizDb";
string basic = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{user}:{password}"));
return $"Basic {basic}";
}
/// <summary>
/// 获取Feed节点
/// </summary>
/// <param name="url">地址</param>
/// <returns>Feed节点</returns>
public GH_Feed_Node GetFeedNode(string url)
{
Dictionary<string, string> headers = new Dictionary<string, string>();
headers["Authorization"] = this.GetAuthorization();
string xml = HttpHelper.Get(url, headers, null);
GH_Feed_Node node = GH_NodeHelper.CreateFeedFromXML(xml);
return node;
}
} }
} }
...@@ -53,5 +53,19 @@ ...@@ -53,5 +53,19 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Storage\VIZ.Framework.Storage.csproj">
<Project>{06b80c09-343d-4bb2-aeb1-61cfbfbf5cad}</Project>
<Name>VIZ.Framework.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Storage\VIZ.TVP.Storage.csproj">
<Project>{d9e0c48d-d7e7-4207-a999-2fded536d4da}</Project>
<Name>VIZ.TVP.Storage</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -50,6 +50,17 @@ ...@@ -50,6 +50,17 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="XML\GH\Enum\GH_Category_Term_Enums.cs" />
<Compile Include="XML\GH\Enum\GH_Link_Rel_Enums.cs" />
<Compile Include="XML\GH\Enum\GH_Link_Type_Enums.cs" />
<Compile Include="XML\GH\Enum\GH_Xmlns_Enums.cs" />
<Compile Include="XML\GH\GH_NodeHelper.cs" />
<Compile Include="XML\GH\Node\GH_Author_Node.cs" />
<Compile Include="XML\GH\Node\GH_Category_Node.cs" />
<Compile Include="XML\GH\Node\GH_Entry_Node.cs" />
<Compile Include="XML\GH\Node\GH_Feed_Node.cs" />
<Compile Include="XML\GH\Node\GH_Link_Node.cs" />
<Compile Include="XML\IXmlSerialize.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj"> <ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
...@@ -64,5 +75,6 @@ ...@@ -64,5 +75,6 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// 类型
/// </summary>
public static class GH_Category_Term_Enums
{
/// <summary>
/// 文件夹
/// </summary>
public const string Folder = "Folder";
/// <summary>
/// 项目
/// </summary>
public const string Project = "Project";
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH 连接 引用类型
/// </summary>
public static class GH_Link_Rel_Enums
{
/// <summary>
/// 搜索
/// </summary>
public const string search = "search";
/// <summary>
/// 父项
/// </summary>
public const string up = "up";
/// <summary>
/// 自身
/// </summary>
public const string self = "self";
/// <summary>
/// 子项
/// </summary>
public const string down = "down";
/// <summary>
/// 描述者
/// </summary>
public const string describedby = "describedby";
/// <summary>
/// 插件
/// </summary>
public const string addon = "addon";
/// <summary>
/// 后补
/// </summary>
public const string alternate = "alternate";
/// <summary>
/// 有关系的
/// </summary>
public const string related = "related";
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH Link 类型
/// </summary>
public static class GH_Link_Type_Enums
{
/// <summary>
/// 资源
/// </summary>
public const string entry = "application/atom+xml;type=entry";
/// <summary>
/// 提供
/// </summary>
public const string feed = "application/atom+xml;type=feed";
/// <summary>
/// 有效载荷
/// </summary>
public const string payload_xml = "application/vnd.vizrt.payload+xml";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH命名空间
/// </summary>
public static class GH_Xmlns_Enums
{
/// <summary>
/// 默认命名空间
/// </summary>
public const string xmlns = "http://www.w3.org/2005/Atom";
/// <summary>
/// 音频
/// </summary>
public const string media = "http://search.yahoo.com/mrss/";
/// <summary>
/// 公开查询
/// </summary>
public const string opensearch = "http://a9.com/-/spec/opensearch/1.1/";
/// <summary>
/// 线程
/// </summary>
public const string thr = "http://purl.org/syndication/thread/1.0";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH 节点辅助类
/// </summary>
public static class GH_NodeHelper
{
/// <summary>
/// 从XML中获取Feed节点
/// </summary>
/// <param name="xml">xml数据</param>
/// <returns>Feed节点</returns>
public static GH_Feed_Node CreateFeedFromXML(string xml)
{
byte[] buffer = Encoding.UTF8.GetBytes(xml);
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer))
{
XElement feed = XElement.Load(ms);
GH_Feed_Node feed_node = new GH_Feed_Node();
feed_node.FromXmlElement(feed);
return feed_node;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH author节点
/// </summary>
public class GH_Author_Node : IXmlSerialize
{
/// <summary>
/// 名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
if (element == null)
return;
this.name = element.Element(XName.Get("name", GH_Xmlns_Enums.xmlns))?.Value;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH Category 节点
/// </summary>
public class GH_Category_Node : IXmlSerialize
{
/// <summary>
/// 命名空间
/// </summary>
public string scheme { get; set; }
/// <summary>
/// 条款
/// </summary>
/// <see cref="GH_Category_Term_Enums"/>
public string term { get; set; }
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
if (element == null)
return;
this.scheme = element.GetAttributeValue<string>("scheme");
this.term = element.GetAttributeValue<string>("term");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH Entry 节点
/// </summary>
public class GH_Entry_Node : IXmlSerialize
{
/// <summary>
/// 编号
/// </summary>
public string id { get; set; }
/// <summary>
/// 标题
/// </summary>
public string title { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public string updated { get; set; }
/// <summary>
/// 分类
/// </summary>
public GH_Category_Node category { get; set; } = new GH_Category_Node();
/// <summary>
/// 连接集合
/// </summary>
public List<GH_Link_Node> links { get; set; } = new List<GH_Link_Node>();
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
if (element == null)
return;
this.title = element.Element(XName.Get("title", GH_Xmlns_Enums.xmlns))?.Value;
this.id = element.Element(XName.Get("id", GH_Xmlns_Enums.xmlns))?.Value;
this.updated = element.Element(XName.Get("updated_at", GH_Xmlns_Enums.xmlns))?.Value;
this.category.FromXmlElement(element.Element(XName.Get("category", GH_Xmlns_Enums.xmlns)));
foreach (XElement link in element.Elements(XName.Get("link", GH_Xmlns_Enums.xmlns)))
{
GH_Link_Node link_node = new GH_Link_Node();
link_node.FromXmlElement(link);
this.links.Add(link_node);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH Feed 节点
/// </summary>
public class GH_Feed_Node : IXmlSerialize
{
/// <summary>
/// 编号
/// </summary>
public string id { get; set; }
/// <summary>
/// 标题
/// </summary>
public string title { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public string updated { get; set; }
/// <summary>
/// 作者
/// </summary>
public GH_Author_Node author { get; set; } = new GH_Author_Node();
/// <summary>
/// 引用连接集合
/// </summary>
public List<GH_Link_Node> links { get; set; } = new List<GH_Link_Node>();
/// <summary>
/// 节点集合
/// </summary>
public List<GH_Entry_Node> entries { get; set; } = new List<GH_Entry_Node>();
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
if (element == null)
return;
this.id = element.Element(XName.Get("id", GH_Xmlns_Enums.xmlns))?.Value;
this.title = element.Element(XName.Get("title", GH_Xmlns_Enums.xmlns))?.Value;
this.updated = element.Element(XName.Get("updated", GH_Xmlns_Enums.xmlns))?.Value;
this.author.FromXmlElement(element.Element(XName.Get("author", GH_Xmlns_Enums.xmlns)));
foreach (XElement link in element.Elements(XName.Get("link", GH_Xmlns_Enums.xmlns)))
{
GH_Link_Node link_node = new GH_Link_Node();
link_node.FromXmlElement(link);
this.links.Add(link_node);
}
foreach (XElement entry in element.Elements(XName.Get("entry", GH_Xmlns_Enums.xmlns)))
{
GH_Entry_Node entry_Node = new GH_Entry_Node();
entry_Node.FromXmlElement(entry);
this.entries.Add(entry_Node);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
namespace VIZ.TVP.Storage
{
/// <summary>
/// GH Link 节点
/// </summary>
public class GH_Link_Node : IXmlSerialize
{
/// <summary>
/// 引用
/// </summary>
/// <see cref="GH_Link_Rel_Enums"/>
public string rel { get; set; }
/// <summary>
/// 类型
/// </summary>
/// <see cref="GH_Link_Type_Enums"/>
public string type { get; set; }
/// <summary>
/// 引用
/// </summary>
public string href { get; set; }
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
if (element == null)
return;
this.href = element.GetAttributeValue<string>("href");
this.rel = element.GetAttributeValue<string>("rel");
this.type = element.GetAttributeValue<string>("type");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace VIZ.TVP.Storage
{
/// <summary>
/// XML序列化
/// </summary>
public interface IXmlSerialize
{
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
void FromXmlElement(XElement element);
}
}
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using System; using System;
using VIZ.TVP.Service;
namespace VIZ.TVP.UnitTest namespace VIZ.TVP.UnitTest
{ {
/// <summary>
/// GH 服务测试
/// </summary>
[TestClass] [TestClass]
public class UnitTest1 public class GHTest
{ {
[TestMethod] [TestMethod]
public void TestMethod1() public void TestMethod1()
{ {
GHService service = new GHService();
//var query = service.GetFeedNode("http://localhost:19398/folders/");
var query = service.GetFeedNode("http://localhost:19398/folders/C7FC16A7-3C53-044C-8D24-29C5BF4AF19D/");
} }
} }
} }
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<Reference Include="System.Web" /> <Reference Include="System.Web" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="UnitTest1.cs" /> <Compile Include="GHTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
...@@ -89,6 +89,10 @@ ...@@ -89,6 +89,10 @@
<Project>{47cf6fb0-e37d-4ef1-afc7-03db2bca8892}</Project> <Project>{47cf6fb0-e37d-4ef1-afc7-03db2bca8892}</Project>
<Name>VIZ.Framework.Module</Name> <Name>VIZ.Framework.Module</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\Viz.Framework.Plugin\VIZ.Framework.Plugin.csproj">
<Project>{39a3cdbe-2132-4c71-bf2f-f99a9e966109}</Project>
<Name>VIZ.Framework.Plugin</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Storage\VIZ.Framework.Storage.csproj"> <ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Storage\VIZ.Framework.Storage.csproj">
<Project>{06b80c09-343d-4bb2-aeb1-61cfbfbf5cad}</Project> <Project>{06b80c09-343d-4bb2-aeb1-61cfbfbf5cad}</Project>
<Name>VIZ.Framework.Storage</Name> <Name>VIZ.Framework.Storage</Name>
...@@ -105,6 +109,14 @@ ...@@ -105,6 +109,14 @@
<Project>{d5e72447-d86a-443c-b0a4-e76bca89ae8d}</Project> <Project>{d5e72447-d86a-443c-b0a4-e76bca89ae8d}</Project>
<Name>VIZ.TVP.Module</Name> <Name>VIZ.TVP.Module</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Plugin\VIZ.TVP.Plugin.csproj">
<Project>{75b858df-c0ac-4b56-b109-5c21317af0ce}</Project>
<Name>VIZ.TVP.Plugin</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Service\VIZ.TVP.Service.csproj">
<Project>{b4faa424-e356-465b-b0ba-7b915c4f8e2a}</Project>
<Name>VIZ.TVP.Service</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Storage\VIZ.TVP.Storage.csproj"> <ProjectReference Include="..\VIZ.TVP.Storage\VIZ.TVP.Storage.csproj">
<Project>{d9e0c48d-d7e7-4207-a999-2fded536d4da}</Project> <Project>{d9e0c48d-d7e7-4207-a999-2fded536d4da}</Project>
<Name>VIZ.TVP.Storage</Name> <Name>VIZ.TVP.Storage</Name>
......
...@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 ...@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.3.32825.248 VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{751737B7-0297-4966-9978-CF1442765BD0}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{751737B7-0297-4966-9978-CF1442765BD0}"
ProjectSection(SolutionItems) = preProject
Doc\GH资源接口返回结果.xml = Doc\GH资源接口返回结果.xml
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}"
EndProject EndProject
......
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