summaryrefslogtreecommitdiff
path: root/utils/tfstats/binaryresource.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/tfstats/binaryresource.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'utils/tfstats/binaryresource.h')
-rw-r--r--utils/tfstats/binaryresource.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/utils/tfstats/binaryresource.h b/utils/tfstats/binaryresource.h
new file mode 100644
index 0000000..7a87061
--- /dev/null
+++ b/utils/tfstats/binaryresource.h
@@ -0,0 +1,48 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $Workfile: $
+// $Date: $
+//
+//------------------------------------------------------------------------------------------------------
+// $Log: $
+//
+// $NoKeywords: $
+//=============================================================================//
+#ifndef BINARYRESOURCE_H
+#define BINARYRESOURCE_H
+#ifdef WIN32
+#pragma once
+#endif
+#include <string>
+#include <stdio.h>
+#include "util.h"
+
+class CBinaryResource
+{
+private:
+ std::string filename;
+ size_t numBytes;
+ unsigned char* pData;
+public:
+ CBinaryResource(char* name, size_t bytes,unsigned char* data)
+ :filename(name),numBytes(bytes),pData(data)
+ {}
+
+ bool writeOut()
+ {
+ FILE* f=fopen(filename.c_str(),"wb");
+ if (!f)
+ return false;
+ fwrite(pData,1,numBytes,f);
+ fclose(f);
+#ifndef WIN32
+ chmod(filename.c_str(),PERMIT);
+#endif
+ return true;
+ }
+};
+
+#endif // BINARYRESOURCE_H
+