-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreference.h
73 lines (56 loc) · 1.94 KB
/
Preference.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Copyright (c) 2015-2021 hkrn All rights reserved
This file is part of emapp component and it's licensed under Mozilla Public License. see LICENSE.md for more details.
*/
#pragma once
#ifndef NANOEM_EMAPP_WIN32_PREFERENCE_H_
#define NANOEM_EMAPP_WIN32_PREFERENCE_H_
#include "emapp/Forward.h"
#include "emapp/ApplicationPreference.h"
#include "nanoem/ext/parson/parson.h"
#include <wincrypt.h>
struct ini_t;
namespace nanoem {
class ThreadedApplicationService;
namespace win32 {
class Preference final {
public:
Preference(ThreadedApplicationService *service, JSON_Value *config);
~Preference();
void synchronize();
void load();
void save();
const ApplicationPreference *applicationPreference() const noexcept;
const char *uuidConstString() const noexcept;
uint32_t vendorId() const noexcept;
uint32_t deviceId() const noexcept;
uint32_t preferredEditingFPS() const noexcept;
private:
struct RandomGenerator {
RandomGenerator();
~RandomGenerator();
uint32_t gen();
HCRYPTPROV m_crypt = 0;
};
void fillLoadedParameters();
void getEffectPluginPath();
void remove(int sectionIndex, const char *key);
bool get(int sectionIndex, const char *key, bool def);
const char *get(int sectionIndex, const char *key, const char *def);
uint32_t get(int sectionIndex, const char *key, uint32_t value);
void set(int sectionIndex, const char *key, const char *value);
void set(int sectionIndex, const char *key, uint32_t value);
void set(int sectionIndex, const char *key, bool value);
ThreadedApplicationService *m_service;
JSON_Value *m_config;
ApplicationPreference m_preference;
String m_renderer;
uint32_t m_vendorId = 0;
uint32_t m_deviceId = 0;
uint32_t m_preferredEditingFPS = 0;
String m_uuid;
ini_t *m_ini = nullptr;
};
} /* namespace win32 */
} /* namespace nanoem */
#endif /* NANOEM_EMAPP_WIN32_PREFERENCE_H_ */