コード例 #1
0
 def OptionalUpgradeGetDetailsURL(self):
     n = nasty.GetAppDataCompiledCodePath()
     fromversion = n.build or boot.build
     if self.upgradeInfo is None:
         return
     toversion = self.upgradeInfo.build
     from appPatch import optionalPatchInfoURLs
     url = '%s?from=%s&to=%s' % (optionalPatchInfoURLs[boot.region], fromversion, toversion)
     return url
コード例 #2
0
 def OptionalUpgradeGetDescription(self):
     try:
         n = nasty.GetAppDataCompiledCodePath()
         fromversion = n.build or boot.build
         if self.upgradeInfo is None:
             return
         toversion = self.upgradeInfo.build
         from appPatch import optionalPatchInfoURLs
         url = '%snoformat.asp?from=%s&to=%s' % (optionalPatchInfoURLs[boot.region], fromversion, toversion)
         socket = urllib2.urlopen(url)
         response = socket.read()
         socket.close()
         return response
     except:
         log.LogException()
         sys.exc_clear()
         return
コード例 #3
0
 def CheckServerUpgradeInfo(self, upgradeInfo):
     self.upgradeInfo = upgradeInfo
     if upgradeInfo is None:
         if nasty.IsRunningWithOptionalUpgrade():
             self.HandleObsoleteUpgrade()
             return
         else:
             return
     localHash = nasty.GetCompiledCodeHash()
     if upgradeInfo.hash == localHash:
         return
     if nasty.IsRunningWithOptionalUpgrade():
         currentCode = nasty.GetAppDataCompiledCodePath()
         currentBuild = currentCode.build
         if currentBuild > upgradeInfo.build:
             self.HandleObsoleteUpgrade()
     else:
         currentBuild = boot.build
     self.LogInfo('Currently running', currentBuild, 'with hash', localHash, 'but server is', upgradeInfo.build, 'with hash', upgradeInfo.hash)
     PFHash = nasty.GetCompiledCodeHash(blue.paths.ResolvePath('script:/compiled.code'))
     if PFHash == upgradeInfo.hash:
         self.LogInfo('Installation directory file matches hash, reverting to that one')
         self.HandleObsoleteUpgrade()
         return
     if upgradeInfo.build > boot.build:
         url = self.OptionalUpgradeGetDetailsURL()
         if not url:
             return
         description = self.OptionalUpgradeGetDescription().strip()
         if not description:
             return
         if description == 'ERROR':
             self.LogError('There was an error getting the update description: ERROR')
             uicore.Message('CompiledCodeUpgradeDescriptionError')
         elif description == 'NOT_FOUND':
             self.LogError('There was no description found for the client update: NOT_FOUND')
             uicore.Message('CompiledCodeUpgradeDescriptionError')
         elif description == '':
             self.LogError('There was no description found for the client update: Empty Response')
             uicore.Message('CompiledCodeUpgradeDescriptionError')
         else:
             description = description.replace('\n', '<br>')
             self.PromptForOptionalUpgrade(description, url)
コード例 #4
0
ファイル: loginII.py プロジェクト: R4M80MrX/eve-1
def GetVersion():
    subbuild = None
    try:
        subbuild = str(boot.build)
        if nasty.IsRunningWithOptionalUpgrade():
            currentCode = nasty.GetAppDataCompiledCodePath()
            subbuild = str(currentCode.build) + ' (' + str(boot.build) + ')'
    except:
        log.LogException()
        if subbuild is None:
            subbuild = '501'

    try:
        buildno = '%s.%s' % (boot.keyval['version'].split('=', 1)[1], subbuild)
    except:
        log.LogException()
        buildno = subbuild

    return buildno
コード例 #5
0
    def DownloadOptionalUpgrade(self, upgradeInfo):
        try:
            downloadDirectory = nasty.GetAppDataCompiledCodePath().path
            filename = unicode(upgradeInfo.build) + u'.code'
            destination = os.path.join(downloadDirectory, filename)
            destination = os.path.normcase(destination)
            tempfile = 'temp_%s_dl.tmp' % upgradeInfo.hash
            tempfile = os.path.normcase(os.path.join(downloadDirectory, tempfile))
            if os.path.exists(tempfile):
                os.remove(tempfile)
            if not os.path.exists(downloadDirectory):
                os.makedirs(downloadDirectory)
            self.LogInfo('Starting download of new compiled.code file')
            SetDownloadProgress(0, localization.GetByLabel('/Carbon/UI/Patch/Downloading'))
            try:
                urllib.urlretrieve(upgradeInfo.fileurl, tempfile, CodeDownLookHook)
                self.LogInfo('Completed downloading compiled.code file to: ' + tempfile)
                readBytes = blue.win32.AtomicFileRead(tempfile)[0]
                cp = blue.crypto.GetVerContext()
                hasher = blue.crypto.CryptCreateHash(cp, blue.crypto.CALG_MD5, None)
                blue.crypto.CryptHashData(hasher, readBytes)
                thehash = blue.crypto.CryptGetHashParam(hasher, blue.crypto.HP_HASHVAL)
                hasher.Destroy()
                tempfilehash = base64.b64encode(thehash).strip().replace('/', '_')
                if tempfilehash == upgradeInfo.hash:
                    if os.path.exists(destination):
                        os.remove(destination)
                    self.LogInfo('Renaming tempfile: %s to final location: %s' % (tempfile, destination))
                    os.rename(tempfile, destination)
                    uicore.Message('CodePatchApplied')
                    appUtils.Reboot('Compiled.Code Update')
                else:
                    self.LogError('Error getting new .code file: hash mismatch. Got %s expected %s' % (tempfilehash, upgradeInfo.hash))
                    uicore.Message('CompiledCodeDownloadFailed')
            finally:
                SetDownloadProgress(1000, localization.GetByLabel('/Carbon/UI/Patch/Downloading'))

        except Exception as e:
            self.LogError('Error getting new .code file: ', e)
            uicore.Message('CompiledCodeDownloadFailed')
            if nasty.IsRunningWithOptionalUpgrade():
                self.HandleObsoleteUpgrade()
コード例 #6
0
# Credits go to wibiti

from nasty import nasty, UnjumbleString
import cPickle
import blue
import struct
import imp
import os
import zipfile
import uthread

store_path = "C:/python27/uncompyle2/eve-%.2f.%s/" % (
    boot.version, nasty.GetAppDataCompiledCodePath().build or boot.build)

root_store_path = store_path + "eve/"
script_store_path = store_path + "eve/client/script/"

(
    fileData,
    fileInfo,
) = blue.win32.AtomicFileRead(nasty.compiledCodeFile)
datain = cPickle.loads(fileData)
code = cPickle.loads(datain[1])["code"]
for (
        k,
        v,
) in code:
    c = v[0]
    c = UnjumbleString(c, True)
    ksplit = k[0].split(':/')
    filename = script_store_path if ksplit[0] == "script" else root_store_path