Commit db792da2 by liulongfei

GH 资源

parent 2a9a359d
......@@ -20,5 +20,10 @@ namespace VIZ.Package.Domain
/// Viz预览
/// </summary>
public const string VIZ_PREVIEW = "VIZ_PREVIEW";
/// <summary>
/// GH场景
/// </summary>
public const string GH_SCENE = "GH_SCENE";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 资源文件类型
/// </summary>
public enum ResourceFileType
{
/// <summary>
/// 未指定
/// </summary>
None,
/// <summary>
/// 未知
/// </summary>
Unknow,
/// <summary>
/// 图片
/// </summary>
IMAGE,
/// <summary>
/// 场景
/// </summary>
SCENE,
/// <summary>
/// 视频
/// </summary>
Video
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 资源文件夹类型
/// </summary>
public enum ResourceFolderType
{
/// <summary>
/// 项目文件夹
/// </summary>
Project,
/// <summary>
/// 普通文件夹
/// </summary>
Folder
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Storage;
namespace VIZ.Package.Domain
{
/// <summary>
/// GH 资源文件模型
/// </summary>
public class GHResourceFileModel : ResourceFileModelBase, IDisposable
{
/// <summary>
/// GH 节点
/// </summary>
public GH_Entry_Node EntryNode { get; set; }
#region FloderModel -- 所属文件夹模型
private GHResourceFolderModel floderModel;
/// <summary>
/// 所属文件夹模型
/// </summary>
public GHResourceFolderModel FloderModel
{
get { return floderModel; }
set { floderModel = value; this.RaisePropertyChanged(nameof(FloderModel)); }
}
#endregion
#region Src --
private string src;
/// <summary>
/// 源
/// </summary>
public string Src
{
get { return src; }
set { src = value; this.RaisePropertyChanged(nameof(Src)); }
}
#endregion
#region Thumbnail -- 缩略图
private string thumbnail;
/// <summary>
/// 缩略图
/// </summary>
public string Thumbnail
{
get { return thumbnail; }
set { thumbnail = value; this.RaisePropertyChanged(nameof(Thumbnail)); }
}
#endregion
#region MimeType -- 文件格式
private string mimeType;
/// <summary>
/// 文件格式
/// </summary>
public string MimeType
{
get { return mimeType; }
set { mimeType = value; this.RaisePropertyChanged(nameof(MimeType)); }
}
#endregion
#region Path -- 路径
private string path;
/// <summary>
/// 路径
/// </summary>
public string Path
{
get { return path; }
set { path = value; this.RaisePropertyChanged(nameof(Path)); }
}
#endregion
#region ResourcePath -- 资源路径
/// <summary>
/// 资源路径
/// </summary>
public string ResourcePath
{
get { return $"{this.FileType}*{this.Path}"; }
}
#endregion
// ---------------------------------------------------------------------
// 扩展属性
#region ThumbnailBitmap -- 缩略图图片
private Bitmap thumbnailBitmap;
/// <summary>
/// 缩略图图片
/// </summary>
public Bitmap ThumbnailBitmap
{
get { return thumbnailBitmap; }
set { thumbnailBitmap = value; this.RaisePropertyChanged(nameof(ThumbnailBitmap)); }
}
#endregion
// ---------------------------------------------------------------------
// 方法
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
this.ThumbnailBitmap?.Dispose();
this.ThumbnailBitmap = null;
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Storage;
namespace VIZ.Package.Domain
{
/// <summary>
/// GH 资源文件夹模型
/// </summary>
public class GHResourceFolderModel : ResourceFolderModelBase
{
/// <summary>
/// GH 节点
/// </summary>
public GH_Entry_Node EntryNode { get; set; }
#region Path -- 路径
private string path;
/// <summary>
/// 路径
/// </summary>
public string Path
{
get { return path; }
set { path = value; this.RaisePropertyChanged(nameof(Path)); }
}
#endregion
#region Files -- 文件集合
private ObservableCollection<GHResourceFileModel> files;
/// <summary>
/// 文件集合
/// </summary>
public ObservableCollection<GHResourceFileModel> Files
{
get { return files; }
set { files = value; this.RaisePropertyChanged(nameof(Files)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 资源拖拽数据
/// </summary>
public class ResourceDragData
{
/// <summary>
/// 资源类型
/// </summary>
public ResourceFileType FileType { get; set; }
/// <summary>
/// 资源路径
/// </summary>
public string ResourcePath { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Package.Domain
{
/// <summary>
/// 资源文件模型基类
/// </summary>
public class ResourceFileModelBase : ModelBase
{
#region FileType -- 文件类型
private ResourceFileType fileType;
/// <summary>
/// 文件类型
/// </summary>
public ResourceFileType FileType
{
get { return fileType; }
set { fileType = value; this.RaisePropertyChanged(nameof(FileType)); }
}
#endregion
#region Name -- 名称
private string name;
/// <summary>
/// 名称
/// </summary>
public string Name
{
get { return name; }
set { name = value; this.RaisePropertyChanged(nameof(Name)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Package.Domain
{
/// <summary>
/// 资源文件夹模型
/// </summary>
public abstract class ResourceFolderModelBase : ModelBase
{
#region Name -- 名称
private string name;
/// <summary>
/// 名称
/// </summary>
public string Name
{
get { return name; }
set { name = value; this.RaisePropertyChanged(nameof(Name)); }
}
#endregion
#region FolderType -- 文件夹类型
private ResourceFolderType folderType;
/// <summary>
/// 文件夹类型
/// </summary>
public ResourceFolderType FolderType
{
get { return folderType; }
set { folderType = value; this.RaisePropertyChanged(nameof(FolderType)); }
}
#endregion
#region Parent -- 父节点
private ResourceFolderModelBase parent;
/// <summary>
/// 父节点
/// </summary>
public ResourceFolderModelBase Parent
{
get { return parent; }
set { parent = value; this.RaisePropertyChanged(nameof(Parent)); }
}
#endregion
#region Children -- 子节点集合
private ObservableCollection<ResourceFolderModelBase> children = new ObservableCollection<ResourceFolderModelBase>();
/// <summary>
/// 子节点集合
/// </summary>
public ObservableCollection<ResourceFolderModelBase> Children
{
get { return children; }
set { children = value; this.RaisePropertyChanged(nameof(Children)); }
}
#endregion
#region IsRefreshedFiles -- 是否刷新过文件
private bool isRefreshedFiles;
/// <summary>
/// 是否刷新过文件
/// </summary>
public bool IsRefreshedFiles
{
get { return isRefreshedFiles; }
set { isRefreshedFiles = value; this.RaisePropertyChanged(nameof(IsRefreshedFiles)); }
}
#endregion
#region IsExpand -- 是否展开
private bool isExpand;
/// <summary>
/// 是否展开
/// </summary>
public bool IsExpand
{
get { return isExpand; }
set { isExpand = value; this.RaisePropertyChanged(nameof(IsExpand)); }
}
#endregion
}
}
......@@ -56,6 +56,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -79,6 +80,13 @@
<Compile Include="Model\Page\PageModel.cs" />
<Compile Include="Model\Page\PageModelBase.cs" />
<Compile Include="Model\Page\PageTemplateModel.cs" />
<Compile Include="Model\Resource\Enum\ResourceFileType.cs" />
<Compile Include="Model\Resource\Enum\ResourceFolderType.cs" />
<Compile Include="Model\Resource\GH\GHResourceFileModel.cs" />
<Compile Include="Model\Resource\GH\GHResourceFolderModel.cs" />
<Compile Include="Model\Resource\ResourceDragData.cs" />
<Compile Include="Model\Resource\ResourceFileModelBase.cs" />
<Compile Include="Model\Resource\ResourceFolderModelBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
......@@ -110,5 +118,8 @@
<Name>VIZ.Package.Storage</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Model\Viz\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxi="http://schemas.devexpress.com/winfx/2008/xaml/core/internal"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys">
<Style x:Key="borderStyle" TargetType="Border">
<Setter Property="Background" Value="{dxi:ThemeResource {dxgt:GridRowThemeKey ResourceKey=BorderNoneBrush}}"/>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="dxg:TableView.IsFocusedRow" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{dxi:ThemeResource {dxgt:GridRowThemeKey ResourceKey=BorderSelectedBrush}}"/>
</MultiTrigger>
<Trigger Property="dxg:TableView.IsFocusedRow" Value="True">
<Setter Property="Background" Value="{dxi:ThemeResource {dxgt:GridRowThemeKey ResourceKey=BorderFocusedBrush}}"/>
</Trigger>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter Property="Background" Value="{dxi:ThemeResource {dxgt:GridRowThemeKey ResourceKey=BorderFocusedBrush}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
<ControlTemplate x:Key="{dxgt:GridCardThemeKey ResourceKey=ContainerTemplate}" TargetType="{x:Type ContentControl}">
<Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ClipToBounds="False">
<Border x:Name="borderCard" Width="Auto" Height="Auto" Style="{StaticResource borderStyle}">
<ContentPresenter />
</Border>
</Grid>
</ControlTemplate>
<Style TargetType="{x:Type dxg:GridCard}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<ContentControl x:Name="card" Template="{DynamicResource {dxgt:GridCardThemeKey ResourceKey=ContainerTemplate}}"
Style="{Binding Path=(dxg:GridControl.ActiveView).CardStyle, RelativeSource={RelativeSource TemplatedParent}}" >
<ContentControl Template="{DynamicResource {dxgt:GridCardThemeKey ResourceKey=DataContentTemplate}}" ClipToBounds="False">
<dxg:GridCardContentPresenter x:Name="presenter" Style="{DynamicResource {dxgt:GridCardThemeKey ResourceKey=ContentPresenterStyle}}" ClipToBounds="False" />
</ContentControl>
</ContentControl>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("VIZ.Package.Module.Resource")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VIZ.Package.Module.Resource")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly:ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace VIZ.Package.Module.Resource.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VIZ.Package.Module.Resource.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap cmd_template {
get {
object obj = ResourceManager.GetObject("cmd_template", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cmd_template" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cmd_template.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace VIZ.Package.Module.Resource.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
\ No newline at end of file
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VIZ.Package.Module.Resource">
</ResourceDictionary>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{327EA1F4-F23C-418A-A2EF-DA4F1039B333}</ProjectGuid>
<OutputType>library</OutputType>
<RootNamespace>VIZ.Package.Module.Resource</RootNamespace>
<AssemblyName>VIZ.Package.Module.Resource</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.Desktop.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Printing.v22.1.Core, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Core.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.1.Core, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Page Include="DevExpreess\GridControl\GridControl_Files.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\folder_24x24.png" />
<Resource Include="Icons\project_24x24.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\cmd_template.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using DevExpress.XtraPrinting.Native.Extensions;
using log4net;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Service;
using VIZ.Package.Storage;
namespace VIZ.Package.Module
{
/// <summary>
/// VIZ资源文件控制器
/// </summary>
public class GHResourceFileController
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(GHResourceFileController));
/// <summary>
/// VIZ资源缩略图控制器
/// </summary>
/// <param name="viewModel">视图模型</param>
public GHResourceFileController(GHResourcePanelModel viewModel)
{
this.ViewModel = viewModel;
}
/// <summary>
/// 支持
/// </summary>
public GHResourcePanelModel ViewModel { get; private set; }
/// <summary>
/// GH 资源服务
/// </summary>
private GHResourceService ghResourceService = new GHResourceService();
/// <summary>
/// GH 服务
/// </summary>
private GHService ghService = new GHService();
/// <summary>
/// 更新文件模型
/// </summary>
/// <param name="folder">文件夹</param>
public void UpdateFileModels(GHResourceFolderModel folder)
{
// 文件夹对象不存在
if (folder == null)
{
this.ViewModel.FileModels = null;
this.ViewModel.SelectedFileModel = null;
return;
}
// 已经获取过文件
if (folder.IsRefreshedFiles)
{
this.ViewModel.FileModels = folder.Files;
return;
}
GH_Link_Node link_related = folder.EntryNode.links.FirstOrDefault(p => p.rel == GH_Link_Rel_Enums.related);
if (link_related == null || string.IsNullOrWhiteSpace(link_related.href))
{
folder.IsRefreshedFiles = true;
return;
}
this.ViewModel.IsFileLoading = true;
ThreadHelper.SafeRun(() =>
{
List<GHResourceFileModel> files = ghResourceService.GetGHResourceFiles(link_related.href, folder);
WPFHelper.BeginInvoke(() =>
{
folder.Files = files.ToObservableCollection();
this.ViewModel.FileModels = folder.Files;
folder.IsRefreshedFiles = true;
this.ViewModel.IsFileLoading = false;
// 开始下载缩略图
this.BeginDownloadThumbnail(folder);
});
});
}
/// <summary>
/// 开始下载缩略图
/// </summary>
/// <param name="folder">文件夹</param>
public void BeginDownloadThumbnail(GHResourceFolderModel folder)
{
if (folder == null || folder.Files == null || folder.Files.Count == 0)
return;
ThreadHelper.SafeRun(() =>
{
foreach (GHResourceFileModel file in folder.Files)
{
this.DownloadThumbnail(file);
}
});
}
/// <summary>
/// 开始下载缩略图
/// </summary>
/// <param name="file">文件</param>
public void DownloadThumbnail(GHResourceFileModel file)
{
if (file == null || string.IsNullOrWhiteSpace(file.Thumbnail))
return;
try
{
Bitmap bmp = this.ghService.GetImage(file.Thumbnail);
WPFHelper.BeginInvoke(() =>
{
file.ThumbnailBitmap = bmp;
});
}
catch (Exception ex)
{
log.Error(ex);
}
}
/// <summary>
/// 销毁文件模型
/// </summary>
public void DisposeFileModels(GHResourceFolderModel folder)
{
if (folder == null || folder.Files == null || folder.Files.Count == 0)
return;
foreach (GHResourceFileModel file in folder.Files)
{
file.Dispose();
}
}
}
}
using DevExpress.Xpf.Core.Native;
using DevExpress.Xpf.Grid;
using DevExpress.Xpf.Grid.TreeList;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Globalization;
using System.Windows.Media;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// GH资源文件夹节点图片选择器
/// </summary>
public class GHResourceFolderNodeImageSelector : TreeListNodeImageSelector
{
/// <summary>
/// 文件夹图标
/// </summary>
public ImageSource Folder { get; set; }
/// <summary>
/// 项目图标
/// </summary>
public ImageSource Project { get; set; }
/// <summary>
/// 选择图标
/// </summary>
/// <param name="rowData">行数据</param>
/// <returns>图标</returns>
public override ImageSource Select(TreeListRowData rowData)
{
ResourceFolderModelBase model = rowData.Row as ResourceFolderModelBase;
if (model == null)
return null;
if (model.FolderType == ResourceFolderType.Project)
return this.Project;
if (model.FolderType == ResourceFolderType.Folder)
return this.Folder;
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
using VIZ.Package.Plugin;
namespace VIZ.Package.Module
{
/// <summary>
/// 日志插件生命周期
/// </summary>
public class GHScenePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public const string PLUGIN_ID = ModulePluginIds.GH_SCENE;
/// <summary>
/// 插件名称
/// </summary>
public const string PLUGIN_NAME = "场景";
/// <summary>
/// 注册
/// </summary>
/// <returns>插件信息</returns>
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(GHSceneView);
return info;
}
/// <summary>
/// 初始化
/// </summary>
public void Initialize()
{
}
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
}
}
}
<UserControl x:Class="VIZ.Package.Module.GHResourcePanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxi="http://schemas.devexpress.com/winfx/2008/xaml/core/internal"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:local="clr-namespace:VIZ.Package.Module"
xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:GHResourcePanelModel}"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.Package.Module.Resource;component/DevExpreess/GridControl/GridControl_Files.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common.Resource;component/Style/GridSplitter/GridSplitter_None.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<fcore:Bitmap2ImageSourceConverter x:Key="Bitmap2ImageSourceConverter"></fcore:Bitmap2ImageSourceConverter>
</ResourceDictionary>
</UserControl.Resources>
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="240" MinWidth="240" MaxWidth="400"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 资源文件夹 -->
<dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,10,0"
SelectedItem="{Binding Path=SelectedFolderModel,Mode=TwoWay}"
ContextMenu="{Binding Path=FolderContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
SelectionMode="Row" ShowNodeImages="True" ShowSearchPanel="False"
ExpandStateFieldName="IsExpand"
AllowEditing="False" TreeViewFieldName="Name" ChildNodesPath="Children">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="NodeDoubleClick" PassEventArgsToCommand="True" Command="{Binding Path=FolderExpandCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:TreeViewControl.NodeImageSelector>
<local:GHResourceFolderNodeImageSelector Folder="/VIZ.Package.Module.Resource;component/Icons/folder_24x24.png"
Project="/VIZ.Package.Module.Resource;component/Icons/project_24x24.png"></local:GHResourceFolderNodeImageSelector>
</dxg:TreeViewControl.NodeImageSelector>
</dxg:TreeViewControl>
<!-- 文件夹等待 -->
<dx:WaitIndicator DeferedVisibility="{Binding IsFolderLoading}" Content="Loading..." Margin="0,0,6,0" />
<GridSplitter HorizontalAlignment="Right" Width="10" Style="{StaticResource GridSplitter_None}"></GridSplitter>
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False"
ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}"
ItemsSource="{Binding Path=FileModels}"
SelectedItem="{Binding Path=SelectedFileModel,Mode=TwoWay}">
<dxg:GridControl.Resources>
<!-- 定义Card模板 -->
<DataTemplate x:Key="CardTemplate">
<Grid Width="120" ClipToBounds="False" UseLayoutRounding="True" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Image Source="{Binding Path=Row.ThumbnailBitmap,Converter={StaticResource Bitmap2ImageSourceConverter}}"></Image>
<TextBlock Grid.Row="1" TextAlignment="Center" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Center"
Text="{Binding Path=Row.Name}" ToolTip="{Binding Path=Row.Name}" Margin="0,5,0,0"/>
</Grid>
</DataTemplate>
</dxg:GridControl.Resources>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Name" AllowColumnFiltering="False" AllowEditing="False" ReadOnly="True"></dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:CardView IsColumnChooserVisible="False"
SeparatorThickness="0"
CardLayout="Rows"
ShowCardExpandButton="False"
ShowColumnHeaders="False"
ShowFilterPanelMode="Never"
ShowGroupedColumns="False"
ShowGroupPanel="False"
SearchPanelHighlightResults="False"
SearchPanelAllowFilter="True"
ShowSearchPanelMode="Never"
SearchColumns="Name"
NavigationStyle="Row"
CardTemplate="{StaticResource CardTemplate}"/>
</dxg:GridControl.View>
</dxg:GridControl>
<!-- 文件等待 -->
<dx:WaitIndicator DeferedVisibility="{Binding IsFileLoading}" Content="Loading..." Grid.Column="1" Grid.Row="1" />
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// GHResourcePanel.xaml 的交互逻辑
/// </summary>
public partial class GHResourcePanel : UserControl
{
public GHResourcePanel()
{
InitializeComponent();
}
#region FolderContextMenu -- 文件夹右键菜单
/// <summary>
/// 文件夹右键菜单
/// </summary>
public ContextMenu FolderContextMenu
{
get { return (ContextMenu)GetValue(FolderContextMenuProperty); }
set { SetValue(FolderContextMenuProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for FolderContextMenu. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty FolderContextMenuProperty =
DependencyProperty.Register("FolderContextMenu", typeof(ContextMenu), typeof(GHResourcePanel), new PropertyMetadata(null));
#endregion
#region FileContextMenu -- 文件右键菜单
/// <summary>
/// 文件右键菜单
/// </summary>
public ContextMenu FileContextMenu
{
get { return (ContextMenu)GetValue(FileContextMenuProperty); }
set { SetValue(FileContextMenuProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for FileContextMenu. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty FileContextMenuProperty =
DependencyProperty.Register("FileContextMenu", typeof(ContextMenu), typeof(GHResourcePanel), new PropertyMetadata(null));
#endregion
}
}
<UserControl x:Class="VIZ.Package.Module.GHSceneView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VIZ.Package.Module"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="Transparent">
<!-- GH资源面板 -->
<local:GHResourcePanel>
<local:GHResourcePanel.FolderContextMenu>
<ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFolderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</local:GHResourcePanel.FolderContextMenu>
<local:GHResourcePanel.FileContextMenu>
<ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</local:GHResourcePanel.FileContextMenu>
</local:GHResourcePanel>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// GHSceneView.xaml 的交互逻辑
/// </summary>
public partial class GHSceneView : UserControl
{
public GHSceneView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new GHSceneViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// GH场景视图模型
/// </summary>
public class GHSceneViewModel : GHResourcePanelModel
{
public GHSceneViewModel()
{
this.FilterResourceFileType = ResourceFileType.SCENE;
}
}
}
......@@ -52,9 +52,14 @@
<ItemGroup>
<Reference Include="DevExpress.Data.Desktop.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Mvvm.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Printing.v22.1.Core, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Core.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Core.v22.1.Extensions, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Docking.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.1.Core, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.1.Extensions, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="LiteDB, Version=5.0.15.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.15\lib\net45\LiteDB.dll</HintPath>
</Reference>
......@@ -64,6 +69,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
......@@ -87,6 +93,17 @@
<Compile Include="Debug\View\DebugWindow.xaml.cs">
<DependentUpon>DebugWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Resource\GHResource\GHScenePluginLifeCycle.cs" />
<Compile Include="Resource\GHResource\ViewModel\GHSceneViewModel.cs" />
<Compile Include="Resource\GHResource\View\GHSceneView.xaml.cs">
<DependentUpon>GHSceneView.xaml</DependentUpon>
</Compile>
<Compile Include="Resource\GHResource\Controller\GHResourceFileController.cs" />
<Compile Include="Resource\GHResource\Core\GHResourceFolderNodeImageSelector.cs" />
<Compile Include="Resource\GHResource\ViewModel\GHResourcePanelModel.cs" />
<Compile Include="Resource\GHResource\View\GHResourcePanel.xaml.cs">
<DependentUpon>GHResourcePanel.xaml</DependentUpon>
</Compile>
<Compile Include="Login\ViewModel\LoginViewModel.cs" />
<Compile Include="Login\View\LoginView.xaml.cs">
<DependentUpon>LoginView.xaml</DependentUpon>
......@@ -119,10 +136,10 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Setup\AppSetup_InitLiteDB.cs" />
<Compile Include="VizPreview\Controller\VizPreviewController.cs" />
<Compile Include="VizPreview\VizPreviewPluginLifeCycle.cs" />
<Compile Include="VizPreview\ViewModel\VizPreviewViewModel.cs" />
<Compile Include="VizPreview\View\VizPreviewView.xaml.cs">
<Compile Include="Preview\VizPreview\Controller\VizPreviewController.cs" />
<Compile Include="Preview\VizPreview\VizPreviewPluginLifeCycle.cs" />
<Compile Include="Preview\VizPreview\ViewModel\VizPreviewViewModel.cs" />
<Compile Include="Preview\VizPreview\View\VizPreviewView.xaml.cs">
<DependentUpon>VizPreviewView.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
......@@ -148,6 +165,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resource\GHResource\View\GHSceneView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resource\GHResource\View\GHResourcePanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Login\View\LoginView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -164,7 +189,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="VizPreview\View\VizPreviewView.xaml">
<Page Include="Preview\VizPreview\View\VizPreviewView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
......@@ -210,6 +235,10 @@
<Project>{dbaeae47-1f2d-4b05-82c3-abf7cc33aa2d}</Project>
<Name>VIZ.Package.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Package.Module.Resource\VIZ.Package.Module.Resource.csproj">
<Project>{327ea1f4-f23c-418a-a2ef-da4f1039b333}</Project>
<Name>VIZ.Package.Module.Resource</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Package.Plugin\VIZ.Package.Plugin.csproj">
<Project>{9c7d3994-340a-480f-8d06-92c562137810}</Project>
<Name>VIZ.Package.Plugin</Name>
......
......@@ -55,6 +55,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -66,6 +67,8 @@
<ItemGroup>
<Compile Include="Logic\Plugin\PluginService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Viz\GHResourceService.cs" />
<Compile Include="Viz\GHService.cs" />
<Compile Include="Viz\VizCommandService.cs" />
</ItemGroup>
<ItemGroup>
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
namespace VIZ.Package.Service
{
/// <summary>
/// GH 资源服务
/// </summary>
public class GHResourceService
{
/// <summary>
/// GH服务
/// </summary>
private GHService ghService = new GHService();
/// <summary>
/// 获取GH资源文件夹
/// </summary>
/// <param name="url">GH请求地址</param>
/// <param name="parent">父级节点</param>
/// <returns>GH资源树根节点</returns>
public List<GHResourceFolderModel> GetGHResourceFolders(string url, GHResourceFolderModel parent)
{
List<GHResourceFolderModel> list = new List<GHResourceFolderModel>();
GH_Feed_Node feed_node = ghService.GetFeedNode(url);
foreach (GH_Entry_Node entry_node in feed_node.entries)
{
GHResourceFolderModel child = new GHResourceFolderModel();
child.EntryNode = entry_node;
// 名称
child.Name = entry_node.title;
// 路径
if (parent != null)
{
child.Path = string.IsNullOrWhiteSpace(parent.Path) ? $"{child.Name}" : $"{parent.Path}/{child.Name}";
}
// 类型
if (entry_node.categorys.Any(p => p.term == GH_Category_Term_Enums.Project))
{
child.FolderType = ResourceFolderType.Project;
}
if (entry_node.categorys.Any(p => p.term == GH_Category_Term_Enums.Folder))
{
child.FolderType = ResourceFolderType.Folder;
}
// 子项信息
GH_Link_Node link_down = entry_node.links.FirstOrDefault(p => p.rel == GH_Link_Rel_Enums.down);
if (link_down == null)
continue;
List<GHResourceFolderModel> child_list = this.GetGHResourceFolders(link_down.href, child);
foreach (GHResourceFolderModel item in child_list)
{
child.Children.Add(item);
item.Parent = child;
}
list.Add(child);
}
return list;
}
/// <summary>
/// 获取GH资源文件
/// </summary>
/// <param name="url">GH请求地址</param>
/// <param name="parent">所属文件夹</param>
/// <returns>GH资源文件</returns>
public List<GHResourceFileModel> GetGHResourceFiles(string url, GHResourceFolderModel parent)
{
List<GHResourceFileModel> list = new List<GHResourceFileModel>();
GH_Feed_Node feed_node = ghService.GetFeedNode(url);
foreach (GH_Entry_Node entry_node in feed_node.entries)
{
GHResourceFileModel child = new GHResourceFileModel();
child.EntryNode = entry_node;
// 名称
child.FloderModel = parent;
child.Name = entry_node.title;
child.Src = entry_node.content.src;
child.Thumbnail = entry_node.thumbnail.url;
child.MimeType = entry_node.content.type;
child.Path = $"{parent.Path}/{child.Name}";
// 图片
if (entry_node.categorys.Any(p => p.term == GH_Category_Term_Enums.IMAGE))
{
child.FileType = ResourceFileType.IMAGE;
}
// 场景
if (entry_node.categorys.Any(p => p.term == GH_Category_Term_Enums.SCENE))
{
child.FileType = ResourceFileType.SCENE;
}
list.Add(child);
}
return list;
}
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Storage;
namespace VIZ.Package.Service
{
/// <summary>
/// GH服务
/// </summary>
public class GHService
{
/// <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;
}
/// <summary>
/// 获取图片
/// </summary>
/// <param name="url">地址</param>
/// <returns>图片对象</returns>
public Bitmap GetImage(string url)
{
Dictionary<string, string> headers = new Dictionary<string, string>();
headers["Authorization"] = this.GetAuthorization();
MemoryStream ms = HttpHelper.GetStream(url, headers, null, null);
Image img = Bitmap.FromStream(ms);
Bitmap bmp = new Bitmap(img);
ms.Dispose();
img.Dispose();
return bmp;
}
}
}
......@@ -79,10 +79,37 @@
<Compile Include="Enum\VizLayer.cs" />
<Compile Include="LocalDbContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Xml\ControlObject\Node\ControlObject_Element_Node.cs" />
<Compile Include="Xml\ControlObject\Node\ControlObject_Entry_Node.cs" />
<Compile Include="Xml\ControlObject\Node\ControlObject_Field_node.cs" />
<Compile Include="Xml\ControlObject\Node\ControlObject_Schema_Node.cs" />
<Compile Include="Xml\GH\Enum\GH_Category_Term_Enums.cs" />
<Compile Include="Xml\GH\Enum\GH_Content_Type_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_Content_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\GH\Node\GH_Thumbnail_Node.cs" />
<Compile Include="Xml\IXmlSerialize.cs" />
</ItemGroup>
<ItemGroup>
<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>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
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.Package.Storage
{
/// <summary>
/// 控制对象元素节点
/// </summary>
public class ControlObject_Element_Node : IXmlSerialize
{
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 实体集合
/// </summary>
public List<ControlObject_Entry_Node> Entrys { get; set; } = new List<ControlObject_Entry_Node>();
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
this.Description = element.GetAttributeValue<string>("description");
foreach (var item in element.Elements("entry"))
{
ControlObject_Entry_Node entry = new ControlObject_Entry_Node();
entry.FromXmlElement(item);
this.Entrys.Add(entry);
}
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
XElement element = new XElement("element");
element.SetAttributeValue("description", this.Description);
foreach (var item in this.Entrys)
{
element.Add(item.ToXmlElement());
}
return element;
}
}
}
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.Package.Storage
{
/// <summary>
/// 控制对象实体节点
/// </summary>
public class ControlObject_Entry_Node : IXmlSerialize
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 值
/// </summary>
public string Value { get; set; }
/// <summary>
/// 子项集合
/// </summary>
public List<ControlObject_Entry_Node> Entrys { get; set; } = new List<ControlObject_Entry_Node>();
/// <summary>
/// 子项元素集合
/// </summary>
public List<ControlObject_Element_Node> Elements { get; set; } = new List<ControlObject_Element_Node>();
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
this.Name = element.GetAttributeValue<string>("name");
if (!element.HasElements)
{
this.Value = element.Value;
}
foreach (var item in element.Elements("entry"))
{
ControlObject_Entry_Node entry = new ControlObject_Entry_Node();
entry.FromXmlElement(item);
this.Entrys.Add(entry);
}
foreach (var item in element.Elements("element"))
{
ControlObject_Element_Node el = new ControlObject_Element_Node();
el.FromXmlElement(item);
this.Elements.Add(el);
}
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
XElement entry = new XElement("entry");
if (!string.IsNullOrWhiteSpace(this.Name))
{
entry.SetAttributeValue("name", this.Name);
}
if (this.Value != null)
{
entry.Value = this.Value;
}
foreach (var item in this.Entrys)
{
entry.Add(item.ToXmlElement());
}
foreach (var item in this.Elements)
{
entry.Add(item.ToXmlElement());
}
return entry;
}
}
}
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
namespace VIZ.Package.Storage
{
/// <summary>
/// 控制对象列节点
/// </summary>
public class ControlObject_Field_node : IXmlSerialize
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 定义
/// </summary>
public ControlObject_Schema_Node Schema { get; set; }
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
this.Name = element.GetAttributeValue<string>("name");
this.Type = element.GetAttributeValue<string>("type");
this.Description = element.GetAttributeValue<string>("description");
var schema = element.Element("schema");
if (schema == null)
return;
this.Schema = new ControlObject_Schema_Node();
this.Schema.FromXmlElement(schema);
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotImplementedException();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace VIZ.Package.Storage
{
/// <summary>
/// 控制对象定义节点
/// </summary>
public class ControlObject_Schema_Node : IXmlSerialize
{
/// <summary>
/// 字段集合
/// </summary>
public List<ControlObject_Field_node> Fields { get; set; } = new List<ControlObject_Field_node>();
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
foreach (var item in element.Elements("field"))
{
ControlObject_Field_node field = new ControlObject_Field_node();
field.FromXmlElement(item);
this.Fields.Add(field);
}
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotImplementedException();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// 类型
/// </summary>
public static class GH_Category_Term_Enums
{
/// <summary>
/// 文件夹
/// </summary>
public const string Folder = "Folder";
/// <summary>
/// 项目
/// </summary>
public const string Project = "Project";
/// <summary>
/// 图片
/// </summary>
public const string IMAGE = "IMAGE";
/// <summary>
/// 场景
/// </summary>
public const string SCENE = "SCENE";
/// <summary>
/// 资源
/// </summary>
public const string asset = "asset";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// 内容类型
/// </summary>
public static class GH_Content_Type_Enums
{
/// <summary>
/// jpeg图片
/// </summary>
public const string image_jpg = "image/jpeg";
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.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.Package.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.Package.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.Package.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.Package.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;
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotSupportedException();
}
}
}
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.Package.Storage
{
/// <summary>
/// GH Category 节点
/// </summary>
public class GH_Category_Node : IXmlSerialize
{
/// <summary>
/// 命名空间
/// </summary>
public string scheme { get; set; }
/// <summary>
/// 条款
/// <see cref="GH_Category_Term_Enums"/>
/// </summary>
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");
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotSupportedException();
}
}
}
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.Package.Storage
{
/// <summary>
/// GH Content 节点
/// </summary>
public class GH_Content_Node : IXmlSerialize
{
/// <summary>
/// 地址
/// </summary>
public string src { get; set; }
/// <summary>
/// 类型
/// <see cref="GH_Content_Type_Enums"/>
/// </summary>
public string type { get; set; }
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
if (element == null)
return;
this.src = element.GetAttributeValue<string>("src");
this.type = element.GetAttributeValue<string>("type");
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotSupportedException();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace VIZ.Package.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 List<GH_Category_Node> categorys { get; set; } = new List<GH_Category_Node>();
/// <summary>
/// 连接集合
/// </summary>
public List<GH_Link_Node> links { get; set; } = new List<GH_Link_Node>();
/// <summary>
/// 内容
/// </summary>
public GH_Content_Node content { get; set; } = new GH_Content_Node();
/// <summary>
/// 缩略图
/// </summary>
public GH_Thumbnail_Node thumbnail { get; set; } = new GH_Thumbnail_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;
// 分类
foreach (XElement category in element.Elements(XName.Get("category", GH_Xmlns_Enums.xmlns)))
{
GH_Category_Node category_node = new GH_Category_Node();
category_node.FromXmlElement(category);
this.categorys.Add(category_node);
}
// 连接
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);
}
// 内容
this.content.FromXmlElement(element.Element(XName.Get("content", GH_Xmlns_Enums.xmlns)));
// 缩略图
this.thumbnail.FromXmlElement(element.Element(XName.Get("thumbnail", GH_Xmlns_Enums.media)));
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotSupportedException();
}
}
}
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.Package.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);
}
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotSupportedException();
}
}
}
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.Package.Storage
{
/// <summary>
/// GH Link 节点
/// </summary>
public class GH_Link_Node : IXmlSerialize
{
/// <summary>
/// 引用
/// <see cref="GH_Link_Rel_Enums"/>
/// </summary>
public string rel { get; set; }
/// <summary>
/// 类型
/// <see cref="GH_Link_Type_Enums"/>
/// </summary>
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");
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotSupportedException();
}
}
}
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.Package.Storage
{
/// <summary>
/// GH 缩略图节点
/// </summary>
public class GH_Thumbnail_Node : IXmlSerialize
{
/// <summary>
/// 地址
/// </summary>
public string url { get; set; }
/// <summary>
/// 宽度
/// </summary>
public string width { get; set; }
/// <summary>
/// 高度
/// </summary>
public string height { get; set; }
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
if (element == null)
return;
this.url = element.GetAttributeValue<string>("url");
this.width = element.GetAttributeValue<string>("width");
this.height = element.GetAttributeValue<string>("height");
}
/// <summary>
/// 转化为XElement节点
/// </summary>
public XElement ToXmlElement()
{
throw new NotSupportedException();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace VIZ.Package.Storage
{
/// <summary>
/// XML序列化
/// </summary>
public interface IXmlSerialize
{
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
void FromXmlElement(XElement element);
/// <summary>
/// 转化为XElement节点
/// </summary>
XElement ToXmlElement();
}
}
......@@ -59,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Package.Module", "VIZ.P
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Package.Connection", "VIZ.Package.Connection\VIZ.Package.Connection.csproj", "{421527F6-37B8-4615-9317-FFD5E272181B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Package.Module.Resource", "VIZ.Package.Module.Resource\VIZ.Package.Module.Resource.csproj", "{327EA1F4-F23C-418A-A2EF-DA4F1039B333}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -187,6 +189,14 @@ Global
{421527F6-37B8-4615-9317-FFD5E272181B}.Release|Any CPU.Build.0 = Release|Any CPU
{421527F6-37B8-4615-9317-FFD5E272181B}.Release|x64.ActiveCfg = Release|Any CPU
{421527F6-37B8-4615-9317-FFD5E272181B}.Release|x64.Build.0 = Release|Any CPU
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Debug|Any CPU.Build.0 = Debug|Any CPU
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Debug|x64.ActiveCfg = Debug|x64
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Debug|x64.Build.0 = Debug|x64
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Release|Any CPU.ActiveCfg = Release|Any CPU
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Release|Any CPU.Build.0 = Release|Any CPU
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Release|x64.ActiveCfg = Release|Any CPU
{327EA1F4-F23C-418A-A2EF-DA4F1039B333}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -207,6 +217,7 @@ Global
{BF693C2D-3DE8-463B-8394-A0667DCA7B42} = {A44C8649-695F-48E5-8CEF-5690FD4CE26B}
{6FD4C0F0-8A00-4DB8-924B-A3CD9A45297F} = {3EF92943-B3E1-4D8F-857E-B8C3B6999096}
{421527F6-37B8-4615-9317-FFD5E272181B} = {13578EF6-3708-4541-AD15-1432CCBB6A76}
{327EA1F4-F23C-418A-A2EF-DA4F1039B333} = {3EF92943-B3E1-4D8F-857E-B8C3B6999096}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {210415E4-5B35-429D-99F2-ACE39AB42FF3}
......
......@@ -180,6 +180,10 @@
<Project>{dbaeae47-1f2d-4b05-82c3-abf7cc33aa2d}</Project>
<Name>VIZ.Package.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Package.Module.Resource\VIZ.Package.Module.Resource.csproj">
<Project>{327ea1f4-f23c-418a-a2ef-da4f1039b333}</Project>
<Name>VIZ.Package.Module.Resource</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Package.Module\VIZ.Package.Module.csproj">
<Project>{6fd4c0f0-8a00-4db8-924b-a3cd9a45297f}</Project>
<Name>VIZ.Package.Module</Name>
......
[Application]
APPLICATION_IS_DEBUG=true
\ No newline at end of file
APPLICATION_IS_DEBUG=false
\ No newline at end of file
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