Einzelnen Beitrag anzeigen

ScharfeMietze

Registriert seit: 5. Mär 2014
165 Beiträge
 
Delphi 10.2 Tokyo Architect
 
#14

AW: Gehen strings als Eigenschaftsnamen? Wenn ja wie?

  Alt 7. Okt 2018, 15:00
Delphi-Quellcode:
  TBotOptions = class
  private
    FChatID: string;
    FRestrictNewUser: Boolean;
    Fcan_send_other_messages: Boolean;
    Fcan_send_messages: Boolean;
    Fcan_add_web_page_previews: Boolean;
    Fcan_send_media_messages: Boolean;
    FAntiSpamMessage: string;
    FDeleteSpam: Boolean;
    FCreator: string;
    Fwhitelist: string;
    Fblacklist: string;
    Frestrict_time: Integer;
    Fwelcomemessage: string;
    FStart: Boolean;

    procedure Set_ChatID(const Value: string);
    procedure Set_AntiSpamMessage(const Value: string);
    procedure Set_can_add_web_page_previews(const Value: Boolean);
    procedure Set_can_send_media_messages(const Value: Boolean);
    procedure Set_can_send_messages(const Value: Boolean);
    procedure Set_can_send_other_messages(const Value: Boolean);
    procedure Set_DeleteSpam(const Value: Boolean);
    procedure Set_RestrictNewUser(const Value: Boolean);
    procedure Set_Creator(const Value: string);
    procedure Set_blacklist(const Value: string);
    procedure Set_whitelist(const Value: string);
    procedure Set_restrict_time(const Value: Integer);
    procedure Set_welcomemessage(const Value: string);
    procedure Set_Fstart(const Value: Boolean);

    { private declarations }
  protected
    { protected declarations }
  public
    property chatid:string read FChatID write Set_ChatID;
    property deletespam:Boolean read FDeleteSpam write Set_DeleteSpam;
    property restrictnewuser:Boolean read FRestrictNewUser write Set_RestrictNewUser;
    property antispammessage:string read FAntiSpamMessage write Set_AntiSpamMessage;
    property can_send_messages:Boolean read Fcan_send_messages write Set_can_send_messages;
    property can_send_media_messages:Boolean read Fcan_send_media_messages write Set_can_send_media_messages;
    property can_send_other_messages:Boolean read Fcan_send_other_messages write Set_can_send_other_messages;
    property can_add_web_page_previews:Boolean read Fcan_add_web_page_previews write Set_can_add_web_page_previews;
    property creator:string read FCreator write Set_Creator;
    property blacklist:string read Fblacklist write Set_blacklist;
    property whitelist:string read Fwhitelist write Set_whitelist;
    property restrict_time:Integer read Frestrict_time write Set_restrict_time;
    property welcomemessage: string read Fwelcomemessage write Set_welcomemessage;
    property start :Boolean read FStart write Set_Fstart;
    { public declarations }


  end;
Ist die aktuelle class ...

und das Json
Code:
  "groupoptions": {
    "ChatID": "-xxxxxx",
    "DeleteSpam": true,
    "RestrictNewUser": true,
    "AntiSpamMessage": "SpamPost",
    "can_send_messages": true,
    "can_send_media_messages": false,
    "can_send_other_messages": false,
    "can_add_web_page_previews": false,
    "Creator": "blablub",
    "blacklist": "blablub",
    "whitelist": "",
    "restrict_time": 15,
    "welcomemessage": "",
    "start": true
  },
Wegen dem Case insensitive LowerCase ich es ja vorher runter ......

Ps: http://docwiki.embarcadero.com/CodeE...RTL.JSONReader ist die komponente die mir das Json ließt....

Geändert von ScharfeMietze ( 7. Okt 2018 um 15:24 Uhr)
  Mit Zitat antworten Zitat