2010-09-26 14:30:53 -04:00
|
|
|
program Paster;
|
2010-10-13 00:29:01 -04:00
|
|
|
//{$DEFINE DEV}
|
2010-10-04 05:06:49 -04:00
|
|
|
const
|
2010-10-06 14:39:45 -04:00
|
|
|
HOSTDef = 'paste.villavu.com';
|
2010-10-04 05:06:49 -04:00
|
|
|
|
|
|
|
function GetName: string;
|
|
|
|
begin;
|
|
|
|
Result := 'Paster';
|
|
|
|
end;
|
|
|
|
|
|
|
|
function GetVersion: string;
|
|
|
|
begin;
|
2011-05-03 01:10:49 -04:00
|
|
|
Result := '0.5';
|
2010-10-04 05:06:49 -04:00
|
|
|
end;
|
|
|
|
|
2010-09-29 06:07:55 -04:00
|
|
|
{$IFDEF EXTENSION}
|
2010-10-04 05:06:49 -04:00
|
|
|
|
2010-09-26 14:30:53 -04:00
|
|
|
var
|
2010-10-04 05:06:49 -04:00
|
|
|
Paster_Menu, GetPaste_MenuItem, Private_MenuItem,
|
2011-05-03 01:10:49 -04:00
|
|
|
Browser_MenuItem, AltHost_Menu: TMenuItem;
|
|
|
|
Paster_MenuItems, Divider_MenuItems: array[1..2] of TMenuItem;
|
2010-09-26 16:44:04 -04:00
|
|
|
AltHost_Menus: array[1..5] of TMenuItem;
|
2011-05-03 01:10:49 -04:00
|
|
|
AltHost_MenuItems: array[1..5] of array[1..6] of TMenuItem;
|
2010-09-26 14:30:53 -04:00
|
|
|
|
2010-09-26 16:44:04 -04:00
|
|
|
function EncodeString(Data: string): string;
|
2010-09-26 14:30:53 -04:00
|
|
|
var
|
|
|
|
Pattern, Replacement: TStringArray;
|
|
|
|
I: integer;
|
|
|
|
begin
|
|
|
|
Pattern := ['\', #8, #9, #10, #11, #12, #13, '"', {#39,} '/'];
|
|
|
|
Replacement := ['\\', '\b', '\t', '\n', '\v', '\f', '\r', '\"', {'\'#39,} '\/'];
|
2010-09-26 16:44:04 -04:00
|
|
|
Result := Data;
|
2010-09-26 14:30:53 -04:00
|
|
|
if (Length(Pattern) = Length(Replacement)) then
|
2010-09-26 16:44:04 -04:00
|
|
|
for I := Low(Pattern) to High(Pattern) do
|
2010-09-26 14:30:53 -04:00
|
|
|
Result := Replace(Result, Pattern[I], Replacement[I], [rfIgnoreCase, rfReplaceAll]);
|
|
|
|
end;
|
|
|
|
|
2010-09-29 06:07:55 -04:00
|
|
|
function JSONRequest(var Data: string; const HOST, Method: string): boolean;
|
|
|
|
begin
|
2010-10-10 21:10:45 -04:00
|
|
|
{$IFDEF DEV}WriteLn('JSONRequest('#39 + Data + #39', '#39 + HOST + #39', '#39 + Method + #39');');{$ENDIF}
|
2010-09-29 06:07:55 -04:00
|
|
|
Data := GetPageEx('http://' + HOST + '/json/?method=' + Method, Data, 'application/json');
|
|
|
|
{$IFDEF DEV}WriteLn('Data := '#39 + Data + #39';');{$ENDIF}
|
|
|
|
if (Data = '') then
|
|
|
|
begin
|
|
|
|
Data := '{"data": null, "error": "Server unresponsive!"}';
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2010-10-17 19:02:40 -04:00
|
|
|
if (not ((Data[1] = '{') and (Data[Length(Data) - 1] = '}'))) then
|
2010-10-17 14:18:41 -04:00
|
|
|
begin
|
|
|
|
Data := '{"data": null, "error": "Host \"' + HOST + '\" is not a LodgeIt Server!"}';
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2010-09-29 06:07:55 -04:00
|
|
|
if (Method = 'pastes.getPaste') then
|
|
|
|
begin
|
|
|
|
//Little hack for getPaste too work....
|
|
|
|
Data := Replace(Data, '{"data": {', '{', []);
|
|
|
|
Data := Replace(Data, '}, "error": ', ', "error": ', []);
|
|
|
|
end;
|
|
|
|
|
|
|
|
Result := True;
|
|
|
|
end;
|
|
|
|
|
|
|
|
function GetPaste(HOST: string): boolean;
|
2010-09-26 14:30:53 -04:00
|
|
|
var
|
2010-09-29 06:07:55 -04:00
|
|
|
Data: string;
|
2010-09-26 14:30:53 -04:00
|
|
|
begin
|
2010-09-26 16:44:04 -04:00
|
|
|
if (HOST = '') then
|
2010-10-04 05:06:49 -04:00
|
|
|
HOST := HOSTDef;
|
2010-10-16 08:21:49 -04:00
|
|
|
if (InputQuery(GetName + ' ' + GetVersion + ' Extension', 'Which ID would you like to grab?', Data)) then
|
2010-09-26 14:30:53 -04:00
|
|
|
begin
|
2010-09-29 06:07:55 -04:00
|
|
|
if IntToStr(StrToInt(Data)) = Data then
|
|
|
|
Data := '{"paste_id": ' + Data + '}'
|
|
|
|
else
|
|
|
|
Data := '{"paste_id": "' + Data + '"}';
|
|
|
|
|
|
|
|
if (not (JSONRequest(Data, HOST, 'pastes.getPaste'))) then
|
2010-09-26 16:44:04 -04:00
|
|
|
begin
|
2010-09-29 06:07:55 -04:00
|
|
|
WriteLn('[Paster]Error: ' + GetJSONValue(Data, 'error'));
|
2010-09-26 16:44:04 -04:00
|
|
|
Result := False;
|
2010-09-29 06:07:55 -04:00
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2010-10-01 09:48:24 -04:00
|
|
|
if ((GetJSONValue(Data, 'data') = 'null') and (GetJSONValue(Data, 'error') = 'null')) then
|
2010-09-26 16:44:04 -04:00
|
|
|
begin
|
2010-09-29 06:07:55 -04:00
|
|
|
WriteLn('[Paster]Error: Invalid Paste ID!');
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
2010-09-26 16:44:04 -04:00
|
|
|
end;
|
2010-09-29 06:07:55 -04:00
|
|
|
|
2010-10-01 09:48:24 -04:00
|
|
|
WriteLn('Opening Paste #' + GetJSONValue(Data, 'paste_id') + ' in a new tab!');
|
2010-12-25 04:01:47 -05:00
|
|
|
OpenScript('Paste #' + GetJSONValue(Data, 'paste_id'), GetJSONValue(Data, 'code'), False);
|
2010-09-29 06:07:55 -04:00
|
|
|
Result := True;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2011-05-03 01:10:49 -04:00
|
|
|
function PasteIt(out Data: string; HOST, S: string): boolean;
|
2011-01-12 21:04:54 -05:00
|
|
|
var
|
|
|
|
ScriptTextEx: string;
|
2010-09-29 06:07:55 -04:00
|
|
|
begin
|
|
|
|
if (MessageDlg(GetName + ' ' + GetVersion + ' Extension', 'Upload this script to ' + HOST + '?', mtConfirmation, [mbYes, mbNo], 0) = mrYes) then
|
|
|
|
begin
|
2011-05-03 01:10:49 -04:00
|
|
|
ScriptTextEx := S;
|
2011-01-12 21:04:54 -05:00
|
|
|
|
|
|
|
if (ExecRegExpr('([N|n][A|a][M|m][E|e]|[P|p][A|a][S|s]{2}|[P|p][I|i][N|n])', ScriptTextEx)) then
|
|
|
|
if (MessageDlg(GetName + ' ' + GetVersion + ' Extension', 'Would you like to mask sensitive data?', mtConfirmation, [mbYes, mbNo], 0) = mrYes) then
|
|
|
|
ScriptTextEx := ReplaceRegExpr('([N|n][A|a][M|m][E|e]|[P|p][A|a][S|s]{2}|[P|p][I|i][N|n])\s*\:\=\s*\''.*?\'';', ScriptTextEx, '$1 := ''*********'';', True);
|
|
|
|
|
|
|
|
Data := '{"language": "delphi", "code": "' + EncodeString(ScriptTextEx) + '", "private": ' + Lowercase(BoolToStr(Private_MenuItem.Checked)) + '}';
|
2010-09-29 06:07:55 -04:00
|
|
|
JSONRequest(Data, HOST, 'pastes.newPaste');
|
|
|
|
if (GetJSONValue(Data, 'error') = 'null') then
|
|
|
|
begin
|
2010-09-30 08:50:04 -04:00
|
|
|
Data := GetJSONValue(Data, 'data');
|
2010-09-29 06:07:55 -04:00
|
|
|
Result := True;
|
|
|
|
end else
|
|
|
|
Data := '[Paster]Error: ' + GetJSONValue(Data, 'error');
|
2010-09-26 14:30:53 -04:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2011-05-03 01:10:49 -04:00
|
|
|
procedure Paste(Host, S: string);
|
2010-09-26 14:30:53 -04:00
|
|
|
var
|
|
|
|
Data: string;
|
2010-09-26 16:44:04 -04:00
|
|
|
begin
|
2010-10-10 16:29:20 -04:00
|
|
|
if (HOST = '') then
|
|
|
|
HOST := HOSTDef;
|
2011-05-03 01:10:49 -04:00
|
|
|
|
|
|
|
if (S = '') then
|
|
|
|
begin
|
|
|
|
WriteLn('[Paster]Error: Ether your script is empty or you didn''t select any text.');
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
|
|
|
if PasteIt(Data, Host, S) then
|
2010-09-26 14:30:53 -04:00
|
|
|
begin
|
2010-09-30 08:50:04 -04:00
|
|
|
if (Browser_MenuItem.Checked) then
|
|
|
|
begin
|
|
|
|
WriteLn('Opening pasted script at "http://' + HOST + '/show/' + Data + '/"!');
|
|
|
|
OpenWebPage('http://' + HOST + '/show/' + Data + '/');
|
|
|
|
end else
|
|
|
|
WriteLn('Script pasted at id "' + Data + '"');
|
2010-09-26 14:30:53 -04:00
|
|
|
end else
|
|
|
|
WriteLn(Data);
|
|
|
|
end;
|
|
|
|
|
2010-10-10 21:10:45 -04:00
|
|
|
procedure UpdateDefault(I: integer);
|
|
|
|
var
|
|
|
|
J: integer;
|
|
|
|
begin
|
|
|
|
Settings.setKeyValue('DefaultHost', IntToStr(I));
|
|
|
|
for J := 1 to 5 do
|
|
|
|
if (J = I) then
|
2011-05-03 01:10:49 -04:00
|
|
|
AltHost_MenuItems[J][5].Checked := True
|
2010-10-10 21:10:45 -04:00
|
|
|
else
|
2011-05-03 01:10:49 -04:00
|
|
|
AltHost_MenuItems[J][5].Checked := False;
|
2010-10-10 21:10:45 -04:00
|
|
|
end;
|
|
|
|
|
2010-09-26 16:44:04 -04:00
|
|
|
procedure UpdateHost(I: integer);
|
|
|
|
var
|
|
|
|
Data: string;
|
|
|
|
begin
|
|
|
|
if InputQuery(GetName + ' ' + GetVersion + ' Extension', 'Please input the LodgeIt Host! (Ex: paste.pocoo.org)', Data) then
|
|
|
|
begin
|
2010-09-29 06:07:55 -04:00
|
|
|
{$IFDEF DEV}WriteLn('Data := '#39 + Data + #39';');{$ENDIF}
|
|
|
|
if (Data = '') then
|
2010-10-01 09:48:24 -04:00
|
|
|
if (AltHost_Menus[I].Caption = 'Host ' + IntToStr(I)) then
|
|
|
|
begin
|
|
|
|
WriteLn('[Paster]Error: The host cannot be blank!');
|
|
|
|
Exit;
|
|
|
|
end else
|
|
|
|
begin
|
|
|
|
AltHost_Menus[I].Caption := 'Host ' + IntToStr(I);
|
|
|
|
AltHost_MenuItems[I][1].Enabled := False;
|
|
|
|
AltHost_MenuItems[I][2].Enabled := False;
|
2011-05-03 01:10:49 -04:00
|
|
|
AltHost_MenuItems[I][3].Enabled := False;
|
|
|
|
AltHost_MenuItems[I][5].Enabled := False;
|
2010-10-01 09:48:24 -04:00
|
|
|
Settings.setKeyValue('Host' + IntToStr(I), 'Host ' + IntToStr(I));
|
2010-10-10 21:10:45 -04:00
|
|
|
if (Settings.getKeyValueDef('DefaultHost', '1') = IntToStr(I)) then
|
|
|
|
UpdateDefault(1);
|
2010-10-01 09:48:24 -04:00
|
|
|
Exit;
|
|
|
|
end;
|
2010-09-26 16:44:04 -04:00
|
|
|
AltHost_Menus[I].Caption := Data;
|
|
|
|
AltHost_MenuItems[I][1].Enabled := True;
|
2010-09-29 06:07:55 -04:00
|
|
|
AltHost_MenuItems[I][2].Enabled := True;
|
2011-05-03 01:10:49 -04:00
|
|
|
AltHost_MenuItems[I][3].Enabled := True;
|
|
|
|
AltHost_MenuItems[I][5].Enabled := True;
|
2010-09-26 16:44:04 -04:00
|
|
|
Settings.setKeyValue('Host' + IntToStr(I), Data);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure OnClick(Sender: TObject);
|
|
|
|
var
|
2010-09-29 06:07:55 -04:00
|
|
|
I, K: integer;
|
2010-09-26 14:30:53 -04:00
|
|
|
begin;
|
2010-10-10 16:29:20 -04:00
|
|
|
{$IFDEF DEV}
|
|
|
|
if (Sender is TMenuItem) then
|
|
|
|
WriteLn('Sender is '#39 + TMenuItem(Sender).Name + #39'.'); //(Sender as TMenuItem).Name
|
|
|
|
{$ENDIF}
|
2010-09-26 16:44:04 -04:00
|
|
|
case Sender of
|
2011-05-03 01:10:49 -04:00
|
|
|
Paster_MenuItems[1]: Paste(Settings.getKeyValue('Host' + Settings.getKeyValueDef('DefaultHost', '1')), ScriptText);
|
|
|
|
Paster_MenuItems[2]: Paste(Settings.getKeyValue('Host' + Settings.getKeyValueDef('DefaultHost', '1')), GetSelectedText);
|
|
|
|
|
2010-10-10 21:10:45 -04:00
|
|
|
GetPaste_MenuItem: GetPaste(Settings.getKeyValue('Host' + Settings.getKeyValueDef('DefaultHost', '1')));
|
2011-05-03 01:10:49 -04:00
|
|
|
|
2010-09-26 16:44:04 -04:00
|
|
|
Private_MenuItem: begin
|
2010-10-10 16:29:20 -04:00
|
|
|
Private_MenuItem.Checked := (not (Private_MenuItem.Checked));
|
|
|
|
Settings.setKeyValue('Private', Lowercase(BoolToStr(Private_MenuItem.Checked)));
|
|
|
|
{$IFDEF DEV}WriteLn('Private = ' + Lowercase(BoolToStr(Private_MenuItem.Checked)));{$ENDIF}
|
|
|
|
end;
|
2010-09-30 08:50:04 -04:00
|
|
|
Browser_MenuItem: begin
|
2010-10-10 16:29:20 -04:00
|
|
|
Browser_MenuItem.Checked := (not (Browser_MenuItem.Checked));
|
|
|
|
Settings.setKeyValue('OpenBrowser', Lowercase(BoolToStr(Browser_MenuItem.Checked)));
|
|
|
|
{$IFDEF DEV}WriteLn('OpenBrowser = ' + Lowercase(BoolToStr(Browser_MenuItem.Checked)));{$ENDIF}
|
|
|
|
end;
|
2010-09-26 16:44:04 -04:00
|
|
|
end;
|
2011-05-03 01:10:49 -04:00
|
|
|
|
2010-09-29 06:07:55 -04:00
|
|
|
for I := 1 to 5 do
|
2011-05-03 01:10:49 -04:00
|
|
|
for K := 1 to 6 do
|
2010-09-29 06:07:55 -04:00
|
|
|
if (Sender = AltHost_MenuItems[I][K]) then
|
|
|
|
begin
|
2010-10-10 16:29:20 -04:00
|
|
|
case K of
|
2011-05-03 01:10:49 -04:00
|
|
|
1: Paste(Settings.getKeyValue('Host' + IntToStr(I)), ScriptText);
|
|
|
|
2: Paste(Settings.getKeyValue('Host' + IntToStr(I)), GetSelectedText);
|
|
|
|
3: GetPaste(Settings.getKeyValue('Host' + IntToStr(I)));
|
|
|
|
5: UpdateDefault(I);
|
|
|
|
6: UpdateHost(I);
|
2010-10-10 16:29:20 -04:00
|
|
|
end;
|
2010-09-29 06:07:55 -04:00
|
|
|
Break;
|
|
|
|
end;
|
2010-09-26 14:30:53 -04:00
|
|
|
end;
|
|
|
|
|
2010-09-26 16:44:04 -04:00
|
|
|
procedure Attach;
|
2010-09-26 14:30:53 -04:00
|
|
|
begin;
|
2010-10-04 05:06:49 -04:00
|
|
|
WriteLn(GetName + ' v' + GetVersion + ' by Dgby714 Loaded!');
|
2010-09-26 16:44:04 -04:00
|
|
|
Paster_Menu.Visible := True;
|
|
|
|
end;
|
|
|
|
|
2010-09-29 06:07:55 -04:00
|
|
|
procedure Detach;
|
2010-09-26 16:44:04 -04:00
|
|
|
begin
|
|
|
|
Paster_Menu.Visible := False;
|
2010-09-26 14:30:53 -04:00
|
|
|
end;
|
|
|
|
|
2010-09-29 06:07:55 -04:00
|
|
|
procedure init;
|
2010-09-26 16:44:04 -04:00
|
|
|
var
|
|
|
|
I, K: integer;
|
2010-09-26 14:30:53 -04:00
|
|
|
begin;
|
2010-09-26 16:44:04 -04:00
|
|
|
Paster_Menu := TMenuItem.Create(Simba_MainMenu);
|
|
|
|
Paster_Menu.Caption := GetName;
|
|
|
|
Simba_MainMenu.Items.Add(Paster_Menu);
|
|
|
|
|
2011-05-03 01:10:49 -04:00
|
|
|
Paster_MenuItems[1] := TMenuItem.Create(Paster_Menu);
|
|
|
|
with Paster_MenuItems[1] do
|
2010-09-26 16:44:04 -04:00
|
|
|
begin
|
2010-10-10 16:29:20 -04:00
|
|
|
Name := 'Default_Paste';
|
2010-09-26 16:44:04 -04:00
|
|
|
Caption := 'Paste It!';
|
|
|
|
OnClick := @OnClick;
|
|
|
|
end;
|
2011-05-03 01:10:49 -04:00
|
|
|
Paster_Menu.Add(Paster_MenuItems[1]);
|
|
|
|
|
|
|
|
Paster_MenuItems[2] := TMenuItem.Create(Paster_Menu);
|
|
|
|
with Paster_MenuItems[2] do
|
|
|
|
begin
|
|
|
|
Name := 'Default_PasteS';
|
|
|
|
Caption := 'Paste Selection!';
|
|
|
|
OnClick := @OnClick;
|
|
|
|
end;
|
|
|
|
Paster_Menu.Add(Paster_MenuItems[2]);
|
2010-09-29 06:07:55 -04:00
|
|
|
|
|
|
|
GetPaste_MenuItem := TMenuItem.Create(Paster_Menu);
|
|
|
|
with GetPaste_MenuItem do
|
|
|
|
begin
|
2010-10-10 16:29:20 -04:00
|
|
|
Name := 'Default_GetPaste';
|
2010-09-29 06:07:55 -04:00
|
|
|
Caption := 'Get Paste!';
|
|
|
|
OnClick := @OnClick;
|
|
|
|
end;
|
|
|
|
Paster_Menu.Add(GetPaste_MenuItem);
|
|
|
|
|
|
|
|
for I := 1 to 2 do
|
|
|
|
begin
|
|
|
|
Divider_MenuItems[I] := TMenuItem.Create(Paster_Menu);
|
|
|
|
Divider_MenuItems[I].Caption := '-';
|
|
|
|
end;
|
|
|
|
|
|
|
|
Paster_Menu.Add(Divider_MenuItems[1]);
|
|
|
|
|
2010-09-26 16:44:04 -04:00
|
|
|
Private_MenuItem := TMenuItem.Create(Paster_Menu);
|
|
|
|
with Private_MenuItem do
|
|
|
|
begin
|
2010-10-10 16:29:20 -04:00
|
|
|
Name := 'Private_Setting';
|
2010-09-26 16:44:04 -04:00
|
|
|
Caption := 'Private';
|
|
|
|
OnClick := @OnClick;
|
|
|
|
Checked := (Lowercase(Settings.getKeyValueDef('Private', 'true')) = 'true');
|
|
|
|
end;
|
|
|
|
Paster_Menu.Add(Private_MenuItem);
|
2010-09-29 06:07:55 -04:00
|
|
|
|
2010-09-30 08:50:04 -04:00
|
|
|
Browser_MenuItem := TMenuItem.Create(Paster_Menu);
|
|
|
|
with Browser_MenuItem do
|
|
|
|
begin
|
2010-10-10 16:29:20 -04:00
|
|
|
Name := 'Browser_Setting';
|
2010-09-30 08:50:04 -04:00
|
|
|
Caption := 'Open in Browser';
|
|
|
|
OnClick := @OnClick;
|
|
|
|
Checked := (Lowercase(Settings.getKeyValueDef('OpenBrowser', 'true')) = 'true');
|
|
|
|
end;
|
|
|
|
Paster_Menu.Add(Browser_MenuItem);
|
|
|
|
|
2010-09-29 06:07:55 -04:00
|
|
|
Paster_Menu.Add(Divider_MenuItems[2]);
|
2010-09-26 16:44:04 -04:00
|
|
|
|
|
|
|
AltHost_Menu := TMenuItem.Create(Paster_Menu);
|
2010-10-10 21:10:45 -04:00
|
|
|
AltHost_Menu.Caption := 'Hosts';
|
2010-09-26 16:44:04 -04:00
|
|
|
Paster_Menu.Add(AltHost_Menu);
|
|
|
|
|
|
|
|
for I := 1 to 5 do
|
|
|
|
begin
|
|
|
|
AltHost_Menus[I] := TMenuItem.Create(AltHost_Menu);
|
2010-10-10 21:10:45 -04:00
|
|
|
if (I = 1) then
|
|
|
|
AltHost_Menus[I].Caption := HOSTDef
|
|
|
|
else
|
|
|
|
AltHost_Menus[I].Caption := Settings.getKeyValueDef('Host' + IntToStr(I), 'Host ' + IntToStr(I));
|
2010-09-26 16:44:04 -04:00
|
|
|
AltHost_Menu.Add(AltHost_Menus[I]);
|
|
|
|
|
2011-05-03 01:10:49 -04:00
|
|
|
for K := 1 to 6 do
|
2010-09-26 16:44:04 -04:00
|
|
|
begin
|
|
|
|
AltHost_MenuItems[I][K] := TMenuItem.Create(AltHost_Menus[I]);
|
|
|
|
case K of
|
2010-10-10 16:29:20 -04:00
|
|
|
1: begin
|
|
|
|
AltHost_MenuItems[I][1].Name := 'Host' + IntToStr(I) + '_Paste';
|
|
|
|
AltHost_MenuItems[I][1].Caption := 'Paste It!';
|
|
|
|
end;
|
|
|
|
2: begin
|
2011-05-03 01:10:49 -04:00
|
|
|
AltHost_MenuItems[I][2].Name := 'Host' + IntToStr(I) + '_PasteS';
|
|
|
|
AltHost_MenuItems[I][2].Caption := 'Paste Selection!';
|
2010-10-10 16:29:20 -04:00
|
|
|
end;
|
2011-05-03 01:10:49 -04:00
|
|
|
3: begin
|
|
|
|
AltHost_MenuItems[I][3].Name := 'Host' + IntToStr(I) + '_GetPaste';
|
|
|
|
AltHost_MenuItems[I][3].Caption := 'Get Paste!';
|
2010-10-10 21:10:45 -04:00
|
|
|
end;
|
2011-05-03 01:10:49 -04:00
|
|
|
4: AltHost_MenuItems[I][4].Caption := '-';
|
2010-10-10 21:10:45 -04:00
|
|
|
5: begin
|
2011-05-03 01:10:49 -04:00
|
|
|
AltHost_MenuItems[I][5].Name := 'Host' + IntToStr(I) + '_Default';
|
|
|
|
AltHost_MenuItems[I][5].Caption := 'Default';
|
|
|
|
AltHost_MenuItems[I][5].Checked := (Settings.getKeyValueDef('DefaultHost', '1') = IntToStr(I));
|
|
|
|
end;
|
|
|
|
6: begin
|
|
|
|
AltHost_MenuItems[I][6].Name := 'Host' + IntToStr(I) + '_Update';
|
|
|
|
AltHost_MenuItems[I][6].Caption := 'Update Host';
|
2010-10-10 16:29:20 -04:00
|
|
|
end;
|
2010-09-26 16:44:04 -04:00
|
|
|
end;
|
|
|
|
AltHost_MenuItems[I][K].OnClick := @OnClick;
|
2011-05-03 01:10:49 -04:00
|
|
|
|
|
|
|
if ((not ((K = 4) or (K = 6))) and (AltHost_Menus[I].Caption = 'Host ' + IntToStr(I))) then
|
2010-09-29 06:07:55 -04:00
|
|
|
AltHost_MenuItems[I][K].Enabled := False;
|
2011-05-03 01:10:49 -04:00
|
|
|
|
|
|
|
if ((I = 1) and (K = 6)) then
|
2010-10-10 21:10:45 -04:00
|
|
|
AltHost_MenuItems[I][K].Visible := False;
|
2010-09-26 16:44:04 -04:00
|
|
|
AltHost_Menus[I].Add(AltHost_MenuItems[I][K]);
|
|
|
|
end;
|
|
|
|
end;
|
2010-09-26 14:30:53 -04:00
|
|
|
end;
|
2010-09-29 06:07:55 -04:00
|
|
|
{$ENDIF}
|
2010-10-04 05:06:49 -04:00
|
|
|
|
2010-09-26 14:30:53 -04:00
|
|
|
begin
|
2010-09-29 06:07:55 -04:00
|
|
|
{$IFNDEF EXTENSION}
|
2010-10-04 05:06:49 -04:00
|
|
|
MessageDlg(GetName + ' v' + GetVersion + ' by Dgby714!',
|
|
|
|
'This is a Extension for Simba.'#13#10
|
|
|
|
'If you are in Simba click View->Extensions and enable paster.sex!',
|
|
|
|
mtWarning, [mbOK]);
|
2010-09-29 06:07:55 -04:00
|
|
|
{$ENDIF}
|
2010-09-26 14:30:53 -04:00
|
|
|
end.
|
2010-09-29 06:07:55 -04:00
|
|
|
|