Einzelnen Beitrag anzeigen

ScharfeMietze

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

AW: Gehen strings als Eigenschaftsnamen? Wenn ja wie?

  Alt 7. Okt 2018, 13:49
Delphi-Quellcode:
            if (Ljtr.TokenType = TJsonToken.String) then
              begin
              if (LowerCase(Ljtr.Path) = 'groupoptions.chatid') then LBotOptions.chatid:= Ljtr.Value.ToString
              else
              if (LowerCase(Ljtr.Path) = 'groupoptions.antispammessage') then LBotOptions.AntiSpamMessage:= Ljtr.Value.ToString
              else
              if (LowerCase(Ljtr.Path) = 'groupoptions.creator') then LBotOptions.Creator:= Ljtr.Value.ToString
              else
              if (LowerCase(Ljtr.Path) = 'groupoptions.blacklist') then LBotOptions.blacklist:= Ljtr.Value.ToString
              else
              if (LowerCase(Ljtr.Path) = 'groupoptions.whitelist') then LBotOptions.whitelist:= Ljtr.Value.ToString
              else
              if (LowerCase(Ljtr.Path) = 'groupoptions.welcomemessage') then LBotOptions.welcomemessage:= Ljtr.Value.ToString
              end
........
Wir sind ja fast da wo ich hin will! Also müsste doch der Part oben durch diesen ersetzbar sein oder? ( ja ich habe den Code seit dem Erstellpost aufgrund der Antwort schon begonnen umzustellen)
Delphi-Quellcode:
            if (Ljtr.TokenType = TJsonToken.String) then
              begin
                SetStrProp(LBotOptions,LowerCase(Ljtr.Path),Ljtr.Value.ToString)
              end;

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