Results 1 to 4 of 4

Thread: [RESOLVED] [2008] Reading text file, compare info, and write info

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Location
    Nowhere
    Posts
    427

    Resolved [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.
    "Programming is like sex. One mistake and you have to support it for the rest of your life." ~Michael Sinz


    Code Snippets/Usefull Links:
    WinRAR DLL|Vista Style Form|Krypton Component Library|Windows Form Aero|Parsing XML files|Calculate File's CRC 32|Download a list of files.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Location
    Nowhere
    Posts
    427

    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.
    "Programming is like sex. One mistake and you have to support it for the rest of your life." ~Michael Sinz


    Code Snippets/Usefull Links:
    WinRAR DLL|Vista Style Form|Krypton Component Library|Windows Form Aero|Parsing XML files|Calculate File's CRC 32|Download a list of files.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Location
    Nowhere
    Posts
    427

    Re: [2008] Reading text file, compare info, and write info

    Edit* Nvm fixed it.
    Last edited by youngbucks; Dec 21st, 2008 at 09:08 AM.
    "Programming is like sex. One mistake and you have to support it for the rest of your life." ~Michael Sinz


    Code Snippets/Usefull Links:
    WinRAR DLL|Vista Style Form|Krypton Component Library|Windows Form Aero|Parsing XML files|Calculate File's CRC 32|Download a list of files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width