private void Init() { lock (_locker) { if (!_isInited) { string json = SpecialPath.ReadGpuProfilesJsonFile(); if (!string.IsNullOrEmpty(json)) { try { GpuProfilesJsonDb data = VirtualRoot.JsonSerializer.Deserialize <GpuProfilesJsonDb>(json); _data = data; } catch (Exception e) { Logger.ErrorDebugLine(e.Message, e); } } else { _data = NewJsonDb(); Save(); } _isInited = true; } } }
private void Init() { lock (_locker) { if (!_isInited) { string json = SpecialPath.ReadGpuProfilesJsonFile(); if (!string.IsNullOrEmpty(json)) { // 反序列化不报异常,但如果格式不正确返回值可能为null GpuProfilesJsonDb data = VirtualRoot.JsonSerializer.Deserialize <GpuProfilesJsonDb>(json); if (data != null) { _data = data; } else { Save(); } } else { Save(); } _isInited = true; } } }
public string GetGpuProfilesJson() { try { return(SpecialPath.ReadGpuProfilesJsonFile()); } catch (Exception e) { Logger.ErrorDebugLine(e); return(string.Empty); } }