-
Dec 20th, 2008, 06:02 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2008] Reading text file, compare info, and write info
I need some help with IO.File Reader as im a nub at it. I have a text file on my server (*.xml) and one that will be on the users computer. The current file to be read is structed like this:
Code:
<?xml version="1.0"?>
<XML>
<PATCHINFO>
<PATCHNODE file="./BAReport.exe">
<SIZE>200704</SIZE>
<CHECKSUM>1049968930</CHECKSUM>
</PATCHNODE>
</PATCHINFO>
</XML>
What i want to do is read through the file it will download from the server and grab the information such as file name, size and checksum in which it will compare that info to that of the current file name (in the order of the list) to the file of the same name in the installation directory and if there different it compiles a list of those files (with the file name info and adds them to end of the patch link) which would be the download links. Im hoping to get the list structed something like this:
Code:
<?xml version="1.0"?>
<XML>
<DOWNLOADINFO>
<PATCHDOWNLOAD file= "http://www.***.net/patch/" & "BAReport.exe">
<DESTINATION>./BAReport.exe</DESTINATION>
</PATCHDOWNLOAD>
</DOWNLOADINFO>
</XML>
The list would be generated so that it would add the file name to the end of each download link and the destination would be the same directory the file was read from.
Code:
<?xml version="1.0"?>
<XML>
<DOWNLOADINFO>
*****************************
</DOWNLOADINFO>
</XML>
This would be the regular plain download list and for each different file it would add
Code:
<PATCHDOWNLOAD file= "http://www.***.net/patch/" (Server) & "BAReport.exe"(Name of file, info grabbed from earlier)>
<DESTINATION>./BAReport.exe (Location of the original file that the info from the xml file was compared to)</DESTINATION>
</PATCHDOWNLOAD>
I know this is a very tedious task and it would be greatly appreaciated if someone could take the time to help me out.
Last edited by youngbucks; Dec 20th, 2008 at 06:36 PM.
-
Dec 20th, 2008, 06:37 PM
#2
Re: [2008] Reading text file
since you are getting XML, load it to an system.xml.xmldocument object instead of just reading it into a string. Then you can query up the specific values of any of the nodes without having to write your own manual parsing. That is the beauty of XML, it has a syntax structure so it can be parsed by any parser, but the actual data structure is up to you.
-
Dec 20th, 2008, 06:42 PM
#3
Thread Starter
Hyperactive Member
Re: [2008] Reading text file, compare info, and write info
This is a first for me so honestly i have no idea of where to even start.
Is this the right thing?
http://www.codeproject.com/KB/cpp/parsefilecode.aspx
Last edited by youngbucks; Dec 20th, 2008 at 07:02 PM.
-
Dec 20th, 2008, 07:28 PM
#4
Thread Starter
Hyperactive Member
Re: [2008] Reading text file, compare info, and write info
Last edited by youngbucks; Dec 21st, 2008 at 09:08 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|