1 stringSourcefilepath =@"e:\ file copy \xx\3773\3773.zip";2 3FileInfo FileInfo =NewFileInfo (sourcefilepath);4 LongLength =fileinfo.length;5 6 if(Length = =0)7 {8 return;9 }Ten One using(Zipinputstream zip =NewZipinputstream (File.openread (Sourcefilepath))) A { - ZipEntry theentry; - stringDestinationdirpath =@"\\172.21.3.21\liung\"; the while((Theentry = zip.) Getnextentry ())! =NULL) - { -Destinationdirpath + =Theentry.name; - + using(FileStream StreamWriter =NewFileStream (Destinationdirpath, FileMode.Create, FileAccess.Write, FileShare.Read |fileshare.write)) - { + byte[] bytes =New byte[zip. Length]; AZip. Read (Bytes,0, Bytes. Length); atStreamWriter.Write (Bytes,0, Bytes. Length); - } - -XmlTextReader xmlReader =NewXmlTextReader (Zip); - while(Xmlreader.read ()) - { in if(Xmlreader.nodetype = = XmlNodeType.Element && xmlReader.Name.ToLower () = ="Fileheader") - { to stringReporttime = Xmlreader.getattribute ("Reporttime"). Replace ("24:00:00","23:59:59"); + stringStartTime = Xmlreader.getattribute ("StartTime"). Replace ("24:00:00","23:59:59"); - stringEndTime = Xmlreader.getattribute ("EndTime"). Replace ("24:00:00","23:59:59"); the * Break; $ }Panax Notoginseng } - } the } + A Console.readkey (); the + using(Gzipinputstream zip =NewGzipinputstream (File.openread (Sourcefilepath))) - { $ using(XmlTextReader xmlReader =NewXmlTextReader (Zip)) $ { - while(Xmlreader.read ()) - { the //HW has no period, temporarily gives a default value of - if(Xmlreader.nodetype = = XmlNodeType.Element && xmlReader.Name.ToLower () = ="Fileheader")Wuyi { the stringReporttime = Xmlreader.getattribute ("Reporttime"). Replace ("24:00:00","23:59:59"); - stringStartTime = Xmlreader.getattribute ("StartTime"). Replace ("24:00:00","23:59:59"); Wu stringEndTime = Xmlreader.getattribute ("EndTime"). Replace ("24:00:00","23:59:59"); - About Break; $ } - } - } -}
Parsing XML content in the case of C # XML compression package without pressure