unit ConditionConfig; interface uses Classes, SysUtils; type TConditionConfig = class private FFaceSize: Int64; FUserInfoController: Boolean; FSMSName: string; FOtherServersDisable: Boolean; FNewCenterServer: Boolean; FUserInfoCheck: Boolean; FGradeSystem: Boolean; FFirstLoginConfirm: Boolean; FDev: Boolean; FRemoteUIHost: string; FRemoteUI: Boolean; public constructor Create; class function Load: TConditionConfig; class function GetConfig: TConditionConfig; property FaceSize: Int64 read FFaceSize; property UserInfoController: Boolean read FUserInfoController; property OtherServersDisable: Boolean read FOtherServersDisable; property NewCenterServer: Boolean read FNewCenterServer; property UserInfoCheck: Boolean read FUserInfoCheck; property SMSName: string read FSMSName; property GradeSystem: Boolean read FGradeSystem; property FirstLoginConfirm: Boolean read FFirstLoginConfirm; property Dev: Boolean read FDev; property RemoteUI: Boolean read FRemoteUI; property RemoteUIHost: string read FRemoteUIHost; end; implementation uses superobject, Dialogs, TypInfo, Winsock2, LoggerImport; const CONDITION_CONFIG: string = 'Config\condition.config'; var config: TConditionConfig; constructor TConditionConfig.Create; begin FFaceSize := 20;//µ¥Î»M end; class function TConditionConfig.GetConfig: TConditionConfig; begin if config <> nil then Result := config else Result := TConditionConfig.Load; end; class function TConditionConfig.Load: TConditionConfig; var AFullFileName: string; jo, AServer: ISuperObject; AGroupServerAddresses: TSuperArray; iLoop: Integer; begin if config <> nil then FreeAndNil(config); config := TConditionConfig.Create; Result := config; AFullFileName := ExtractFilePath(ParamStr(0)) + CONDITION_CONFIG; if not FileExists(AFullFileName) then Exit; try jo := TSuperObject.ParseFile(AFullFileName, False); if jo.O['faceSize'] <> nil then Result.FFaceSize := jo['faceSize'].AsInteger; Result.FUserInfoController := jo.B['userInfoController']; Result.FOtherServersDisable := jo.B['otherServersDisable']; Result.FNewCenterServer := jo.B['newCenterServer']; Result.FSMSName := jo.S['smsName']; Result.FUserInfoCheck := jo.B['userInfoCheck']; Result.FGradeSystem := jo.B['grade']; Result.FFirstLoginConfirm := jo.B['firstLoginConfirm']; Result.FDev := jo.B['dev']; Result.FRemoteUI := jo.B['remoteUI']; Result.FRemoteUIHost := jo.S['remoteUIHost']; except on E: Exception do begin Error(E.Message, 'TConditionConfig.Load'); end; end; end; initialization finalization if config <> nil then FreeAndNil(config); end.