Advertisement
Professional

Yeet

Oct 24th, 2018
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1. //--------------------------------------------------------------------------------------
  2. // Name: MediaLocator::MediaLocator()
  3. // Desc: Constructs a MediaLocator object for use with the specified xzp archive.
  4. //--------------------------------------------------------------------------------------
  5. MediaLocator::MediaLocator( LPCWSTR szPackage )
  6. {
  7.     wcscpy_s( m_szPackage, szPackage );
  8.     m_szMediaPath[ 0 ] = L'\0';
  9. }
  10.  
  11.  
  12. //--------------------------------------------------------------------------------------
  13. // Name: MediaLocator::SetPackage()
  14. // Desc: Replace the current working xzp archive with a new one.
  15. //--------------------------------------------------------------------------------------
  16. VOID MediaLocator::SetPackage( LPCWSTR szPackage )
  17. {
  18.     wcscpy_s( m_szPackage, szPackage );
  19.     m_szMediaPath[ 0 ] = L'\0';
  20. }
  21.  
  22. //--------------------------------------------------------------------------------------
  23. // Name: MediaLocator::GetMediaPath()
  24. // Desc: Retrieves the path to the media folder that sits inside the xzp archive.
  25. //--------------------------------------------------------------------------------------
  26. LPCWSTR MediaLocator::GetMediaPath() const
  27. {
  28.     if( m_szMediaPath[ 0 ] == L'\0' && m_szPackage[ 0 ] != L'\0' )
  29.     {
  30.         LocateMediaFolder( m_szMediaPath, ARRAYSIZE( m_szMediaPath ), m_szPackage );
  31.     }
  32.    
  33.     return m_szMediaPath;
  34. }
  35.  
  36.  
  37. //--------------------------------------------------------------------------------------
  38. // Name: MediaLocator::ComposeResourceLocator()
  39. // Desc: If succesful, returns TRUE and szLocator contains the resource locator for the
  40. //       file identified by szPath and szFile that sits inside the media folder of the
  41. //       xzp archive. It returns FALSE upon failure.
  42. //--------------------------------------------------------------------------------------
  43. BOOL MediaLocator::ComposeResourceLocator( LPWSTR szLocator, DWORD dwLocatorSize,
  44.                                            LPCWSTR szPath, LPCWSTR szFile         ) const
  45. {
  46.    if( m_szPackage[ 0 ] == L'\0' )
  47.        return FALSE;
  48.  
  49.    return ATG::ComposeResourceLocator( szLocator, dwLocatorSize, m_szPackage, GetMediaPath(), szPath, szFile );
  50. }
  51.  
  52.  
  53. } // namespace ATG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement