aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/General/gen_crasher/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Plugins/General/gen_crasher/config.h')
-rw-r--r--Src/Plugins/General/gen_crasher/config.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/Src/Plugins/General/gen_crasher/config.h b/Src/Plugins/General/gen_crasher/config.h
new file mode 100644
index 00000000..1016b570
--- /dev/null
+++ b/Src/Plugins/General/gen_crasher/config.h
@@ -0,0 +1,62 @@
+#ifndef NULLSOFT_CONFIG_H_
+#define NULLSOFT_CONFIG_H_
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#define BUFF_SIZE 8192
+
+class ConfigW
+{
+public:
+ ConfigW();
+ ConfigW(const wchar_t *ini, const wchar_t *section);
+ ~ConfigW();
+
+public:
+ void Flush(void);
+
+ BOOL Write(const wchar_t *name, double value);
+ BOOL Write(const wchar_t *section, const wchar_t *name, double value);
+ BOOL Write(const wchar_t *name, long long value);
+ BOOL Write(const wchar_t *section, const wchar_t *name, long long value);
+ BOOL Write(const wchar_t *name, int value);
+ BOOL Write(const wchar_t *section, const wchar_t *name, int value);
+ BOOL Write(const wchar_t *name, const wchar_t *value);
+ BOOL Write(const wchar_t *section, const wchar_t *name, const wchar_t *value);
+ BOOL Write(const wchar_t *name, const char value);
+ BOOL Write(const wchar_t *section, const wchar_t *name, const char *value);
+
+ int ReadInt(const wchar_t *name, int defvalue);
+ long long ReadInt64(const wchar_t *name, long long defvalue);
+ double ReadDouble(const wchar_t *name, double defvalue);
+ const char* ReadStringA(const wchar_t *name, const char *defvalue);
+ const wchar_t* ReadStringW(const wchar_t *name, const wchar_t *defvalue);
+ int ReadInt(const wchar_t *section, const wchar_t *name, int defvalue);
+ long long ReadInt64(const wchar_t *section, const wchar_t *name, long long defvalue);
+ double ReadDouble(const wchar_t *section, const wchar_t *name, double defvalue);
+ const char* ReadStringA(const wchar_t *section, const wchar_t *name, const char *defvalue);
+ const wchar_t* ReadStringW(const wchar_t *section, const wchar_t *name, const wchar_t *defvalue);
+
+ BOOL SetSection(const wchar_t *section);
+ BOOL SetIniFile(const wchar_t *file);
+ BOOL IsFileExist(void);
+
+ const wchar_t* GetSection(void);
+ const wchar_t* GetFile(void);
+private:
+ HANDLE CreateFileHandle();
+ void CreateFileWithBOM(void);
+ void RemoveEmptyFile(void);
+private:
+ BOOL emptyBOM;
+ wchar_t buff[BUFF_SIZE];
+ char *buffA;
+ wchar_t *fileName;
+ wchar_t *defSection;
+};
+
+#endif //NULLSOFT_CONFIG_H_ \ No newline at end of file