| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- unit GroupConfig;
- interface
- uses
- BaseConfig, InterfaceConfig, TypInfo;
- type
- TGroupConfig = class(TBaseConfig, IGroupConfig)
- private
- public
- constructor Create(); override;
- function GetGatewayEnable: Boolean;
- function GetImageHost: string;
- function GetSocketHost: string;
- function GetGroupVersion: TGroupVersion;
- function GetGatewayHost: string;
- property SocketHost: string read GetSocketHost;
- property ImageHost: string read GetImageHost;
- property GatewayHost: string read GetGatewayHost;
- property Version: TGroupVersion read GetGroupVersion;
- property GatewayEnable: Boolean read GetGatewayEnable;
- end;
- implementation
- { TGroupConfig }
- constructor TGroupConfig.Create;
- begin
- ConfigType := ctPublic;
- FileName := 'group.json';
- inherited;
- end;
- function TGroupConfig.GetGatewayEnable: Boolean;
- begin
- if GetGroupVersion <> gvIndependent then
- Result := False;
- Result := Data.B['gatewayEnable'];
- end;
- function TGroupConfig.GetGatewayHost: string;
- begin
- if GetGroupVersion <> gvIndependent then
- Result := '';
- Result := Data.S['gatewayHost'];
- end;
- function TGroupConfig.GetGroupVersion: TGroupVersion;
- begin
- Result := TGroupVersion(GetEnumValue(TypeInfo(TGroupVersion), Data.S['version']));
- end;
- function TGroupConfig.GetImageHost: string;
- begin
- if GetGroupVersion <> gvIndependent then
- Result := '';
- Result := Data.S['imageHost'];
- end;
- function TGroupConfig.GetSocketHost: string;
- begin
- if GetGroupVersion <> gvIndependent then
- Result := '';
- Result := Data.S['socketHost'];
- end;
- end.
|