SmartAPI
Open Source .NET RQL library for RedDot CMS / OpenText WSM Management Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
FileAttributes.cs
Go to the documentation of this file.
1 ï»¿// SmartAPI - .Net programmatic access to RedDot servers
2 //
3 // Copyright (C) 2013 erminas GbR
4 //
5 // This program is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free Software Foundation,
7 // either version 3 of the License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 // See the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program.
14 // If not, see <http://www.gnu.org/licenses/>.
15 
16 using System;
17 using System.Xml;
18 using erminas.SmartAPI.Exceptions;
19 using erminas.SmartAPI.Utils;
20 
21 namespace erminas.SmartAPI.CMS.Project.Folder
22 {
23  public class FileAttributes
24  {
25  internal FileAttributes(IFolder folder, XmlElement xmlElement)
26  {
27  Folder = folder;
28  LoadXml(xmlElement);
29  }
30 
31  public string Album { get; private set; }
32  public string Artist { get; private set; }
33  public string Colordepth { get; private set; }
34  public string Comment { get; private set; }
35  public string DocAuthor { get; private set; }
36  public string DocCreatedWith { get; private set; }
37  public string DocCreationDate { get; private set; }
38  public string DocModificationDate { get; private set; }
39  public int DocNumberOfPages { get; private set; }
40  public string DocOriginalAuthor { get; private set; }
41  public string DocTitle { get; private set; }
42  public DateTime EntryDate { get; private set; }
43  public string Filesize { get; private set; }
44  public IFolder Folder { get; private set; }
45  public string Genre { get; private set; }
46  public string Height { get; private set; }
47  public string Keywords { get; private set; }
48  public string LastEditor { get; private set; }
49  public DateTime ModificationDate { get; private set; }
50  public string OriginalAuthor { get; private set; }
51  public string Title { get; private set; }
52  public string Width { get; private set; }
53  public string Year { get; private set; }
54 
55  /*
56  private static readonly Dictionary<string, string> RQLMapping = new Dictionary<string, string>()
57  {
58  {"ext01", "Erstellungsautor"},
59  {"ext02", "Datum der Erstaufnahme"},
60  {"ext03", "Änderungsautor"},
61  {"ext04", "Änderungsdatum"},
62  {"ext05", "Höhe (Pixel)"},
63  {"ext06", "Breite (Pixel)"},
64  {"ext07", "Farbtiefe (Bit)"},
65  {"ext08", "Dateigröße (Byte)"},
66  {"ext09", "Titel"},
67  {"ext10", "Künstler"},
68  {"ext11", "Album"},
69  {"ext12", "Jahr"},
70  {"ext13", "Kommentar"},
71  {"ext14", "Genre"}
72  };*/
73 
74  private void LoadXml(XmlElement xmlElement)
75  {
76  if (xmlElement == null)
77  {
78  return;
79  }
80  try
81  {
82  if (xmlElement.GetAttributeValue("ext01") != null)
83  {
84  OriginalAuthor = xmlElement.GetAttributeValue("ext01");
85  }
86 
87  if (xmlElement.GetAttributeValue("ext02") != null)
88  {
89  EntryDate = xmlElement.GetOADate("ext02").GetValueOrDefault();
90  }
91 
92  if (xmlElement.GetAttributeValue("ext03") != null)
93  {
94  LastEditor = xmlElement.GetAttributeValue("ext03");
95  }
96 
97  if (xmlElement.GetAttributeValue("ext04") != null)
98  {
99  ModificationDate = xmlElement.GetOADate("ext04").GetValueOrDefault();
100  }
101 
102  if (xmlElement.GetAttributeValue("ext05") != null)
103  {
104  Height = xmlElement.GetAttributeValue("ext05") + " Pixel";
105  }
106 
107  if (xmlElement.GetAttributeValue("ext06") != null)
108  {
109  Width = xmlElement.GetAttributeValue("ext06") + " Pixel";
110  }
111 
112  if (xmlElement.GetAttributeValue("ext07") != null)
113  {
114  Colordepth = xmlElement.GetAttributeValue("ext07") + " Bit";
115  }
116 
117  if (xmlElement.GetAttributeValue("ext08") != null)
118  {
119  Filesize = xmlElement.GetAttributeValue("ext08") + " Byte";
120  }
121 
122  if (xmlElement.GetAttributeValue("ext09") != null)
123  {
124  Title = xmlElement.GetAttributeValue("ext09");
125  }
126 
127  if (xmlElement.GetAttributeValue("ext10") != null)
128  {
129  Artist = xmlElement.GetAttributeValue("ext10");
130  }
131 
132  if (xmlElement.GetAttributeValue("ext11") != null)
133  {
134  Album = xmlElement.GetAttributeValue("ext11");
135  }
136 
137  if (xmlElement.GetAttributeValue("ext12") != null)
138  {
139  Year = xmlElement.GetAttributeValue("ext12");
140  }
141 
142  if (xmlElement.GetAttributeValue("ext13") != null)
143  {
144  Comment = xmlElement.GetAttributeValue("ext13");
145  }
146 
147  if (xmlElement.GetAttributeValue("ext14") != null)
148  {
149  Genre = xmlElement.GetAttributeValue("ext14");
150  }
151 
152  if (xmlElement.GetAttributeValue("ext4124") != null)
153  {
154  DocTitle = xmlElement.GetAttributeValue("ext4124");
155  }
156 
157  if (xmlElement.GetAttributeValue("ext4125") != null)
158  {
159  Keywords = xmlElement.GetAttributeValue("ext4125");
160  }
161 
162  if (xmlElement.GetAttributeValue("ext4126") != null)
163  {
164  DocAuthor = xmlElement.GetAttributeValue("ext4126");
165  }
166 
167  if (xmlElement.GetAttributeValue("ext4127") != null)
168  {
169  DocOriginalAuthor = xmlElement.GetAttributeValue("ext4127");
170  }
171 
172  if (xmlElement.GetAttributeValue("ext4128") != null)
173  {
174  DocCreatedWith = xmlElement.GetAttributeValue("ext4128");
175  }
176 
177  if (xmlElement.GetAttributeValue("ext4129") != null)
178  {
179  DocCreationDate = xmlElement.GetAttributeValue("ext4129");
180  }
181 
182  if (xmlElement.GetAttributeValue("ext4130") != null)
183  {
184  DocModificationDate = xmlElement.GetAttributeValue("ext4130");
185  }
186 
187  if (xmlElement.GetAttributeValue("ext4131") != null)
188  {
189  DocNumberOfPages = int.Parse(xmlElement.GetAttributeValue("ext4131"));
190  }
191  } catch (Exception e)
192  {
193  // couldn't read data
194  throw new FileDataException(Folder.Project.Session.ServerLogin, "Couldn't read file data..", e);
195  }
196  }
197  }
198 }