📄 accdata.pas
字号:
unit AccData;
interface
uses Windows, IniFiles;
type
TAccountData = class(TObject)
private
FIni: TIniFile;
function GetEMail: string;
procedure SetEMail(Value: string);
function GetServer: string;
procedure SetServer(Value: string);
function GetPort: WORD;
procedure SetPort(Value: WORD);
function GetLogin: string;
procedure SetLogin(Value: string);
function GetPassword: string;
procedure SetPassword(Value: string);
function GetSSL: boolean;
procedure SetSSL(Value: boolean);
function GetSPA: boolean;
procedure SetSPA(Value: boolean);
function GetTimeout: integer;
procedure SetTimeout(Value: integer);
public
constructor Create;
destructor Destroy; override;
published
property EMail: string read GetEMail write SetEMail;
property Server: string read GetServer write SetServer;
property Port: WORD read GetPort write SetPort;
property Login: string read GetLogin write SetLogin;
property Password: string read GetPassword write SetPassword;
property UseSSL: boolean read GetSSL write SetSSL;
property UseSPA: boolean read GetSPA write SetSPA;
property Timeout: integer read GetTimeout write SetTimeout;
end;
implementation
uses SysUtils;
constructor TAccountData.Create;
begin
inherited Create;
FIni := TIniFile.Create(ChangeFileExt(ParamStr(0), '.INI'));
end;
destructor TAccountData.Destroy;
begin
FIni.Free();
inherited Destroy();
end;
function TAccountData.GetEMail: string;
begin
Result := FIni.ReadString('User', 'EMail', 'CleverTester@company.mail');
end;
procedure TAccountData.SetEmail(Value: string);
begin
FIni.WriteString('User', 'EMail', Value);
end;
function TAccountData.GetServer: string;
begin
Result := FIni.ReadString('Server', 'Address', 'localhost');
end;
procedure TAccountData.SetServer(Value: string);
begin
FIni.WriteString('Server', 'Address', Value);
end;
function TAccountData.GetPort: WORD;
begin
Result := FIni.ReadInteger('Server', 'Port', 143);
end;
procedure TAccountData.SetPort(Value: WORD);
begin
FIni.WriteInteger('Server', 'Port', Value);
end;
function TAccountData.GetLogin: string;
begin
Result := FIni.ReadString('Server', 'Login', '');
end;
procedure TAccountData.SetLogin(Value: string);
begin
FIni.WriteString('Server', 'Login', Value);
end;
function TAccountData.GetPassword: string;
begin
Result := FIni.ReadString('Server', 'Password', '');
end;
procedure TAccountData.SetPassword(Value: string);
begin
FIni.WriteString('Server', 'Password', Value);
end;
function TAccountData.GetSSL: boolean;
begin
Result := FIni.ReadBool('Server', 'SSL', False);
end;
procedure TAccountData.SetSSL(Value: boolean);
begin
FIni.WriteBool('Server', 'SSL', Value);
end;
function TAccountData.GetSPA: boolean;
begin
Result := FIni.ReadBool('Server', 'SPA', False);
end;
procedure TAccountData.SetSPA(Value: boolean);
begin
FIni.WriteBool('Server', 'SPA', Value);
end;
function TAccountData.GetTimeout: integer;
begin
Result := FIni.ReadInteger('Server', 'Timeout', 60);
end;
procedure TAccountData.SetTimeout(Value: integer);
begin
FIni.WriteInteger('Server', 'Timeout', Value);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -