@@ -31,7 +31,11 @@ public Step5Project(string filename, bool showDeleted)
31
31
this . _ziphelper = new ZipHelper ( filename ) ;
32
32
_projectfilename = _ziphelper . GetFirstZipEntryWithEnding ( ".s5d" ) ;
33
33
if ( string . IsNullOrEmpty ( _projectfilename ) )
34
- throw new Exception ( "Zip-File contains no valid Step5 Project !" ) ;
34
+ throw new Exception ( "Zip-File contains no valid Step5 Project !" ) ;
35
+ }
36
+ else
37
+ {
38
+ this . _ziphelper = new ZipHelper ( filename ) ;
35
39
}
36
40
37
41
ProjectFile = filename ;
@@ -43,11 +47,11 @@ internal Step5Project(ZipHelper _ziphelper, string filename, bool showDeleted)
43
47
{
44
48
_showDeleted = showDeleted ;
45
49
this . _ziphelper = _ziphelper ;
46
-
50
+
47
51
_projectfilename = _ziphelper . GetFirstZipEntryWithEnding ( ".s5d" ) ;
48
- if ( string . IsNullOrEmpty ( _projectfilename ) )
49
- throw new Exception ( "Zip-File contains no valid Step5 Project !" ) ;
50
-
52
+ if ( string . IsNullOrEmpty ( _projectfilename ) )
53
+ throw new Exception ( "Zip-File contains no valid Step5 Project !" ) ;
54
+
51
55
ProjectFile = filename ;
52
56
53
57
LoadProject ( ) ;
@@ -76,10 +80,10 @@ protected override void LoadProject()
76
80
ProjectName = System . Text . Encoding . UTF7 . GetString ( s5ProjectByteArray , 0x08 , 8 ) ;
77
81
78
82
//Read the Project Size
79
- Size = s5ProjectByteArray [ 0x14 ] + s5ProjectByteArray [ 0x15 ] * 0x100 ;
83
+ Size = s5ProjectByteArray [ 0x14 ] + s5ProjectByteArray [ 0x15 ] * 0x100 ;
80
84
81
85
//Create the main Project Folder
82
- ProjectStructure = new Step5ProgrammFolder ( ) { Project = this , Name = this . ToString ( ) } ;
86
+ ProjectStructure = new Step5ProgrammFolder ( ) { Project = this , Name = this . ToString ( ) } ;
83
87
_allFolders . Add ( ProjectStructure ) ;
84
88
85
89
//int startpos = s5ProjectByteArray[0x12] * 0x80;
@@ -90,12 +94,12 @@ protected override void LoadProject()
90
94
91
95
for ( int j = 0 ; j < anz_sections ; j ++ )
92
96
{
93
- int pos = 0x44 + j * 19 ;
94
- sections_lst . Add ( s5ProjectByteArray [ pos + 15 ] + s5ProjectByteArray [ pos + 16 ] * 0x100 ) ;
97
+ int pos = 0x44 + j * 19 ;
98
+ sections_lst . Add ( s5ProjectByteArray [ pos + 15 ] + s5ProjectByteArray [ pos + 16 ] * 0x100 ) ;
95
99
}
96
100
97
101
98
- Step5BlocksFolder blkFld = new Step5BlocksFolder ( ) { Name = "Blocks" , Project = this , Parent = ProjectStructure } ;
102
+ Step5BlocksFolder blkFld = new Step5BlocksFolder ( ) { Name = "Blocks" , Project = this , Parent = ProjectStructure } ;
99
103
BlocksFolder = blkFld ;
100
104
ProjectStructure . SubItems . Add ( blkFld ) ;
101
105
@@ -107,7 +111,7 @@ protected override void LoadProject()
107
111
108
112
foreach ( int secpos in sections_lst )
109
113
{
110
- int section_start = secpos * 0x80 ;
114
+ int section_start = secpos * 0x80 ;
111
115
/* The len for a Section is not always calculated right, so if the Section does not begin with the filename add 0x80 until it works */
112
116
/* But I don't know why it's wrong */
113
117
@@ -136,7 +140,7 @@ protected override void LoadProject()
136
140
for ( int j = 0 ; j < anzbst ; j ++ )
137
141
{
138
142
byte [ ] tmp = new byte [ 15 ] ;
139
- Array . Copy ( s5ProjectByteArray , section_start + 68 + j * 15 , tmp , 0 , 15 ) ;
143
+ Array . Copy ( s5ProjectByteArray , section_start + 68 + j * 15 , tmp , 0 , 15 ) ;
140
144
bstHeaders . Add ( tmp ) ;
141
145
}
142
146
@@ -154,7 +158,7 @@ protected override void LoadProject()
154
158
*/
155
159
156
160
//Don't know wich Information is in the Section Header!
157
- int section_header_size = s5ProjectByteArray [ section_start + 18 ] * 0x80 ;
161
+ int section_header_size = s5ProjectByteArray [ section_start + 18 ] * 0x80 ;
158
162
159
163
160
164
@@ -166,7 +170,7 @@ protected override void LoadProject()
166
170
// n += 0x80;
167
171
168
172
while ( akanz < anzbst && n + 1 < s5ProjectByteArray . Length )
169
- //n < section_start + section_size)
173
+ //n < section_start + section_size)
170
174
{
171
175
akanz ++ ;
172
176
int len = 0 ;
@@ -294,23 +298,23 @@ protected override void LoadProject()
294
298
if ( _showDeleted )
295
299
{
296
300
//Read also the deleted Blocks, that means, don't use the Section Headers ...
297
- int akpos = s5ProjectByteArray [ 0x12 ] * 0x80 ;
301
+ int akpos = s5ProjectByteArray [ 0x12 ] * 0x80 ;
298
302
299
303
while ( akpos <= s5ProjectByteArray . Length - 0x80 )
300
304
{
301
305
while ( ! IsCurrentPosABlockStart ( s5ProjectByteArray , akpos ) &&
302
306
akpos <= s5ProjectByteArray . Length - 0x80 )
303
307
akpos += 0x80 ;
304
-
308
+
305
309
if ( akpos <= s5ProjectByteArray . Length - 0x80 )
306
310
{
307
311
bool blkExists = ByteAddressOFExistingBlocks . Contains ( akpos ) ;
308
- var tmp = AddBlockInfo ( s5ProjectByteArray , ref akpos , blkFld , null ) ;
312
+ var tmp = AddBlockInfo ( s5ProjectByteArray , ref akpos , blkFld , null ) ;
309
313
if ( ! blkExists )
310
314
{
311
315
tmp . Deleted = true ;
312
316
blkFld . step5BlocksinfoList . Add ( tmp ) ;
313
- }
317
+ }
314
318
}
315
319
}
316
320
}
@@ -319,7 +323,7 @@ protected override void LoadProject()
319
323
{
320
324
Stream symTabStream = _ziphelper . GetReadStream ( _projectfilename . ToLower ( ) . Replace ( "st.s5d" , "z0.seq" ) ) ;
321
325
322
- SymbolTable symtab = new SymbolTable ( ) ;
326
+ SymbolTable symtab = new SymbolTable ( ) ;
323
327
symtab . LoadSymboltable ( symTabStream ) ;
324
328
symTabStream . Close ( ) ;
325
329
symtab . Parent = ProjectStructure ;
@@ -328,7 +332,7 @@ protected override void LoadProject()
328
332
_allFolders . Add ( symtab ) ;
329
333
}
330
334
331
- var refFld = new ReferenceData ( ( Step5ProgrammFolder ) ProjectStructure , this ) ;
335
+ var refFld = new ReferenceData ( ( Step5ProgrammFolder ) ProjectStructure , this ) ;
332
336
ProjectStructure . SubItems . Add ( refFld ) ; // { Parent = ProjectStructure, Project = this });
333
337
_allFolders . Add ( refFld ) ;
334
338
@@ -470,7 +474,7 @@ public override string ToString()
470
474
retVal += "(zipped)" ;
471
475
if ( _showDeleted == true )
472
476
retVal += " (show deleted)" ;
473
- return retVal ;
477
+ return retVal ;
474
478
}
475
- }
479
+ }
476
480
}
0 commit comments