|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.IO; |
|
19 using System.Xml; |
|
20 using System.Text; |
|
21 using System.Collections.Generic; |
|
22 using SymbianTree; |
|
23 using SymbianUtils; |
|
24 using SymbianXmlInputLib.Elements; |
|
25 using SymbianXmlInputLib.Elements.Types.FileSystem; |
|
26 |
|
27 namespace SymbianXmlInputLib.Parser.Nodes |
|
28 { |
|
29 public class SXILParserNodeFileSystem : SXILParserNode |
|
30 { |
|
31 #region Constructors |
|
32 public SXILParserNodeFileSystem() |
|
33 { |
|
34 } |
|
35 #endregion |
|
36 |
|
37 #region From SXILParserNode |
|
38 public override bool CanHandle( XmlNode aNode ) |
|
39 { |
|
40 bool ret = base.CanHandle( aNode ); |
|
41 // |
|
42 if ( !ret && aNode.NodeType == XmlNodeType.Element ) |
|
43 { |
|
44 string name = aNode.Name.ToUpper(); |
|
45 if ( name == "FILE" || name == "DIRECTORY" ) |
|
46 { |
|
47 int count = aNode.Attributes.Count; |
|
48 if ( count == 1 && aNode.Attributes[ "name" ] != null ) |
|
49 { |
|
50 ret = true; |
|
51 } |
|
52 } |
|
53 } |
|
54 // |
|
55 return ret; |
|
56 } |
|
57 |
|
58 public override bool IsMulti |
|
59 { |
|
60 get { return true; } |
|
61 } |
|
62 |
|
63 public override void XmlParse( XmlNode aNode ) |
|
64 { |
|
65 string type = aNode.Name; |
|
66 XmlAttribute name = aNode.Attributes[ "name" ]; |
|
67 // |
|
68 if ( type == "file" ) |
|
69 { |
|
70 string value = name.Value.Trim(); |
|
71 base.Document.CurrentNode.Add( new SXILElementFile( new FileInfo( value ) ) ); |
|
72 } |
|
73 else if ( type == "directory" ) |
|
74 { |
|
75 string value = name.Value.Trim(); |
|
76 base.Document.CurrentNode.Add( new SXILElementDirectory( new DirectoryInfo( value ) ) ); |
|
77 } |
|
78 } |
|
79 #endregion |
|
80 |
|
81 #region Properties |
|
82 #endregion |
|
83 |
|
84 #region Internal methods |
|
85 #endregion |
|
86 } |
|
87 } |