AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi FastScript - dem Script ein Interface hinzufügen
Thema durchsuchen
Ansicht
Themen-Optionen

FastScript - dem Script ein Interface hinzufügen

Ein Thema von geskill · begonnen am 29. Dez 2009 · letzter Beitrag vom 31. Dez 2009
Antwort Antwort
Benutzerbild von geskill
geskill

Registriert seit: 17. Feb 2007
Ort: NRW
420 Beiträge
 
Delphi 2010 Professional
 
#1

Re: FastScript - dem Script ein Interface hinzufügen

  Alt 31. Dez 2009, 14:58
ups, da hatte ich mir wohl ein Eigentor geschossen, ein paar Zeilen später im Code hatte ich ein clear Befehl, der alle hinzugefügten Objekte wieder gelöscht hat.
Somit geht es soweit. Habe mir die Komponenten jetzt gekauft.


Falls irgendwann jemand einen Lösungsansatz braucht:
Delphi-Quellcode:
function TTemplateParser.GetProp(Instance: TObject; ClassType: TClass; const PropName: String): Variant;
begin
  Result := 0;
  if PropName = 'MIRRORCOUNTthen
    Result := IMirrorController(Instance as TMirrorController).MirrorCount
  else if PropName = 'DIRECTLINKSMIRRORCOUNTthen
    Result := IMirrorControl(Instance as TMirrorControl).DirectlinksMirrorCount
  else if PropName = 'CRYPTERCOUNTthen
    Result := IMirrorControl(Instance as TMirrorControl).CrypterCount
  else if PropName = 'NAMEthen
    Result := ICrypterPanel(Instance as TCrypterPanel).Name
  else if PropName = 'LINKthen
    Result := ICrypterPanel(Instance as TCrypterPanel).Link;
end;

function TTemplateParser.CallMethod(Instance: TObject; ClassType: TClass; const MethodName: String;
  var Params: Variant): Variant;
begin
  Result := 0;
  if MethodName = 'MIRROR.GETthen
    Result := Integer(IMirrorController(Instance as TMirrorController).Mirror[Params[0]] as TMirrorControl)
  else if MethodName = 'DIRECTLINKSMIRROR.GETthen
    Result := IMirrorControl(Instance as TMirrorControl).DirectlinksMirror[Params[0]]
  else if MethodName = 'CRYPTER.GETthen
    Result := Integer(IMirrorControl(Instance as TMirrorControl).Crypter[Params[0]] as TCrypterPanel)
end;

function TTemplateParser.Exec(s: string): string;
var
  I: Integer;
begin
  Result := '';

  with FfsScript do
  begin
    Clear;
    Lines.Text := s;
    Parent := fsGlobalUnit;

    with AddClass(TCrypterPanel, 'TCrypterPanel') do
    begin
      AddProperty('Name', 'string', GetProp, nil);
      AddProperty('Link', 'string', GetProp, nil);
    end;

    with AddClass(TMirrorControl, 'TMirrorControl') do
    begin
      AddIndexProperty('DirectlinksMirror', 'Integer', 'string', CallMethod);
      AddProperty('DirectlinksMirrorCount', 'Integer', GetProp, nil);

      AddIndexProperty('Crypter', 'Integer', 'TCrypterPanel', CallMethod);
      AddProperty('CrypterCount', 'Integer', GetProp, nil);
    end;

    with AddClass(TMirrorController, 'TMirrorController') do
    begin
      AddIndexProperty('Mirror', 'Integer', 'TMirrorControl', CallMethod);
      AddProperty('MirrorCount', 'Integer', GetProp, nil);
    end;
    AddObject('IMirrorController', FITabSheetController.MirrorController as TMirrorController);

    if Compile then
      Execute;
    else
      Error(ErrorMsg);

  end;
end;
Sebastian
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:39 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz