@@ -31,7 +31,11 @@ public Step5Project(string filename, bool showDeleted)
3131 this . _ziphelper = new ZipHelper ( filename ) ;
3232 _projectfilename = _ziphelper . GetFirstZipEntryWithEnding ( ".s5d" ) ;
3333 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 ) ;
3539 }
3640
3741 ProjectFile = filename ;
@@ -43,11 +47,11 @@ internal Step5Project(ZipHelper _ziphelper, string filename, bool showDeleted)
4347 {
4448 _showDeleted = showDeleted ;
4549 this . _ziphelper = _ziphelper ;
46-
50+
4751 _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+
5155 ProjectFile = filename ;
5256
5357 LoadProject ( ) ;
@@ -76,10 +80,10 @@ protected override void LoadProject()
7680 ProjectName = System . Text . Encoding . UTF7 . GetString ( s5ProjectByteArray , 0x08 , 8 ) ;
7781
7882 //Read the Project Size
79- Size = s5ProjectByteArray [ 0x14 ] + s5ProjectByteArray [ 0x15 ] * 0x100 ;
83+ Size = s5ProjectByteArray [ 0x14 ] + s5ProjectByteArray [ 0x15 ] * 0x100 ;
8084
8185 //Create the main Project Folder
82- ProjectStructure = new Step5ProgrammFolder ( ) { Project = this , Name = this . ToString ( ) } ;
86+ ProjectStructure = new Step5ProgrammFolder ( ) { Project = this , Name = this . ToString ( ) } ;
8387 _allFolders . Add ( ProjectStructure ) ;
8488
8589 //int startpos = s5ProjectByteArray[0x12] * 0x80;
@@ -90,12 +94,12 @@ protected override void LoadProject()
9094
9195 for ( int j = 0 ; j < anz_sections ; j ++ )
9296 {
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 ) ;
9599 }
96100
97101
98- Step5BlocksFolder blkFld = new Step5BlocksFolder ( ) { Name = "Blocks" , Project = this , Parent = ProjectStructure } ;
102+ Step5BlocksFolder blkFld = new Step5BlocksFolder ( ) { Name = "Blocks" , Project = this , Parent = ProjectStructure } ;
99103 BlocksFolder = blkFld ;
100104 ProjectStructure . SubItems . Add ( blkFld ) ;
101105
@@ -107,7 +111,7 @@ protected override void LoadProject()
107111
108112 foreach ( int secpos in sections_lst )
109113 {
110- int section_start = secpos * 0x80 ;
114+ int section_start = secpos * 0x80 ;
111115 /* 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 */
112116 /* But I don't know why it's wrong */
113117
@@ -136,7 +140,7 @@ protected override void LoadProject()
136140 for ( int j = 0 ; j < anzbst ; j ++ )
137141 {
138142 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 ) ;
140144 bstHeaders . Add ( tmp ) ;
141145 }
142146
@@ -154,7 +158,7 @@ protected override void LoadProject()
154158 */
155159
156160 //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 ;
158162
159163
160164
@@ -166,7 +170,7 @@ protected override void LoadProject()
166170 // n += 0x80;
167171
168172 while ( akanz < anzbst && n + 1 < s5ProjectByteArray . Length )
169- //n < section_start + section_size)
173+ //n < section_start + section_size)
170174 {
171175 akanz ++ ;
172176 int len = 0 ;
@@ -294,23 +298,23 @@ protected override void LoadProject()
294298 if ( _showDeleted )
295299 {
296300 //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 ;
298302
299303 while ( akpos <= s5ProjectByteArray . Length - 0x80 )
300304 {
301305 while ( ! IsCurrentPosABlockStart ( s5ProjectByteArray , akpos ) &&
302306 akpos <= s5ProjectByteArray . Length - 0x80 )
303307 akpos += 0x80 ;
304-
308+
305309 if ( akpos <= s5ProjectByteArray . Length - 0x80 )
306310 {
307311 bool blkExists = ByteAddressOFExistingBlocks . Contains ( akpos ) ;
308- var tmp = AddBlockInfo ( s5ProjectByteArray , ref akpos , blkFld , null ) ;
312+ var tmp = AddBlockInfo ( s5ProjectByteArray , ref akpos , blkFld , null ) ;
309313 if ( ! blkExists )
310314 {
311315 tmp . Deleted = true ;
312316 blkFld . step5BlocksinfoList . Add ( tmp ) ;
313- }
317+ }
314318 }
315319 }
316320 }
@@ -319,7 +323,7 @@ protected override void LoadProject()
319323 {
320324 Stream symTabStream = _ziphelper . GetReadStream ( _projectfilename . ToLower ( ) . Replace ( "st.s5d" , "z0.seq" ) ) ;
321325
322- SymbolTable symtab = new SymbolTable ( ) ;
326+ SymbolTable symtab = new SymbolTable ( ) ;
323327 symtab . LoadSymboltable ( symTabStream ) ;
324328 symTabStream . Close ( ) ;
325329 symtab . Parent = ProjectStructure ;
@@ -328,7 +332,7 @@ protected override void LoadProject()
328332 _allFolders . Add ( symtab ) ;
329333 }
330334
331- var refFld = new ReferenceData ( ( Step5ProgrammFolder ) ProjectStructure , this ) ;
335+ var refFld = new ReferenceData ( ( Step5ProgrammFolder ) ProjectStructure , this ) ;
332336 ProjectStructure . SubItems . Add ( refFld ) ; // { Parent = ProjectStructure, Project = this });
333337 _allFolders . Add ( refFld ) ;
334338
@@ -470,7 +474,7 @@ public override string ToString()
470474 retVal += "(zipped)" ;
471475 if ( _showDeleted == true )
472476 retVal += " (show deleted)" ;
473- return retVal ;
477+ return retVal ;
474478 }
475- }
479+ }
476480}
0 commit comments