MCPcopy Create free account
hub / github.com/ChiyukiGana/Quickinput / LoadQimMacro

Function LoadQimMacro

source/src/macro.cpp:213–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211 }
212 macro.storageType = Macro::StorageType::JSON;
213 macro.name = name;
214 macro.fromJson(json.object());
215 return true;
216}
217bool LoadQimMacro(Macro& macro, const QString& path, const QString& name)
218{
219 auto data = File::FileReadAll(path.toStdWString());
220 if (data.empty())
221 {
222 MsgBox::Error(reinterpret_cast<const wchar_t*>(name.utf16()), lang_trans("加载宏失败").toStdWString());
223 return false;
224 }
225 typepack::object pack = typepack::object::fromBinary(data);
226 if (pack.empty())
227 {
228 MsgBox::Error(reinterpret_cast<const wchar_t*>(name.utf16()), lang_trans("宏数据错误").toStdWString());
229 return false;
230 }
231 macro.storageType = Macro::StorageType::QIM;
232 macro.name = name;
233 macro.fromPack(pack);
234 return true;

Callers 1

loadAllMethod · 0.85

Calls 2

ErrorEnum · 0.85
fromPackMethod · 0.45

Tested by

no test coverage detected