@@ -13,12 +13,32 @@ namespace Common
13
13
// Component object definition
14
14
public class Component : Category
15
15
{
16
+ public string URL { get ; set ; }
16
17
public string Hash { get ; set ; }
17
18
public long Size { get ; set ; }
18
19
public string [ ] Depends { get ; set ; } = new string [ ] { } ;
19
20
20
21
public Component ( XmlNode node ) : base ( node )
21
22
{
23
+ // URL
24
+
25
+ var root = node . OwnerDocument . GetElementsByTagName ( "list" ) [ 0 ] ;
26
+
27
+ if ( root . Attributes != null && root . Attributes [ "url" ] != null )
28
+ {
29
+ URL = root . Attributes [ "url" ] . Value + ID + ".zip" ;
30
+ }
31
+ else
32
+ {
33
+ MessageBox . Show (
34
+ "An error occurred while parsing the component list XML. Please alert Flashpoint staff ASAP!\n \n " +
35
+ "Description: Root element does not contain URL attribute" ,
36
+ "Error" , MessageBoxButtons . OK , MessageBoxIcon . Error
37
+ ) ;
38
+
39
+ Environment . Exit ( 1 ) ;
40
+ }
41
+
22
42
// Hash
23
43
24
44
string hash = GetAttribute ( node , "hash" , true ) ;
@@ -34,6 +54,8 @@ public Component(XmlNode node) : base(node)
34
54
$ "Description: Hash of component \" { Title } \" is invalid",
35
55
"Error" , MessageBoxButtons . OK , MessageBoxIcon . Error
36
56
) ;
57
+
58
+ Environment . Exit ( 1 ) ;
37
59
}
38
60
39
61
// Size
@@ -61,9 +83,6 @@ public Component(XmlNode node) : base(node)
61
83
62
84
if ( depends . Length > 0 ) Depends = depends . Split ( ' ' ) ;
63
85
}
64
-
65
- // Get internet location of component's ZIP archive
66
- public string GetURL ( ) => FPM . XmlTree . GetElementsByTagName ( "list" ) [ 0 ] . Attributes [ "url" ] . Value + ID + ".zip" ;
67
86
}
68
87
69
88
// Category object definition
0 commit comments