NetConfig.pas 912 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. unit NetConfig;
  2. interface
  3. uses
  4. BaseConfig, InterfaceConfig;
  5. type
  6. TNetConfig = class(TBaseConfig, INetConfig)
  7. private
  8. public
  9. function GetIP: string;
  10. function GetPort: Integer;
  11. procedure SetIP(const Value: string);
  12. procedure SetPort(const Value: Integer);
  13. constructor Create(); override;
  14. property IP: string read GetIP write SetIP;
  15. property Port: Integer read GetPort write SetPort;
  16. end;
  17. implementation
  18. { TNetConfig }
  19. constructor TNetConfig.Create;
  20. begin
  21. ConfigType := ctPublic;
  22. FileName := 'net.json';
  23. inherited;
  24. end;
  25. function TNetConfig.GetIP: string;
  26. begin
  27. Result := Data.S['ip'];
  28. end;
  29. function TNetConfig.GetPort: Integer;
  30. begin
  31. Result := Data.I['port'];
  32. end;
  33. procedure TNetConfig.SetIP(const Value: string);
  34. begin
  35. Data.S['ip'] := Value;
  36. end;
  37. procedure TNetConfig.SetPort(const Value: Integer);
  38. begin
  39. Data.I['port'] := Value;
  40. end;
  41. end.