| 1 | #Region "Microsoft.VisualBasic::08c37d07e12bcd1b14d7abbe21a4729f, Microsoft.VisualBasic.Core\Text\Xml\Models\Href.vb" |
| 2 | |
| 3 | ' Author: |
| 4 | ' |
| 5 | ' asuka (amethyst.asuka@gcmodeller.org) |
| 6 | ' xie (genetics@smrucc.org) |
| 7 | ' xieguigang (xie.guigang@live.com) |
| 8 | ' |
| 9 | ' Copyright (c) 2018 GPL3 Licensed |
| 10 | ' |
| 11 | ' |
| 12 | ' GNU GENERAL PUBLIC LICENSE (GPL3) |
| 13 | ' |
| 14 | ' |
| 15 | ' This program is free software: you can redistribute it and/or modify |
| 16 | ' it under the terms of the GNU General Public License as published by |
| 17 | ' the Free Software Foundation, either version 3 of the License, or |
| 18 | ' (at your option) any later version. |
| 19 | ' |
| 20 | ' This program is distributed in the hope that it will be useful, |
| 21 | ' but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | ' GNU General Public License for more details. |
| 24 | ' |
| 25 | ' You should have received a copy of the GNU General Public License |
| 26 | ' along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 27 | |
| 28 | |
| 29 | |
| 30 | ' /********************************************************************************/ |
| 31 | |
| 32 | ' Summaries: |
| 33 | |
| 34 | ' Class Href |
| 35 | ' |
| 36 | ' Properties: Comment, ResourceId, Value |
| 37 | ' |
| 38 | ' Function: GetFullPath, ToString |
| 39 | ' |
| 40 | ' |
| 41 | ' /********************************************************************************/ |
| 42 | |
| 43 | #End Region |
| 44 | |
| 45 | Imports System.IO |
| 46 | Imports System.Xml.Serialization |
| 47 | Imports Microsoft.VisualBasic.ComponentModel.Collection.Generic |
| 48 | Imports Microsoft.VisualBasic.FileIO |
| 49 | |
| 50 | Namespace Text.Xml.Models |
| 51 | |
| 52 | ''' <summary> |
| 53 | ''' Resource link data. |
| 54 | ''' </summary> |
| 55 | ''' <remarks></remarks> |
| 56 | <XmlType("href-text", Namespace:="Microsoft.VisualBasic/Href_Annotation-Text")> |
| 57 | Public Class Href : Implements INamedValue |
| 58 | |
| 59 | #Region "Public Property" |
| 60 | |
| 61 | ''' <summary> |
| 62 | ''' 资源的名称 |
| 63 | ''' </summary> |
| 64 | ''' <returns></returns> |
| 65 | <XmlAttribute("Resource.Id", Namespace:="Microsoft.VisualBasic/Href_Annotation-ResourceId")> |
| 66 | Public Property ResourceId As String Implements INamedValue.Key |
| 67 | ''' <summary> |
| 68 | ''' The relative path of the target resource object in the file system.(资源对象在文件系统之中的相对路径) |
| 69 | ''' </summary> |
| 70 | ''' <value></value> |
| 71 | ''' <returns></returns> |
| 72 | ''' <remarks></remarks> |
| 73 | <XmlElement("href-text", Namespace:="Microsoft.VisualBasic/Href_Annotation-Text-Data")> |
| 74 | Public Property Value As String |
| 75 | |
| 76 | ''' <summary> |
| 77 | ''' 注释数据 |
| 78 | ''' </summary> |
| 79 | ''' <returns></returns> |
| 80 | <XmlText> Public Property Comment As String |
| 81 | #End Region |
| 82 | |
| 83 | ''' <summary> |
| 84 | ''' 获取<see cref="Value"></see>所指向的资源文件的完整路径 |
| 85 | ''' </summary> |
| 86 | ''' <param name="DIR"></param> |
| 87 | ''' <returns></returns> |
| 88 | ''' <remarks></remarks> |
| 89 | Public Function GetFullPath(DIR As String) As String |
| 90 | Using directory As New TemporaryEnvironment(DIR) |
| 91 | Dim url As String = Path.GetFullPath(Me.Value) |
| 92 | Return url |
| 93 | End Using |
| 94 | End Function |
| 95 | |
| 96 | Public Overrides Function ToString() As String |
| 97 | Return Value |
| 98 | End Function |
| 99 | End Class |
| 100 | End Namespace |