- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面的代码在D10西雅图上编译得很好,但是我安装了D10的电脑坏了。然后我需要使用 DXE5 在我的项目中进行小更新,但无法编译,因为命令 TJSONBool.Create(False)
和 JSONObj.ToJSON
存在。
在DXE5上,什么相当于TJSONBool.Create(False)
和JSONObj.ToJSON
?
uses
Data.DBXJSON, SHFolder;
function GetSpecialFolderPath(folder : integer) : string;
const
SHGFP_TYPE_CURRENT = 0;
var
path: array [0..MAX_PATH] of char;
begin
if SUCCEEDED(SHGetFolderPath(0,folder,0,SHGFP_TYPE_CURRENT,@path[0])) then
Result := path
else
Result := '';
end;
procedure ChangeChromeSetting(const ATarget, Avalue: string);
var
specialfolder: integer;
pathchrome: String;
JSONObj, ObjIpp: TJSONObject;
JSONPair: TJSONPair;
OldValue: string;
begin
specialFolder := CSIDL_LOCAL_APPDATA;
pathchrome := GetSpecialFolderPath(specialFolder);
pathchrome := pathchrome + '\Google\Chrome\User Data\Local State';
if fileexists(pathchrome) then
begin
JSONObj := TJSONObject.ParseJSONValue(TFile.ReadAllText(pathchrome)) as TJSONObject;
if not Assigned(JSONObj) then Exit; {raise Exception.Create('Cannot read file: ' + pathchrome);}
try
OldValue := JSONObj.GetValue<string>(ATarget);
if OldValue = '' then
Exit;
if not SameText(OldValue, Avalue) then
begin
JSONPair := JSONObj.Get(ATarget);
JSONPair.JsonValue.Free;
JSONPair.JsonValue := TJSONString.Create(Avalue);
ObjIpp := TJSONObject.Create;
ObjIpp.AddPair('enabled', TJSONBool.Create(False));
JSONObj.AddPair('hardware_acceleration_mode', ObjIpp);
TFile.WriteAllText(pathchrome, JSONObj.ToJSON);
end;
finally
JSONObj.Free;
end;
end;
end;
////////////////////// USAGE /////////////////////////
ChangeChromeSetting('hardware_acceleration_mode_previous', 'false');
最佳答案
TJSONBool
和 TJSONAncestor.AsJSON
在 XE5 中尚不存在。 XE7 中添加了 ToJSON
,10.0 Seattle 中添加了 TJSONBool
。
在旧版本中,使用 TJSONTrue
/TJSONFalse
和 TJSONObject.ToString
相反:
ObjIpp.AddPair('enabled', TJSONFalse.Create);
...
TFile.WriteAllText(pathchrome, JSONObj.ToString);
关于json - D10 到 DXE5 : what's the equivalent of TJSONBool. 创建(False)和 JSONObj.ToJSON?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47745697/
我想在 onClick 时将对象添加到 JSONObj 中,并在 ListView 内的另一个 Activity 中显示为 CardView。 我尝试了一些东西,但什么也没出现,没有错误,我不知道问题
我有一个像这样的 json 对象,实际上它是动态生成的。例如,我们可以使用这个 Json 对象。 var JsonObj= { "one":1, "two":2, "three":3, "four":
我有以下 JSON 字符串: var location= JSON.parse('[{"lat":53.230379427401,"lon":6.5237550480959,"couple":"cal
我正在尝试使用以下方法将 JSON 对象转换为“普通”对象... var slaobj = eval('('+s+')'); s 是 JSON。然而,它似乎不起作用(它的“.lengt
我有一项服务返回一个包含以下对象的响应 { "features": [ { "name": "climateControl" }, { "name"
JSONObject jsonObj = {"a":"1","b":null} 案例 1:jsonObj.getString("a") 返回“1”; 案例 2:jsonObj.getString("
我正在使用找到的方法 here使用 ChartJS 输入 JSON 响应中缺少的日期。 jsonObj["result"]["data"] 是初始 JSON 响应的输出: { "action"
我正在尝试使用 ajax 通过 post 将数据传递到我的 sendjs.php。 jsonObj 不仅在 IE11 中被传递(没有测试过较低版本的 IE,但它在 Edge 和所有其他浏览器中工作)。
下面的代码在D10西雅图上编译得很好,但是我安装了D10的电脑坏了。然后我需要使用 DXE5 在我的项目中进行小更新,但无法编译,因为命令 TJSONBool.Create(False) 和 JSON
我想将 jsonObj 存储在全局变量中。然而,这不起作用。 var jsonContent; csvConverter.on("end_parsed", function(jsonObj){ //
我知道了 link但是没看懂。锯: { "@context": "http://schema.org", "@type": "WebSite", "url": "http:/
我是一名优秀的程序员,十分优秀!