1 #Region "Microsoft.VisualBasic::10c963f24f9f1d23eccfe50c74ff1259, Microsoft.VisualBasic.Core\Text\Xml\OpenXml\Content_Types.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 ContentTypes
35     
36     '         Properties: [Default], [Overrides]
37     
38     '         FunctionToString
39     
40     '     Structure Type
41     
42     '         Properties: ContentType, Extension, PartName
43     
44     '         FunctionToString
45     
46     
47     ' /********************************************************************************/
48
49 #End Region
50
51 Imports System.Xml.Serialization
52 Imports Microsoft.VisualBasic.Language
53 Imports Microsoft.VisualBasic.Serialization.JSON
54
55 Namespace Text.Xml.OpenXml
56
57     ''' <summary>
58     ''' ``[Content_Types].xml``
59     ''' </summary>
60     ''' 
61     <XmlRoot("Types"Namespace:="http://schemas.openxmlformats.org/package/2006/content-types")>
62     Public Class ContentTypes
63
64         <XmlElement> Public Property [Default] As Type()
65         <XmlElement("Override")>
66         Public Property [Overrides] As List(Of Type)
67
68         Public Overrides Function ToString() As String
69             Return [Overrides] _
70                 .Select(Function(t) t.PartName) _
71                 .ToArray _
72                 .GetJson
73         End Function
74     End Class
75
76     Public Structure Type
77
78         <XmlAttribute> Public Property Extension As String
79         <XmlAttribute> Public Property ContentType As String
80         <XmlAttribute> Public Property PartName As String
81
82         Public Overrides Function ToString() As String
83             If PartName.StringEmpty Then
84                 Return ContentType
85             Else
86                 Return $"({PartName}) {ContentType}"
87             End If
88         End Function
89     End Structure
90 End Namespace