parameters: (args)
docstring: Installs the CryVersionSelector on this machine.
docstring_summary: Installs the CryVersionSelector on this machine.
docstring_tokens: Installs the CryVersionSelector on this machine .
function: def cmd_install(args):
      """
      Installs the CryVersionSelector on this machine.
      """
      if not HAS_WIN_MODULES:
          error_missing_windows_modules(args, "install")
  
      uninstall_integration()
  
      if getattr(sys, 'frozen', False):
          # when the current module is executable, we use it directly
          # otherwise we have to call python in the cmd line
          curr_module_path = os.path.abspath(sys.executable)
          engine_commands = [
              ('add', 'Register Engine', '"%s" add "%%1"' % curr_module_path),
              ('1engine_gen', 'Generate Engine Solution',
               '"%s" engine_gen "%%1"' % curr_module_path)
          ]
  
          # --- extended, action, title, command
          # The first collumn defines extended action. The associated
          # commands will be displayed only when the user right-clicks an
          # object while also pressing the SHIFT key.
          # https://msdn.microsoft.com/en-us/library/cc144171(VS.85).aspx
          project_commands = [
              (False, 'edit', 'Launch Editor', '"%s" edit "%%1"' % curr_module_path),
              (False, '1open', 'Launch Game', '"%s" open "%%1"' % curr_module_path),
              (False, '2dedicated', 'Launch Dedicated Server',
               '"%s" server "%%1"' % curr_module_path),
              (False, '3package', 'Package Build',
               '"%s" package "%%1"' % curr_module_path),
              (False, '4metagen', 'Generate/Repair Metadata',
               '"%s" metagen "%%1"' % curr_module_path),
              (False, '5projgen', 'Generate Solution',
               '"%s" projgen "%%1"' % curr_module_path),
              (False, '6cmake-gui', 'Open CMake GUI',
               '"%s" cmake-gui "%%1"' % curr_module_path),
              (False, '7switch', 'Switch Engine Version',
               '"%s" switch "%%1"' % curr_module_path),
              (False, '8backup', 'Backup Project',
               '"%s" backup "%%1"' % curr_module_path)
          ]
  
          plugin_commands = [
              (False, 'register', 'Register Plugin',
                  '"%s" add_plugin_gui "%%1"' % curr_module_path),
              (False, '1unregister', 'Unregister Plugin',
                  '"%s" remove_plugin_gui "%%1"' % curr_module_path),
          ]
      else:
          curr_module_path = os.path.abspath(__file__)
          python_path = get_python_path()
          engine_commands = [
              ('add', 'Register Engine', '"%s" "%s" add "%%1"' %
               (python_path, curr_module_path)),
              ('1engine_gen', 'Generate Engine Solution',
               '"%s" "%s" engine_gen "%%1"' % (python_path, curr_module_path))
          ]
  
          project_commands = [
              (False, 'edit', 'Launch Editor', '"%s" "%s" edit "%%1"' %
               (python_path, curr_module_path)),
              (False, '1open', 'Launch Game', '"%s" "%s" open "%%1"' %
               (python_path, curr_module_path)),
              (False, '2dedicated', 'Launch Dedicated Server',
               '"%s" "%s" server "%%1"' % (python_path, curr_module_path)),
              (False, '3package', 'Package Build', '"%s" "%s" package "%%1"' %
               (python_path, curr_module_path)),
              (False, '4metagen', 'Generate/Repair Metadata',
               '"%s" "%s" metagen "%%1"' % (python_path, curr_module_path)),
              (False, '5projgen', 'Generate Solution',
               '"%s" "%s" projgen "%%1"' % (python_path, curr_module_path)),
              (False, '6cmake-gui', 'Open CMake GUI',
               '"%s" "%s" cmake-gui "%%1"' % (python_path, curr_module_path)),
              (False, '7switch', 'Switch Engine Version',
               '"%s" "%s" switch "%%1"' % (python_path, curr_module_path)),
              (False, '8backup', 'Backup Project', '"%s" "%s" backup "%%1"' %
               (python_path, curr_module_path))
          ]
  
          plugin_commands = [
              (False, 'register', 'Register Plugin',
                  '"%s" "%s" add_plugin_gui "%%1"' % (python_path, curr_module_path)),
              (False, '1unregister', 'Unregister Plugin',
                  '"%s" "%s" remove_plugin_gui "%%1"'
                  % (python_path, curr_module_path)),
          ]
  
      key = False and win32con.HKEY_LOCAL_MACHINE or win32con.HKEY_CURRENT_USER
      hClassesRoot = win32api.RegOpenKeyEx(key, 'Software\\Classes')
      # https://msdn.microsoft.com/en-us/library/windows/desktop/cc144152(v=vs.85).aspx
  
      # .cryengine
  
      FriendlyTypeName = 'CryEngine version'
      ProgID = 'CrySelect.engine'
      AppUserModelID = 'CrySelect.engine'
      DefaultIcon = os.path.join(crypath.get_exec_dir(), 'editor_icon.ico')
  
      hProgID = win32api.RegCreateKey(hClassesRoot, ProgID)
      win32api.RegSetValueEx(hProgID, None, None,
                             win32con.REG_SZ, FriendlyTypeName)
      win32api.RegSetValueEx(hProgID, 'AppUserModelID',
                             None, win32con.REG_SZ, AppUserModelID)
      win32api.RegSetValueEx(hProgID, 'FriendlyTypeName',
                             None, win32con.REG_SZ, FriendlyTypeName)
      win32api.RegSetValue(hProgID, 'DefaultIcon', win32con.REG_SZ, DefaultIcon)
  
      # ---
  
      hShell = win32api.RegCreateKey(hProgID, 'shell')
      win32api.RegCloseKey(hProgID)
  
      for action, title, command in engine_commands:
          hAction = win32api.RegCreateKey(hShell, action)
          win32api.RegSetValueEx(hAction, None, None, win32con.REG_SZ, title)
          win32api.RegSetValueEx(hAction, 'Icon', None,
                                 win32con.REG_SZ, DefaultIcon)
          win32api.RegSetValue(hAction, 'command', win32con.REG_SZ, command)
          win32api.RegCloseKey(hAction)
  
      action = 'add'
      win32api.RegSetValueEx(hShell, None, None, win32con.REG_SZ, action)
      win32api.RegCloseKey(hShell)
  
      # ---
  
      hCryProj = win32api.RegCreateKey(
          hClassesRoot, cryregistry.ENGINE_EXTENSION)
      win32api.RegSetValueEx(hCryProj, None, None, win32con.REG_SZ, ProgID)
      win32api.RegCloseKey(hCryProj)
  
      # .cryproject
  
      FriendlyTypeName = 'CryEngine project'
      ProgID = 'CrySelect.project'
      AppUserModelID = 'CrySelect.project'
      DefaultIcon = os.path.join(crypath.get_exec_dir(), 'editor_icon16.ico')
  
      hProgID = win32api.RegCreateKey(hClassesRoot, ProgID)
      win32api.RegSetValueEx(hProgID, None, None,
                             win32con.REG_SZ, FriendlyTypeName)
      win32api.RegSetValueEx(hProgID, 'AppUserModelID',
                             None, win32con.REG_SZ, AppUserModelID)
      win32api.RegSetValueEx(hProgID, 'FriendlyTypeName',
                             None, win32con.REG_SZ, FriendlyTypeName)
      win32api.RegSetValue(hProgID, 'DefaultIcon', win32con.REG_SZ, DefaultIcon)
  
      # ---
  
      hShell = win32api.RegCreateKey(hProgID, 'shell')
      win32api.RegCloseKey(hProgID)
  
      for extended, action, title, command in project_commands:
          hAction = win32api.RegCreateKey(hShell, action)
          win32api.RegSetValueEx(hAction, None, None, win32con.REG_SZ, title)
          win32api.RegSetValueEx(hAction, 'Icon', None,
                                 win32con.REG_SZ, DefaultIcon)
          win32api.RegSetValue(hAction, 'command', win32con.REG_SZ, command)
          if extended:
              win32api.RegSetValueEx(hAction, 'extended',
                                     None, win32con.REG_SZ, '')
  
          win32api.RegCloseKey(hAction)
  
      action = 'edit'
      win32api.RegSetValueEx(hShell, None, None, win32con.REG_SZ, action)
      win32api.RegCloseKey(hShell)
  
      # ---
  
      hCryProj = win32api.RegCreateKey(hClassesRoot, '.cryproject')
      win32api.RegSetValueEx(hCryProj, None, None, win32con.REG_SZ, ProgID)
      win32api.RegCloseKey(hCryProj)
  
      # --- .cryplugin
  
      FriendlyTypeName = 'CryEngine plugin'
      ProgID = 'CrySelect.plugin'
      AppUserModelID = 'CrySelect.plugin'
      DefaultIcon = os.path.join(crypath.get_exec_dir(), 'editor_icon16.ico')
  
      hProgID = win32api.RegCreateKey(hClassesRoot, ProgID)
      win32api.RegSetValueEx(
          hProgID, None, None, win32con.REG_SZ, FriendlyTypeName)
      win32api.RegSetValueEx(
          hProgID, 'AppUserModelID', None, win32con.REG_SZ, AppUserModelID)
      win32api.RegSetValueEx(
          hProgID, 'FriendlyTypeName', None, win32con.REG_SZ, FriendlyTypeName)
      win32api.RegSetValue(hProgID, 'DefaultIcon', win32con.REG_SZ, DefaultIcon)
  
      # ---
  
      hShell = win32api.RegCreateKey(hProgID, 'shell')
      win32api.RegCloseKey(hProgID)
  
      for extended, action, title, command, in plugin_commands:
          hAction = win32api.RegCreateKey(hShell, action)
          win32api.RegSetValueEx(hAction, None, None, win32con.REG_SZ, title)
          win32api.RegSetValueEx(
              hAction, 'Icon', None, win32con.REG_SZ, DefaultIcon)
          win32api.RegSetValue(hAction, 'command', win32con.REG_SZ, command)
          if extended:
              win32api.RegSetValueEx(
                  hAction, 'extended', None, win32con.REG_SZ, '')
  
          win32api.RegCloseKey(hAction)
  
      action = 'register'
      win32api.RegSetValueEx(hShell, None, None, win32con.REG_SZ, action)
      win32api.RegCloseKey(hShell)
  
      # ---
  
      hCryProj = win32api.RegCreateKey(hClassesRoot, '.cryplugin')
      win32api.RegSetValueEx(hCryProj, None, None, win32con.REG_SZ, ProgID)
      win32api.RegCloseKey(hCryProj)
