| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- 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;
- FMapHost: string;
- 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;
- property MapHost: string read FMapHost;
- 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'];
- Result.FMapHost := jo.S['mapHost'];
- except
- on E: Exception do
- begin
- Error(E.Message, 'TConditionConfig.Load');
- end;
- end;
- end;
- initialization
- finalization
- if config <> nil then
- FreeAndNil(config);
- end.
|