NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

liveIconCacheUtils.py (1664B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\cosmetics\client\liveIconCacheUtils.py
      2 import trinity
      3 import blue
      4 import os
      5 import hashlib
      6 import evegraphics.settings as gfxsettings
      7 MAP_CACHE_PATH = u'cache:/SKINR/icons'
      8 
      9 def is_low_spec():
     10     return gfxsettings.Get(gfxsettings.GFX_SHADER_QUALITY) == gfxsettings.SHADER_MODEL_LOW
     11 
     12 
     13 def open_cache_directory_in_explorer():
     14     fileSystemPath = blue.paths.ResolvePath(MAP_CACHE_PATH)
     15     os.startfile(fileSystemPath)
     16 
     17 
     18 def create_cache_directory():
     19     cachePath = blue.paths.ResolvePathForWriting(MAP_CACHE_PATH)
     20     if not os.path.exists(cachePath):
     21         os.makedirs(cachePath)
     22 
     23 
     24 def clear_all_cached_maps():
     25     fileSystemPath = blue.paths.ResolvePath(MAP_CACHE_PATH)
     26     for root, dirs, files in os.walk(fileSystemPath):
     27         for f in files:
     28             os.remove(os.path.join(root, f))
     29 
     30 
     31 def get_cache_file_path(cachePath, hashKey):
     32     hashKey = str(hashKey).replace('-', '_')
     33     return u'{0}/{1}.dds'.format(cachePath, hashKey)
     34 
     35 
     36 def get_unique_filename(skin_design, bg_texture_path):
     37     uniqueString = skin_design.design_hex + bg_texture_path + str(gfxsettings.Get(gfxsettings.GFX_SHADER_QUALITY))
     38     h = hashlib.new('sha256')
     39     h.update(uniqueString.encode())
     40     hex = h.hexdigest()
     41     hex = str(skin_design.ship_type_id) + hex
     42     path = blue.paths.ResolvePathForWriting(get_cache_file_path(MAP_CACHE_PATH, hex))
     43     path.encode('utf-8', 'ignore')
     44     return path
     45 
     46 
     47 def cached_render_available(skin_design, bg_texture_path):
     48     filePath = get_unique_filename(skin_design, bg_texture_path)
     49     fileExists = os.path.isfile(filePath)
     50     return fileExists