function_tokens: def cmd_install ( args ) : if not HAS_WIN_MODULES : error_missing_windows_modules ( args , "install" ) uninstall_integration ( ) if getattr ( sys , 'frozen' , False ) : # when the current module is executable, we use it directly # otherwise we have to call python in the cmd line curr_module_path = os . path . abspath ( sys . executable ) engine_commands = [ ( 'add' , 'Register Engine' , '"%s" add "%%1"' % curr_module_path ) , ( '1engine_gen' , 'Generate Engine Solution' , '"%s" engine_gen "%%1"' % curr_module_path ) ] # --- extended, action, title, command # The first collumn defines extended action. The associated # commands will be displayed only when the user right-clicks an # object while also pressing the SHIFT key. # https://msdn.microsoft.com/en-us/library/cc144171(VS.85).aspx project_commands = [ ( False , 'edit' , 'Launch Editor' , '"%s" edit "%%1"' % curr_module_path ) , ( False , '1open' , 'Launch Game' , '"%s" open "%%1"' % curr_module_path ) , ( False , '2dedicated' , 'Launch Dedicated Server' , '"%s" server "%%1"' % curr_module_path ) , ( False , '3package' , 'Package Build' , '"%s" package "%%1"' % curr_module_path ) , ( False , '4metagen' , 'Generate/Repair Metadata' , '"%s" metagen "%%1"' % curr_module_path ) , ( False , '5projgen' , 'Generate Solution' , '"%s" projgen "%%1"' % curr_module_path ) , ( False , '6cmake-gui' , 'Open CMake GUI' , '"%s" cmake-gui "%%1"' % curr_module_path ) , ( False , '7switch' , 'Switch Engine Version' , '"%s" switch "%%1"' % curr_module_path ) , ( False , '8backup' , 'Backup Project' , '"%s" backup "%%1"' % curr_module_path ) ] plugin_commands = [ ( False , 'register' , 'Register Plugin' , '"%s" add_plugin_gui "%%1"' % curr_module_path ) , ( False , '1unregister' , 'Unregister Plugin' , '"%s" remove_plugin_gui "%%1"' % curr_module_path ) , ] else : curr_module_path = os . path . abspath ( __file__ ) python_path = get_python_path ( ) engine_commands = [ ( 'add' , 'Register Engine' , '"%s" "%s" add "%%1"' % ( python_path , curr_module_path ) ) , ( '1engine_gen' , 'Generate Engine Solution' , '"%s" "%s" engine_gen "%%1"' % ( python_path , curr_module_path ) ) ] project_commands = [ ( False , 'edit' , 'Launch Editor' , '"%s" "%s" edit "%%1"' % ( python_path , curr_module_path ) ) , ( False , '1open' , 'Launch Game' , '"%s" "%s" open "%%1"' % ( python_path , curr_module_path ) ) , ( False , '2dedicated' , 'Launch Dedicated Server' , '"%s" "%s" server "%%1"' % ( python_path , curr_module_path ) ) , ( False , '3package' , 'Package Build' , '"%s" "%s" package "%%1"' % ( python_path , curr_module_path ) ) , ( False , '4metagen' , 'Generate/Repair Metadata' , '"%s" "%s" metagen "%%1"' % ( python_path , curr_module_path ) ) , ( False , '5projgen' , 'Generate Solution' , '"%s" "%s" projgen "%%1"' % ( python_path , curr_module_path ) ) , ( False , '6cmake-gui' , 'Open CMake GUI' , '"%s" "%s" cmake-gui "%%1"' % ( python_path , curr_module_path ) ) , ( False , '7switch' , 'Switch Engine Version' , '"%s" "%s" switch "%%1"' % ( python_path , curr_module_path ) ) , ( False , '8backup' , 'Backup Project' , '"%s" "%s" backup "%%1"' % ( python_path , curr_module_path ) ) ] plugin_commands = [ ( False , 'register' , 'Register Plugin' , '"%s" "%s" add_plugin_gui "%%1"' % ( python_path , curr_module_path ) ) , ( False , '1unregister' , 'Unregister Plugin' , '"%s" "%s" remove_plugin_gui "%%1"' % ( python_path , curr_module_path ) ) , ] key = False and win32con . HKEY_LOCAL_MACHINE or win32con . HKEY_CURRENT_USER hClassesRoot = win32api . RegOpenKeyEx ( key , 'Software\\Classes' ) # https://msdn.microsoft.com/en-us/library/windows/desktop/cc144152(v=vs.85).aspx # .cryengine FriendlyTypeName = 'CryEngine version' ProgID = 'CrySelect.engine' AppUserModelID = 'CrySelect.engine' DefaultIcon = os . path . join ( crypath . get_exec_dir ( ) , 'editor_icon.ico' ) hProgID = win32api . RegCreateKey ( hClassesRoot , ProgID ) win32api . RegSetValueEx ( hProgID , None , None , win32con . REG_SZ , FriendlyTypeName ) win32api . RegSetValueEx ( hProgID , 'AppUserModelID' , None , win32con . REG_SZ , AppUserModelID ) win32api . RegSetValueEx ( hProgID , 'FriendlyTypeName' , None , win32con . REG_SZ , FriendlyTypeName ) win32api . RegSetValue ( hProgID , 'DefaultIcon' , win32con . REG_SZ , DefaultIcon ) # --- hShell = win32api . RegCreateKey ( hProgID , 'shell' ) win32api . RegCloseKey ( hProgID ) for action , title , command in engine_commands : hAction = win32api . RegCreateKey ( hShell , action ) win32api . RegSetValueEx ( hAction , None , None , win32con . REG_SZ , title ) win32api . RegSetValueEx ( hAction , 'Icon' , None , win32con . REG_SZ , DefaultIcon ) win32api . RegSetValue ( hAction , 'command' , win32con . REG_SZ , command ) win32api . RegCloseKey ( hAction ) action = 'add' win32api . RegSetValueEx ( hShell , None , None , win32con . REG_SZ , action ) win32api . RegCloseKey ( hShell ) # --- hCryProj = win32api . RegCreateKey ( hClassesRoot , cryregistry . ENGINE_EXTENSION ) win32api . RegSetValueEx ( hCryProj , None , None , win32con . REG_SZ , ProgID ) win32api . RegCloseKey ( hCryProj ) # .cryproject FriendlyTypeName = 'CryEngine project' ProgID = 'CrySelect.project' AppUserModelID = 'CrySelect.project' DefaultIcon = os . path . join ( crypath . get_exec_dir ( ) , 'editor_icon16.ico' ) hProgID = win32api . RegCreateKey ( hClassesRoot , ProgID ) win32api . RegSetValueEx ( hProgID , None , None , win32con . REG_SZ , FriendlyTypeName ) win32api . RegSetValueEx ( hProgID , 'AppUserModelID' , None , win32con . REG_SZ , AppUserModelID ) win32api . RegSetValueEx ( hProgID , 'FriendlyTypeName' , None , win32con . REG_SZ , FriendlyTypeName ) win32api . RegSetValue ( hProgID , 'DefaultIcon' , win32con . REG_SZ , DefaultIcon ) # --- hShell = win32api . RegCreateKey ( hProgID , 'shell' ) win32api . RegCloseKey ( hProgID ) for extended , action , title , command in project_commands : hAction = win32api . RegCreateKey ( hShell , action ) win32api . RegSetValueEx ( hAction , None , None , win32con . REG_SZ , title ) win32api . RegSetValueEx ( hAction , 'Icon' , None , win32con . REG_SZ , DefaultIcon ) win32api . RegSetValue ( hAction , 'command' , win32con . REG_SZ , command ) if extended : win32api . RegSetValueEx ( hAction , 'extended' , None , win32con . REG_SZ , '' ) win32api . RegCloseKey ( hAction ) action = 'edit' win32api . RegSetValueEx ( hShell , None , None , win32con . REG_SZ , action ) win32api . RegCloseKey ( hShell ) # --- hCryProj = win32api . RegCreateKey ( hClassesRoot , '.cryproject' ) win32api . RegSetValueEx ( hCryProj , None , None , win32con . REG_SZ , ProgID ) win32api . RegCloseKey ( hCryProj ) # --- .cryplugin FriendlyTypeName = 'CryEngine plugin' ProgID = 'CrySelect.plugin' AppUserModelID = 'CrySelect.plugin' DefaultIcon = os . path . join ( crypath . get_exec_dir ( ) , 'editor_icon16.ico' ) hProgID = win32api . RegCreateKey ( hClassesRoot , ProgID ) win32api . RegSetValueEx ( hProgID , None , None , win32con . REG_SZ , FriendlyTypeName ) win32api . RegSetValueEx ( hProgID , 'AppUserModelID' , None , win32con . REG_SZ , AppUserModelID ) win32api . RegSetValueEx ( hProgID , 'FriendlyTypeName' , None , win32con . REG_SZ , FriendlyTypeName ) win32api . RegSetValue ( hProgID , 'DefaultIcon' , win32con . REG_SZ , DefaultIcon ) # --- hShell = win32api . RegCreateKey ( hProgID , 'shell' ) win32api . RegCloseKey ( hProgID ) for extended , action , title , command , in plugin_commands : hAction = win32api . RegCreateKey ( hShell , action ) win32api . RegSetValueEx ( hAction , None , None , win32con . REG_SZ , title ) win32api . RegSetValueEx ( hAction , 'Icon' , None , win32con . REG_SZ , DefaultIcon ) win32api . RegSetValue ( hAction , 'command' , win32con . REG_SZ , command ) if extended : win32api . RegSetValueEx ( hAction , 'extended' , None , win32con . REG_SZ , '' ) win32api . RegCloseKey ( hAction ) action = 'register' win32api . RegSetValueEx ( hShell , None , None , win32con . REG_SZ , action ) win32api . RegCloseKey ( hShell ) # --- hCryProj = win32api . RegCreateKey ( hClassesRoot , '.cryplugin' ) win32api . RegSetValueEx ( hCryProj , None , None , win32con . REG_SZ , ProgID ) win32api . RegCloseKey ( hCryProj )