Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef ERRORSYSTEM_H
  5. #define ERRORSYSTEM_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "replay/ireplayerrorsystem.h"
  11. #include "basethinker.h"
  12. #include "utllinkedlist.h"
  13. //----------------------------------------------------------------------------------------
  14. class KeyValues;
  15. class CClientRecordingSessionBlock;
  16. class CHttpDownloader;
  17. //----------------------------------------------------------------------------------------
  18. class IErrorReporter
  19. {
  20. public:
  21. virtual void ReportErrorsToUser( wchar_t *pErrorText ) = 0;
  22. };
  23. //----------------------------------------------------------------------------------------
  24. class CErrorSystem : public CBaseThinker,
  25. public IReplayErrorSystem
  26. {
  27. public:
  28. CErrorSystem( IErrorReporter *pErrorReporter );
  29. ~CErrorSystem();
  30. virtual void AddErrorFromTokenName( const char *pToken );
  31. virtual void AddFormattedErrorFromTokenName( const char *pFormatToken, KeyValues *pFormatArgs );
  32. #if !defined( DEDICATED )
  33. void OGS_ReportSessionBlockDownloadError( const CHttpDownloader *pDownloader, const CClientRecordingSessionBlock *pBlock,
  34. int nLocalFileSize, int nMaxBlock, const bool *pSizesDiffer,
  35. const bool *pHashFail, uint8 *pLocalHash );
  36. void OGS_ReportSessioInfoDownloadError( const CHttpDownloader *pDownloader, const char *pErrorToken );
  37. void OGS_ReportGenericError( const char *pGenericErrorToken );
  38. #endif
  39. private:
  40. void AddError( const wchar_t *pError );
  41. void AddError( const char *pError );
  42. float GetNextThinkTime() const;
  43. void Think();
  44. void Clear();
  45. IErrorReporter *m_pErrorReporter;
  46. CUtlLinkedList< wchar_t *, int > m_lstErrors;
  47. };
  48. //----------------------------------------------------------------------------------------
  49. #endif // ERRORSYSTEM_H