unit CAConfig; interface uses superobject, Classes, SysUtils, mybean.core.objects, InterfaceCA; type TCAConfig = class(TMyBeanInterfacedObject, ICAConfig) private FURL: string; FAppID: string; FEnable: Boolean; FCASubject: string; // FIsChooseCa: Boolean; public procedure Load; function GetAppID: string; stdcall; function GetEnable: Boolean; stdcall; function GetURL: string; stdcall; function GetCASubject: string; stdcall; // function GetIsChooseCa: Boolean; stdcall; // procedure SetIsChooseCa(AValue: Boolean); stdcall; constructor Create(); override; property URL: string read GetURL; property AppID: string read GetAppID; property Enable: Boolean read GetEnable; end; implementation uses DataProviderImport, InterfaceDataProvider; { TCAConfig } const CONFIG_FILE: string = 'Config\ca.config'; constructor TCAConfig.Create; begin inherited; Load; end; function TCAConfig.GetAppID: string; begin Result := FAppID; end; function TCAConfig.GetCASubject: string; begin Result := FCASubject; end; function TCAConfig.GetEnable: Boolean; begin Result := FEnable; end; //function TCAConfig.GetIsChooseCa: Boolean; //begin // Result := FIsChooseCa; //end; function TCAConfig.GetURL: string; begin Result := FURL; end; procedure TCAConfig.Load; var AFullFileName: string; jo, AServer: ISuperObject; AGroupServerAddresses: TSuperArray; iLoop: Integer; CAUIConfig: string; begin AFullFileName := ExtractFilePath(ParamStr(0)) + CONFIG_FILE; if not FileExists(AFullFileName) then Exit; jo := TSuperObject.ParseFile(AFullFileName, False); if jo = nil then Exit; FURL := jo.S['url']; FAppID := jo.S['appid']; FEnable := jo.B['enable']; FCASubject := jo.S['casubject']; // jo := nil; // CAUIConfig := GetConfigProvider.Find(WideString('caui_v1_0')); // if (CAUIConfig = '') or (SO(CAUIConfig) = nil)then // begin // jo := SO('{}'); // jo.B['isChooseCa'] := false; // GetConfigProvider.Insert('caui_v1_0', jo.AsJSon()); // end // else // jo := SO(CAUIConfig); // // FIsChooseCa := jo.B['isChooseCa']; end; //procedure TCAConfig.SetIsChooseCa(AValue: Boolean); //var // jo: ISuperObject; // // CAUIConfig: string; //begin // if FIsChooseCa = Avalue then // Exit; // FIsChooseCa := AValue; // // CAUIConfig := GetConfigProvider.Find(WideString('caui_v1_0')); // jo := SO(CAUIConfig); // if (CAUIConfig = '') or (SO(CAUIConfig) = nil)then // jo := SO('{}') // else // jo := SO(CAUIConfig); // jo.B['isChooseCa'] := FIsChooseCa; // GetConfigProvider.Insert(WideString('caui_v1_0'), WideString(jo.AsJSon())); //end; end.