MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / Load

Method Load

WinArk/EventConfiguration.cpp:56–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56bool EventsConfiguration::Load(PCWSTR path, bool clean) {
57 IniFile file(path);
58 if (clean)
59 _categories.clear();
60
61 auto data = file.ReadSection(L"Events");
62 for (auto& cat : data) {
63 auto equal = cat.Find(L'=');
64 ATLASSERT(equal >= 0);
65 if (equal < 0)
66 return false;
67 EventConfigCategory category;
68 category.Name = cat.Left(equal);
69 auto events = cat.Mid(equal + 1);
70 if (!events.IsEmpty()) {
71 int start = 0;
72 for (;;) {
73 auto id = events.Tokenize(L",", start);
74 if (id.IsEmpty())
75 break;
76 category.Opcodes.push_back(_wtoi(id));
77 }
78 }
79 _categories.push_back(category);
80 }
81 return true;
82}
83
84bool EventConfigCategory::Contains(int opcode) const {
85 return std::find(Opcodes.begin(), Opcodes.end(), opcode) != Opcodes.end();

Callers

nothing calls this directly

Calls 5

clearMethod · 0.80
ReadSectionMethod · 0.80
FindMethod · 0.80
IsEmptyMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected