wasStitchNET – Blame information for rev 13
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
13 | office | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
||
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
||
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
||
5 | /////////////////////////////////////////////////////////////////////////// |
||
6 | |||
7 | using System.Collections.Generic; |
||
8 | using System.IO; |
||
9 | using System.Xml.Serialization; |
||
10 | using wasSharp; |
||
11 | |||
12 | namespace wasStitchNET.Repository |
||
13 | { |
||
14 | [XmlRoot(ElementName = "FileExcludes")] |
||
15 | public class FileExcludes |
||
16 | { |
||
17 | [XmlElement(ElementName = "Path")] |
||
18 | public HashSet<string> Path { get; set; } |
||
19 | } |
||
20 | |||
21 | [XmlRoot(ElementName = "ConfigurationExcludes")] |
||
22 | public class ConfigurationExcludes |
||
23 | { |
||
24 | [XmlElement(ElementName = "Path")] |
||
25 | public HashSet<string> Tag { get; set; } |
||
26 | } |
||
27 | |||
28 | [XmlRoot(ElementName = "ConfigurationForce")] |
||
29 | public class ConfigurationForce |
||
30 | { |
||
31 | [XmlElement(ElementName = "Path")] |
||
32 | public HashSet<string> Tag { get; set; } |
||
33 | } |
||
34 | |||
35 | [XmlRoot(ElementName = "StitchOptions")] |
||
36 | public class StitchOptions |
||
37 | { |
||
38 | [Reflection.NameAttribute("force")] |
||
39 | [XmlElement(ElementName = "force")] |
||
40 | public bool Force { get; set; } |
||
41 | |||
42 | [Reflection.NameAttribute("FileExcludes")] |
||
43 | [XmlElement(ElementName = "FileExcludes")] |
||
44 | public FileExcludes FileExcludes { get; set; } |
||
45 | |||
46 | [Reflection.NameAttribute("ConfigurationExcludes")] |
||
47 | [XmlElement(ElementName = "ConfigurationExcludes")] |
||
48 | public ConfigurationExcludes ConfigurationExcludes { get; set; } |
||
49 | |||
50 | [Reflection.NameAttribute("ConfigurationForce")] |
||
51 | [XmlElement(ElementName = "ConfigurationForce")] |
||
52 | public ConfigurationExcludes ConfigurationForce { get; set; } |
||
53 | |||
54 | [XmlAttribute(AttributeName = "xsi", Namespace = "http://www.w3.org/2000/xmlns/")] |
||
55 | public string Xsi { get; set; } |
||
56 | |||
57 | [XmlAttribute(AttributeName = "xsd", Namespace = "http://www.w3.org/2000/xmlns/")] |
||
58 | public string Xsd { get; set; } |
||
59 | } |
||
60 | |||
61 | public static class StitchOptionsSerialization |
||
62 | { |
||
63 | public static StitchOptions Load(this StitchOptions stitchOptions, Stream stream) |
||
64 | { |
||
65 | using (var streamReader = new StreamReader(stream)) |
||
66 | { |
||
67 | var serializer = new XmlSerializer(typeof(StitchOptions)); |
||
68 | return (StitchOptions) serializer.Deserialize(streamReader); |
||
69 | } |
||
70 | } |
||
71 | |||
72 | public static string ToXML(this StitchOptions stitchOptions) |
||
73 | { |
||
74 | using (var writer = new StringWriter()) |
||
75 | { |
||
76 | var serializer = new XmlSerializer(typeof(StitchOptions)); |
||
77 | serializer.Serialize(writer, stitchOptions); |
||
78 | return writer.ToString(); |
||
79 | } |
||
80 | } |
||
81 | } |
||
82 | } |