Ë
    Î£jg  ã                   ó  — d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ  e j                  «       Z
 G d„ de«      Z G d„ de«      Zd	ed
efd„Zddeez  dz  d
efd„Zej&                  fded
efd„Zddedz  dedz  d
efd„Zy)é    N)ÚPath)ÚAny)Ú
Sourcemodsc                   ó   — e Zd Zy)ÚInvalidSourcemodN©Ú__name__Ú
__module__Ú__qualname__© ó    úFC:\Users\pivot\Documents\cueki\casual-preloader\core\util\sourcemod.pyr   r      ó   „ Ør   r   c                   ó   — e Zd Zy)Ú InvalidSourcemodInstallationPathNr   r   r   r   r   r      r   r   r   ÚnameÚreturnc                 ó�   — t         j                  ddt        j                  t        j                  z   «      }| j                  |«      S )NÚ )ÚstrÚ	maketransÚstringÚ
whitespaceÚpunctuationÚ	translate)r   Únon_alphanums     r   Ú
clean_namer      s4   € Ü—=‘=  R¬×):Ñ):¼V×=OÑ=OÑ)OÓP€LØ�>‰>˜,Ó'Ð'r   Ú	sourcemodc                 óÆ  — | €t         j                  S t        | t        «      r,t         D ]  }| |j                  k(  sŒ|c S  t        d| › �«      ‚t        | j                  «       «      }	 t         |   S # t        $ r Y nw xY wt         D ]  }|j                  | k(  sŒ|c S  t         D ],  }t        |j                  j                  «       «      |k(  sŒ*|c S  t        d| › d�«      ‚)zÍ
    Normalizes sourcemods using known aliases.

    Args:
        sourcemod: The steam id of a sourcemod, its name or an alias thereof, or None (gets the default).

    Returns:
        The sourcemod
    z Unknown sourcemod with steam id z;Unknown sourcemod with name/alias or abbreviation thereof `Ú`)
r   ÚDEFAULTÚ
isinstanceÚintÚappidr   r   ÚupperÚKeyErrorÚ	full_name)r   Ú
_sourcemodÚsourcemod_upper_cleans      r   Úget_sourcemodr*      sñ   € ð ÐÜ×!Ñ!Ð!ä�)œSÔ!ß$ˆJØ˜J×,Ñ,Ó,Ø"Ò"ð %ô Ð!AÀ)ÀÐMÓNÐNä& y§¡Ó'8Ó9ÐðÜÐ/Ñ0Ð0øÜò Ùðú÷ !ˆ
Ø×Ñ 9Ó,ØÒð !÷ !ˆ
Ü�j×*Ñ*×0Ñ0Ó2Ó3Ð7LÓLØÒð !ô ÐXÐYbÐXcÐcdÐeÓ
fÐfs   Á)A2 Á2	A>Á=A>c                 ó�  — t         j                  dk(  rt        d«      t        d«      g}n2t        d«      j                  «       t        d«      j                  «       g}| j                  j                  «       }t        |«      }|D ]¨  }|j                  «       sŒ|j                  «       D ]‚  }|j                  «       sŒ|j                  j                  «       }||k(  st        |«      |k(  sŒB|j                  «       D ].  }|j                  «       sŒ|dz  j                  «       sŒ(|c c c S  Œ„ Œª t        d| j                  › d�«      ‚)	zÁAuto-detect a Source mod installation by looking for a subdirectory with gameinfo.txt.

    Args:
        sourcemod: A sourcemod object

    Returns:
        The path to the mod directory.
    Úwin32z-C:/Program Files (x86)/Steam/steamapps/commonz-D:/Program Files (x86)/Steam/steamapps/commonz~/.steam/steam/steamapps/commonz%~/.local/share/Steam/steamapps/commonúgameinfo.txtz-Cannot find installation path for sourcemod `r    )ÚsysÚplatformr   Ú
expanduserr'   Úlowerr   Úis_dirÚiterdirr   Úis_filer   )r   Ústeam_pathsÚ
name_lowerÚname_lower_cleanÚ
steam_pathÚgame_folderÚ_name_lowerÚsubdirs           r   Úauto_detect_sourcemodr<   >   s/  € ô ‡|�|�wÒäÐ@ÓAÜÐ@ÓAð
‰ô Ð2Ó3×>Ñ>Ó@ÜÐ8Ó9×DÑDÓFð
ˆð
 ×$Ñ$×*Ñ*Ó,€JÜ! *Ó-ÐÛ!ˆ
Ø× Ñ Ô"Øà%×-Ñ-Ö/ˆKØ×%Ñ%Ô'Øà%×*Ñ*×0Ñ0Ó2ˆKØ :Ò-´¸KÓ1HÐL\Ò1\Øà%×-Ñ-Ö/�Ø—=‘=•?¨°Ñ(?×'HÑ'HÕ'JØ!–Mñ 0ñ 0ð	 "ô  +Ð-ZÐ[d×[iÑ[iÐZjÐjkÐ+lÓ
mÐmr   ÚpathÚvalidation_labelc                 óR  — | €|r|j                  d«       y| j                  «       s%|r"|j                  d«       |j                  d«       y| dz  j                  «       s%|r"|j                  d«       |j                  d«       y|r"|j                  d«       |j                  d«       y	)
z=Validate a Source mod directory by checking for gameinfo.txt.r   FzDirectory does not exist!zcolor: red;r-   zOgameinfo.txt not found - this doesn't appear to be a valid Source mod directoryz$Valid Source mod directory detected!zcolor: green;T)ÚsetTextr2   ÚsetStyleSheetr4   )r=   r>   s     r   Úvalidate_game_directoryrB   h   sž   € à€|ÙØ×$Ñ$ RÔ(Øà�;‰;Œ=ÙØ×$Ñ$Ð%@ÔAØ×*Ñ*¨=Ô9Øà�>Ñ!×*Ñ*Ô,ÙØ×$Ñ$Ð%vÔwØ×*Ñ*¨=Ô9ØáØ× Ñ Ð!GÔHØ×&Ñ& Ô7àr   )N)Úloggingr   r.   Úpathlibr   Útypingr   Úcore.constantsr   Ú	getLoggerÚlogr&   r   ÚFileNotFoundErrorr   r   r   r#   r*   r!   r<   ÚboolrB   r   r   r   Ú<module>rK      s¸   ðÛ Û Û 
Ý Ý å %à€g×ÑÓ€ô	�xô 	ô	Ð'8ô 	ð(�Sð (˜Só (ñ
$g˜S 3™Y¨Ñ-ð $g¸ó $gðL 3=×2DÑ2Dñ &n Zð &nÈó &nñT $¨¡+ð ÀÀtÁð ÐW[ô r   