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, MultipleChoiceEditor,
18 IdException, HttpThread, IdHTTP, LogDownload,
19 ScriptConsts, DateUtils, BottleChainRule, BottleChainEvent,
20 SakuraSeekerInstance, HEditor, HTSearch, heClasses, heFountain,
21 SakuraScriptFountain, SppList, SurfacePreview, XDOM_2_3_J3, SsPlayTime,
22 RegexUtils, StrReplace, StrReplaceDialog, ReplacePresetEditor;
25 TSurfacePreviewType = (spHint, spEditor);
27 TfrmSender = class(TForm)
31 mnRegister: TMenuItem;
34 StatusBar: TStatusBar;
37 mnEditConst: TMenuItem;
38 ActionList: TActionList;
40 mnPopPaste: TMenuItem;
43 mnPopSelectAll: TMenuItem;
45 mnPopConst: TMenuItem;
50 mnSelectAll: TMenuItem;
52 ApplicationEvents: TApplicationEvents;
53 mnPopUpTaskTray: TPopupMenu;
54 mnTaskStart: TMenuItem;
56 mnTaskRestore: TMenuItem;
57 mnTaskNewMessage: TMenuItem;
61 mnTaskExit: TMenuItem;
69 mnPopupConst: TPopupMenu;
70 actEditConst: TAction;
72 mnShowToolBar: TMenuItem;
73 mnShowConstBar: TMenuItem;
74 ConstBarMenu: TMainMenu;
76 tbtnClear: TToolButton;
77 tbtnConfirm: TToolButton;
78 tbtnSend: TToolButton;
79 tbtnSeparator: TToolButton;
80 tbtnStart: TToolButton;
81 tbtnSeparator2: TToolButton;
82 tbtnInsertConst: TToolButton;
83 ConstMenuBar: TMenuBar;
88 actCopyAllNoReturn: TAction;
89 mnCopyAllNoReturn: TMenuItem;
90 mnPopCopyAll: TMenuItem;
91 mnPopCopyAllNoReturn: TMenuItem;
93 tbtnSetting: TToolButton;
94 mnStayOnTop: TMenuItem;
96 actExitClient: TAction;
98 tbtnEditConst: TToolButton;
99 actClearBottles: TAction;
100 mnClearBottles: TMenuItem;
101 MediaPlayer: TMediaPlayer;
102 mnGetNewId: TMenuItem;
103 actNextChannel: TAction;
104 actPrevChannel: TAction;
106 mnNextChannel: TMenuItem;
107 mnPrevChannel: TMenuItem;
110 tbtnShowLog: TToolButton;
111 tbtnSleep: TToolButton;
115 mnTaskSleep: TMenuItem;
117 tabChannel: TTabControl;
120 cbxTargetGhost: TComboBox;
121 actVoteMessage: TAction;
122 mnPopUpChannelTab: TPopupMenu;
123 mnLeaveThisChannel: TMenuItem;
125 mnGotoVote: 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;
165 mnReplace: TMenuItem;
166 actSendToEditor: TAction;
167 actSendToLogWindow: TAction;
168 mnSendLogWindow: TMenuItem;
169 actDeleteLogItem: TAction;
171 actEditCopy: TEditCopy;
172 tbtnSendToLogWindow: TToolButton;
173 SsPlayTime: TSsPlayTime;
179 mnPresetReplaceRoot: TMenuItem;
180 procedure actConfirmExecute(Sender: TObject);
181 procedure FormCreate(Sender: TObject);
182 procedure FormDestroy(Sender: TObject);
183 procedure actSendExecute(Sender: TObject);
184 procedure HTTPSuccess(Sender: TObject);
185 procedure HTTPFailure(Sender: TObject);
186 procedure actStartClick(Sender: TObject);
187 procedure actStopExecute(Sender: TObject);
188 procedure FormShow(Sender: TObject);
189 procedure actAboutClick(Sender: TObject);
190 procedure actExitClientExecute(Sender: TObject);
191 procedure actClearExecute(Sender: TObject);
192 procedure memScriptChange(Sender: TObject);
193 procedure mnStayOnTopClick(Sender: TObject);
194 procedure actEditConstExecute(Sender: TObject);
195 procedure mnTaskBarClick(Sender: TObject);
196 procedure FormClose(Sender: TObject; var Action: TCloseAction);
197 procedure ApplicationEventsMinimize(Sender: TObject);
198 procedure ApplicationEventsRestore(Sender: TObject);
199 procedure mnTaskRestoreClick(Sender: TObject);
200 procedure TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
201 procedure FormActivate(Sender: TObject);
202 procedure mnTaskNewMessageClick(Sender: TObject);
203 procedure ApplicationEventsHint(Sender: TObject);
204 procedure memScriptKeyDown(Sender: TObject; var Key: Word;
206 procedure mnShowToolBarClick(Sender: TObject);
207 procedure mnShowConstBarClick(Sender: TObject);
208 procedure mnGoToHPClick(Sender: TObject);
209 procedure LabelTimerTimer(Sender: TObject);
210 procedure actCopyAllExecute(Sender: TObject);
211 procedure actCopyAllNoReturnExecute(Sender: TObject);
212 procedure Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
213 const Param: String);
214 procedure actSettingExecute(Sender: TObject);
215 procedure memScriptKeyPress(Sender: TObject; var Key: Char);
216 procedure Slpp20Disconnect(Sender: TObject);
217 procedure actClearBottlesExecute(Sender: TObject);
218 procedure SakuraSeekerDetectResultChanged(Sender: TObject);
219 procedure mnGetNewIdClick(Sender: TObject);
220 procedure tabChannelChange(Sender: TObject);
221 procedure actPrevChannelExecute(Sender: TObject);
222 procedure actNextChannelExecute(Sender: TObject);
223 procedure cbxTargetGhostDropDown(Sender: TObject);
224 procedure actShowLogExecute(Sender: TObject);
225 procedure actSleepExecute(Sender: TObject);
226 procedure actVoteMessageExecute(Sender: TObject);
227 procedure tabChannelContextPopup(Sender: TObject; MousePos: TPoint;
228 var Handled: Boolean);
229 procedure mnLeaveThisChannelClick(Sender: TObject);
230 procedure mnGotoVoteClick(Sender: TObject);
231 procedure tabChannelMouseMove(Sender: TObject; Shift: TShiftState; X,
233 procedure mnGoToHelpClick(Sender: TObject);
234 procedure tabChannelMouseDown(Sender: TObject; Button: TMouseButton;
235 Shift: TShiftState; X, Y: Integer);
236 procedure tabChannelDragOver(Sender, Source: TObject; X, Y: Integer;
237 State: TDragState; var Accept: Boolean);
238 procedure tabChannelDragDrop(Sender, Source: TObject; X, Y: Integer);
239 procedure tabChannelEndDrag(Sender, Target: TObject; X, Y: Integer);
240 procedure cbxTargetGhostDrawItem(Control: TWinControl; Index: Integer;
241 Rect: TRect; State: TOwnerDrawState);
242 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
243 procedure actAgreeMessageExecute(Sender: TObject);
244 procedure actPrevGhostExecute(Sender: TObject);
245 procedure actNextGhostExecute(Sender: TObject);
246 procedure actResetGhostExecute(Sender: TObject);
247 procedure timDisconnectCheckTimerTimer(Sender: TObject);
248 procedure actDownloadLogExecute(Sender: TObject);
249 procedure cbxTargetGhostChange(Sender: TObject);
250 procedure actFMOExplorerExecute(Sender: TObject);
251 procedure actInsertCueExecute(Sender: TObject);
252 procedure FormResize(Sender: TObject);
253 procedure actCopyExecute(Sender: TObject);
254 procedure actPasteExecute(Sender: TObject);
255 procedure actCutExecute(Sender: TObject);
256 procedure actSelectAllExecute(Sender: TObject);
257 procedure memScriptMouseMove(Sender: TObject; Shift: TShiftState; X,
259 procedure actRecallScriptBufferExecute(Sender: TObject);
260 procedure actEditorPreviewExecute(Sender: TObject);
261 procedure actResetPluginsExecute(Sender: TObject);
262 procedure IdSLPP20Connect(Sender: TObject);
263 procedure actReplaceExecute(Sender: TObject);
264 procedure actSendToEditorExecute(Sender: TObject);
265 procedure actSendToLogWindowExecute(Sender: TObject);
266 procedure memScriptDragOver(Sender, Source: TObject; X, Y: Integer;
267 State: TDragState; var Accept: Boolean);
268 procedure memScriptDragDrop(Sender, Source: TObject; X, Y: Integer);
269 procedure actDeleteLogItemExecute(Sender: TObject);
270 procedure memScriptSelectionChange(Sender: TObject; Selected: Boolean);
271 procedure actUndoExecute(Sender: TObject);
272 procedure actRedoExecute(Sender: TObject);
273 procedure IdSLPP20ConnectFailed(Sender: TObject);
275 FSleeping: boolean; //
\94z
\91\97\83X
\83\8a\81[
\83v
\92\86\82©
\82Ç
\82¤
\82©
277 FConnecting: boolean;
279 FBooted: boolean; //
\8f\89\89ñ
\8bN
\93®
\92Ê
\90M
\97p
280 FEndSession: Boolean; // Windows
\8fI
\97¹
\82ð
\8c\9f\92m
\82µ
\82Ätrue
\82É
\82È
\82é
281 FOriginalCaption: String;
282 FAutoAddAfterGetChannel: boolean; //
\83`
\83\83\83\93\83l
\83\8b\8eæ
\93¾
\8cã
\82É
\83_
\83C
\83A
\83\8d\83O
\82È
\82µ
\82É
283 //
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82·
\82é
\82©
\82Ç
\82¤
\82©
287 FNowChannel: String; //
\8c»
\8dÝ
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b
288 JoinChannelsBackup: TStringList; //
\88ê
\8e\9e\8eg
\97p
290 FScriptModified: boolean; //
\83X
\83N
\83\8a\83v
\83g
\82ª
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\81B
291 //
\83\8d\81[
\83J
\83\8b\8am
\94F
\8b
\90§
\97p
\83t
\83\89\83O
\81BTRichEdit.Modified
\82Í
292 //
\95Ê
\82Ì
\97p
\93r
\82Å
\8eg
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8eg
\82¦
\82È
\82¢
294 FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
295 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)
297 FBottleSstp: TBottleSstp; //
\8dÄ
\91\97\83v
\83\8d\83O
\83\89\83\80
299 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Ý)
300 FBeginConnectFailCount: integer; //
\89½
\93x
\82à
\90Ú
\91±
\8e¸
\94s
\82µ
\82½
\82ç
\83\8a\83g
\83\89\83C
\92\86\8e~
302 FVisiblePreviewGhost: String;
303 FVisiblePreviewSurface: integer; //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82Å
\8c©
\82¦
\82Ä
\82¢
\82é
\82à
\82Ì
304 FVisibleMenuItem: TMenuItem; //
\83N
\83\8a\83b
\83N
\82³
\82ê
\82½
\83\81\83j
\83\85\81[
\83A
\83C
\83e
\83\80\81B
305 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82ª
\83\81\83j
\83\85\81[
\82Ì
\89º
\82É
306 //
\89B
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\8bL
\89¯
\82µ
\82Ä
\82¨
\82
308 FTargetGhostExpand: boolean; //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ª
\81A
309 //
\88ê
\8e\9e\93I
\82É
\91S
\95\94\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\82Ì
\83t
\83\89\83O
311 FScriptBuffer: TObjectList; //
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
313 FWM_TaskBarCreated: WORD; //
\83^
\83X
\83N
\83o
\81[
\93o
\98^
\97p
\83E
\83B
\83\93\83h
\83E
\83\81\83b
\83Z
\81[
\83WID
315 procedure SetStatusText(const Value: String);
316 procedure SetSleeping(const Value: boolean);
318 procedure SetConnecting(const Value: boolean);
319 procedure SetAdded(const Value: boolean);
320 procedure mnConstClick(Sender: TObject);
321 procedure mnConstGroupClick(Sender: TObject);
322 procedure mnPresetReplaceClick(Sender: TObject);
323 property Added: boolean read FAdded write SetAdded;
324 property Sleeping: boolean read FSleeping write SetSleeping;
325 property StatusText: String read FStatusText write SetStatusText;
326 function GetScriptText: String;
327 procedure ChangeTaskIcon;
328 procedure ShowHintLabel(const Mes: String; Col: TColor = clBlue);
329 procedure UpdateLayout;
330 procedure DispatchBottle(EventType: TIdSlppEventType; Dat: THeadValue);
331 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
332 procedure UpdateChannelInfo(Dat: THeadValue);
333 procedure UpdateJoinChannelList(Dat: THeadValue);
334 procedure NoLuidError;
335 procedure UpdateIfGhostBox;
336 function BuildMenuConditionCheck(const IfGhost, Ghost: String): boolean;
337 procedure BuildMenu(Root: TMenuItem; Simple: boolean);
338 procedure BuildReplaceMenu(Root: TMenuItem);
339 procedure PlaySound(const FileName: String);
340 //TBottleSstp
\8aÖ
\8cW
\83C
\83x
\83\93\83g
\83n
\83\93\83h
\83\89
341 procedure BottleSstpResendCountChange(Sender: TObject);
342 procedure BottleSstpResendTrying(Sender: TObject; MID: String);
343 procedure BottleSstpResendEnd(Sender: TObject; MID: String);
344 function IsSurfaceTag(const Script: String; var ID: integer): boolean;
345 procedure DoSurfacePreview(Surface: integer; const Kind:
346 TSurfacePreviewType);
347 function GetSurfacePreviewPositionHint(w, h: integer): TPoint;
348 function GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
349 procedure EditorPreview;
350 //
\83^
\83O
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\95Ï
\8a·
\82·
\82é
351 function TagReplace(Script: String;
352 Before, After: array of String): String; overload;
353 function TagReplace(Script: String;
354 Before, After: TStrings): String; overload;
355 //
\83T
\81[
\83t
\83B
\83X
\82ð
\95Ï
\8a·
\82·
\82é
356 function ReplaceSurface(Script: String; Params: TCollection): String;
357 procedure ClearEditor;
358 procedure CopyFromLogToEditor(Log: TLogItem);
360 procedure AppendTextLog(const FileName, Line: String);
361 procedure AppendXMLLog(const FileName: String; Args: THeadValue);
363 procedure WndProc(var Message: TMessage); override;
364 procedure WMQueryEndSession(var msg: TWMQueryEndSession);
365 message WM_QUERYENDSESSION;
367 function DoTrans(var Script: String;
368 Options: TScriptTransOptions): String; overload;
369 function DoTrans(var Script: String;
370 Options: TScriptTransOptions; out FoundURL: boolean): String; overload;
371 function ScriptTransForSSTP(const Script: String;
372 out Error: String): String; overload;
373 procedure BeginConnect;
374 procedure RetryBeginConnect;
375 procedure EndConnect;
376 procedure ConstructMenu(Simple: boolean);
377 property Connecting: boolean read FConnecting write SetConnecting;
378 property BottleSstp: TBottleSstp read FBottleSstp;
379 function GhostNameToSetName(const Ghost: String): String;
380 procedure PostCommand(const Command: array of String); overload;
381 procedure PostCommand(Command: TStrings); overload;
382 procedure PostSetChannel(Channels: TStrings);
383 procedure SaveChainRuleList;
388 frmSender: TfrmSender;
391 PanelConnecting = 0; //
\81u
\90Ú
\91±
\92\86\81v
\95\
\8e¦
\97p
392 PanelBytes = 1; //
\81\9b\81\9b\83o
\83C
\83g
393 PanelCount = 2; //Local Proxy
\81A
\8c»
\8dÝ
\81\9b\8c\8f\91Ò
\82¿
394 PanelMembers = 3; //
\81\9b\81\9b\90l
395 PanelStatus = 4; //SSTP Bottle
\83T
\81[
\83o
\82É
\93o
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81c
\82È
\82Ç
398 IconDisconnected = 18;
400 IconSleepDisconnected = 20;
402 WarningColor = clRed;
404 SendButtonLongHint = 'Bottle
\82Ì
\91\97\90M';
406 function Token(const Str: String; const Delimiter: char;
407 const Index: integer): String;
409 function StringReplaceEx(const Before: String; List: THeadValue): String;
410 procedure OpenBrowser(const Url: String);
414 uses SendConfirm, SettingForm, ChannelListForm, LogForm,
415 MessageBox, FMOExplorer, EditorTalkShow;
419 //
\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
420 function Token(const Str: String; const Delimiter: char;
421 const Index: integer): String;
422 var i, c, len: integer;
428 while i <= len do begin
429 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
431 if c > Index then Break;
432 end else if c = Index then Result := Result + Str[i];
437 //
\83u
\83\89\83E
\83U
\82ÅURL
\82ð
\8aJ
\82
\8f\88\97\9d
438 procedure OpenBrowser(const Url: String);
440 if Pref.BrowserExeName='' then
442 ShellExecute(HWND(nil), 'open', PChar(Url), nil, nil, SW_SHOW);
445 ShellExecute(HWND(nil), 'open', PChar(Pref.BrowserExeName), PChar(Url), nil, SW_SHOW);
449 //
\95¶
\8e\9a\97ñ
\82ð
\92u
\82«
\8a·
\82¦
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
450 function StringReplaceEx(const Before: String; List: THeadValue): String;
452 i, MinPos, MinKey, p: integer;
461 for i := 0 to List.Count-1 do
463 p := Pos(List.KeyAt[i], Work);
464 if (p > 0) and ((p < MinPos) or (MinPos < 0)) then
472 Result := Result + Work;
476 Result := Result + Copy(Work, 1, MinPos-1) + List.ValueAt[MinKey];
477 Delete(Work, 1, (MinPos - 1) + Length(List.KeyAt[MinKey]));
485 procedure TfrmSender.actConfirmExecute(Sender: TObject);
487 AScript, Err, AGhost: String;
491 // Partial Confirmation
492 if memScript.SelText <> '' then
495 if not Pref.AutoPartialConfirm then
496 if not MultipleChoiceEdit('
\8am
\94F', ['
\91I
\91ð
\95\94\95ª
\82Ì
\82Ý', '
\83X
\83N
\83\8a\83v
\83g
\91S
\91Ì'], Choice) then
500 AScript := memScript.SelText;
501 AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
503 AScript := GetScriptText;
505 AScript := GetScriptText;
506 AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
508 if Length(AScript) = 0 then Exit;
510 AScript := ScriptTransForSSTP(AScript, Err);
517 if cbxTargetGhost.ItemIndex > 0 then
518 AGhost := cbxTargetGhost.Text
519 else if FNowChannel <> '' then
520 AGhost := ChannelList.Channel[FNowChannel].Ghost
524 if Pref.IgnoreTimeCritical then
525 AScript := TagReplace(AScript, ['\t'], ['']);
527 Item := TLogItem.Create;
533 Channel := '
\81y
\8am
\94F
\81z';
536 BottleSstp.Unshift(Item);
541 FScriptModified := false;
544 procedure TfrmSender.FormCreate(Sender: TObject);
545 var Str: TStringList;
547 FScriptBuffer := TObjectList.Create(true);
549 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
550 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
551 ScriptConstList.LoadFromDir(FConstDir);
552 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
553 Spps.LoadFromDirectory(FSppDir);
554 ConstructMenu(false);
555 BuildReplaceMenu(mnPresetReplaceRoot);
557 Str := TStringList.Create;
560 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
561 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
564 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
565 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
567 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');
568 Application.Terminate;
569 Application.ProcessMessages;
577 FOriginalCaption := Self.Caption;
580 mnShowToolBar.Checked := Pref.ShowToolBar;
581 mnShowConstBar.Checked := Pref.ShowConstBar;
582 if Pref.StayOnTop then begin
583 FormStyle := fsStayOnTop;
584 mnStayOnTop.Checked := true;
586 FormStyle := fsNormal;
587 mnStayOnTop.Checked := false;
590 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
591 mnGoToHP.Hint := Pref.HomePage;
592 mnGotoVote.Hint := Pref.VotePage;
593 mnGotoHelp.Hint := Pref.HelpPage;
595 mnGetNewId.Enabled := (Pref.LUID = '');
597 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
599 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
600 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
602 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
603 Application.Terminate;
606 //
\8dÄ
\90¶
\8e\9e\8aÔ
\90\84\92è
\83R
\83\93\83|
\81[
\83l
\83\93\83g
\82É
\83p
\83\89\83\81\81[
\83^
\82ð
\8ew
\92è
607 SsPlayTime.PlayTimeParams := Pref.PlayTimeParams;
609 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
610 with Pref.SenderWindowPosition do begin
613 Self.Width := Right - Left + 1;
614 Self.Height := Bottom - Top + 1;
617 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
618 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
620 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
621 actClearExecute(Sender);
622 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
624 //
\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»)
625 UpdateJoinChannelList(nil);
627 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
628 FBottleSstp := TBottleSstp.Create(false);
629 with FBottleSstp do begin
630 OnResendCountChange := BottleSstpResendCountChange;
631 OnResendTrying := BottleSstpResendTrying;
632 OnResendEnd := BottleSstpResendEnd;
636 procedure TfrmSender.FormDestroy(Sender: TObject);
638 if FScriptBuffer <> nil then
641 if FBottleSstp <> nil then begin
642 FBottleSstp.Terminate;
646 with Pref.SenderWindowPosition do begin
649 Right := Self.Left + Self.Width - 1;
650 Bottom := Self.Top + Self.Height - 1;
653 if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
655 ScriptConstList.Save;
658 BottleChainRuleList.Free;
663 procedure TfrmSender.SetConnecting(const Value: boolean);
665 FConnecting := Value;
667 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
668 actStart.Enabled := false;
669 actStop.Enabled := false;
670 actSend.Enabled := false;
671 actVoteMessage.Enabled := false;
672 actAgreeMessage.Enabled := false;
673 mnGetNewId.Enabled := false;
674 Screen.Cursor := crAppStart;
676 StatusBar.Panels[PanelConnecting].Text := '';
677 actStart.Enabled := true;
678 actStop.Enabled := true;
679 actSend.Enabled := true;
680 frmLog.lvwLogChange(Self, nil, ctState);
681 mnGetNewId.Enabled := Pref.LUID = '';
682 Screen.Cursor := crDefault;
686 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
687 procedure TfrmSender.actSendExecute(Sender: TObject);
688 var Talk, Ghost: String;
689 Command: TStringList;
693 if Length(GetScriptText) = 0 then begin
694 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
698 if Pref.LUID = '' then begin
702 if tabChannel.TabIndex < 0 then begin
703 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
704 '
\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');
707 if ChannelList.Channel[FNowChannel].NoPost then begin
709 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
714 Talk := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
715 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
716 if Err <> '' then begin
717 MessageDlg(Err, mtWarning, [mbOk], 0);
721 if Pref.NeedConfirmBeforeSend and FScriptModified then
723 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
727 if Length(Talk) < Pref.MinScriptLength then
729 MessageDlg('
\8dÅ
\8f¬
\91\97\90M
\83o
\83C
\83g
\90\94\88È
\89º
\82Å
\82·
\81B', mtError, [mbOk], 0);
733 if not Pref.NoConfirm then begin
734 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
738 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text;
739 Command := TStringList.Create;
741 with Command do begin
742 Add('Command: sendBroadcast');
743 Add('Channel: ' + FNowChannel);
744 Add('LUID: ' + Pref.LUID);
745 Add('Agent: ' + VersionString);
746 if Ghost <> '' then Add('Ghost: ' + Ghost);
747 Add('Talk: ' + Talk);
749 PostCommand(Command);
754 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
755 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
756 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
760 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
765 procedure TfrmSender.BeginConnect;
767 if Pref.LUID = '' then begin
771 IdSlpp20.LUID := Pref.LUID;
772 self.Cursor := crHourGlass;
773 if IdSlpp20.Connected then IdSlpp20.Disconnect;
774 if Pref.UseHttpProxy then begin
775 IdSlpp20.Host := Pref.ProxyAddress;
776 IdSlpp20.Port := Pref.ProxyPort;
777 IdSlpp20.ProxyMode := true;
778 if Pref.ProxyNeedAuthentication then begin
779 IdSlpp20.ProxyUser := Pref.ProxyUser;
780 IdSlpp20.ProxyPass := Pref.ProxyPass;
782 IdSlpp20.ProxyUser := '';
783 IdSlpp20.ProxyPass := '';
786 IdSlpp20.Host := Pref.BottleServer;
787 IdSlpp20.Port := Pref.BottleServerPort;
788 IdSlpp20.ProxyMode := false;
790 IdSlpp20.ConnectServer;
791 self.Cursor := crDefault;
794 procedure TfrmSender.EndConnect;
796 IdSlpp20.OnDisconnect := nil;
800 procedure TfrmSender.SetAdded(const Value: boolean);
802 if FAdded = Value then Exit;
805 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
808 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
810 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
814 procedure TfrmSender.HTTPSuccess(Sender: TObject);
815 var Str, ResStr, Command: String;
816 HeadValue: THeadValue;
818 SetChannel: TStringList;
821 Str := (Sender as THttpDownloadThread).RecvString;
825 HeadValue := THeadValue.Create(Str);
828 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89ð
\90Í
\82Å
\82«
\82È
\82¢
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
831 Command := HeadValue['Command'];
832 ResStr := HeadValue['Result'];
833 if ResStr = 'Err' then begin
834 if HeadValue['ExtraMessage'] <> '' then begin
836 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
837 HeadValue['ExtraMessage']);
840 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
843 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
844 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
845 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
846 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
847 if Pref.ResetIfGhostAfterSend then begin
848 actResetGhostExecute(Self);
850 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
851 if Pref.ClearAfterSend then begin
854 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
855 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
857 if (Command = 'getNewId') then begin
858 if ResStr = 'OK' then begin
859 Pref.LUID := HeadValue['NewID'];
860 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
861 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
862 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
863 'LUID: ' + Pref.LUID + #13#10 +
864 '
\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' +
865 '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' +
866 '
\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');
867 mnGetNewId.Enabled := false;
870 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
873 if (Command = 'voteMessage') then begin
874 if ResStr = 'OK' then begin
875 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
878 if (Command = 'getChannels') and (ResStr = 'OK') then begin
879 UpdateChannelInfo(HeadValue);
882 if FAutoAddAfterGetChannel then begin
883 SetChannel := TStringList.Create;
884 if JoinChannelsBackup <> nil then begin
885 //
\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
886 SetChannel.Assign(JoinChannelsBackup);
888 //
\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¾
889 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
890 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
891 SetChannel.Add(Pref.AutoJoinChannels[i]);
895 Application.CreateForm(TfrmChannelList, frmChannelList);
897 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
898 SetChannel := TStringList.Create;
899 SetChannel.Assign(frmChannelList.JoinList);
902 frmChannelList.Release;
905 if SetChannel <> nil then PostSetChannel(SetChannel);
907 if SetChannel <> nil then FreeAndNil(SetChannel);
910 if (Command = 'setChannels') then begin
911 if ResStr <> 'OK' then begin
913 frmMessageBox.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¢');
914 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
917 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
923 procedure TfrmSender.actStartClick(Sender: TObject);
925 if Pref.LUID = '' then begin
929 if not IdSlpp20.Connected then begin
930 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
934 FAutoAddAfterGetChannel := false;
935 PostCommand(['Command: getChannels']);
939 procedure TfrmSender.actStopExecute(Sender: TObject);
941 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
942 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
946 procedure TfrmSender.FormShow(Sender: TObject);
948 if FBooted or Application.Terminated then Exit;
949 //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
950 if Pref.LUID <> '' then BeginConnect
951 else mnGetNewIdClick(Self);
953 FAutoAddAfterGetChannel := Pref.AutoStart;
957 frmSurfacePreview.Show;
960 //
\83G
\83f
\83B
\83^
\83v
\83\8c\83r
\83\85\81[
\82ª
\91O
\89ñ
\95\
\8e¦
\8fó
\91Ô
\82È
\82ç
\82±
\82±
\82Å
\95\
\8e¦
\82·
\82é
961 if Pref.ShowEditorPreviewWindow then actEditorPreviewExecute(Sender);
963 SakuraSeeker.BeginDetect;
964 SakuraSeekerDetectResultChanged(self);
965 if (SakuraSeeker.Count = 0) and not Pref.NoWarnOfEmptyFMO then
966 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 +
967 '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 +
968 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
971 procedure TfrmSender.actAboutClick(Sender: TObject);
975 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
976 Str := Str + Format('Compiler Version: %f', [CompilerVersion]) + #13#10;
977 Str := Str + 'Indy Version: ' + IdSLPP20.Version;
978 frmMessageBox.ShowMessage(Str);
981 procedure TfrmSender.actExitClientExecute(Sender: TObject);
986 procedure TfrmSender.actClearExecute(Sender: TObject);
988 Script, Default: String;
990 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
991 Default := StringReplace(Pref.DefaultScript, '|', '', [rfReplaceAll]);
992 Default := StringReplace(Default, #13#10, '', [rfReplaceAll]);
994 if (Pref.AutoClip) and (Length(GetScriptText) > 0) and (Script <> Default) then
995 actSendToLogWindow.Execute
1000 procedure TfrmSender.memScriptChange(Sender: TObject);
1005 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
1006 Text := Format('%d
\83o
\83C
\83g/%d
\95b', [Length(Script), SsPlayTime.PlayTime(Script) div 1000]);
1007 StatusBar.Panels[PanelBytes].Text := Text;
1008 FScriptModified := true;
1012 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
1014 Pref.StayOnTop := not Pref.StayOnTop;
1015 mnStayOnTop.Checked := Pref.StayOnTop;
1016 if Pref.StayOnTop then begin
1017 FormStyle := fsStayOnTop;
1019 FormStyle := fsNormal;
1024 function TfrmSender.GetScriptText: String;
1026 Result := memScript.Lines.Text;
1029 procedure TfrmSender.mnConstClick(Sender: TObject);
1032 i := (Sender as TMenuItem).Tag;
1033 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
1036 procedure TfrmSender.actEditConstExecute(Sender: TObject);
1038 ScriptConstList.LoadFromDir(FConstDir);
1040 Application.CreateForm(TfrmConstEditor, frmConstEditor);
1041 frmConstEditor.Execute;
1042 ScriptConstList.Save;
1044 frmConstEditor.Release;
1046 ConstructMenu(false);
1049 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
1051 Application.Minimize;
1052 WindowState := wsNormal;
1055 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
1058 TaskTray.Registered := false;
1061 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
1064 Application.ShowMainForm := false;
1065 ShowWindow(Application.Handle, SW_HIDE);
1068 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
1070 Application.ShowMainForm := true;
1074 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1076 Application.Restore;
1079 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1081 Application.Restore;
1084 procedure TfrmSender.FormActivate(Sender: TObject);
1089 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1091 Application.Restore;
1092 actClearExecute(Sender);
1095 procedure TfrmSender.ChangeTaskIcon;
1100 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1102 if Sleeping then IcoNum := IconSleepDisconnected
1103 else IcoNum := IconDisconnected;
1106 Ico := TIcon.Create;
1108 imgIcon.GetIcon(IcoNum, Ico);
1109 TaskTray.Icon := Ico;
1110 TaskTray.Registered := true;
1115 ; // 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
1116 //
\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
1117 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1121 procedure TfrmSender.SetStatusText(const Value: String);
1123 FStatusText := Value;
1124 StatusBar.Panels[PanelStatus].Text := Value;
1127 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1130 if Length(Application.Hint) > 0 then
1132 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1133 Application.HintColor := clInfoBk;
1134 if (Application.Hint = SendButtonLongHint)
1135 and (FNowChannel <> '') then
1137 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1138 Application.HintColor := clYellow;
1139 Application.ActivateHint(Mouse.CursorPos);
1141 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1143 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1144 DoSurfacePreview(id, spHint);
1148 StatusBar.Panels[PanelStatus].Text := FStatusText;
1149 frmSurfacePreview.HideAway;
1153 procedure TfrmSender.ConstructMenu(Simple: boolean);
1155 BuildMenu(mnPopConst, Simple);
1156 BuildMenu(mnPopUpConst.Items, Simple);
1157 BuildMenu(ConstBarMenu.Items, Simple);
1159 {$IFDEF CONDITIONALEXPRESSIONS}
1160 {$IF Declared(CompilerVersion)}
1161 {$IF CompilerVersion < 15.0} // Delphi6
\88È
\89º
\82È
\82ç
1162 //
\83\81\83j
\83\85\81[
\82ð
\88ê
\93x
\8fÁ
\82·
1163 //
\82È
\82º
\82©2
\89ñ
\96Ú
\88È
\8d~
\82Ì
\95\
\8e¦
\82ª
\82¨
\82©
\82µ
\82
\82È
\82é
\96â
\91è
\82Ì
\8fC
\90³
1164 // ported from YasagureClient
1165 ConstMenuBar.AutoSize := false;
1166 ConstMenuBar.Menu := nil;
1171 ConstMenuBar.Menu := ConstBarMenu;
1172 ConstMenuBar.Width := 1000;
1173 ConstMenuBar.AutoSize := true;
1176 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1177 Shift: TShiftState);
1179 Func: TReturnKeyFunction;
1181 if (Key = VK_RETURN) then begin
1182 if (ssShift in Shift) then
1183 Func := Pref.WhenShiftReturn
1184 else if (ssCtrl in Shift) then
1185 Func := Pref.WhenCtrlReturn
1187 Func := Pref.WhenReturn;
1190 with tbtnInsertConst do
1191 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1192 mnPopUpConst.Popup(Pos.X, Pos.Y);
1195 memScript.SelText := '\n';
1199 memScript.SelText := '\n'#13#10;
1202 memScript.SelText := #13#10
1208 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1210 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1211 Pref.ShowToolBar := mnShowToolBar.Checked;
1215 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1217 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1218 Pref.ShowConstBar := mnShowConstBar.Checked;
1222 procedure TfrmSender.UpdateLayout;
1224 with SakuraScriptFountain do begin
1225 TagColor.Color := Pref.MarkUpColor;
1226 TagErrorColor.Color := Pref.MarkErrorColor;
1227 Scope0Color.Color := Pref.TalkColorH;
1228 Scope1Color.Color := Pref.TalkColorU;
1229 SynchronizedColor.Color := Pref.TalkColorS;
1231 memScript.Ruler.Visible := Pref.ShowRuler;
1232 memScript.Ruler.Color := Pref.TextColor;
1233 memScript.Color := Pref.BgColor;
1235 ToolBar.Visible := Pref.ShowToolBar;
1236 ConstMenuBar.Visible := Pref.ShowConstBar;
1239 with tabChannel do begin
1240 TabPosition := Pref.TabPosition;
1241 case Pref.TabPosition of
1242 tpTop: Align := alTop;
1243 tpBottom: Align := alBottom;
1245 TabWidth := Pref.TabWidth;
1249 function TfrmSender.DoTrans(var Script: String;
1250 Options: TScriptTransOptions; out FoundURL: boolean): String;
1251 var UrlCancel, Mark: String;
1252 Url, UrlName: array[0..6] of String;
1253 i, j, u, UrlCount: integer;
1254 LastSurfaceH, LastSurfaceU: integer;
1255 UnyuTalking: boolean;
1256 QuickSection, Synchronize: boolean;
1257 Warnings: TStringList;
1262 UnyuTalking := false;
1263 QuickSection := false;
1264 Synchronize := false;
1265 SsParser.LeaveEscape := true;
1266 SsParser.EscapeInvalidMeta := false;
1267 SsParser.InputString := Script;
1269 Warnings := TStringList.Create;
1271 for i := 0 to SsParser.Count-1 do begin
1272 if SsParser[i] = '\t' then begin
1273 if not(toIgnoreTimeCritical in Options) then
1274 Script := Script + '\t';
1275 end else if SsParser[i] = '\e' then begin
1277 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1278 if toConvertURL in Options then begin
1279 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1280 for u := 7 downto 1 do begin
1281 if (SsParser.Match(SsParser[i],
1282 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1283 '-', '%b', [rfReplaceAll]))) > 0 then begin
1284 for j := 1 to u do begin
1285 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1286 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1287 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1288 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1291 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1292 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1294 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1295 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1296 Url[0] := SsParser.GetParam(SsParser[i], 1);
1297 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1298 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1299 if Pos('http://', Url[0]) > 0 then begin
1301 if not QuickSection then
1302 Script := Script + '\_q' + Url[0] + '\_q'
1304 Script := Script + Url[0];
1307 end else Script := Script + SsParser[i];
1309 Mark := SsParser[i];
1310 if Mark = '\h' then begin
1311 UnyuTalking := false;
1312 if toHUTagTo01Tag in Options then Mark := '\0';
1313 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1314 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');
1315 end else if Mark = '\u' then begin
1316 UnyuTalking := true;
1317 if toHUTagTo01Tag in Options then Mark := '\1';
1318 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1319 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');
1320 end else if Mark = '\_q' then begin
1321 QuickSection := not QuickSection;
1322 end else if Mark = '\_s' then begin
1323 Synchronize := not Synchronize;
1324 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1325 if UnyuTalking then begin
1326 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1329 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1332 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1333 if UnyuTalking then begin
1334 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1336 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1339 Script := Script + Mark;
1342 if UrlCount > 0 then begin
1344 Script := Script + '\h\n';
1345 if not (toNoChoice in Options) then begin
1346 for i := 0 to UrlCount-1 do begin
1347 Script := Script + Format('\q%d[%s][%s]',
1348 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1350 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1351 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1353 Script := Script + '\h';
1354 for i := 0 to UrlCount-1 do begin
1355 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1357 Script := Script + Format('\n{%s}', [UrlCancel]);
1361 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1362 if toWaitScriptEnd in Options then begin
1363 i := Pref.WaitScriptEnd;
1364 while i > 0 do begin
1366 Script := Script + '\w9';
1369 Script := Script + '\w' + IntToStr(i);
1375 Script := Script + '\e';
1376 RegExp.Subst('s/\r\n//gk', Script);
1378 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1379 for i := 0 to SsParser.Count-1 do begin
1380 if SsParser.MarkUpType[i] = mtTagErr then begin
1381 Result := '"' + SsParser[i] + '"'#13#10 +
1382 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1386 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1387 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1391 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1392 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1393 mbOkCancel, 0) = mrCancel then
1394 Result := Warnings.Text;
1401 function TfrmSender.DoTrans(var Script: String;
1402 Options: TScriptTransOptions): String;
1405 Result := DoTrans(Script, Options, dum);
1408 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1410 OpenBrowser(Pref.HomePage);
1413 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1415 lblMessage.Caption := Mes;
1416 lblMessage.Font.Color := Col;
1417 lblMessage.Visible := true;
1418 LabelTimer.Enabled := false;
1419 LabelTimer.Enabled := true;
1422 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1424 LabelTimer.Enabled := false;
1425 lblmessage.Visible := false;
1428 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1432 Str := memScript.Lines.Text;
1433 Clip := ClipBoard();
1434 Clip.SetTextBuf(PChar(Str));
1437 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1441 Str := memScript.Lines.Text;
1442 RegExp.Subst('s/\r\n//gk', Str);
1443 Clip := ClipBoard();
1444 Clip.SetTextBuf(PChar(Str));
1447 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1448 const Param: String);
1449 var HeadValue: THeadValue;
1451 HeadValue := THeadValue.Create(Param);
1454 etScript, etForceBroadcast, etUnicast: begin
1455 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1456 DispatchBottle(EventType, HeadValue);
1459 etMemberCount: begin
1460 //
\91\8d\8eQ
\89Á
\8eÒ
\90\94
1461 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1464 etChannelCount: begin
1465 //
\83`
\83\83\83\93\83l
\83\8b\95Ê
\8eQ
\89Á
\8eÒ
\90\94
1467 if HeadValue['Channel'] <> '' then begin
1468 if ChannelList.Channel[HeadValue['Channel']] <> nil then begin
1469 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1477 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1479 FBeginConnectFailCount := 0;
1480 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1481 if not Connecting then
1482 PostCommand(['Command: getChannels']);
1484 SakuraSeeker.BeginDetect;
1486 on E: Exception do ShowHintLabel(E.Message,WarningColor);
1490 etChannelList: begin
1491 UpdateJoinChannelList(HeadValue);
1492 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1493 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1494 JoinChannelsBackup.Assign(JoinChannels);
1497 etCloseChannel: begin
1498 //
\83`
\83\83\83\93\83l
\83\8b\94p
\8e~
1499 if HeadValue['Channel'] <> '' then begin
1500 with JoinChannels do
1501 if IndexOf(HeadValue['Channel']) >= 0 then
1502 Delete(IndexOf(HeadValue['Channel']));
1503 with tabChannel do begin
1504 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1505 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1506 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1507 tabChannelChange(self);
1509 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1511 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1512 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1516 etForceBroadcastInformation: begin
1517 //
\93\8a\95[
\81^
\93¯
\88Ó
\81^
\82»
\82Ì
\91¼
\83u
\83\8d\81[
\83h
\83L
\83\83\83X
\83g
\8fî
\95ñ
1518 if HeadValue['MID'] <> '' then begin
1519 try //Num
\82ª
\90\94\92l
\82Å
\82È
\82©
\82Á
\82½
\82Æ
\82«
\91Î
\8dô
1520 if HeadValue['Type'] = 'Vote' then begin
1521 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1522 end else if HeadValue['Type'] = 'Agree' then begin
1523 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1535 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1537 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1539 TaskTray.TipString := 'SSTP Bottle Client (' +
1540 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1542 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1544 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1547 procedure TfrmSender.actSettingExecute(Sender: TObject);
1549 Application.CreateForm(TfrmSetting, frmSetting);
1559 BuildReplaceMenu(mnPresetReplaceRoot);
1562 frmLog.UpdateWindow;
1565 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1567 if (Key = #13) or (Key = #10) then Key := Char(0);
1570 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1573 UpdateJoinChannelList(nil);
1574 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1575 if not Application.Terminated then RetryBeginConnect;
1578 procedure TfrmSender.SetSleeping(const Value: boolean);
1581 FBottleSstp.ResendSleep := Value;
1585 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1588 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]),
1589 mtWarning, mbOkCancel, 0);
1590 if Re = mrOk then begin
1592 frmLog.AllBottleOpened;
1593 frmLog.UpdateWindow;
1597 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1599 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1602 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1604 Ch: TChannelListItem;
1607 for i := 1 to Dat.IntData['Count'] do begin
1608 Ch := TChannelListItem.Create;
1609 Ch.Name := Dat[Format('CH%d_name', [i])];
1610 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1611 Ch.Info := Dat[Format('CH%d_info', [i])];
1612 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1613 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1614 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1615 ChannelList.Add(Ch);
1620 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1622 PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1625 procedure TfrmSender.NoLuidError;
1628 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1629 '
\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+
1630 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1633 procedure TfrmSender.tabChannelChange(Sender: TObject);
1635 if tabChannel.TabIndex >= 0 then begin
1636 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1637 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1642 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1643 ConstructMenu(true);
1646 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1648 with tabChannel do begin
1649 if Tabs.Count = 0 then Exit;
1650 if TabIndex=0 then TabIndex := Tabs.Count-1
1651 else TabIndex := TabIndex-1;
1653 tabChannelChange(Self);
1656 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1658 with tabChannel do begin
1659 if Tabs.Count = 0 then Exit;
1660 if TabIndex=Tabs.Count-1 then TabIndex := 0
1661 else TabIndex := TabIndex+1;
1663 tabChannelChange(Self);
1666 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1670 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1671 if nodat then Dat := THeadValue.Create('');
1673 for i := 0 to Dat.Count-1 do
1674 if Dat.KeyAt[i] = 'Entry' then begin
1675 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1676 JoinChannels.Add(RegExp[1]);
1678 with tabChannel do begin
1683 for i := 0 to JoinChannels.Count-1 do begin
1684 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1685 if ChannelList.Channel[JoinChannels[i]] <> nil then
1686 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1687 Tabs.Add(JoinChannels[i]);
1690 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1691 //
\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)
1693 for i := 0 to Tabs.Count-1 do
1694 if Tabs[i] = FNowChannel then TabIndex := i;
1695 if Tabs.Count > 0 then begin
1696 FNowChannel := Tabs[TabIndex];
1697 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1700 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1702 Visible := Tabs.Count > 0;
1703 if Tabs.Count > 1 then begin
1704 actNextChannel.Enabled := true;
1705 actPrevChannel.Enabled := true;
1707 actNextChannel.Enabled := false;
1708 actPrevChannel.Enabled := false;
1710 OnChange := tabChannelChange;
1712 if nodat then Dat.Free;
1713 if JoinChannels.Count = 0 then begin
1714 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1715 actSend.Enabled := false;
1717 Self.Caption := FOriginalCaption;
1718 actSend.Enabled := true;
1722 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1724 SakuraSeeker.BeginDetect;
1728 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1731 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1734 procedure TfrmSender.actSleepExecute(Sender: TObject);
1736 if actSleep.Checked then begin
1737 actSleep.Checked := false;
1738 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1740 actSleep.Checked := true;
1741 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1743 Sleeping := actSleep.Checked;
1748 procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1750 var Opt: TSstpSendOptions;
1751 Event: TBottleChainBottleEvent;
1752 Script, Sender, Ghost, Channel, ErrorMes: String;
1753 BreakFlag, NoDispatch: boolean;
1754 Sound, LogName: String;
1755 i, j, k, SkipCount: integer;
1756 Rule: TBottleChainRule;
1757 Action: TBottleChainAction;
1758 LogNameList: TStringList;
1760 ReplaceHash: THeadValue;
1762 Channel := Dat['Channel'];
1765 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1766 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1768 etScript: Sender := Channel;
1769 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1770 etUnicast: Sender := Dat['SenderUID'];
1773 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1774 if Dat['IfGhost'] <> '' then begin
1775 Ghost := Dat['IfGhost'];
1777 if ChannelList.Channel[Channel] <> nil then
1778 Ghost := ChannelList.Channel[Channel].Ghost;
1780 Dat['TargetGhost'] := Ghost;
1782 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1783 ReplaceHash := THeadValue.Create;
1784 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1785 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1786 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1787 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1788 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1789 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1790 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1791 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1792 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1794 Event := TBottleChainBottleEvent.Create;
1797 if EventType = etScript then Event.LogType := ltBottle
1798 else Event.LogType := ltSystemLog;
1800 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1801 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1802 if ErrorMes <> '' then begin
1803 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'+
1804 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1809 NoDispatch := false;
1811 LogNameList := TStringList.Create;
1814 for i := 0 to BottleChainRuleList.Count-1 do begin
1815 if SkipCount > 0 then begin
1819 Rule := BottleChainRuleList[i];
1820 if not Rule.Enabled then Continue;
1821 if not Rule.Check(Event) then Continue;
1822 for j := 0 to Rule.Actions.Count-1 do begin
1823 Action := (Rule.Actions[j] as TBottleChainAction);
1824 if Action is TBottleChainAbortRuleAction then
1826 if Action is TBottleChainSkipRuleAction then
1827 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1828 if (Action is TBottleChainSoundAction) and (Sound = '') then
1830 Sound := (Action as TBottleChainSoundAction).SoundFile;
1831 Sound := StringReplaceEx(Sound, ReplaceHash);
1833 if Action is TBottleChainNoDispatchAction then
1835 if Action is TBottleChainLogAction then
1837 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1838 LogName := (Action as TBottleChainLogAction).LogNames[k];
1839 LogName := StringReplaceEx(LogName, ReplaceHash);
1840 LogNameList.Add(LogName);
1843 if Action is TBottleChainOverrideGhostAction then
1845 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1847 if Action is TBottleChainQuitAction then
1848 Application.Terminate;
1849 if Action is TBottleChainSaveTextLogAction then
1850 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1851 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1852 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]));
1853 if Action is TBottleChainSaveXMLLogAction then
1854 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1856 if Action is TBottleChainSurfaceReplaceAction then
1857 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1859 if BreakFlag then Break;
1862 if Dat['Script'] <> '' then begin
1863 for i := 0 to LogNameList.Count-1 do
1864 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost']);
1865 if NoDispatch then begin
1866 frmLog.SetBottleState(Dat['MID'], lsOpened);
1868 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1869 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1870 Script, Ghost, Now());
1872 FBottleSstp.Push(CueItem);
1879 if Dat['DialogMessage'] <> '' then begin
1881 frmMessageBox.ShowMessage(
1882 DateTimeToStr(Now) + #13#10 +
1883 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1884 for i := 0 to LogNameList.Count-1 do
1885 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1889 if (Sound <> '') then PlaySound(Sound);
1899 procedure TfrmSender.YenETrans;
1900 var St, Le, i: integer;
1903 St := memScript.SelStart;
1904 Le := memScript.SelLength;
1905 Orig := GetScriptText;
1906 RegExp.Subst('s/(\r\n)+$//kg', Orig);
1908 with SsParser do begin
1909 LeaveEscape := true;
1910 EscapeInvalidMeta := false;
1911 InputString := Orig;
1913 for i := 0 to SsParser.Count-1 do begin
1914 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
1917 Text := Text + '\e';
1919 if Orig <> Text then memScript.Lines.Text := Text;
1920 SsParser.InputString := Text;
1922 RegExp.Subst('s/\r\n//kg', Text);
1924 memScript.SelStart := St;
1925 memScript.SelLength := Le;
1928 procedure TfrmSender.PostCommand(const Command: array of String);
1929 var PostStr: TStringList;
1934 PostStr := TStringList.Create;
1935 for i := Low(Command) to High(Command) do begin
1936 PostStr.Add(Command[i]);
1938 PostCommand(PostStr);
1944 procedure TfrmSender.PostCommand(Command: TStrings);
1945 var PostStr: String;
1948 PostStr := Command.Text;
1949 PostStr := ParamsEncode(PostStr);
1951 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
1952 if Pref.UseHttpProxy then begin
1953 FHttp.ProxyServer := Pref.ProxyAddress;
1954 FHttp.ProxyPort := Pref.ProxyPort;
1955 if Pref.ProxyNeedAuthentication then begin
1956 FHttp.ProxyUser := Pref.ProxyUser;
1957 FHttp.ProxyPass := Pref.ProxyPass;
1960 FHttp.OnSuccess := HttpSuccess;
1961 FHttp.OnConnectionFailed := HttpFailure;
1962 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
1965 on EHeapException do begin
1966 Connecting := false;
1972 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
1975 if frmLog.lvwLog.Selected = nil then Exit;
1976 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1977 if Log = nil then Exit;
1978 if Log.LogType <> ltBottle then Exit;
1980 'Command: voteMessage',
1982 'LUID: ' + Pref.LUID,
1988 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
1991 if frmLog.lvwLog.Selected = nil then Exit;
1992 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1993 if Log = nil then Exit;
1994 if Log.LogType <> ltBottle then Exit;
1996 'Command: voteMessage',
1998 'LUID: ' + Pref.LUID,
2004 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
2006 if SakuraSeeker.ProcessByName[Ghost] <> nil then
2007 Result := SakuraSeeker.ProcessByName[Ghost].SetName
2012 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
2013 MousePos: TPoint; var Handled: Boolean);
2016 with tabChannel do begin
2017 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
2018 if Tag < 0 then Handled := true;
2023 procedure TfrmSender.PostSetChannel(Channels: TStrings);
2024 var PostStr: TStringList;
2027 PostStr := TStringList.Create;
2029 with PostStr do begin
2030 Add('Command: setChannels');
2031 Add('Agent: ' + VersionString);
2032 Add('LUID: ' + Pref.LUID);
2033 if Channels <> nil then
2034 for i := 0 to Channels.Count-1 do begin
2035 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
2038 PostCommand(PostStr);
2044 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
2048 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
2050 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
2051 Chs := TStringList.Create;
2053 //
\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ð
2054 //
\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é
2056 Chs.Assign(JoinChannels);
2057 while Chs.IndexOf(Ch) >= 0 do
2058 Chs.Delete(Chs.IndexOf(Ch));
2059 PostSetChannel(Chs);
2065 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
2067 OpenBrowser(Pref.VotePage);
2070 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
2071 Shift: TShiftState; X, Y: Integer);
2075 with tabChannel do begin
2076 Index := IndexOfTabAt(X, Y);
2078 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2082 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2084 OpenBrowser(Pref.HelpPage);
2087 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2088 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2091 with tabChannel do begin
2092 Index := IndexOfTabAt(X, Y);
2093 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2094 if Button = mbLeft then begin
2095 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2097 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2102 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2103 Y: Integer; State: TDragState; var Accept: Boolean);
2104 var TargetRect: TRect;
2107 Accept := Source = tabChannel;
2108 if not Accept then Exit;
2109 with tabChannel do begin
2110 OldDest := FDragTabDest;
2111 FDragTabDest := IndexOfTabAt(X, Y);
2112 if FDragTabDest = -1 then begin
2113 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2116 with Canvas do begin
2120 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2121 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2122 TargetRect := TabRect(OldDest);
2123 with Canvas do begin
2124 Brush.Style := bsClear;
2125 Rectangle(TargetRect.Left, TargetRect.Top,
2126 TargetRect.Right, TargetRect.Bottom);
2129 if (OldDest <> FDragTabDest) then begin
2130 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2131 TargetRect := TabRect(FDragTabDest);
2132 with Canvas do begin
2133 Brush.Style := bsClear;
2134 Rectangle(TargetRect.Left, TargetRect.Top,
2135 TargetRect.Right, TargetRect.Bottom);
2141 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2143 var DestIndex: integer;
2145 with tabChannel do begin
2146 DestIndex := IndexOfTabAt(X, Y);
2147 Tabs.Move(FDragTabIndex, DestIndex);
2151 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2154 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2155 tabChannel.Tabs.BeginUpdate;
2156 tabChannel.Tabs.EndUpdate;
2159 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2160 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2161 var AlignRight: boolean;
2164 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2165 with cbxTargetGhost do begin
2166 AlignRight := false;
2167 if Pref.HideGhosts and not FTargetGhostExpand and
2168 (Index = Items.Count-1) and (Index > 0) then
2170 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2171 Canvas.Font.Color := clWindowText;
2172 Canvas.Font.Style := [];
2174 end else if (Index > 0) then
2176 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2177 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2178 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2180 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2181 Canvas.Font.Style := [fsBold];
2184 Canvas.Font.Color := clWindowText;
2185 Canvas.Font.Style := [];
2187 if odSelected in State then
2188 Canvas.Font.Color := clHighlightText;
2192 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2193 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2194 cbxTargetGhost.Items[Index]);
2196 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2197 cbxTargetGhost.Items[Index]);
2201 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2202 var CanClose: Boolean);
2204 if (not Pref.ConfirmOnExit) or FEndSession then
2206 if MessageDlg('SSTP Bottle Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2207 mbOkCancel, 0) = mrCancel then
2211 procedure TfrmSender.UpdateIfGhostBox;
2215 HiddenCount: integer;
2217 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2218 Selected := cbxTargetGhost.Text;
2220 with cbxTargetGhost do begin
2223 Items.Add(ChannelDefault);
2224 for i := 0 to SakuraSeeker.Count-1 do begin
2225 //
\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é
2226 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2227 if Pref.HideGhosts and not FTargetGhostExpand then
2228 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2233 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2234 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2236 cbxTargetGhost.ItemIndex := 0;
2237 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2238 with cbxTargetGhost do begin
2239 for i := 1 to Items.Count-1 do begin
2240 if Items[i] = Selected then
2243 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2244 if ItemIndex = 0 then begin
2245 Items.Add(Selected);
2246 ItemIndex := Items.Count - 1;
2250 if Pref.HideGhosts and not FTargetGhostExpand then
2251 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2256 procedure TfrmSender.HTTPFailure(Sender: TObject);
2260 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2261 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2262 (Sender as THTTPDownloadThread).LastErrorMessage);
2263 Connecting := false;
2266 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2269 SakuraSeeker.BeginDetect;
2271 i := cbxTargetGhost.ItemIndex;
2275 i := cbxTargetGhost.Items.Count-1;
2276 if Pref.HideGhosts and not FTargetGhostExpand then
2279 cbxTargetGhost.ItemIndex := i;
2280 cbxTargetGhostChange(self);
2283 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2286 SakuraSeeker.BeginDetect;
2288 i := cbxTargetGhost.ItemIndex;
2290 if Pref.HideGhosts and not FTargetGhostExpand then
2292 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2295 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2297 cbxTargetGhost.ItemIndex := i;
2298 cbxTargetGhostChange(self);
2301 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2303 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2304 FTargetGhostExpand := false;
2305 if Visible then memScript.SetFocus;
2306 cbxTargetGhostChange(self);
2309 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2311 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2313 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2314 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2316 if not IdSlpp20.Connected then begin
2318 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2320 //
\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
2321 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2327 procedure TfrmSender.RetryBeginConnect;
2329 if FBeginConnectFailCount < 3 then begin
2330 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2331 IdSlpp20.OnDisconnect := nil;
2332 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2333 FAutoAddAfterGetChannel := true;
2335 IdSlpp20.OnDisconnect := Slpp20Disconnect;
2336 end else if FBeginConnectFailCount = 3 then begin
2337 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2338 frmMessageBox.ShowMessage(
2339 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2340 '
\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+
2341 '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'
2343 Inc(FBeginConnectFailCount);
2347 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2348 var BottleLog: TBottleLogList;
2350 Cond: TBottleLogDownloadCondition;
2352 function TimeStr(Mins: integer): String;
2353 var day, hour, min: integer;
2355 day := Mins div (60 * 24);
2356 hour := (Mins div 60) mod 24;
2359 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2360 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2361 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2364 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2366 if frmLogDownload.Execute then begin
2367 with frmLogDownload do begin
2368 if IsRange then begin
2369 if CompareDate(DateLo, DateHi) = 0 then
2370 Title := FormatDateTime('yy-mm-dd', DateLo)
2372 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2374 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2376 if Channel <> '' then Title := Title + '(' + Channel + ')';
2378 BottleLog := TBottleLogList.Create(Title);
2380 BottleLog.OnLoaded := frmLog.LogLoaded;
2381 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2382 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2383 with frmLogDownload do begin
2384 Cond.IsRange := IsRange;
2385 Cond.RecentCount := RecentCount;
2386 Cond.DateLo := DateLo;
2387 Cond.DateHi := DateHi;
2388 Cond.MinVote := MinVote;
2389 Cond.MinAgree := MinAgree;
2390 Cond.Channel := Channel;
2392 BottleLog.LoadFromWeb(Cond);
2394 FreeAndNil(BottleLog);
2396 if BottleLog <> nil then begin
2397 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2399 frmLog.tabBottleLog.TabIndex := NewIndex;
2400 frmLog.UpdateWindow;
2404 frmLogDownload.Release;
2408 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2409 Ghost: String): boolean;
2416 Cond := Token(IfGhost, ',', i);
2417 if Cond <> '' then begin
2418 if Cond[1] = '!' then begin
2419 Cond := Copy(Cond, 2, High(integer));
2420 if Cond = Ghost then Result := false;
2422 if Cond <> Ghost then Result := false;
2429 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2430 var i, j, k, count: integer;
2431 ConstData: TScriptConst;
2432 Menu1, Menu2: TMenuItem;
2435 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2436 // 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
2437 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2438 else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2440 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2441 if Simple then begin
2442 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2443 for i := Root.Count-1 downto 0 do begin
2444 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2448 //
\91S
\95\94\8dí
\8f\9c
2452 for i := 0 to ScriptConstList.Count-1 do begin
2453 for j := 0 to ScriptConstList[i].Count-1 do begin
2454 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2455 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2457 // 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
2458 if Simple and (count < Root.Count) then
2459 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2463 Menu1 := TMenuItem.Create(Root);
2466 Caption := ScriptConstList[i][j].Caption;
2467 Hint := ScriptConstList[i][j].Caption;
2468 AutoHotkeys := maManual;
2469 Tag := ScriptConstList[i][j].ID;
2470 OnClick := mnConstGroupClick;
2473 if not Simple then begin
2476 if count < Root.Count-1 then
2477 Root.Insert(count, Menu1)
2482 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2483 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2484 ConstData := ScriptConstList[i][j][k];
2485 Menu2 := TMenuItem.Create(Root);
2486 Menu2.Caption := ConstData.Caption;
2487 Menu2.Hint := ConstData.ConstText;
2488 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2489 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2490 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2491 Menu2.ShortCut := ConstData.ShortCut;
2492 Menu2.OnClick := mnConstClick;
2493 Menu2.AutoHotkeys := maManual;
2494 Menu2.Tag := ConstData.ID;
2495 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2502 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2504 //
\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
2505 if Pref.HideGhosts and not FTargetGhostExpand then
2507 with cbxTargetGhost do
2509 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2510 //
\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
2511 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2513 FTargetGhostExpand := true;
2516 DroppedDown := true;
2520 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2521 ConstructMenu(true);
2522 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2526 procedure TfrmSender.PlaySound(const FileName: String);
2528 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2530 MediaPlayer.FileName := FileName;
2534 on E: EMCIDeviceError do begin
2535 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2540 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2543 if not Assigned(frmFMOExplorer) then
2544 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2547 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2550 frmFMOExplorer.Show;
2553 procedure TfrmSender.SaveChainRuleList;
2554 var Str: TStringList;
2556 Str := TStringList.Create;
2558 Str.Text := ComponentToString(BottleChainRuleList);
2559 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2565 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2567 frmLog.SetBottleState(MID, lsOpened);
2570 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2572 frmLog.SetBottleState(MID, lsPlaying);
2575 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2576 var InsertItem: TLogItem;
2577 i, errCount, Res: integer;
2578 Log: TBottleLogList;
2579 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2581 if FBottleSstp.CueCount > 0 then begin
2582 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'+
2583 '
\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+
2584 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2585 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2588 frmLog.AllBottleOpened;
2589 if frmLog.lvwLog.Selected = nil then Exit;
2590 Log := frmLog.SelectedBottleLog;
2591 if Log = nil then Exit;
2592 FBottleSSTP.OnResendCountChange := nil;
2594 for i := frmLog.lvwLog.Selected.Index downto 0 do begin
2595 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2596 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2598 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2599 if ErrorMes <> '' then
2601 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2602 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2605 raise Exception.Create('Script Syntax Error')
2606 else if Res = mrCancel then
2610 frmLog.AllBottleOpened;
2614 if InsertItem.Ghost = '' then begin
2615 if ChannelList.Channel[InsertItem.Channel] <> nil then
2616 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2618 FBottleSSTP.Push(InsertItem);
2619 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2625 if errCount > 0 then
2626 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]));
2627 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2628 BottleSstpResendCountChange(self);
2629 frmLog.lvwLog.Invalidate;
2632 function TfrmSender.ScriptTransForSSTP(const Script: String;
2633 out Error: String): String;
2634 var TransOpt: TScriptTransOptions;
2636 if Pref.NoTransURL then
2637 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2639 TransOpt := [toConvertURL, toWaitScriptEnd];
2640 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2641 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2642 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2644 Error := DoTrans(Result, TransOpt);
2647 procedure TfrmSender.FormResize(Sender: TObject);
2648 var w, SelS, SelL: integer;
2650 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2651 if memScript.ColWidth <> 0 then
2657 w := Width - LeftMargin - ColWidth div 2;
2658 if ScrollBars in [ssVertical, ssBoth] then
2659 w := w - GetSystemMetrics(SM_CYVSCROLL);
2660 WrapOption.WrapByte := w div ColWidth;
2667 procedure TfrmSender.actCopyExecute(Sender: TObject);
2669 memScript.CopyToClipboard;
2672 procedure TfrmSender.actPasteExecute(Sender: TObject);
2674 memScript.PasteFromClipboard;
2677 procedure TfrmSender.actCutExecute(Sender: TObject);
2679 memScript.CutToClipboard;
2682 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2684 memScript.SelectAll;
2687 procedure TfrmSender.actUndoExecute(Sender: TObject);
2692 procedure TfrmSender.actRedoExecute(Sender: TObject);
2697 function TfrmSender.IsSurfaceTag(const Script: String;
2698 var ID: integer): boolean;
2701 if SsParser.Match(Script, '\s%d') = 3 then
2704 ID := Ord(Script[3]) - Ord('0')
2706 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2709 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2713 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2714 Shift: TShiftState; X, Y: Integer);
2718 //
\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[
2719 if not Pref.SurfacePreviewOnScriptPoint then
2721 token := memScript.TokenStringFromPos(Point(X, Y));
2722 if IsSurfaceTag(token, id) then
2724 DoSurfacePreview(id, spEditor);
2727 frmSurfacePreview.HideAway;
2731 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2732 const Kind: TSurfacePreviewType);
2737 if cbxTargetGhost.ItemIndex > 0 then
2738 ghost := cbxTargetGhost.Text
2739 else if FNowChannel <> '' then
2740 ghost := ChannelList.Channel[FNowChannel].Ghost;
2742 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2743 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2744 not (frmSurfacePreview.IsHidden) then
2751 Bmp := TBitmap.Create;
2753 if Spps.TryGetImage(ghost, Surface, Bmp) then
2757 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2759 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2761 CPos := Point(0, 0);
2763 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2764 FVisiblePreviewGhost := Ghost;
2765 FVisiblePreviewSurface := Surface;
2767 frmSurfacePreview.HideAway;
2774 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2775 {var MousePoint: TPoint;
2778 //
\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é
2779 //
\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Å
2780 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2781 {GetCursorPos(MousePoint);
2782 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2783 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2784 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2785 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2788 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2789 var MousePoint: TPoint;
2791 GetCursorPos(MousePoint);
2792 case Pref.SurfacePreviewOnScriptPointPosition of
2793 spspMainWindowRight:
2794 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2796 Result := Point(Self.Left - w, MousePoint.Y);
2800 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2802 if (Sender is TMenuItem) then
2803 FVisibleMenuItem := Sender as TMenuItem;
2806 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2808 if FScriptBuffer.Count = 0 then
2810 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2811 memScriptChange(Self);
2812 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2815 procedure TfrmSender.EditorPreview;
2816 var Ghost, Script: String;
2818 if frmEditorTalkShow <> nil then
2819 if frmEditorTalkShow.Visible then
2821 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2823 if cbxTargetGhost.ItemIndex > 0 then
2824 Ghost := cbxTargetGhost.Text
2825 else if FNowChannel <> '' then
2826 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2827 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2831 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2833 if frmEditorTalkShow <> nil then
2834 frmEditorTalkShow.Show
2837 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
2838 frmEditorTalkShow.TalkShowFrame.SetPreviewFont(memScript.Font);
2839 frmEditorTalkShow.Show;
2841 Pref.ShowEditorPreviewWindow := True;
2845 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
2846 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
2848 Spps.ClearImagePool;
2849 Spps.LoadFromDirectory(FSppDir);
2852 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
2854 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
2857 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2858 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
2859 function TfrmSender.TagReplace(Script: String; Before,
2860 After: array of String): String;
2861 var BeforeList, AfterList: TStringList;
2864 BeforeList := TStringList.Create;
2865 AfterList := TStringList.Create;
2867 for i := Low(Before) to High(Before) do
2868 BeforeList.Add(Before[i]);
2869 for i := Low(After) to High(After) do
2870 AfterList.Add(After[i]);
2871 Result := TagReplace(Script, BeforeList, AfterList);
2878 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2879 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
2880 //
\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¢)
2881 function TfrmSender.TagReplace(Script: String; Before,
2882 After: TStrings): String;
2884 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
2890 OldStr := InputString;
2891 OldLeaveEscape := LeaveEscape;
2892 OldEscapeInvalidMeta := EscapeInvalidMeta;
2893 LeaveEscape := true;
2894 EscapeInvalidMeta := false;
2895 InputString := Script;
2897 for i := 0 to SsParser.Count-1 do
2900 for j := 0 to Before.Count-1 do
2902 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
2905 Result := Result + After[j];
2909 Result := Result + SsParser[i];
2913 LeaveEscape := OldLeaveEscape;
2914 EscapeInvalidMeta := OldEscapeInvalidMeta;
2915 InputString := OldStr;
2919 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
2920 //
\91Î
\89\9e\82·
\82é
2921 procedure TfrmSender.WndProc(var Message: TMessage);
2923 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
2925 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
2926 //
\8bC
\82Ã
\82©
\82¹
\82é
2934 procedure TfrmSender.actReplaceExecute(Sender: TObject);
2936 Form: TfrmStrReplaceDialog;
2938 Options: TReplaceFlags;
2940 Application.CreateForm(TfrmStrReplaceDialog, Form);
2942 if Form.Execute then
2946 Lines := memScript.Lines.Text;
2947 Options := [rfReplaceAll];
2949 Options := Options + [rfIgnoreCase];
2951 Lines := StringReplaceRegExp(Lines, BeforeStr, AfterStr, Options)
2953 Lines := StringReplace(Lines, BeforeStr, AfterStr, Options);
2955 if Lines <> memScript.Lines.Text then
2957 memScript.SelectAll;
2958 memScript.SelText := Lines;
2966 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
2969 if frmLog.lvwLog.Selected = nil then Exit;
2970 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2971 if Log = nil then Exit;
2972 CopyFromLogToEditor(Log);
2975 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
2976 var Ghost, Script: String;
2979 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2980 if cbxTargetGhost.ItemIndex > 0 then
2981 Ghost := cbxTargetGhost.Text
2984 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost);
2988 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
2989 Y: Integer; State: TDragState; var Accept: Boolean);
2991 //
\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é
2992 if Source is TBottleLogDragObject then
2993 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
2996 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
2998 var Src: TBottleLogDragObject;
3001 //
\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é
3002 if not (Source is TBottleLogDragObject) then
3004 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
3006 Src := Source as TBottleLogDragObject;
3008 CopyFromLogToEditor(Log);
3011 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
3013 if Log.LogType <> ltBottle then Exit;
3014 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Ä)
3015 memScript.Lines.Clear;
3016 memScript.Lines.Add(Log.Script);
3017 if Log.Ghost <> '' then
3019 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
3020 //
\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Å
3021 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
3022 cbxTargetGhost.Items.Add(Log.Ghost);
3023 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
3025 cbxTargetGhost.Invalidate;
3027 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
3031 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
3033 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
3034 if frmLog.SelectedBottleLog = nil then
3036 if frmLog.lvwLog.Selected = nil then
3038 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
3039 frmLog.UpdateWindow;
3040 frmLog.lvwLogChange(Self, nil, ctState);
3043 procedure TfrmSender.ClearEditor;
3044 var TmpScript: String;
3046 DoSaveBuffer: boolean;
3047 SavedScript: TStringList;
3049 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
3050 //
\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é
3051 DoSaveBuffer := false;
3052 if FScriptBuffer.Count = 0 then
3053 DoSaveBuffer := true
3054 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
3055 DoSaveBuffer := true;
3056 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
3057 DoSaveBuffer := false;
3058 if DoSaveBuffer then
3060 SavedScript := TStringList.Create;
3061 SavedScript.Text := GetScriptText;
3062 FScriptBuffer.Insert(0, SavedScript);
3064 if FScriptBuffer.Count >= 4 then
3065 FScriptBuffer.Delete(FScriptBuffer.Count-1);
3066 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
3068 TmpScript := Pref.DefaultScript;
3069 Position := Pos('|', TmpScript);
3070 if Position < 1 then Position := 1;
3071 TmpScript := StringReplace(TmpScript, '|', '', []);
3072 memScript.Lines.Text := TmpScript;
3073 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
3074 memScript.SelStart := Position-1;
3076 if Visible then memScript.SetFocus;
3077 FScriptModified := false;
3078 memScriptChange(self);
3081 procedure TfrmSender.AppendTextLog(const FileName, Line: String);
3085 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3087 ForceDirectories(ExtractFileDir(FileName));
3088 AssignFile(F, FileName);
3089 if FileExists(FileName) then
3098 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3102 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3107 Impl: TDomImplementation;
3108 Parser: TXmlToDomParser;
3111 try // Long try block to handle all kinds of exception in this method
3112 if not FileExists(FileName) then
3114 // Create empty XML log file
3115 Impl := TDomImplementation.create(nil);
3117 ForceDirectories(ExtractFileDir(FileName));
3118 Parser := TXmlToDomParser.create(nil);
3119 Parser.DOMImpl := Impl;
3122 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3125 documentElement.setAttribute('saved',
3126 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3127 documentElement.setAttribute('generator', VersionString);
3128 documentElement.setAttribute('version', '1.0');
3130 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3131 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3133 DOM.writeCodeAsShiftJIS(F);
3138 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3141 Parser.DOMImpl.freeDocument(DOM);
3148 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3154 F.Seek(P, soFromEnd);
3156 if Buf = '</bottlelog>' then
3161 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3164 F.Seek(P, soFromEnd);
3165 Buf := Format('<message mid="%s">', [Args['MID']]);
3166 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3167 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3168 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3169 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3170 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3171 Buf := Buf + '</message>';
3172 Buf := Buf + '</bottlelog>';
3173 F.Write(Buf[1], Length(Buf));
3180 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3184 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3189 SelText := memScript.SelText;
3190 if SelText <> '' then
3192 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3195 memScriptChange(Self);
3199 function TfrmSender.ReplaceSurface(Script: String;
3200 Params: TCollection): String;
3202 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3203 OldStr, Tag: String;
3204 i, j, k, Cur: integer;
3205 Item: TSurfaceReplaceItem;
3206 Before: TSurfaceReplaceBeforeItem;
3212 OldStr := InputString;
3213 OldLeaveEscape := LeaveEscape;
3214 OldEscapeInvalidMeta := EscapeInvalidMeta;
3215 LeaveEscape := true;
3216 EscapeInvalidMeta := false;
3217 InputString := Script;
3219 for i := 0 to SsParser.Count-1 do
3221 if SsParser.MarkUpType[i] <> mtTag then
3223 Result := Result + SsParser.Str[i];
3226 Tag := SsParser.Str[i];
3227 if SsParser.Match(Tag, '\s%d') = 2 then
3228 Cur := Ord(Tag[3]) - Ord('0')
3229 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3230 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3233 Result := Result + Tag;
3237 for j := 0 to Params.Count-1 do
3239 Item := Params.Items[j] as TSurfaceReplaceItem;
3240 for k := 0 to Item.Before.Count-1 do
3242 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3243 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3246 Result := Result + Format('\s[%d]', [Item.After]);
3254 Result := Result + Tag;
3258 LeaveEscape := OldLeaveEscape;
3259 EscapeInvalidMeta := OldEscapeInvalidMeta;
3260 InputString := OldStr;
3264 procedure TfrmSender.WMQueryEndSession(var msg: TWMQueryEndSession);
3266 // Windows
\82ª
\8fI
\97¹
\82µ
\82æ
\82¤
\82Æ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82ð
\8a´
\92m
\82·
\82é
3267 FEndSession := true;
3271 procedure TfrmSender.IdSLPP20ConnectFailed(Sender: TObject);
3274 if FBeginConnectFailCount = 0 then
3277 if Pref.UseHttpProxy then
3278 frmMessageBox.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 +
3279 '
\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 +
3280 '
\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')
3282 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3283 '
\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 +
3284 '
\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');
3286 ShowHintLabel('SSTP Bottle Server
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
3287 Inc(FBeginConnectFailCount);
3290 procedure TfrmSender.BuildReplaceMenu(Root: TMenuItem);
3293 Presets: TReplacePresetCollection;
3297 Presets := Pref.ReplacePresets.Presets;
3298 for i := 0 to Presets.Count-1 do
3300 NewItem := TMenuItem.Create(Root);
3303 Caption := Presets[i].Title;
3304 ShortCut := Presets[i].ShortCut;
3305 AutoHotkeys := maManual;
3306 Hint := Presets[i].Pairs.StringExpression;
3308 OnClick := mnPresetReplaceClick;
3312 Root.Enabled := Presets.Count > 0;
3315 procedure TfrmSender.mnPresetReplaceClick(Sender: TObject);
3317 Preset: TReplacePreset;
3320 //
\83v
\83\8a\83Z
\83b
\83g
\92u
\8a·
\82ð
\8eÀ
\8ds
3321 Preset := Pref.ReplacePresets.Presets[(Sender as TMenuItem).Tag];
3322 Lines := memScript.Lines.Text;
3323 New := Preset.Pairs.ExecuteReplace(Lines);
3324 if New <> Lines then
3326 memScript.SelectAll;
3327 memScript.SelText := New;
3329 if Preset.ConfirmAfterReplace then