Announcement

Collapse
No announcement yet.

method to index/compare user's files for update?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • method to index/compare user's files for update?

    okay, i'm creating an installer w/ Setup Factory to install mappack updates to a user's computer (this is for www.warcrygamers.com)

    i've already made a nifty version of the installer that gives the user 3 options (Default Install, Web Update, or Full Install which does both) (web update was using TrueUpdate)

    well, i'm also creating an alternate version of the installer, because it was suggested by a user at the website that we compare the users files already installed, to the files on the website, and install accordingly....

    well, i've already managed to get the installer to retrieve the user's Halflife/Counterstrike dir from Registry, then it scans/indexes all the files in cstrike dir, and i'm trying to decide what to do from there (how to make it compare the files to a list of files that it could download from the site...)

    first off, is there a better way to index compare? i'm sure there is, cus i know alot of files have diff fileversions, and i wouldn't want to overwrite users newer files...
    second, i'm concerned about filesize, because normally the installer is 60megs fully zipped, 100 megs unzipped... so i would need a method to either dnamically zip the files on the server (which would prolly put to much load on the server), or have each map w/ it's files in a .zip of it's own, and somehow have files associated to each zip, so if the user is missing even 1 of his files, the zip itself would be downloaded to install

    any suggestions? this is a hefty undertaking for a n00b like myself, but i have a bit of code that i've worked out that is by NO means final (i have a ways to go w/ it, cus i need to decide what retrieval method from the server, etc etc), but as it stands i have the code to download the currently imaginary list of files (in a txt file) from the server, and then use that to compare the user's files against...

    here's my code, keep in mind i was up late coding it, so i know some of it wouldn't work yet, lol, but tell me what y'all think (it lost it's formatting in the paste, which is one reason why it looks unorganized, lol):

    ----------------------------------------------------
    Search for File (%csinstalled% = location of *)
    Write to Text File ("%csinstalled%" to %SrcDir%\csinstalled.txt
    Assign Value (%mappacklist% = %SrcDir%\mappack.txt
    Count Text Lines (%csinstalledcount% = number of lines in "%csinstalled%")
    Count Text Lines (%mappackcount% = number of lines in "%mappacklist%")
    Read Text File (%readmappack% = Contents of %mappacklist%)
    Read Text File (%readcsinstalled% = Contents of %csinstalled%)
    Assign Value (%filenames% = -2)
    WHILE (%filenames% <= %mappackcount%)
    Assign Value (%rotate% = %filenames% + 1)
    Get Delimited String (%filenames% = string %rotate% in %readmappack%, delimiter =
    Get Delimited String (%minifilenames% = string -1 in %filenames%, delimiter = \)
    Find String (%mini% = position of cstrike in %minifilenames%)
    Assign Value (%mini1% = %mini% - 1)
    Assign Value (%mini3% = %mini1%)
    Assign Value (%mini2filenames% = "%SrcDir%\mini2.txt")
    WHILE ((%mini3% > "-1") AND (%mini3% <= %mini1%))
    Get Delimited String (%mini2% = string %mini3% in %minifilenames%, delimiter =
    Write to Text File ("%mini2%" to %mini2filenames%)
    Assign Value (%mini3% = %mini3% -1)
    END WHILE
    Assign Value (%mini4% = %mini1%)
    Assign Value (%downloadurl% = "%SrcDir%\downloadurl.txt")
    Write to Text File ("http://csmapcentral.com/warcry/" to %downloadurl%)
    ***Adds a folder such as 'example/' to the url, but not the filename itself***
    WHILE ((%mini4% > "0") AND (%mini4% <= %mini1%))
    Read Text File (%readmini2filenames% = Contents of %mini2filenames%)
    Get Delimited String (%mini4string% = string %mini4% in %mini4filenames%, delimiter =
    Write to Text File ("%mini4string%/" to %downloadurl%)
    Assign Value (%mini4% = %mini4% - 1)
    ***I'm going to clean up the statements here, create another variable so that i can write the download url at one time, instead of adding later on, cus i don't know if Setup Factory will toss in delimiters automatically, which would be bad, similar to what i did at end of second loop***
    IF (%mini4% = 0)
    Read Text File (%readmini2filenames% = Contents of %mini2filenames%)
    Get Delimited String (%mini4string% = string %mini4% in %mini4filenames%, delimiter =
    Write to Text File ("%mini4string%/" to %downloadurl%)
    END IF
    END WHILE
    Read Text File (%readdownloadurl% = Contents of %downloadurl%)
    Write to Text File ("%readdownloadurl%" to %SrcDir%\downloadlist.txt)
    Write to Text File ("%mini1%" to %SrcDir%\filenames.txt)
    Assign Value (%filenames% = %rotate%)
    END WHILE
    ***start loop for the generated cs list***
    ***this is pretty much the same loop, with a couple of changes***
    WHILE (%filenames% <= %csinstalledcount%)
    Assign Value (%rotate% = %filenames% + 1)
    Get Delimited String (%filenames% = string %rotate% in %readcsinstalled%, delimiter =
    Get Delimited String (%minifilenames% = string -1 in %filenames%, delimiter = \)
    Find String (%mini% = position of cstrike in %minifilenames%)
    Assign Value (%mini1% = %mini% - 1)
    Assign Value (%mini3% = %mini1%)
    Assign Value (%mini2filenames% = "%SrcDir%\mini2.txt")
    WHILE ((%mini3% > "-1") AND (%mini3% <= %mini1%))
    Get Delimited String (%mini2% = string %mini3% in %minifilenames%, delimiter =
    Write to Text File ("%mini2%" to %mini2filenames%)
    Assign Value (%mini3% = %mini3% -1)
    END WHILE
    Assign Value (%mini4% = %mini1%)
    Assign Value (%downloadurl% = "%SrcDir%\downloadurl.txt")
    Write to Text File ("http://csmapcentral.com/warcry/" to %downloadurl%)
    ***Adds a folder such as 'example/' to the url, but not the filename itself***
    WHILE ((%mini4% > "0") AND (%mini4% <= %mini1%))
    Read Text File (%readmini2filenames% = Contents of %mini2filenames%)
    Get Delimited String (%mini4string% = string %mini4% in %mini4filenames%, delimiter =
    Write to Text File ("%mini4string%/" to %downloadurl%)
    Assign Value (%mini4% = %mini4% - 1)
    IF (%mini4% = 0)
    Read Text File (%readmini2filenames% = Contents of %mini2filenames%)
    Get Delimited String (%mini4string% = string %mini4% in %mini4filenames%, delimiter =
    Write to Text File ("%mini4string%/" to %downloadurl%)
    END IF
    END WHILE
    Read Text File (%fileurl% = Contents of %downloadurl%)
    Read Text File (%urlcompare% = Contents of %downloadlist%)
    Find String (%comparestring% = position of %fileurl% in %urlcompare%)
    IF (%comparestring% >= 0)
    HTTP Download (%fileurl% -> %SrcDir%\Patches)
    END IF
    Delete Files (%downloadurl%)
    Write to Text File ("%mini1%" to %SrcDir%\filenames.txt)
    Write to Text File (""http://csmapcentral.com/warcry/" + %filenames%" to %SrcDir%\urls.txt)
    Assign Value (%filenames% = %rotate%)
    END WHILE
    ----------------------------------------------------------

    this code runs after the user chooses install dir (my installer detects default HL install dir, and enters it, and then user can alter it if he/she needs to), so that's something to keep in mind

    thx to ne1 that bothered to read this post, hehe, i know it's lengthy, sorry
Working...
X