EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   General::General Discussion (https://www.eqemulator.org/forums/forumdisplay.php?f=586)
-   -   Multi-Client utility (https://www.eqemulator.org/forums/showthread.php?t=32542)

enneract 11-25-2010 07:40 PM

Multi-Client utility
 
I generally play on my laptop with a 64gb SSD, so disk space is at a premium. I also like to play on a couple different servers with different client requirements. As such, I created a small utility which can recursively symlink the files in a directory (not create 'directory junctions'), so that server-specific changes can be made, using a minimum amount of disk space (at most a few MB, instead of 4GB per client install).

For those not in the know, a symlink basically makes your computer think that a single file (stored in a specific space in physical memory), exists in multiple places in logical memory simultaneously. So, if symlinked, C:\Foo.txt and C:\Bar.txt have the same contents, and if you edit Foo.txt, Bar.txt will also be changed. The other consequence is that only 1 file's worth of storage is consumed.

Cleaned it up, here it is.

Command line, usage is
Code:

EQEClone -s <source> -d <destination>
Run the app, it will create the new folder, and symlink the contents. It will create a COPY of eqhosts.txt so that you can use a different login server. Copy over any server-specific alterations you might need, overwriting whatever. Note that EDITING any file that you havent overwritten in the clone folder will also CHANGE THE SOURCE FOLDER'S COPY. Renaming, deleting, etc, will not, though. I don't know what you'd edit besides eqhosts.txt, but keep it in mind.

Your antivirus might not like it due to being a packaged autoit macro. It isn't a virus.

source, for the paranoid for the above reason:

Code:

; Creates symlinked EQ:Titanium install for Project1999

#NoTrayIcon

#include <Array.au3>
#include <File.au3>


$srcName    = ""
$destName  = ""
readCmdLineParams()

If NOT FileExists($destName) Then
        DirCreate($destName)       
EndIf

getFileList($srcName)
ConsoleWrite("Directory cloning complete")

Func getFileList($folderName)
 Local $fileArray, $i, $fullFilePath, $fileAttributes

 $fileArray = _FileListToArray($folderName)

 For $i=1 To $fileArray[0]
        $fullFilePath = $folderName & "\" & $fileArray[$i] ;retrieve the full path
        $tempName    = StringReplace($fullFilePath, $srcName, $destName)
        $fileAttributes = FileGetAttrib($fullFilePath)
        If StringInStr($fileAttributes,"D") Then ;folder, have to explore
                ConsoleWrite("FOLDER - " & $fullFilePath & @CRLF)
                IF NOT FileExists($destname & "\" & $fileArray[$i]) Then
                        DirCreate($tempName)
                EndIf
                getFileList($fullFilePath) ;recursive call
        ElseIf $fileArray[$i] = "eqhost.txt" Then
                ConsoleWrite("Skipping EQHosts.txt")
                FileCopy($fullFilePath, $tempName)
        Else ;file
                ConsoleWrite("FILE - " & $fullFilePath & @CRLF)
                ShellExecute("cmd" , "/c mklink /H " & $tempName & " " & $fullFilePath, "", "", @SW_HIDE)
        EndIf
 Next
EndFunc

Func readCmdLineParams()        ;Read in the optional switch set in the users profile and set a variable - used in case selection
 
        ;;Loop through every arguement
        ;;$cmdLine[0] is an integer that is eqaul to the total number of arguements that we passwed to the command line
        for $i = 1 to $cmdLine[0]
 
                select
                        ;;If the arguement equal -h
                        case $CmdLine[$i] = "-s"
                                ;check for missing argument
                                if $i == $CmdLine[0] Then cmdLineHelpMsg()
 
                                ;Make sure the next argument is not another paramter
                                if StringLeft($cmdline[$i+1], 1) == "-" Then
                                        cmdLineHelpMsg()
                                Else
                                        ;;Stip white space from the begining and end of the input
                                        ;;Not alway nessary let it in just in case
                                        $srcName = StringStripWS($CmdLine[$i + 1], 3)
                                endif
 
                        ;;If the arguement equal  -b
                        case $CmdLine[$i] = "-d"
 
                                ;check for missing arguement
                                if $i == $CmdLine[0] Then cmdLineHelpMsg()
 
                                ;Make sure the next argument is not another paramter
                                if StringLeft($cmdline[$i+1], 1) == "-" Then
                                        cmdLineHelpMsg()
                                Else
                                        ;;Stip white space from the begining and end of the input
                                        ;;Not alway nessary let it in just in case
                                        $destName = StringStripWS($CmdLine[$i + 1], 3)
                                EndIf
 
                        ;set the -x flag to True
                        case $cmdLine[$i] = "-x"
                                $flagX = "True"
 
                        ;set the -y flag to True
                        case $cmdLine[$i] = "-y"
                                $flagY = "True"
 
                EndSelect
 
        Next
 
        ;Make sure required options are set and if not display the Help Message
        if $srcName == "" Or $destName == "" Then
                cmdLineHelpMsg()
        EndIf
 
EndFunc

Func cmdLineHelpMsg()
        ConsoleWrite('EQEmu Directory Cloning tool' & @LF & @LF & _
                                        'Syntax:' & @tab & 'eqeclone.exe [options]' & @LF & @LF & _
                                        'Default:' & @tab & 'Display help message.' & @LF & @LF & _
                                        'Required Options:' & @LF & _
                                        '-s [message]' & @tab & ' Source Folder' & @LF & _
                                        '-d [message]' & @tab & ' Destination Folder' & @LF)
        Exit
EndFunc


steve 11-27-2010 01:31 PM

Nice! I've been looking for something like this.

Does this work with Windows 7? Can this be used on Live installs? So I can have a LiveEQ, TestEQ, and BetaEQ folder, with just the changed contents?

enneract 11-27-2010 01:38 PM

It probably ONLY works on windows 7. It might work on Vista too, but not sure.

As for working on live installs... Maybe? I don't know, I haven't tested it. The patcher may or may not bork the original install.


All times are GMT -4. The time now is 07:24 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.