4 \83A
\83v
\83\8a\83P
\81[
\83V
\83\87\83\93\82Ì
\83\81\83C
\83\93\83t
\83H
\81[
\83\80\81B
5 \91\97\90M
\81E
\8eó
\90M
\81E
\83{
\83g
\83\8b\94z
\91\97\8aÖ
\8cW
\82Ì
\82¢
\82ë
\82¢
\82ë
\82È
\8f\88\97\9d\82ð
\8ds
\82¤
\81B
11 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
12 Menus, StdCtrls, ComCtrls, BRegExp, BottleDef, BottleSstp,
13 DirectSstp, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
14 IdSLPP20, SsParser, ImgList, AppEvnts, TaskTray, StdActns,
15 ActnList, MPlayer, MenuBar, ToolWin,
16 IniFiles, ExtCtrls, ShellAPI, Contnrs,
17 ConstEditor, Buttons, Clipbrd, HeadValue, Logs,
18 IdException, HttpThread, IdHTTP, IdURI, LogDownload,
19 ScriptConsts, DateUtils, BottleChainRule, BottleChainEvent,
20 SakuraSeekerInstance, HEditor, HTSearch, heClasses, heFountain,
21 SakuraScriptFountain, SppList, SurfacePreview;
24 TSurfacePreviewType = (spHint, spEditor);
26 TfrmSender = class(TForm)
30 mnRegister: TMenuItem;
33 StatusBar: TStatusBar;
36 mnEditConst: TMenuItem;
37 ActionList: TActionList;
39 mnPopPaste: TMenuItem;
42 mnPopSelectAll: TMenuItem;
44 mnPopConst: TMenuItem;
49 mnSelectAll: TMenuItem;
51 ApplicationEvents: TApplicationEvents;
52 mnPopUpTaskTray: TPopupMenu;
53 mnTaskStart: TMenuItem;
55 mnTaskRestore: TMenuItem;
56 mnTaskNewMessage: TMenuItem;
60 mnTaskExit: TMenuItem;
68 mnPopupConst: TPopupMenu;
69 actEditConst: TAction;
71 mnShowToolBar: TMenuItem;
72 mnShowConstBar: TMenuItem;
73 ConstBarMenu: TMainMenu;
75 tbtnClear: TToolButton;
76 tbtnConfirm: TToolButton;
77 tbtnSend: TToolButton;
78 tbtnSeparator: TToolButton;
79 tbtnStart: TToolButton;
80 tbtnSeparator2: TToolButton;
81 tbtnInsertConst: TToolButton;
82 ConstMenuBar: TMenuBar;
87 actCopyAllNoReturn: TAction;
88 mnCopyAllNoReturn: TMenuItem;
89 mnPopCopyAll: TMenuItem;
90 mnPopCopyAllNoReturn: TMenuItem;
92 tbtnSetting: TToolButton;
93 mnStayOnTop: TMenuItem;
95 actExitClient: TAction;
97 tbtnEditConst: TToolButton;
98 actClearBottles: TAction;
99 mnClearBottles: TMenuItem;
100 MediaPlayer: TMediaPlayer;
101 mnGetNewId: TMenuItem;
102 actNextChannel: TAction;
103 actPrevChannel: TAction;
105 mnNextChannel: TMenuItem;
106 mnPrevChannel: TMenuItem;
109 tbtnShowLog: TToolButton;
110 tbtnSleep: TToolButton;
114 mnTaskSleep: TMenuItem;
116 tabChannel: TTabControl;
119 cbxTargetGhost: TComboBox;
120 actVoteMessage: TAction;
121 mnPopUpChannelTab: TPopupMenu;
122 mnLeaveThisChannel: TMenuItem;
124 mnGotoVote: TMenuItem;
125 mnGotoGLog: TMenuItem;
126 mnGoToHelp: TMenuItem;
130 mnExitAllChannels: TMenuItem;
131 actAgreeMessage: TAction;
134 actPrevGhost: TAction;
135 actNextGhost: TAction;
136 mnPrevGhost: TMenuItem;
137 mnNextGhost: TMenuItem;
138 actResetGhost: TAction;
139 mnResetGhost: TMenuItem;
140 timDisconnectCheckTimer: TTimer;
141 DirectSstp: TDirectSstp;
142 actDownloadLog: TAction;
143 actFMOExplorer: TAction;
144 tbtnFMOExplorer: TToolButton;
145 mnFMOExplorer: TMenuItem;
147 actInsertCue: TAction;
148 SakuraScriptFountain: TSakuraScriptFountain;
153 actSelectAll: TAction;
154 actRecallScriptBuffer: TAction;
156 mnRecallScriptBuffer: TMenuItem;
157 tbtnEditorPreview: TToolButton;
158 actEditorPreview: TAction;
159 mnEditorPreview: TMenuItem;
160 actResetPlugins: TAction;
162 mnResetPlugins: TMenuItem;
163 ReplaceDialog: TReplaceDialog;
166 mnReplace: TMenuItem;
167 actSendToEditor: TAction;
168 actSendToLogWindow: TAction;
169 mnSendLogWindow: TMenuItem;
170 actDeleteLogItem: TAction;
172 procedure actConfirmExecute(Sender: TObject);
173 procedure FormCreate(Sender: TObject);
174 procedure FormDestroy(Sender: TObject);
175 procedure actSendExecute(Sender: TObject);
176 procedure HTTPSuccess(Sender: TObject);
177 procedure HTTPFailure(Sender: TObject);
178 procedure actStartClick(Sender: TObject);
179 procedure actStopExecute(Sender: TObject);
180 procedure FormShow(Sender: TObject);
181 procedure actAboutClick(Sender: TObject);
182 procedure actExitClientExecute(Sender: TObject);
183 procedure actClearExecute(Sender: TObject);
184 procedure memScriptChange(Sender: TObject);
185 procedure mnStayOnTopClick(Sender: TObject);
186 procedure actEditConstExecute(Sender: TObject);
187 procedure mnTaskBarClick(Sender: TObject);
188 procedure FormClose(Sender: TObject; var Action: TCloseAction);
189 procedure ApplicationEventsMinimize(Sender: TObject);
190 procedure ApplicationEventsRestore(Sender: TObject);
191 procedure mnTaskRestoreClick(Sender: TObject);
192 procedure TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
193 procedure FormActivate(Sender: TObject);
194 procedure mnTaskNewMessageClick(Sender: TObject);
195 procedure ApplicationEventsHint(Sender: TObject);
196 procedure memScriptKeyDown(Sender: TObject; var Key: Word;
198 procedure mnShowToolBarClick(Sender: TObject);
199 procedure mnShowConstBarClick(Sender: TObject);
200 procedure mnGoToHPClick(Sender: TObject);
201 procedure LabelTimerTimer(Sender: TObject);
202 procedure actCopyAllExecute(Sender: TObject);
203 procedure actCopyAllNoReturnExecute(Sender: TObject);
204 procedure Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
205 const Param: String);
206 procedure actSettingExecute(Sender: TObject);
207 procedure memScriptKeyPress(Sender: TObject; var Key: Char);
208 procedure Slpp20Disconnect(Sender: TObject);
209 procedure actClearBottlesExecute(Sender: TObject);
210 procedure SakuraSeekerDetectResultChanged(Sender: TObject);
211 procedure mnGetNewIdClick(Sender: TObject);
212 procedure tabChannelChange(Sender: TObject);
213 procedure actPrevChannelExecute(Sender: TObject);
214 procedure actNextChannelExecute(Sender: TObject);
215 procedure cbxTargetGhostDropDown(Sender: TObject);
216 procedure actShowLogExecute(Sender: TObject);
217 procedure actSleepExecute(Sender: TObject);
218 procedure actVoteMessageExecute(Sender: TObject);
219 procedure tabChannelContextPopup(Sender: TObject; MousePos: TPoint;
220 var Handled: Boolean);
221 procedure mnLeaveThisChannelClick(Sender: TObject);
222 procedure mnGotoVoteClick(Sender: TObject);
223 procedure mnGotoGLogClick(Sender: TObject);
224 procedure tabChannelMouseMove(Sender: TObject; Shift: TShiftState; X,
226 procedure mnGoToHelpClick(Sender: TObject);
227 procedure tabChannelMouseDown(Sender: TObject; Button: TMouseButton;
228 Shift: TShiftState; X, Y: Integer);
229 procedure tabChannelDragOver(Sender, Source: TObject; X, Y: Integer;
230 State: TDragState; var Accept: Boolean);
231 procedure tabChannelDragDrop(Sender, Source: TObject; X, Y: Integer);
232 procedure tabChannelEndDrag(Sender, Target: TObject; X, Y: Integer);
233 procedure cbxTargetGhostDrawItem(Control: TWinControl; Index: Integer;
234 Rect: TRect; State: TOwnerDrawState);
235 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
236 procedure actAgreeMessageExecute(Sender: TObject);
237 procedure actPrevGhostExecute(Sender: TObject);
238 procedure actNextGhostExecute(Sender: TObject);
239 procedure actResetGhostExecute(Sender: TObject);
240 procedure timDisconnectCheckTimerTimer(Sender: TObject);
241 procedure actDownloadLogExecute(Sender: TObject);
242 procedure cbxTargetGhostChange(Sender: TObject);
243 procedure actFMOExplorerExecute(Sender: TObject);
244 procedure actInsertCueExecute(Sender: TObject);
245 procedure FormResize(Sender: TObject);
246 procedure actCopyExecute(Sender: TObject);
247 procedure actPasteExecute(Sender: TObject);
248 procedure actCutExecute(Sender: TObject);
249 procedure actSelectAllExecute(Sender: TObject);
250 procedure memScriptMouseMove(Sender: TObject; Shift: TShiftState; X,
252 procedure actRecallScriptBufferExecute(Sender: TObject);
253 procedure actEditorPreviewExecute(Sender: TObject);
254 procedure actResetPluginsExecute(Sender: TObject);
255 procedure IdSLPP20Connect(Sender: TObject);
256 procedure actReplaceExecute(Sender: TObject);
257 procedure ReplaceDialogFind(Sender: TObject);
258 procedure ReplaceDialogReplace(Sender: TObject);
259 procedure actSendToEditorExecute(Sender: TObject);
260 procedure actSendToLogWindowExecute(Sender: TObject);
261 procedure memScriptDragOver(Sender, Source: TObject; X, Y: Integer;
262 State: TDragState; var Accept: Boolean);
263 procedure memScriptDragDrop(Sender, Source: TObject; X, Y: Integer);
264 procedure actDeleteLogItemExecute(Sender: TObject);
266 FSleeping: boolean; //
\94z
\91\97\83X
\83\8a\81[
\83v
\92\86\82©
\82Ç
\82¤
\82©
268 FConnecting: boolean;
270 FBooted: boolean; //
\8f\89\89ñ
\8bN
\93®
\92Ê
\90M
\97p
271 FOriginalCaption: String;
272 FAutoAddAfterGetChannel: boolean; //
\83`
\83\83\83\93\83l
\83\8b\8eæ
\93¾
\8cã
\82É
\83_
\83C
\83A
\83\8d\83O
\82È
\82µ
\82É
273 //
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82·
\82é
\82©
\82Ç
\82¤
\82©
277 FMutex: THandle; //Mutex
\83I
\83u
\83W
\83F
\83N
\83g
\81c
\93ñ
\8fd
\8bN
\93®
\96h
\8e~
\97p
279 FNowChannel: String; //
\8c»
\8dÝ
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b
280 JoinChannelsBackup: TStringList; //
\88ê
\8e\9e\8eg
\97p
282 FScriptModified: boolean; //
\83X
\83N
\83\8a\83v
\83g
\82ª
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\81B
283 //
\83\8d\81[
\83J
\83\8b\8am
\94F
\8b
\90§
\97p
\83t
\83\89\83O
\81BTRichEdit.Modified
\82Í
284 //
\95Ê
\82Ì
\97p
\93r
\82Å
\8eg
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8eg
\82¦
\82È
\82¢
286 FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
287 FDragTabDest: integer; //
\83h
\83\8d\83b
\83v
\82·
\82é
\88Ê
\92u(
\82·
\82®
\89E
\82É
\82
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X)
289 FBottleSstp: TBottleSstp; //
\8dÄ
\91\97\83v
\83\8d\83O
\83\89\83\80
291 FHttp: THTTPDownloadThread; //HTTP
\83_
\83E
\83\93\83\8d\81[
\83h
\83X
\83\8c\83b
\83h(
\83C
\83\93\83X
\83^
\83\93\83X
\82Í1
\8cÂ
\82Ì
\82Ý)
292 FBeginConnectFailCount: integer; //
\89½
\93x
\82à
\90Ú
\91±
\8e¸
\94s
\82µ
\82½
\82ç
\83\8a\83g
\83\89\83C
\92\86\8e~
294 FVisiblePreviewGhost: String;
295 FVisiblePreviewSurface: integer; //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82Å
\8c©
\82¦
\82Ä
\82¢
\82é
\82à
\82Ì
296 FVisibleMenuItem: TMenuItem; //
\83N
\83\8a\83b
\83N
\82³
\82ê
\82½
\83\81\83j
\83\85\81[
\83A
\83C
\83e
\83\80\81B
297 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82ª
\83\81\83j
\83\85\81[
\82Ì
\89º
\82É
298 //
\89B
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\8bL
\89¯
\82µ
\82Ä
\82¨
\82
300 FTargetGhostExpand: boolean; //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ª
\81A
301 //
\88ê
\8e\9e\93I
\82É
\91S
\95\94\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\82Ì
\83t
\83\89\83O
303 FScriptBuffer: TObjectList; //
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
305 //
\88È
\89º
\81A
\8d\91\90¨
\92²
\8d¸
\82ð
\89ß
\93x
\82É
\91\97\90M
\82µ
\82È
\82¢
\82½
\82ß
\82Ì
\95Ï
\90\94
306 FLastGhostList: String; //
\83S
\81[
\83X
\83g
\83\8a\83X
\83g
\82Ì
\95¶
\8e\9a\97ñ
307 FLastGhostListSend: Int64; //
\8d\91\90¨
\92²
\8d¸
\82ð
\8dÅ
\8cã
\82É
\91\97\90M
\82µ
\82½
\8e\9e\8d\8f
309 FWM_TaskBarCreated: WORD; //
\83^
\83X
\83N
\83o
\81[
\93o
\98^
\97p
\83E
\83B
\83\93\83h
\83E
\83\81\83b
\83Z
\81[
\83WID
311 procedure SetStatusText(const Value: String);
312 procedure SetSleeping(const Value: boolean);
314 procedure SetConnecting(const Value: boolean);
315 procedure SetAdded(const Value: boolean);
316 procedure mnConstClick(Sender: TObject);
317 procedure mnConstGroupClick(Sender: TObject);
318 property Added: boolean read FAdded write SetAdded;
319 property Sleeping: boolean read FSleeping write SetSleeping;
320 property StatusText: String read FStatusText write SetStatusText;
321 function GetScriptText: String;
322 procedure ChangeTaskIcon;
323 procedure ShowHintLabel(const Mes: String; Col: TColor = clBlue);
324 procedure UpdateLayout;
325 procedure DispatchBottle(EventType: TIdSlppEventType; Dat: THeadValue);
326 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
327 procedure UpdateChannelInfo(Dat: THeadValue);
328 procedure UpdateJoinChannelList(Dat: THeadValue);
329 procedure NoLuidError;
330 procedure UpdateIfGhostBox;
331 function BuildMenuConditionCheck(const IfGhost, Ghost: String): boolean;
332 procedure BuildMenu(Root: TMenuItem; Simple: boolean);
333 procedure PlaySound(const FileName: String);
334 //TBottleSstp
\8aÖ
\8cW
\83C
\83x
\83\93\83g
\83n
\83\93\83h
\83\89
335 procedure BottleSstpResendCountChange(Sender: TObject);
336 procedure BottleSstpResendTrying(Sender: TObject; MID: String);
337 procedure BottleSstpResendEnd(Sender: TObject; MID: String);
338 function IsSurfaceTag(const Script: String; var ID: integer): boolean;
339 procedure DoSurfacePreview(Surface: integer; const Kind:
340 TSurfacePreviewType);
341 function GetSurfacePreviewPositionHint(w, h: integer): TPoint;
342 function GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
343 procedure EditorPreview;
344 //
\83^
\83O
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\95Ï
\8a·
\82·
\82é
345 function TagReplace(Script: String;
346 Before, After: array of String): String; overload;
347 function TagReplace(Script: String;
348 Before, After: TStrings): String; overload;
349 procedure ClearEditor;
350 procedure CopyFromLogToEditor(Log: TLogItem);
352 procedure WndProc(var Message: TMessage); override;
354 function DoTrans(var Script: String;
355 Options: TScriptTransOptions): String; overload;
356 function DoTrans(var Script: String;
357 Options: TScriptTransOptions; out FoundURL: boolean): String; overload;
358 function ScriptTransForSSTP(const Script: String;
359 out Error: String): String; overload;
360 procedure BeginConnect;
361 procedure RetryBeginConnect;
362 procedure EndConnect;
363 procedure ConstructMenu(Simple: boolean);
364 property Connecting: boolean read FConnecting write SetConnecting;
365 property BottleSstp: TBottleSstp read FBottleSstp;
366 function GhostNameToSetName(const Ghost: String): String;
367 procedure PostCommand(const Command: array of String); overload;
368 procedure PostCommand(Command: TStrings); overload;
369 procedure PostSetChannel(Channels: TStrings);
370 procedure SaveChainRuleList;
375 frmSender: TfrmSender;
378 PanelConnecting = 0; //
\81u
\90Ú
\91±
\92\86\81v
\95\
\8e¦
\97p
379 PanelBytes = 1; //
\81\9b\81\9b\83o
\83C
\83g
380 PanelCount = 2; //Local Proxy
\81A
\8c»
\8dÝ
\81\9b\8c\8f\91Ò
\82¿
381 PanelMembers = 3; //
\81\9b\81\9b\90l
382 PanelStatus = 4; //SSTP Bottle
\83T
\81[
\83o
\82É
\93o
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81c
\82È
\82Ç
385 IconDisconnected = 18;
387 IconSleepDisconnected = 20;
389 WarningColor = clRed;
391 SendButtonLongHint = 'Bottle
\82Ì
\91\97\90M';
393 function Token(const Str: String; const Delimiter: char;
394 const Index: integer): String;
398 uses SendConfirm, SettingForm, ChannelListForm, LogForm,
399 MessageBox, FMOExplorer, EditorTalkShow;
403 //
\92P
\8f\83\82É
\83o
\83C
\83g
\92P
\88Ê
\82Å
\95¶
\8e\9a\97ñ
\82ð
\8c©
\82Ä
\82¢
\82«
\95ª
\89ð
\82·
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
404 function Token(const Str: String; const Delimiter: char;
405 const Index: integer): String;
406 var i, c, len: integer;
412 while i <= len do begin
413 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
415 if c > Index then Break;
416 end else if c = Index then Result := Result + Str[i];
423 procedure TfrmSender.actConfirmExecute(Sender: TObject);
424 var AScript, Err, AGhost: String;
427 AScript := GetScriptText;
428 if Length(AScript) = 0 then Exit;
430 AScript := ScriptTransForSSTP(AScript, Err);
437 if cbxTargetGhost.ItemIndex > 0 then
438 AGhost := cbxTargetGhost.Text
439 else if FNowChannel <> '' then
440 AGhost := ChannelList.Channel[FNowChannel].Ghost
444 if Pref.IgnoreTimeCritical then
445 AScript := TagReplace(AScript, ['\t'], ['']);
447 Item := TLogItem.Create;
453 Channel := '
\81y
\8am
\94F
\81z';
456 BottleSstp.Unshift(Item);
461 FScriptModified := false;
464 procedure TfrmSender.FormCreate(Sender: TObject);
465 var Str: TStringList;
467 FScriptBuffer := TObjectList.Create(true);
469 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
470 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
471 ScriptConstList.LoadFromDir(FConstDir);
472 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
473 Spps.LoadFromDirectory(FSppDir);
474 ConstructMenu(false);
476 Str := TStringList.Create;
479 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
480 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
483 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
484 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
486 Showmessage('defrule.txt
\93Ç
\82Ý
\8d\9e\82Ý
\92\86\82É
\92v
\96½
\93I
\83G
\83\89\81[
\82ª
\94
\90¶
\82µ
\82Ü
\82µ
\82½
\81Bdefrule.txt
\82ð
\8dÄ
\83C
\83\93\83X
\83g
\81[
\83\8b\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B');
487 Application.Terminate;
488 Application.ProcessMessages;
496 FOriginalCaption := Self.Caption;
499 ShowMessage('
\93ñ
\8fd
\8bN
\93®
\8b\96\89Â
\83o
\81[
\83W
\83\87\83\93\82Å
\82·
\81B'#13#10 + VersionString);
501 FMutex := CreateMutex(nil, true, 'SSTPBottleClient2');
502 if GetLastError = ERROR_ALREADY_EXISTS then begin
504 ShowMessage('SSTP Bottle Client
\82Í
\93ñ
\8fd
\8bN
\93®
\82Å
\82«
\82Ü
\82¹
\82ñ');
506 Application.Terminate;
507 Application.ProcessMessages; //WM_QUIT
\82ð
\97¬
\82·
513 mnShowToolBar.Checked := Pref.ShowToolBar;
514 mnShowConstBar.Checked := Pref.ShowConstBar;
515 if Pref.StayOnTop then begin
516 FormStyle := fsStayOnTop;
517 mnStayOnTop.Checked := true;
519 FormStyle := fsNormal;
520 mnStayOnTop.Checked := false;
523 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
524 mnGoToHP.Hint := Pref.HomePage;
525 mnGotoGlog.Hint := Pref.GLogPage;
526 mnGotoVote.Hint := Pref.VotePage;
527 mnGotoHelp.Hint := Pref.HelpPage;
529 mnGetNewId.Enabled := (Pref.LUID = '');
531 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
533 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
534 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
536 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
537 Application.Terminate;
540 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
541 with Pref.SenderWindowPosition do begin
544 Self.Width := Right - Left + 1;
545 Self.Height := Bottom - Top + 1;
548 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
549 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
551 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
552 actClearExecute(Sender);
553 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
555 //
\83`
\83\83\83\93\83l
\83\8b\8eQ
\89Á
\8aÖ
\8cW
\82Ì
\83^
\83u
\82Ì
\8f\88\97\9d\82È
\82Ç(
\83`
\83\83\83\93\83l
\83\8b\95s
\8eQ
\89Á
\82Å
\8f\89\8aú
\89»)
556 UpdateJoinChannelList(nil);
558 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
559 FBottleSstp := TBottleSstp.Create(false);
560 with FBottleSstp do begin
561 OnResendCountChange := BottleSstpResendCountChange;
562 OnResendTrying := BottleSstpResendTrying;
563 OnResendEnd := BottleSstpResendEnd;
567 procedure TfrmSender.FormDestroy(Sender: TObject);
569 if FScriptBuffer <> nil then
572 if FBottleSstp <> nil then begin
573 FBottleSstp.Terminate;
577 with Pref.SenderWindowPosition do begin
580 Right := Self.Left + Self.Width - 1;
581 Bottom := Self.Top + Self.Height - 1;
584 if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
586 ScriptConstList.Save;
589 BottleChainRuleList.Free;
592 ReleaseMutex(FMutex);
597 procedure TfrmSender.SetConnecting(const Value: boolean);
599 FConnecting := Value;
601 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
602 actStart.Enabled := false;
603 actStop.Enabled := false;
604 actSend.Enabled := false;
605 actVoteMessage.Enabled := false;
606 actAgreeMessage.Enabled := false;
607 mnGetNewId.Enabled := false;
608 Screen.Cursor := crAppStart;
610 StatusBar.Panels[PanelConnecting].Text := '';
611 actStart.Enabled := true;
612 actStop.Enabled := true;
613 actSend.Enabled := true;
614 frmLog.lvwLogChange(Self, nil, ctState);
615 mnGetNewId.Enabled := Pref.LUID = '';
616 Screen.Cursor := crDefault;
620 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
621 procedure TfrmSender.actSendExecute(Sender: TObject);
622 var Talk, Ghost: String;
623 Command: TStringList;
627 if Length(GetScriptText) = 0 then begin
628 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
632 if Pref.LUID = '' then begin
636 if tabChannel.TabIndex < 0 then begin
637 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
638 '
\83\81\83j
\83\85\81[
\82©
\82ç
\81u
\83`
\83\83\83\93\83l
\83\8b\8eQ
\89Á
\81v
\82ð
\8ds
\82Á
\82Ä
\82
\82¾
\82³
\82¢
\81B');
641 if ChannelList.Channel[FNowChannel].NoPost then begin
643 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
647 if Pref.NeedConfirmBeforeSend and FScriptModified then begin
648 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
652 if not Pref.NoConfirm then begin
653 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
657 Talk := GetScriptText;
658 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
659 if Err <> '' then begin
660 MessageDlg(Err, mtWarning, [mbOk], 0);
665 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text;
667 Command := TStringList.Create;
668 with Command do begin
669 Add('Command: sendBroadcast');
670 Add('Channel: ' + FNowChannel);
671 Add('LUID: ' + Pref.LUID);
672 Add('Agent: ' + VersionString);
673 if Ghost <> '' then Add('Ghost: ' + Ghost);
674 Add('Talk: ' + Talk);
676 PostCommand(Command);
681 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
682 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
683 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
687 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
692 procedure TfrmSender.BeginConnect;
694 if Pref.LUID = '' then begin
698 IdSlpp20.LUID := Pref.LUID;
699 self.Cursor := crHourGlass;
701 if IdSlpp20.Connected then IdSlpp20.Disconnect;
702 if Pref.UseHttpProxy then begin
703 IdSlpp20.Host := Pref.ProxyAddress;
704 IdSlpp20.Port := Pref.ProxyPort;
705 IdSlpp20.ProxyMode := true;
707 IdSlpp20.Host := 'bottle.mikage.to';
708 IdSlpp20.Port := 9871;
709 IdSlpp20.ProxyMode := false;
713 on EIdException do begin
715 if FBeginConnectFailCount = 0 then begin
716 Inc(FBeginConnectFailCount);
718 if Pref.UseHttpProxy then
719 ShowMessage('HTTP Proxy
\82ð
\92Ê
\82¶
\82ÄSSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
720 '
\83l
\83b
\83g
\83\8f\81[
\83N
\82Ì
\8fó
\91Ô
\81EProxy
\82Ì
\8fó
\91Ô
\82ð
\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B'#13#10 +
721 '
\82 \82é
\82¢
\82Í
\83T
\81[
\83o
\82ª
\83_
\83E
\83\93\82µ
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B')
723 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
724 '
\83l
\83b
\83g
\83\8f\81[
\83N
\82É
\8cq
\82ª
\82Á
\82Ä
\82¢
\82é
\82©
\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B'#13#10 +
725 '
\82 \82é
\82¢
\82Í
\83T
\81[
\83o
\82ª
\83_
\83E
\83\93\82µ
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B');
727 Inc(FBeginConnectFailCount);
730 self.Cursor := crDefault;
733 procedure TfrmSender.EndConnect;
735 IdSlpp20.OnDisconnect := nil;
739 procedure TfrmSender.SetAdded(const Value: boolean);
741 if FAdded = Value then Exit;
744 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
747 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
749 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
753 procedure TfrmSender.HTTPSuccess(Sender: TObject);
754 var Str, ResStr, Command: String;
755 HeadValue: THeadValue;
757 SetChannel: TStringList;
760 Str := (Sender as THttpDownloadThread).RecvString;
764 HeadValue := THeadValue.Create(Str);
766 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89ð
\90Í
\82Å
\82«
\82È
\82¢
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
769 Command := HeadValue['Command'];
770 ResStr := HeadValue['Result'];
771 if ResStr = 'Err' then begin
772 if HeadValue['ExtraMessage'] <> '' then begin
774 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
775 HeadValue['ExtraMessage']);
778 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
781 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
782 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
783 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
784 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
785 if Pref.ResetIfGhostAfterSend then begin
786 actResetGhostExecute(Self);
788 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
789 if Pref.ClearAfterSend then begin
792 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
793 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
795 if (Command = 'getNewId') then begin
796 if ResStr = 'OK' then begin
797 Pref.LUID := HeadValue['NewID'];
798 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
799 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
800 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
801 'LUID: ' + Pref.LUID + #13#10 +
802 '
\90Ý
\92è
\83t
\83@
\83C
\83\8b\82ð
\8dí
\8f\9c\82·
\82é
\82±
\82Æ
\82Å
\81ALUID
\82Í
\8e©
\97R
\82É
\8eæ
\93¾
\82Å
\82«
\82Ü
\82·
\82ª
\81A' +
803 'LUID
\82Ì
\8eg
\97p
\8eÀ
\90Ñ
\82É
\89\9e\82¶
\82Ä
\93Á
\93T
\82ª
\82 \82é
\82©
\82à
\82µ
\82ê
\82Ü
\82¹
\82ñ
\82Ì
\82Å
\81A' +
804 '
\8fo
\97\88\82é
\82¾
\82¯
\93¯
\82¶
\82à
\82Ì
\82ð
\8eg
\82Á
\82Ä
\82
\82¾
\82³
\82¢
\81B
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\82
\82¾
\82³
\82¢
\81B');
805 mnGetNewId.Enabled := false;
808 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
811 if (Command = 'voteMessage') then begin
812 if ResStr = 'OK' then begin
813 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
816 if (Command = 'getChannels') and (ResStr = 'OK') then begin
817 UpdateChannelInfo(HeadValue);
820 if FAutoAddAfterGetChannel then begin
821 SetChannel := TStringList.Create;
822 if JoinChannelsBackup <> nil then begin
823 //
\88ê
\92U
\83`
\83\83\83\93\83l
\83\8b\8eQ
\89Á
\82É
\90¬
\8c÷
\82µ
\82½
\8cã
\82È
\82ç
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b
824 SetChannel.Assign(JoinChannelsBackup);
826 //
\8a®
\91S
\82É
\8f\89\89ñ
\8bN
\93®
\82Ì
\8fê
\8d\87\82Í
\83v
\83\8c\83t
\83@
\83\8c\83\93\83X
\82©
\82ç
\93o
\98^
\95ª
\82ð
\8eæ
\93¾
827 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
828 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
829 SetChannel.Add(Pref.AutoJoinChannels[i]);
833 Application.CreateForm(TfrmChannelList, frmChannelList);
835 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
836 SetChannel := TStringList.Create;
837 SetChannel.Assign(frmChannelList.JoinList);
840 frmChannelList.Release;
843 if SetChannel <> nil then PostSetChannel(SetChannel);
845 if SetChannel <> nil then FreeAndNil(SetChannel);
848 if (Command = 'setChannels') then begin
849 if ResStr <> 'OK' then begin
851 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½
\81B
\82à
\82¤
\88ê
\93x
\93o
\98^
\82µ
\82È
\82¨
\82µ
\82Ä
\82
\82¾
\82³
\82¢');
852 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
855 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
861 procedure TfrmSender.actStartClick(Sender: TObject);
863 if Pref.LUID = '' then begin
867 if not IdSlpp20.Connected then begin
868 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
872 FAutoAddAfterGetChannel := false;
873 PostCommand(['Command: getChannels']);
877 procedure TfrmSender.actStopExecute(Sender: TObject);
879 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
880 IdSlpp20.OnDisconnect := nil;
881 if IdSlpp20.Connected then IdSlpp20.Disconnect;
882 FAutoAddAfterGetChannel := true;
884 IdSlpp20.OnDisconnect := Slpp20Disconnect;
887 procedure TfrmSender.FormShow(Sender: TObject);
889 if FBooted or Application.Terminated then Exit;
890 //LUID
\82ª
\8eæ
\93¾
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\91\81\91¬
\93o
\98^
\81B
\82»
\82¤
\82Å
\82È
\82¯
\82ê
\82ÎLUID
\8eæ
\93¾
\81B
891 if Pref.LUID <> '' then BeginConnect
892 else mnGetNewIdClick(Self);
893 FAutoAddAfterGetChannel := Pref.AutoStart;
896 frmSurfacePreview.Show;
898 SakuraSeeker.BeginDetect;
899 SakuraSeekerDetectResultChanged(self);
900 if SakuraSeeker.Count = 0 then
901 frmMessageBox.ShowMessage('
\83S
\81[
\83X
\83g(SSTP
\83T
\81[
\83o)
\82ª1
\82Â
\82à
\8bN
\93®
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10 +
902 'SSTP Bottle
\82ð
\97\98\97p
\82·
\82é
\82½
\82ß
\82É
\82Í
\81A
\83S
\81[
\83X
\83g
\82ð
\93¯
\8e\9e\82É
\8bN
\93®
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B'#13#10 +
903 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
906 procedure TfrmSender.actAboutClick(Sender: TObject);
909 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
910 Str := Str + Format('Compiler Version: %f', [CompilerVersion]);
911 frmMessageBox.ShowMessage(Str);
914 procedure TfrmSender.actExitClientExecute(Sender: TObject);
919 procedure TfrmSender.actClearExecute(Sender: TObject);
921 if Pref.AutoClip then
922 actSendToLogWindow.Execute
927 procedure TfrmSender.memScriptChange(Sender: TObject);
930 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
931 StatusBar.Panels[PanelBytes].Text := IntToStr(length(Script)) + '
\83o
\83C
\83g';
932 FScriptModified := true;
936 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
938 Pref.StayOnTop := not Pref.StayOnTop;
939 mnStayOnTop.Checked := Pref.StayOnTop;
940 if Pref.StayOnTop then begin
941 FormStyle := fsStayOnTop;
943 FormStyle := fsNormal;
948 function TfrmSender.GetScriptText: String;
950 Result := memScript.Lines.Text;
953 procedure TfrmSender.mnConstClick(Sender: TObject);
956 i := (Sender as TMenuItem).Tag;
957 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
960 procedure TfrmSender.actEditConstExecute(Sender: TObject);
962 ScriptConstList.LoadFromDir(FConstDir);
964 Application.CreateForm(TfrmConstEditor, frmConstEditor);
965 frmConstEditor.Execute;
966 ScriptConstList.Save;
968 frmConstEditor.Release;
970 ConstructMenu(false);
973 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
975 Application.Minimize;
976 WindowState := wsNormal;
979 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
982 TaskTray.Registered := false;
985 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
988 Application.ShowMainForm := false;
989 ShowWindow(Application.Handle, SW_HIDE);
992 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
994 Application.ShowMainForm := true;
998 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1000 Application.Restore;
1003 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1005 Application.Restore;
1008 procedure TfrmSender.FormActivate(Sender: TObject);
1013 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1015 Application.Restore;
1016 actClearExecute(Sender);
1019 procedure TfrmSender.ChangeTaskIcon;
1024 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1026 if Sleeping then IcoNum := IconSleepDisconnected
1027 else IcoNum := IconDisconnected;
1030 Ico := TIcon.Create;
1032 imgIcon.GetIcon(IcoNum, Ico);
1033 TaskTray.Icon := Ico;
1034 TaskTray.Registered := true;
1039 ; // PC
\82Ì
\95\89\89×
\82ª
\8d\82\82¢
\82Æ4
\95b
\88È
\93à
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\82Å
\82«
\82¸
\81A
1040 //
\83V
\83F
\83\8b\82ª
\83n
\83\93\83O
\82µ
\82Ä
\82¢
\82é
\82Æ
\94»
\92f
\82³
\82ê
\82Ä
\97á
\8aO
\82ª
\94
\90¶
\82·
\82é
\81B
1041 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1045 procedure TfrmSender.SetStatusText(const Value: String);
1047 FStatusText := Value;
1048 StatusBar.Panels[PanelStatus].Text := Value;
1051 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1054 if Length(Application.Hint) > 0 then
1056 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1057 Application.HintColor := clInfoBk;
1058 if (Application.Hint = SendButtonLongHint)
1059 and (FNowChannel <> '') then
1061 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1062 Application.HintColor := clYellow;
1063 Application.ActivateHint(Mouse.CursorPos);
1065 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1067 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1068 DoSurfacePreview(id, spHint);
1072 StatusBar.Panels[PanelStatus].Text := FStatusText;
1073 frmSurfacePreview.HideAway;
1077 procedure TfrmSender.ConstructMenu(Simple: boolean);
1079 BuildMenu(mnPopConst, Simple);
1080 BuildMenu(mnPopUpConst.Items, Simple);
1081 BuildMenu(ConstBarMenu.Items, Simple);
1082 //ConstMenuBar.Menu := nil;
1083 ConstMenuBar.AutoSize := false;
1084 ConstMenuBar.Width := 1000;
1085 ConstMenuBar.Menu := ConstBarMenu;
1086 ConstMenuBar.AutoSize := true;
1089 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1090 Shift: TShiftState);
1092 Func: TReturnKeyFunction;
1094 if (Key = VK_RETURN) then begin
1095 if (ssShift in Shift) then
1096 Func := Pref.WhenShiftReturn
1097 else if (ssCtrl in Shift) then
1098 Func := Pref.WhenCtrlReturn
1100 Func := Pref.WhenReturn;
1103 with tbtnInsertConst do
1104 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1105 mnPopUpConst.Popup(Pos.X, Pos.Y);
1108 memScript.SelText := '\n';
1112 memScript.SelText := '\n'#13#10;
1115 memScript.SelText := #13#10
1121 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1123 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1124 Pref.ShowToolBar := mnShowToolBar.Checked;
1128 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1130 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1131 Pref.ShowConstBar := mnShowConstBar.Checked;
1135 procedure TfrmSender.UpdateLayout;
1137 with SakuraScriptFountain do begin
1138 TagColor.Color := Pref.MarkUpColor;
1139 TagErrorColor.Color := Pref.MarkErrorColor;
1140 Scope0Color.Color := Pref.TalkColorH;
1141 Scope1Color.Color := Pref.TalkColorU;
1142 SynchronizedColor.Color := Pref.TalkColorS;
1144 memScript.Ruler.Visible := Pref.ShowRuler;
1145 memScript.Ruler.Color := Pref.TalkColorH;
1146 memScript.Color := Pref.BgColor;
1148 ToolBar.Visible := Pref.ShowToolBar;
1149 ConstMenuBar.Visible := Pref.ShowConstBar;
1152 with tabChannel do begin
1153 TabPosition := Pref.TabPosition;
1154 case Pref.TabPosition of
1155 tpTop: Align := alTop;
1156 tpBottom: Align := alBottom;
1161 function TfrmSender.DoTrans(var Script: String;
1162 Options: TScriptTransOptions; out FoundURL: boolean): String;
1163 var UrlCancel, Mark: String;
1164 Url, UrlName: array[0..6] of String;
1165 i, j, u, UrlCount: integer;
1166 LastSurfaceH, LastSurfaceU: integer;
1167 UnyuTalking: boolean;
1168 QuickSection, Synchronize: boolean;
1169 Warnings: TStringList;
1174 UnyuTalking := false;
1175 QuickSection := false;
1176 Synchronize := false;
1177 SsParser.LeaveEscape := true;
1178 SsParser.EscapeInvalidMeta := false;
1179 SsParser.InputString := Script;
1181 Warnings := TStringList.Create;
1183 for i := 0 to SsParser.Count-1 do begin
1184 if SsParser[i] = '\t' then begin
1185 if not(toIgnoreTimeCritical in Options) then
1186 Script := Script + '\t';
1187 end else if SsParser[i] = '\e' then begin
1189 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1190 if toConvertURL in Options then begin
1191 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1192 for u := 7 downto 1 do begin
1193 if (SsParser.Match(SsParser[i],
1194 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1195 '-', '%b', [rfReplaceAll]))) > 0 then begin
1196 for j := 1 to u do begin
1197 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1198 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1199 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1200 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1203 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1204 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1206 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1207 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1208 Url[0] := SsParser.GetParam(SsParser[i], 1);
1209 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1210 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1211 if Pos('http://', Url[0]) > 0 then begin
1213 if not QuickSection then
1214 Script := Script + '\_q' + Url[0] + '\_q'
1216 Script := Script + Url[0];
1219 end else Script := Script + SsParser[i];
1221 Mark := SsParser[i];
1222 if Mark = '\h' then begin
1223 UnyuTalking := false;
1224 if toHUTagTo01Tag in Options then Mark := '\0';
1225 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1226 Warnings.Add('
\83V
\83\93\83N
\83\8d\83i
\83C
\83Y
\83h
\83Z
\83N
\83V
\83\87\83\93\92\86\82É\h
\82ª
\82 \82è
\82Ü
\82·
\81B');
1227 end else if Mark = '\u' then begin
1228 UnyuTalking := true;
1229 if toHUTagTo01Tag in Options then Mark := '\1';
1230 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1231 Warnings.Add('
\83V
\83\93\83N
\83\8d\83i
\83C
\83Y
\83h
\83Z
\83N
\83V
\83\87\83\93\92\86\82É\u
\82ª
\82 \82è
\82Ü
\82·
\81B');
1232 end else if Mark = '\_q' then begin
1233 QuickSection := not QuickSection;
1234 end else if Mark = '\_s' then begin
1235 Synchronize := not Synchronize;
1236 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1237 if UnyuTalking then begin
1238 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1241 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1244 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1245 if UnyuTalking then begin
1246 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1248 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1251 Script := Script + Mark;
1254 if UrlCount > 0 then begin
1256 Script := Script + '\h\n';
1257 if not (toNoChoice in Options) then begin
1258 for i := 0 to UrlCount-1 do begin
1259 Script := Script + Format('\q%d[%s][%s]',
1260 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1262 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1263 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1265 Script := Script + '\h';
1266 for i := 0 to UrlCount-1 do begin
1267 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1268 Script := Script + Format('\n{%s}', [UrlCancel]);
1273 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1274 if toWaitScriptEnd in Options then begin
1275 i := Pref.WaitScriptEnd;
1276 while i > 0 do begin
1278 Script := Script + '\w9';
1281 Script := Script + '\w' + IntToStr(i);
1287 Script := Script + '\e';
1288 RegExp.Subst('s/\r\n//gk', Script);
1290 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1291 for i := 0 to SsParser.Count-1 do begin
1292 if SsParser.MarkUpType[i] = mtTagErr then begin
1293 Result := '"' + SsParser[i] + '"'#13#10 +
1294 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1298 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1299 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1303 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1304 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1305 mbOkCancel, 0) = mrCancel then
1306 Result := Warnings.Text;
1313 function TfrmSender.DoTrans(var Script: String;
1314 Options: TScriptTransOptions): String;
1317 Result := DoTrans(Script, Options, dum);
1320 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1322 ShellExecute(Handle, 'open', PChar(Pref.HomePage), nil, nil, SW_SHOW);
1325 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1327 lblMessage.Caption := Mes;
1328 lblMessage.Font.Color := Col;
1329 lblMessage.Visible := true;
1330 LabelTimer.Enabled := false;
1331 LabelTimer.Enabled := true;
1334 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1336 LabelTimer.Enabled := false;
1337 lblmessage.Visible := false;
1340 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1344 Str := memScript.Lines.Text;
1345 Clip := ClipBoard();
1346 Clip.SetTextBuf(PChar(Str));
1349 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1353 Str := memScript.Lines.Text;
1354 RegExp.Subst('s/\r\n//gk', Str);
1355 Clip := ClipBoard();
1356 Clip.SetTextBuf(PChar(Str));
1359 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1360 const Param: String);
1361 var HeadValue: THeadValue;
1363 HeadValue := THeadValue.Create(Param);
1366 etScript, etForceBroadcast, etUnicast: begin
1367 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1368 DispatchBottle(EventType, HeadValue);
1370 etMemberCount: begin
1371 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1373 etChannelCount: begin
1375 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1380 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1382 FBeginConnectFailCount := 0;
1383 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1384 if not Connecting then
1385 PostCommand(['Command: getChannels']);
1386 SakuraSeeker.BeginDetect;
1388 etChannelList: begin
1389 UpdateJoinChannelList(HeadValue);
1390 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1391 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1392 JoinChannelsBackup.Assign(JoinChannels);
1394 etCloseChannel: begin
1395 with JoinChannels do
1396 if IndexOf(HeadValue['Channel']) >= 0 then
1397 Delete(IndexOf(HeadValue['Channel']));
1398 with tabChannel do begin
1399 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1400 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1401 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1402 tabChannelChange(self);
1404 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1406 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1407 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1409 etForceBroadcastInformation: begin
1410 if HeadValue['Type'] = 'Vote' then begin
1411 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1412 end else if HeadValue['Type'] = 'Agree' then begin
1413 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1422 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1424 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1426 TaskTray.TipString := 'SSTP Bottle Client (' +
1427 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1429 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1431 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1434 procedure TfrmSender.actSettingExecute(Sender: TObject);
1436 Application.CreateForm(TfrmSetting, frmSetting);
1448 frmLog.UpdateWindow;
1451 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1453 if (Key = #13) or (Key = #10) then Key := Char(0);
1456 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1459 UpdateJoinChannelList(nil);
1460 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1461 if not Application.Terminated then RetryBeginConnect;
1464 procedure TfrmSender.SetSleeping(const Value: boolean);
1467 FBottleSstp.ResendSleep := Value;
1471 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1474 Re := MessageDlg(Format('
\96¢
\94z
\91\97\82Ì%d
\8c\8f\82ÌBottle
\82ð
\91S
\95\94\83N
\83\8a\83A
\82µ
\82Ü
\82·', [FBottleSstp.CueCount]),
1475 mtWarning, mbOkCancel, 0);
1476 if Re = mrOk then begin
1478 frmLog.AllBottleOpened;
1479 frmLog.UpdateWindow;
1483 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1486 Http: THTTPDownloadThread;
1489 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1491 if (FLastGhostListSend <> 0) and
1492 (GetTickCount < FLastGhostListSend + 1000*60) then
1496 FLastGhostListSend := GetTickCount;
1498 //
\8d\91\90¨
\92²
\8d¸
\82É
\8eQ
\89Á
1499 if FBooted and not Pref.NoSendGhostList and (SakuraSeeker.Count > 0) then begin
1500 GhostList := 'CCC=' + TIdURI.ParamsEncode('
\88¤');
1501 GhostList := GhostList + '&LUID=' + Pref.LUID;
1503 for i := 0 to SakuraSeeker.Count-1 do begin
1504 if SakuraSeeker[i].Name <> '' then begin//
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\82½
\82Ü
\82ÉFMO
\89ó
\82ê
\82Å
\8bó
\82Ì
\83S
\81[
\83X
\83g
\82ð
\91\97\82Á
\82Ä
\82µ
\82Ü
\82¤
1505 GhostList := GhostList + '&GHOST=' + TIdURI.ParamsEncode(SakuraSeeker[i].SetName);
1509 if SendOk and (FLastGhostList <> GhostList) then begin
1510 FLastGhostList := GhostList;
1511 Http := THTTPDownloadThread.Create(BottleServer, Pref.CgiNameGhost, GhostList);
1512 if Pref.UseHttpProxy then begin
1513 Http.ProxyServer := Pref.ProxyAddress;
1514 Http.ProxyPort := Pref.ProxyPort;
1516 Http.FreeOnTerminate := true;
1522 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1524 Ch: TChannelListItem;
1527 for i := 1 to Dat.IntData['Count'] do begin
1528 Ch := TChannelListItem.Create;
1529 Ch.Name := Dat[Format('CH%d_name', [i])];
1530 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1531 Ch.Info := Dat[Format('CH%d_info', [i])];
1532 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1533 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1534 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1535 ChannelList.Add(Ch);
1540 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1542 PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1545 procedure TfrmSender.NoLuidError;
1548 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1549 '
\83w
\83\8b\83v
\83\81\83j
\83\85\81[
\82Ì[LUID
\8eæ
\93¾]
\82©
\82çID
\82ð
\8eæ
\93¾
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B'#13#10+
1550 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1553 procedure TfrmSender.tabChannelChange(Sender: TObject);
1555 if tabChannel.TabIndex >= 0 then begin
1556 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1557 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1562 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1563 ConstructMenu(true);
1566 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1568 with tabChannel do begin
1569 if Tabs.Count = 0 then Exit;
1570 if TabIndex=0 then TabIndex := Tabs.Count-1
1571 else TabIndex := TabIndex-1;
1573 tabChannelChange(Self);
1576 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1578 with tabChannel do begin
1579 if Tabs.Count = 0 then Exit;
1580 if TabIndex=Tabs.Count-1 then TabIndex := 0
1581 else TabIndex := TabIndex+1;
1583 tabChannelChange(Self);
1586 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1590 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1591 if nodat then Dat := THeadValue.Create('');
1593 for i := 0 to Dat.Count-1 do
1594 if Dat.KeyAt[i] = 'Entry' then begin
1595 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1596 JoinChannels.Add(RegExp[1]);
1598 with tabChannel do begin
1603 for i := 0 to JoinChannels.Count-1 do begin
1604 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1605 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1606 Tabs.Add(JoinChannels[i]);
1609 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1610 //
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82æ
\82¤
\82É
\82·
\82é(
\83^
\83u
\82ª
\82¸
\82ê
\82È
\82¢
\8f\88\97\9d)
1612 for i := 0 to Tabs.Count-1 do
1613 if Tabs[i] = FNowChannel then TabIndex := i;
1614 if Tabs.Count > 0 then begin
1615 FNowChannel := Tabs[TabIndex];
1616 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1619 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1621 Visible := Tabs.Count > 0;
1622 if Tabs.Count > 1 then begin
1623 actNextChannel.Enabled := true;
1624 actPrevChannel.Enabled := true;
1626 actNextChannel.Enabled := false;
1627 actPrevChannel.Enabled := false;
1629 OnChange := tabChannelChange;
1631 if nodat then Dat.Free;
1632 if JoinChannels.Count = 0 then begin
1633 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1634 actSend.Enabled := false;
1636 Self.Caption := FOriginalCaption;
1637 actSend.Enabled := true;
1641 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1643 SakuraSeeker.BeginDetect;
1647 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1650 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1653 procedure TfrmSender.actSleepExecute(Sender: TObject);
1655 if actSleep.Checked then begin
1656 actSleep.Checked := false;
1657 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1659 actSleep.Checked := true;
1660 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1662 Sleeping := actSleep.Checked;
1667 procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1669 var Opt: TSstpSendOptions;
1670 Event: TBottleChainBottleEvent;
1671 Script, Sender, Ghost, Channel, ErrorMes: String;
1672 BreakFlag, NoDispatch: boolean;
1673 Sound, LogName: String;
1674 i, j, k, SkipCount: integer;
1675 Rule: TBottleChainRule;
1676 Action: TBottleChainAction;
1677 LogNameList: TStringList;
1681 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1682 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1683 Channel := Dat['Channel'];
1685 etScript: Sender := Channel;
1686 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1687 etUnicast: Sender := Dat['SenderUID'];
1690 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1691 if Dat['IfGhost'] <> '' then begin
1692 Ghost := Dat['IfGhost'];
1694 if ChannelList.Channel[Channel] <> nil then
1695 Ghost := ChannelList.Channel[Channel].Ghost;
1697 Dat['TargetGhost'] := Ghost;
1699 Event := TBottleChainBottleEvent.Create;
1702 if EventType = etScript then Event.LogType := ltBottle
1703 else Event.LogType := ltSystemLog;
1705 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1706 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1707 if ErrorMes <> '' then begin
1708 frmLog.AddCurrentSystemLog('SYSTEM', '
\96â
\91è
\82Ì
\82 \82é
\89Â
\94\
\90«
\82Ì
\82 \82é
\83X
\83N
\83\8a\83v
\83g
\82ª
\93Í
\82¢
\82½
\82½
\82ß
\81A'+
1709 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1714 NoDispatch := false;
1716 LogNameList := TStringList.Create;
1719 for i := 0 to BottleChainRuleList.Count-1 do begin
1720 if SkipCount > 0 then begin
1724 Rule := BottleChainRuleList[i];
1725 if not Rule.Enabled then Continue;
1726 if not Rule.Check(Event) then Continue;
1727 for j := 0 to Rule.Actions.Count-1 do begin
1728 Action := (Rule.Actions[j] as TBottleChainAction);
1729 if Action is TBottleChainAbortRuleAction then BreakFlag := true;
1730 if Action is TBottleChainSkipRuleAction then
1731 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1732 if (Action is TBottleChainSoundAction) and (Sound = '') then begin
1733 Sound := (Action as TBottleChainSoundAction).SoundFile;
1734 Sound := StringReplace(Sound, '%channel%', Dat['Channel'], [rfReplaceAll]);
1735 Sound := StringReplace(Sound, '%ghost%', Dat['TargetGhost'], [rfReplaceAll]);
1737 if Action is TBottleChainNoDispatchAction then NoDispatch := true;
1738 if Action is TBottleChainLogAction then begin
1739 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1740 LogName := (Action as TBottleChainLogAction).LogNames[k];
1741 LogName := StringReplace(LogName, '%channel%', Dat['Channel'], [rfReplaceAll]);
1742 LogName := StringReplace(LogName, '%ghost%', Dat['TargetGhost'], [rfReplaceAll]);
1743 LogName := StringReplace(LogName, '%date%', FormatDateTime('yy/mm/dd', Now()), [rfReplaceAll]);
1744 LogNameList.Add(LogName);
1747 if Action is TBottleChainOverrideGhostAction then begin
1748 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1750 if Action is TBottleChainQuitAction then Application.Terminate;
1752 if BreakFlag then Break;
1755 if Dat['Script'] <> '' then begin
1756 for i := 0 to LogNameList.Count-1 do
1757 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost']);
1758 if NoDispatch then begin
1759 frmLog.SetBottleState(Dat['MID'], lsOpened);
1761 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1762 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1763 Script, Ghost, Now());
1765 FBottleSstp.Push(CueItem);
1772 if Dat['DialogMessage'] <> '' then begin
1774 frmMessageBox.ShowMessage(
1775 DateTimeToStr(Now) + #13#10 +
1776 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1777 for i := 0 to LogNameList.Count-1 do
1778 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1782 if (Sound <> '') then PlaySound(Sound);
1791 procedure TfrmSender.YenETrans;
1792 var St, Le, i: integer;
1795 St := memScript.SelStart;
1796 Le := memScript.SelLength;
1797 Orig := GetScriptText;
1798 RegExp.Subst('s/(\r\n)+$//kg', Orig);
1800 with SsParser do begin
1801 LeaveEscape := true;
1802 EscapeInvalidMeta := false;
1803 InputString := Orig;
1805 for i := 0 to SsParser.Count-1 do begin
1806 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
1809 Text := Text + '\e';
1811 if Orig <> Text then memScript.Lines.Text := Text;
1812 SsParser.InputString := Text;
1814 RegExp.Subst('s/\r\n//kg', Text);
1816 memScript.SelStart := St;
1817 memScript.SelLength := Le;
1820 procedure TfrmSender.PostCommand(const Command: array of String);
1821 var PostStr: TStringList;
1826 PostStr := TStringList.Create;
1827 for i := Low(Command) to High(Command) do begin
1828 PostStr.Add(Command[i]);
1830 PostCommand(PostStr);
1836 procedure TfrmSender.PostCommand(Command: TStrings);
1837 var PostStr: String;
1840 PostStr := Command.Text;
1841 PostStr := TIdURI.ParamsEncode(PostStr);
1843 FHttp := THTTPDownloadThread.Create(BottleServer, Pref.CgiName, PostStr);
1844 if Pref.UseHttpProxy then begin
1845 FHttp.ProxyServer := Pref.ProxyAddress;
1846 FHttp.ProxyPort := Pref.ProxyPort;
1848 FHttp.OnSuccess := HttpSuccess;
1849 FHttp.OnConnectionFailed := HttpFailure;
1850 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
1853 on EHeapException do begin
1854 Connecting := false;
1860 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
1863 if frmLog.lvwLog.Selected = nil then Exit;
1864 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1865 if Log = nil then Exit;
1866 if Log.LogType <> ltBottle then Exit;
1868 'Command: voteMessage',
1870 'LUID: ' + Pref.LUID,
1876 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
1879 if frmLog.lvwLog.Selected = nil then Exit;
1880 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1881 if Log = nil then Exit;
1882 if Log.LogType <> ltBottle then Exit;
1884 'Command: voteMessage',
1886 'LUID: ' + Pref.LUID,
1892 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
1894 if SakuraSeeker.ProcessByName[Ghost] <> nil then
1895 Result := SakuraSeeker.ProcessByName[Ghost].SetName
1900 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
1901 MousePos: TPoint; var Handled: Boolean);
1904 with tabChannel do begin
1905 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
1906 if Tag < 0 then Handled := true;
1911 procedure TfrmSender.PostSetChannel(Channels: TStrings);
1912 var PostStr: TStringList;
1915 PostStr := TStringList.Create;
1917 with PostStr do begin
1918 Add('Command: setChannels');
1919 Add('Agent: ' + VersionString);
1920 Add('LUID: ' + Pref.LUID);
1921 if Channels <> nil then
1922 for i := 0 to Channels.Count-1 do begin
1923 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
1926 PostCommand(PostStr);
1932 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
1936 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
1938 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
1939 Chs := TStringList.Create;
1941 //
\8c»
\8dÝ
\8eQ
\89Á
\92\86\82Ì
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\81A
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\82ð
1942 //
\8aO
\82µ
\82½
\83\8a\83X
\83g
\82Å
\81A
\90V
\82½
\82É
\83`
\83\83\83\93\83l
\83\8b\8eQ
\89Á
\83R
\83}
\83\93\83h
\82ð
\91\97\82é
1944 Chs.Assign(JoinChannels);
1945 while Chs.IndexOf(Ch) >= 0 do
1946 Chs.Delete(Chs.IndexOf(Ch));
1947 PostSetChannel(Chs);
1953 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
1955 ShellExecute(Handle, 'open', PChar(Pref.VotePage), nil, nil, SW_SHOW);
1958 procedure TfrmSender.mnGotoGLogClick(Sender: TObject);
1960 ShellExecute(Handle, 'open', PChar(Pref.GLogPage), nil, nil, SW_SHOW);
1963 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
1964 Shift: TShiftState; X, Y: Integer);
1968 with tabChannel do begin
1969 Index := IndexOfTabAt(X, Y);
1971 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
1975 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
1977 ShellExecute(Handle, 'open', PChar(Pref.HelpPage), nil, nil, SW_SHOW);
1980 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
1981 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1984 with tabChannel do begin
1985 Index := IndexOfTabAt(X, Y);
1986 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
1987 if Button = mbLeft then begin
1988 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
1990 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
1995 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
1996 Y: Integer; State: TDragState; var Accept: Boolean);
1997 var TargetRect: TRect;
2000 Accept := Source = tabChannel;
2001 if not Accept then Exit;
2002 with tabChannel do begin
2003 OldDest := FDragTabDest;
2004 FDragTabDest := IndexOfTabAt(X, Y);
2005 if FDragTabDest = -1 then begin
2006 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2009 with Canvas do begin
2013 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2014 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2015 TargetRect := TabRect(OldDest);
2016 with Canvas do begin
2017 Brush.Style := bsClear;
2018 Rectangle(TargetRect.Left, TargetRect.Top,
2019 TargetRect.Right, TargetRect.Bottom);
2022 if (OldDest <> FDragTabDest) then begin
2023 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2024 TargetRect := TabRect(FDragTabDest);
2025 with Canvas do begin
2026 Brush.Style := bsClear;
2027 Rectangle(TargetRect.Left, TargetRect.Top,
2028 TargetRect.Right, TargetRect.Bottom);
2034 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2036 var DestIndex: integer;
2038 with tabChannel do begin
2039 DestIndex := IndexOfTabAt(X, Y);
2040 Tabs.Move(FDragTabIndex, DestIndex);
2044 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2047 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2048 tabChannel.Tabs.BeginUpdate;
2049 tabChannel.Tabs.EndUpdate;
2052 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2053 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2054 var AlignRight: boolean;
2057 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2058 with cbxTargetGhost do begin
2059 AlignRight := false;
2060 if Pref.HideGhosts and not FTargetGhostExpand and
2061 (Index = Items.Count-1) and (Index > 0) then
2063 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2064 Canvas.Font.Color := clWindowText;
2065 Canvas.Font.Style := [];
2067 end else if (Index > 0) then
2069 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2070 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2071 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2073 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2074 Canvas.Font.Style := [fsBold];
2077 Canvas.Font.Color := clWindowText;
2078 Canvas.Font.Style := [];
2080 if odSelected in State then
2081 Canvas.Font.Color := clHighlightText;
2085 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2086 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2087 cbxTargetGhost.Items[Index]);
2089 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2090 cbxTargetGhost.Items[Index]);
2094 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2095 var CanClose: Boolean);
2097 if not Pref.ConfirmOnExit then Exit;
2098 if MessageDlg('SSTP Bottle Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2099 mbOkCancel, 0) = mrCancel then CanClose := false;
2102 procedure TfrmSender.UpdateIfGhostBox;
2106 HiddenCount: integer;
2108 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2109 Selected := cbxTargetGhost.Text;
2111 with cbxTargetGhost do begin
2114 Items.Add(ChannelDefault);
2115 for i := 0 to SakuraSeeker.Count-1 do begin
2116 //
\94j
\91¹FMO
\91Î
\8dô
\81BHWND
\82Ì
\92f
\95Ð
\82ª
\8ec
\82Á
\82Ä
\82¢
\82é
\82ªName
\82ª
\8fÁ
\82¦
\82Ä
\82¢
\82é
\8fê
\8d\87\82ª
\82 \82é
2117 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2118 if Pref.HideGhosts and not FTargetGhostExpand then
2119 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2124 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2125 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2127 cbxTargetGhost.ItemIndex := 0;
2128 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2129 with cbxTargetGhost do begin
2130 for i := 1 to Items.Count-1 do begin
2131 if Items[i] = Selected then
2134 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2135 if ItemIndex = 0 then begin
2136 Items.Add(Selected);
2137 ItemIndex := Items.Count - 1;
2141 if Pref.HideGhosts and not FTargetGhostExpand then
2142 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2147 procedure TfrmSender.HTTPFailure(Sender: TObject);
2151 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2152 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2153 (Sender as THTTPDownloadThread).LastErrorMessage);
2154 Connecting := false;
2157 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2160 SakuraSeeker.BeginDetect;
2162 i := cbxTargetGhost.ItemIndex;
2166 i := cbxTargetGhost.Items.Count-1;
2167 if Pref.HideGhosts and not FTargetGhostExpand then
2170 cbxTargetGhost.ItemIndex := i;
2171 cbxTargetGhostChange(self);
2174 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2177 SakuraSeeker.BeginDetect;
2179 i := cbxTargetGhost.ItemIndex;
2181 if Pref.HideGhosts and not FTargetGhostExpand then
2183 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2186 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2188 cbxTargetGhost.ItemIndex := i;
2189 cbxTargetGhostChange(self);
2192 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2194 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2195 FTargetGhostExpand := false;
2196 if Visible then memScript.SetFocus;
2197 cbxTargetGhostChange(self);
2200 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2202 if (IdSlpp20.LastReadTimeInterval > BottleServerTimeOut) then begin
2204 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2205 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2207 if not IdSlpp20.Connected then begin
2209 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2211 //
\90Ø
\92f
\82µ
\82½
\82Ü
\82Ü
\8dÄ
\90Ú
\91±
\82Å
\82«
\82¸
\95ú
\92u
\82³
\82ê
\82Ä
\82¢
\82é
\8fê
\8d\87\82à
\88ê
\92è
\8e\9e\8aÔ
\92u
\82«
\82É
\8dÄ
\90Ú
\91±
\83g
\83\89\83C
2212 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2218 procedure TfrmSender.RetryBeginConnect;
2220 if FBeginConnectFailCount < 3 then begin
2221 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2222 FAutoAddAfterGetChannel := true;
2224 end else if FBeginConnectFailCount = 3 then begin
2225 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2226 frmMessageBox.ShowMessage(
2227 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2228 '
\83l
\83b
\83g
\83\8f\81[
\83N
\82É
\90Ú
\91±
\82µ
\82Ä
\82¢
\82é
\82±
\82Æ
\82ð
\8am
\94F
\82µ
\82½
\8cã
\82Å
\81A
\83`
\83\83\83\93\83l
\83\8b\8eQ
\89Á
\83{
\83^
\83\93\82ð
\89\9f\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B'#13#10+
2229 'SSTP Bottle
\83T
\81[
\83o
\82ª
\83_
\83E
\83\93\82µ
\82Ä
\82¢
\82é
\8fê
\8d\87\82Í
\81A
\82µ
\82Î
\82ç
\82
\82µ
\82Ä
\82©
\82ç
\8dÄ
\90Ú
\91±
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B'
2231 Inc(FBeginConnectFailCount);
2235 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2236 var BottleLog: TBottleLogList;
2238 Cond: TBottleLogDownloadCondition;
2240 function TimeStr(Mins: integer): String;
2241 var day, hour, min: integer;
2243 day := Mins div (60 * 24);
2244 hour := (Mins div 60) mod 24;
2247 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2248 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2249 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2252 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2254 if frmLogDownload.Execute then begin
2255 with frmLogDownload do begin
2256 if IsRange then begin
2257 if CompareDate(DateLo, DateHi) = 0 then
2258 Title := FormatDateTime('yy/mm/dd', DateLo)
2260 Title := FormatDateTime('yy/mm/dd', DateLo) + ' - ' + FormatdateTime('yy/mm/dd', DateHi);
2262 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2264 if Channel <> '' then Title := Title + '(' + Channel + ')';
2266 BottleLog := TBottleLogList.Create(Title);
2268 BottleLog.OnLoaded := frmLog.LogLoaded;
2269 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2270 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2271 with frmLogDownload do begin
2272 Cond.IsRange := IsRange;
2273 Cond.RecentCount := RecentCount;
2274 Cond.DateLo := DateLo;
2275 Cond.DateHi := DateHi;
2276 Cond.MinVote := MinVote;
2277 Cond.MinAgree := MinAgree;
2278 Cond.Channel := Channel;
2280 BottleLog.LoadFromWeb(Cond);
2282 FreeAndNil(BottleLog);
2284 if BottleLog <> nil then begin
2285 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2287 frmLog.tabBottleLog.TabIndex := NewIndex;
2288 frmLog.UpdateWindow;
2292 frmLogDownload.Release;
2296 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2297 Ghost: String): boolean;
2304 Cond := Token(IfGhost, ',', i);
2305 if Cond <> '' then begin
2306 if Cond[1] = '!' then begin
2307 Cond := Copy(Cond, 2, High(integer));
2308 if Cond = Ghost then Result := false;
2310 if Cond <> Ghost then Result := false;
2317 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2318 var i, j, k, count: integer;
2319 ConstData: TScriptConst;
2320 Menu1, Menu2: TMenuItem;
2323 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2324 // Simple = true
\82Ì
\8fê
\8d\87\82Í
\83S
\81[
\83X
\83g
\8aÖ
\8cW
\82Ì
\82Ý
\8dÄ
\8d\
\92z
\82·
\82é
\82Ì
\82Å
\8d\82\91¬
\81B
2325 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2326 else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2328 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2329 if Simple then begin
2330 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2331 for i := Root.Count-1 downto 0 do begin
2332 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2336 //
\91S
\95\94\8dí
\8f\9c
2337 for i := Root.Count-1 downto 0 do begin
2343 for i := 0 to ScriptConstList.Count-1 do begin
2344 for j := 0 to ScriptConstList[i].Count-1 do begin
2345 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2346 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2348 // Simple
\82Ì
\8fê
\8d\87\82Í
\8aù
\82É
\8aY
\93\96\83\81\83j
\83\85\81[
\82ª
\91¶
\8dÝ
\82·
\82é
\82±
\82Æ
\82ª
\82 \82é
\82Ì
\82Å
\83X
\83L
\83b
\83v
2349 if Simple and (count < Root.Count) then
2350 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2354 Menu1 := TMenuItem.Create(Root);
2355 Menu1.Caption := ScriptConstList[i][j].Caption;
2356 Menu1.Hint := ScriptConstList[i][j].Caption;
2357 Menu1.AutoHotkeys := maManual;
2358 Menu1.Tag := ScriptConstList[i][j].ID;
2359 Menu1.OnClick := mnConstGroupClick;
2361 if not Simple then begin
2364 if count < Root.Count-1 then
2365 Root.Insert(count, Menu1)
2370 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2371 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2372 ConstData := ScriptConstList[i][j][k];
2373 Menu2 := TMenuItem.Create(Root);
2374 Menu2.Caption := ConstData.Caption;
2375 Menu2.Hint := ConstData.ConstText;
2376 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2377 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2378 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2379 Menu2.ShortCut := ConstData.ShortCut;
2380 Menu2.OnClick := mnConstClick;
2381 Menu2.AutoHotkeys := maManual;
2382 Menu2.Tag := ConstData.ID;
2383 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2390 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2392 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
\82ð
\91I
\91ð
\82³
\82ê
\82½
\8fê
\8d\87\82Í
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ð
\8dÄ
\8d\
\92z
2393 if Pref.HideGhosts and not FTargetGhostExpand then
2395 with cbxTargetGhost do
2397 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2398 //
\82½
\82¾
\82µItemIndex=0
\82Ì
\8fê
\8d\87(
\83S
\81[
\83X
\83g
\82ª
\8bN
\93®
\82µ
\82Ä
\82¢
\82È
\82¢
\8fê
\8d\87)
\82Í
\97á
\8aO
2399 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2401 FTargetGhostExpand := true;
2404 DroppedDown := true;
2408 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2409 ConstructMenu(true);
2410 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2414 procedure TfrmSender.PlaySound(const FileName: String);
2416 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2418 MediaPlayer.FileName := FileName;
2422 on E: EMCIDeviceError do begin
2423 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2428 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2431 if not Assigned(frmFMOExplorer) then
2432 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2435 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2438 frmFMOExplorer.Show;
2441 procedure TfrmSender.SaveChainRuleList;
2442 var Str: TStringList;
2444 Str := TStringList.Create;
2446 Str.Text := ComponentToString(BottleChainRuleList);
2447 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2453 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2455 frmLog.SetBottleState(MID, lsOpened);
2458 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2460 frmLog.SetBottleState(MID, lsPlaying);
2463 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2464 var InsertItem: TLogItem;
2465 i, errCount, Res: integer;
2466 Log: TBottleLogList;
2467 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2469 if FBottleSstp.CueCount > 0 then begin
2470 if MessageDlg(Format('
\8c»
\8dÝ
\8dÄ
\91\97\83L
\83\85\81[
\82É
\93ü
\82Á
\82Ä
\82¢
\82é%d
\8c\8f\82Ì
\96¢
\94z
\91\97\83{
\83g
\83\8b\82ð
\83N
\83\8a\83A
\82µ
\82Ä
\81A'+
2471 '
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82É
\82 \82é
\83{
\83g
\83\8b\82ð
\98A
\91±
\8dÄ
\90¶
\82µ
\82Ü
\82·
\81B'#13#10+
2472 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2473 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2476 frmLog.AllBottleOpened;
2477 if frmLog.lvwLog.Selected = nil then Exit;
2478 Log := frmLog.SelectedBottleLog;
2479 if Log = nil then Exit;
2480 FBottleSSTP.OnResendCountChange := nil;
2482 for i := frmLog.lvwLog.Selected.Index downto 0 do begin
2483 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2484 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2486 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2487 if ErrorMes <> '' then
2489 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2490 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2493 raise Exception.Create('Script Syntax Error')
2494 else if Res = mrCancel then
2498 frmLog.AllBottleOpened;
2502 if InsertItem.Ghost = '' then begin
2503 if ChannelList.Channel[InsertItem.Channel] <> nil then
2504 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2506 FBottleSSTP.Push(InsertItem);
2507 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2513 if errCount > 0 then
2514 ShowMessage(Format('%d
\8c\8f\82Ì
\83{
\83g
\83\8b\82É
\96â
\91è
\82ª
\82 \82Á
\82½
\82½
\82ß
\8dÄ
\90¶
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B', [errCount]));
2515 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2516 BottleSstpResendCountChange(self);
2517 frmLog.lvwLog.Invalidate;
2520 function TfrmSender.ScriptTransForSSTP(const Script: String;
2521 out Error: String): String;
2522 var TransOpt: TScriptTransOptions;
2524 if Pref.NoTransURL then
2525 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2527 TransOpt := [toConvertURL, toWaitScriptEnd];
2528 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2529 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2530 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2532 Error := DoTrans(Result, TransOpt);
2535 procedure TfrmSender.FormResize(Sender: TObject);
2538 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2539 if memScript.ColWidth <> 0 then
2543 w := Width - LeftMargin - ColWidth div 2;
2544 if ScrollBars in [ssVertical, ssBoth] then
2545 w := w - GetSystemMetrics(SM_CYVSCROLL);
2546 WrapOption.WrapByte := w div ColWidth;
2551 procedure TfrmSender.actCopyExecute(Sender: TObject);
2553 memScript.CopyToClipboard;
2556 procedure TfrmSender.actPasteExecute(Sender: TObject);
2558 memScript.PasteFromClipboard;
2561 procedure TfrmSender.actCutExecute(Sender: TObject);
2563 memScript.CutToClipboard;
2566 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2568 memScript.SelectAll;
2571 function TfrmSender.IsSurfaceTag(const Script: String;
2572 var ID: integer): boolean;
2575 if SsParser.Match(Script, '\s%d') = 3 then
2578 ID := Ord(Script[3]) - Ord('0')
2580 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2583 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2587 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2588 Shift: TShiftState; X, Y: Integer);
2592 //
\95Ò
\8fW
\83E
\83B
\83\93\83h
\83E
\82Å
\83}
\83E
\83X
\83|
\83C
\83\93\83g
\82·
\82é
\82Æ
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
2593 if not Pref.SurfacePreviewOnScriptPoint then
2595 token := memScript.TokenStringFromPos(Point(X, Y));
2596 if IsSurfaceTag(token, id) then
2598 DoSurfacePreview(id, spEditor);
2601 frmSurfacePreview.HideAway;
2605 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2606 const Kind: TSurfacePreviewType);
2611 if cbxTargetGhost.ItemIndex > 0 then
2612 ghost := cbxTargetGhost.Text
2613 else if FNowChannel <> '' then
2614 ghost := ChannelList.Channel[FNowChannel].Ghost;
2616 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2617 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2618 not (frmSurfacePreview.IsHidden) then
2625 Bmp := TBitmap.Create;
2627 if Spps.TryGetImage(ghost, Surface, Bmp) then
2631 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2633 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2635 CPos := Point(0, 0);
2637 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2638 FVisiblePreviewGhost := Ghost;
2639 FVisiblePreviewSurface := Surface;
2641 frmSurfacePreview.HideAway;
2648 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2649 {var MousePoint: TPoint;
2652 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\83E
\83B
\83\93\83h
\83E
\82Ì
\95\
\8e¦
\88Ê
\92u
\82ð
\8c\88\92è
\82·
\82é
2653 //
\91\97\90M
\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82É
\82æ
\82Á
\82Ä
\82Í
\96
\82È
\82Æ
\82±
\82ë
\82É
\83\81\83j
\83\85\81[
\82ª
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82Ì
\82Å
2654 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2655 {GetCursorPos(MousePoint);
2656 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2657 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2658 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2659 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2662 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2663 var MousePoint: TPoint;
2665 GetCursorPos(MousePoint);
2666 case Pref.SurfacePreviewOnScriptPointPosition of
2667 spspMainWindowRight:
2668 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2670 Result := Point(Self.Left - w, MousePoint.Y);
2674 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2676 if (Sender is TMenuItem) then
2677 FVisibleMenuItem := Sender as TMenuItem;
2680 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2682 if FScriptBuffer.Count = 0 then
2684 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2685 memScriptChange(Self);
2686 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2689 procedure TfrmSender.EditorPreview;
2690 var Ghost, Script: String;
2692 if frmEditorTalkShow <> nil then
2693 if frmEditorTalkShow.Visible then
2695 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2697 if cbxTargetGhost.ItemIndex > 0 then
2698 Ghost := cbxTargetGhost.Text
2699 else if FNowChannel <> '' then
2700 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2701 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2705 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2707 if frmEditorTalkShow <> nil then
2708 frmEditorTalkShow.Show
2711 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
2712 frmEditorTalkShow.Show;
2717 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
2718 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
2720 Spps.ClearImagePool;
2721 Spps.LoadFromDirectory(FSppDir);
2724 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
2726 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
2729 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2730 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
2731 function TfrmSender.TagReplace(Script: String; Before,
2732 After: array of String): String;
2733 var BeforeList, AfterList: TStringList;
2736 BeforeList := TStringList.Create;
2737 AfterList := TStringList.Create;
2739 for i := Low(Before) to High(Before) do
2740 BeforeList.Add(Before[i]);
2741 for i := Low(After) to High(After) do
2742 AfterList.Add(After[i]);
2743 Result := TagReplace(Script, BeforeList, AfterList);
2750 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2751 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
2752 //
\82Ü
\82½
\83p
\83^
\81[
\83\93\82ð
\95¡
\90\94\8ew
\92è
\82Å
\82«
\82é(
\92u
\8a·
\8cã
\82Ì
\8c\8b\89Ê
\82ª
\82Ü
\82½
\92u
\8a·
\82³
\82ê
\82½
\82è
\82µ
\82È
\82¢)
2753 function TfrmSender.TagReplace(Script: String; Before,
2754 After: TStrings): String;
2756 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
2762 OldStr := InputString;
2763 OldLeaveEscape := LeaveEscape;
2764 OldEscapeInvalidMeta := EscapeInvalidMeta;
2765 LeaveEscape := true;
2766 EscapeInvalidMeta := false;
2767 InputString := Script;
2769 for i := 0 to SsParser.Count-1 do
2772 for j := 0 to Before.Count-1 do
2774 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
2777 Result := Result + After[j];
2781 Result := Result + SsParser[i];
2785 LeaveEscape := OldLeaveEscape;
2786 EscapeInvalidMeta := OldEscapeInvalidMeta;
2787 InputString := OldStr;
2791 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
2792 //
\91Î
\89\9e\82·
\82é
2793 procedure TfrmSender.WndProc(var Message: TMessage);
2795 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
2797 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
2798 //
\8bC
\82Ã
\82©
\82¹
\82é
2805 //
\8c\9f\8dõ
\81E
\92u
\8a·
\83_
\83C
\83A
\83\8d\83O
\82ð
\8f\89\8aú
\89»
\82µ
\82Ä
\95\
\8e¦
2806 procedure TfrmSender.actReplaceExecute(Sender: TObject);
2808 with ReplaceDialog do
2816 //
\8c\9f\8dõ
\81E
\92u
\8a·
2817 procedure TfrmSender.ReplaceDialogFind(Sender: TObject);
2818 var Opt: TSearchOptions;
2821 if frMatchCase in ReplaceDialog.Options then
2822 Opt := Opt + [sfrMatchCase];
2823 if frWholeWord in ReplaceDialog.Options then
2824 Opt := Opt + [sfrWholeWord];
2825 memScript.Search(ReplaceDialog.FindText, Opt);
2828 //
\8c\9f\8dõ
\81E
\92u
\8a·
2829 procedure TfrmSender.ReplaceDialogReplace(Sender: TObject);
2830 var Opt: TSearchOptions;
2833 if frMatchCase in ReplaceDialog.Options then
2834 Opt := Opt + [sfrMatchCase];
2835 if frWholeWord in ReplaceDialog.Options then
2836 Opt := Opt + [sfrWholeWord];
2837 if frReplaceAll in ReplaceDialog.Options then
2838 while memScript.Search(ReplaceDialog.FindText, Opt) do
2839 memScript.SelText := ReplaceDialog.ReplaceText
2842 if memScript.Search(ReplaceDialog.FindText, Opt) then
2843 memScript.SelText := ReplaceDialog.ReplaceText
2847 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
2850 if frmLog.lvwLog.Selected = nil then Exit;
2851 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2852 if Log = nil then Exit;
2853 CopyFromLogToEditor(Log);
2856 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
2857 var Ghost, Script: String;
2860 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2861 if cbxTargetGhost.ItemIndex > 0 then
2862 Ghost := cbxTargetGhost.Text
2865 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost);
2869 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
2870 Y: Integer; State: TDragState; var Accept: Boolean);
2872 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82©
\82ç
\82Ì
\83\8d\83O
\83A
\83C
\83e
\83\80\82Ì
\92¼
\90ÚD&D
\82ð
\8b\96\89Â
\82·
\82é
2873 if Source is TBottleLogDragObject then
2874 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
2877 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
2879 var Src: TBottleLogDragObject;
2882 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82©
\82ç
\83\8d\83O
\83A
\83C
\83e
\83\80\82ðD&D
\82µ
\82Ä
\82
\82é
2883 if not (Source is TBottleLogDragObject) then
2885 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
2887 Src := Source as TBottleLogDragObject;
2889 CopyFromLogToEditor(Log);
2892 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
2894 if Log.LogType <> ltBottle then Exit;
2895 frmSender.actClear.Execute; //
\8c»
\8dÝ
\82Ì
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83b
\83v
\82·
\82é(
\90Ý
\92è
\82É
\82æ
\82Á
\82Ä)
2896 memScript.Lines.Clear;
2897 memScript.Lines.Add(Log.Script);
2898 if Log.Ghost <> '' then
2900 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
2901 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ð
\92Ç
\89Á
\82µ
\82Ä
\82©
\82ç
\8dÄ
\8d\
\92z
\82·
\82é
\82±
\82Æ
\82Å
2902 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
2903 cbxTargetGhost.Items.Add(Log.Ghost);
2904 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
2906 cbxTargetGhost.Invalidate;
2908 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
2912 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
2914 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
2915 if frmLog.SelectedBottleLog = nil then
2917 if frmLog.lvwLog.Selected = nil then
2919 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
2920 frmLog.UpdateWindow;
2921 frmLog.lvwLogChange(Self, nil, ctState);
2924 procedure TfrmSender.ClearEditor;
2925 var TmpScript: String;
2927 DoSaveBuffer: boolean;
2928 SavedScript: TStringList;
2930 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
2931 //
\82Ü
\82¸
\81A
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
\82É
\8c»
\8dÝ
\82Ì
\83X
\83N
\83\8a\83v
\83g
\82ð
\95Û
\91¶
\82·
\82é
2932 DoSaveBuffer := false;
2933 if FScriptBuffer.Count = 0 then
2934 DoSaveBuffer := true
2935 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
2936 DoSaveBuffer := true;
2937 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
2938 DoSaveBuffer := false;
2939 if DoSaveBuffer then
2941 SavedScript := TStringList.Create;
2942 SavedScript.Text := GetScriptText;
2943 FScriptBuffer.Insert(0, SavedScript);
2945 if FScriptBuffer.Count >= 4 then
2946 FScriptBuffer.Delete(FScriptBuffer.Count-1);
2947 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
2949 TmpScript := Pref.DefaultScript;
2950 Position := Pos('|', TmpScript);
2951 if Position < 1 then Position := 1;
2952 TmpScript := StringReplace(TmpScript, '|', '', []);
2953 memScript.Lines.Text := TmpScript;
2954 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
2955 memScript.SelStart := Position-1;
2957 if Visible then memScript.SetFocus;
2958 FScriptModified := false;
2959 memScriptChange(self);