1+ using MetadataExtractCore . Analysis ;
2+ using MetadataExtractCore . Diagrams ;
3+ using MetadataExtractCore . Utilities ;
14using System ;
25using System . Collections . Generic ;
6+ using System . IO ;
37using System . Linq ;
48using System . Text ;
5- using System . IO ;
69using System . Text . RegularExpressions ;
7- using MetadataExtractCore . Utilities ;
8- using MetadataExtractCore . Analysis ;
9- using MetadataExtractCore . Diagrams ;
1010
1111namespace MetadataExtractCore . Metadata
1212{
@@ -20,7 +20,7 @@ public Office972003()
2020 dicPictureEXIF = new SerializableDictionary < string , EXIFDocument > ( ) ;
2121 }
2222
23- public Office972003 ( Stream stm ) : this ( )
23+ public Office972003 ( Stream stm ) : this ( )
2424 {
2525 this . stm = new MemoryStream ( ) ;
2626 Functions . CopyStream ( stm , this . stm ) ;
@@ -189,7 +189,7 @@ private void GetPrintersInXls(OleDocument doc)
189189 return ;
190190 BinaryReader br = new BinaryReader ( Workbook ) ;
191191 Workbook . Seek ( 0 , SeekOrigin . Begin ) ;
192- while ( Workbook . Position <= Workbook . Length - 2 )
192+ while ( Workbook . Position <= Workbook . Length - 4 )
193193 {
194194 try
195195 {
@@ -200,14 +200,14 @@ private void GetPrintersInXls(OleDocument doc)
200200 if ( Tipo == 0x4D )
201201 {
202202 long PosOri = Workbook . Position ;
203- if ( br . ReadInt16 ( ) == 0 )
203+ if ( br . ReadInt16 ( ) == 0 )
204204 {
205205 String PrinterName = Encoding . Unicode . GetString ( br . ReadBytes ( 32 * 2 ) ) . Replace ( '\0 ' , ' ' ) ;
206206 br . ReadInt16 ( ) ;
207207 br . ReadInt16 ( ) ;
208208 Int16 StructSize = br . ReadInt16 ( ) ;
209209 Int16 DriverSize = br . ReadInt16 ( ) ;
210-
210+
211211 if ( DriverSize != 0 )
212212 {
213213 Workbook . Seek ( StructSize - ( 8 + 64 ) , SeekOrigin . Current ) ;
@@ -233,7 +233,7 @@ private void GetPrintersInXls(OleDocument doc)
233233 }
234234 }
235235
236- private void GetHistory ( OleDocument doc )
236+ private void GetHistory ( OleDocument doc )
237237 {
238238 using ( Stream WordDocument = doc . OpenStream ( "WordDocument" ) )
239239 {
@@ -323,29 +323,36 @@ private void GetOperatingSystem(OleDocument doc)
323323 case 4 :
324324 switch ( intLowVersion )
325325 {
326- case 0 : FoundMetaData . OperativeSystem = "Windows NT 4.0" ;
326+ case 0 :
327+ FoundMetaData . OperativeSystem = "Windows NT 4.0" ;
327328 break ;
328- case 10 : FoundMetaData . OperativeSystem = "Windows 98" ;
329+ case 10 :
330+ FoundMetaData . OperativeSystem = "Windows 98" ;
329331 break ;
330332 }
331333 break ;
332334 case 5 :
333335 switch ( intLowVersion )
334336 {
335- case 0 : FoundMetaData . OperativeSystem = "Windows Server 2000" ;
337+ case 0 :
338+ FoundMetaData . OperativeSystem = "Windows Server 2000" ;
336339 break ;
337- case 1 : FoundMetaData . OperativeSystem = "Windows XP" ;
340+ case 1 :
341+ FoundMetaData . OperativeSystem = "Windows XP" ;
338342 break ;
339- case 2 : FoundMetaData . OperativeSystem = "Windows Server 2003" ;
343+ case 2 :
344+ FoundMetaData . OperativeSystem = "Windows Server 2003" ;
340345 break ;
341346 }
342347 break ;
343348 case 6 :
344349 switch ( intLowVersion )
345350 {
346- case 0 : FoundMetaData . OperativeSystem = "Windows Vista" ;
351+ case 0 :
352+ FoundMetaData . OperativeSystem = "Windows Vista" ;
347353 break ;
348- case 1 : FoundMetaData . OperativeSystem = "Windows 7" ;
354+ case 1 :
355+ FoundMetaData . OperativeSystem = "Windows 7" ;
349356 break ;
350357 }
351358 break ;
@@ -354,7 +361,8 @@ private void GetOperatingSystem(OleDocument doc)
354361
355362 private void GetPathPpt ( OleDocument doc )
356363 {
357- using ( var WordDocument = doc . OpenStream ( "PowerPoint Document" ) ) {
364+ using ( var WordDocument = doc . OpenStream ( "PowerPoint Document" ) )
365+ {
358366 if ( WordDocument == null )
359367 return ;
360368 try
@@ -424,7 +432,7 @@ private void GetImagesDoc(OleDocument doc)
424432 }
425433 }
426434
427- List < int > lstJPEG = Functions . SearchBytesInBytes ( bufferPIC , new byte [ ] { 0xFF , 0xD8 } ) ;
435+ List < int > lstJPEG = Functions . SearchBytesInBytes ( bufferPIC , new byte [ ] { 0xFF , 0xD8 , 0xFF } ) ;
428436 if ( lstJPEG . Count > 0 )
429437 {
430438 using ( MemoryStream msJPG = new MemoryStream ( bufferPIC , lstJPEG [ 0 ] , bufferPIC . Length - lstJPEG [ 0 ] ) )
@@ -468,17 +476,13 @@ private void GetImagesPpt(OleDocument doc)
468476 if ( PICLength == 0 || stmPictures . Position + PICLength > stmPictures . Length ) break ;
469477 byte [ ] bufferPIC = brData . ReadBytes ( ( int ) PICLength ) ;
470478 string strImageName = "Image" + ImagesFound ++ ;
479+
471480 using ( MemoryStream msJPG = new MemoryStream ( bufferPIC , 0x11 , bufferPIC . Length - 0x11 ) )
472481 {
473482 EXIFDocument eDoc = new EXIFDocument ( msJPG , ".jpg" ) ;
474-
483+
475484 eDoc . analyzeFile ( ) ;
476485 eDoc . Close ( ) ;
477- if ( eDoc . Thumbnail != null )
478- lon += eDoc . Thumbnail . Length ;
479- cont ++ ;
480- System . Diagnostics . Debug . WriteLine ( cont . ToString ( ) ) ;
481- System . Diagnostics . Debug . WriteLine ( lon / ( 1024 * 1024 ) + " Megacas" ) ;
482486
483487 dicPictureEXIF . Add ( strImageName , eDoc ) ;
484488
@@ -496,9 +500,6 @@ private void GetImagesPpt(OleDocument doc)
496500 }
497501 }
498502
499- static int cont = 0 ;
500- static long lon = 0 ;
501-
502503 private void GetLinksBinary ( OleDocument doc )
503504 {
504505 var pending = new List < Action > ( ) {
@@ -566,9 +567,9 @@ private void GetLinksBinaryWorkbook(Stream document)
566567 continue ;
567568
568569 string aux = link ;
569- aux = aux . Trim ( new char [ ] { ( char ) 18 } ) ;
570+ aux = aux . Trim ( new char [ ] { ( char ) 18 } ) ;
570571
571- if ( ! link . EndsWith ( "/" ) )
572+ if ( ! link . EndsWith ( "/" ) )
572573 {
573574 int cuentaSlash = 0 ;
574575 for ( int i = 0 ; i < aux . Length ; i ++ )
@@ -603,7 +604,7 @@ private void GetLinksBinaryPowerPointDocument(Stream document)
603604 }
604605
605606
606- private bool IsInterestingLink ( string href )
607+ private bool IsInterestingLink ( string href )
607608 {
608609 if ( href != string . Empty )
609610 {
@@ -642,9 +643,9 @@ private bool IsInterestingLink(string href)
642643 return true ;
643644 }
644645 }
645- catch ( UriFormatException )
646+ catch ( UriFormatException )
646647 {
647- if ( ! href . StartsWith ( "#" ) )
648+ if ( ! href . StartsWith ( "#" ) )
648649 {
649650 return true ;
650651 }
0 commit comments