Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: So 09.02.03 11:52 
Hallo,

Wer kennt shareit.de nicht.
Shareit.de stellt eine Programmierplattform da wo jeder einen Keygenerstor basteln kann.
In verschiedensten Sprachen und auch in Delphi.
Nur leider kann ich den Sinn nicht finden?
Also die Hilfe ist zu knap geschrieben.
Wie wende ich den an wenn ich ein Edit1.Text für den Namen und Edit2.Text für den Key habe?

Danke...

KeyIntf.pas
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
unit KeyIntf;
{
  element 5 AG / ShareIt!
  key generator interface
  version 2.5

  DO NOT MODIFY THIS FILE!
}

interface

uses
  Windows, SysUtils, Classes;

const // error result codes supported by element 5
  ERC_SUCCESS = 0;
  ERC_SUCCESS_BIN = 1;
  ERC_ERROR = 10;
  ERC_MEMORY = 11;
  ERC_FILE_IO = 12;
  ERC_BAD_ARGS = 13;
  ERC_BAD_INPUT = 14;
  ERC_EXPIRED = 15;
  ERC_INTERNAL = 16;

// use this function to get the value of input parameters
function Value(key: string): string;

// main entry point
procedure Main;

var
  gList: TStrings; // holds input parameters

implementation

uses
  KeyUser;

// use this function to get the value of input parameters
function Value(key: string): string;
begin
  try
    result := gList.Values[key];
  except
    result := '';
  end;
end;

// write a string to the given filename
procedure WriteFile(filename, value: string);
var
  fout: TextFile;
begin
  if (filename = '') or (value = '') then exit; // happens only when writing exception file

  // write output data
  AssignFile(fout, filename);
{$I-}
  Rewrite(fout);
  Write(fout, value);
  CloseFile(fout);
{$I+}
  if IOResult <> 0 then
    raise Exception.Create('i/o error on write');
end;

// main function ** DO NOT CHANGE **
procedure Generate;
var
  userkey, cckey: string;
begin
  // check parameter count
  if (ParamCount <> 3) then begin
    ExitCode := ERC_BAD_INPUT;
    raise Exception.Create('bad args: ' + IntToStr(ParamCount));
  end;

  // see if input file supplied
  if not FileExists(ParamStr(1)) then begin
    ExitCode := ERC_FILE_IO;
    raise Exception.Create('file not found: ' + ParamStr(1));
  end;

  // load input values
  gList.LoadFromFile(ParamStr(1));

  // call key generator
  userkey := '';
  cckey := '';
  ExitCode := GenerateKey(userkey, cckey);

  // write output if successful
  WriteFile(ParamStr(2), userkey);
  WriteFile(ParamStr(3), cckey);
end;

procedure Main;
begin
  writeln(Title);
  gList := TStringList.Create;
  try
    Generate;

  except
    on E: Exception do begin
      // update exit code only if it does not yet report an error
      if ExitCode < ERC_ERROR then ExitCode := ERC_INTERNAL;
      writeln(E.Message);

      try // to write error to first output file
        WriteFile(ParamStr(2), 'ERROR: ' + E.Message);
      except // print to console
        on E: Exception do writeln(E.Message);
      end;
    end;
  end;

  gList.Free;
end;

end.


KeyUser.pas
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
unit KeyUser;
{
  element 5 AG / ShareIt!
  key generator interface
  version 2.5

  IMPLEMENT YOUR CODE HERE!
}

interface

// key generator title
const Title = 'Delphi Key Generator Example';

function GenerateKey(var userkey, cckey: string): integer;

implementation

uses
  KeyIntf, SysUtils;

// implement your key generator here
function GenerateKey(var userkey, cckey: string): integer;
var                          
  name, a1: string; // input data
  d: double;
begin
  result := ERC_INTERNAL;
  name := Value('REG_NAME');
  a1 := Value('EMAIL');

  if (name <> '') and (a1 <> '') then begin
    d := 2365; // StrToInt('0'); cause exception
    cckey := name + '-' + a1 + FloatToStr(d);
    userkey := 'Your key is: ' + cckey;
    result := ERC_SUCCESS;
  end;
end;

end.


Danke...
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: So 09.02.03 16:07 
Hi Biarchiv,

wo hast Du denn diesen Code her ? Ich bräuchte den nämlich auch. Gibt es da eine Download URL zu ? Ich habe den nicht gefunden bei Shareit.de.
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: So 09.02.03 19:02 
Hallo,

Ich glaube du must einen Account habe um ihn zu bekommen.

Kann ihn dir zumailen wenn du willst.
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Mo 10.02.03 02:39 
Einen Account habe ich schon seit längerem.
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Mo 10.02.03 11:26 
Du hast Post.

Ich findes es selber nicht mehr an.
Ist glaub wo bei den Texten dabei.