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;
413 uses SendConfirm, SettingForm, ChannelListForm, LogForm,
414 MessageBox, FMOExplorer, EditorTalkShow;
418 //
\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
419 function Token(const Str: String; const Delimiter: char;
420 const Index: integer): String;
421 var i, c, len: integer;
427 while i <= len do begin
428 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
430 if c > Index then Break;
431 end else if c = Index then Result := Result + Str[i];
436 //
\95¶
\8e\9a\97ñ
\82ð
\92u
\82«
\8a·
\82¦
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
437 function StringReplaceEx(const Before: String; List: THeadValue): String;
439 i, MinPos, MinKey, p: integer;
448 for i := 0 to List.Count-1 do
450 p := Pos(List.KeyAt[i], Work);
451 if (p > 0) and ((p < MinPos) or (MinPos < 0)) then
459 Result := Result + Work;
463 Result := Result + Copy(Work, 1, MinPos-1) + List.ValueAt[MinKey];
464 Delete(Work, 1, (MinPos - 1) + Length(List.KeyAt[MinKey]));
471 procedure TfrmSender.actConfirmExecute(Sender: TObject);
473 AScript, Err, AGhost: String;
477 // Partial Confirmation
478 if memScript.SelText <> '' then
481 if not Pref.AutoPartialConfirm then
482 if not MultipleChoiceEdit('
\8am
\94F', ['
\91I
\91ð
\95\94\95ª
\82Ì
\82Ý', '
\83X
\83N
\83\8a\83v
\83g
\91S
\91Ì'], Choice) then
486 AScript := memScript.SelText;
487 AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
489 AScript := GetScriptText;
491 AScript := GetScriptText;
492 AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
494 if Length(AScript) = 0 then Exit;
496 AScript := ScriptTransForSSTP(AScript, Err);
503 if cbxTargetGhost.ItemIndex > 0 then
504 AGhost := cbxTargetGhost.Text
505 else if FNowChannel <> '' then
506 AGhost := ChannelList.Channel[FNowChannel].Ghost
510 if Pref.IgnoreTimeCritical then
511 AScript := TagReplace(AScript, ['\t'], ['']);
513 Item := TLogItem.Create;
519 Channel := '
\81y
\8am
\94F
\81z';
522 BottleSstp.Unshift(Item);
527 FScriptModified := false;
530 procedure TfrmSender.FormCreate(Sender: TObject);
531 var Str: TStringList;
533 FScriptBuffer := TObjectList.Create(true);
535 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
536 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
537 ScriptConstList.LoadFromDir(FConstDir);
538 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
539 Spps.LoadFromDirectory(FSppDir);
540 ConstructMenu(false);
541 BuildReplaceMenu(mnPresetReplaceRoot);
543 Str := TStringList.Create;
546 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
547 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
550 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
551 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
553 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');
554 Application.Terminate;
555 Application.ProcessMessages;
563 FOriginalCaption := Self.Caption;
566 mnShowToolBar.Checked := Pref.ShowToolBar;
567 mnShowConstBar.Checked := Pref.ShowConstBar;
568 if Pref.StayOnTop then begin
569 FormStyle := fsStayOnTop;
570 mnStayOnTop.Checked := true;
572 FormStyle := fsNormal;
573 mnStayOnTop.Checked := false;
576 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
577 mnGoToHP.Hint := Pref.HomePage;
578 mnGotoVote.Hint := Pref.VotePage;
579 mnGotoHelp.Hint := Pref.HelpPage;
581 mnGetNewId.Enabled := (Pref.LUID = '');
583 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
585 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
586 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
588 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
589 Application.Terminate;
592 //
\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è
593 SsPlayTime.PlayTimeParams := Pref.PlayTimeParams;
595 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
596 with Pref.SenderWindowPosition do begin
599 Self.Width := Right - Left + 1;
600 Self.Height := Bottom - Top + 1;
603 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
604 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
606 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
607 actClearExecute(Sender);
608 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
610 //
\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»)
611 UpdateJoinChannelList(nil);
613 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
614 FBottleSstp := TBottleSstp.Create(false);
615 with FBottleSstp do begin
616 OnResendCountChange := BottleSstpResendCountChange;
617 OnResendTrying := BottleSstpResendTrying;
618 OnResendEnd := BottleSstpResendEnd;
622 procedure TfrmSender.FormDestroy(Sender: TObject);
624 if FScriptBuffer <> nil then
627 if FBottleSstp <> nil then begin
628 FBottleSstp.Terminate;
632 with Pref.SenderWindowPosition do begin
635 Right := Self.Left + Self.Width - 1;
636 Bottom := Self.Top + Self.Height - 1;
639 if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
641 ScriptConstList.Save;
644 BottleChainRuleList.Free;
649 procedure TfrmSender.SetConnecting(const Value: boolean);
651 FConnecting := Value;
653 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
654 actStart.Enabled := false;
655 actStop.Enabled := false;
656 actSend.Enabled := false;
657 actVoteMessage.Enabled := false;
658 actAgreeMessage.Enabled := false;
659 mnGetNewId.Enabled := false;
660 Screen.Cursor := crAppStart;
662 StatusBar.Panels[PanelConnecting].Text := '';
663 actStart.Enabled := true;
664 actStop.Enabled := true;
665 actSend.Enabled := true;
666 frmLog.lvwLogChange(Self, nil, ctState);
667 mnGetNewId.Enabled := Pref.LUID = '';
668 Screen.Cursor := crDefault;
672 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
673 procedure TfrmSender.actSendExecute(Sender: TObject);
674 var Talk, Ghost: String;
675 Command: TStringList;
679 if Length(GetScriptText) = 0 then begin
680 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
684 if Pref.LUID = '' then begin
688 if tabChannel.TabIndex < 0 then begin
689 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
690 '
\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');
693 if ChannelList.Channel[FNowChannel].NoPost then begin
695 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
700 Talk := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
701 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
702 if Err <> '' then begin
703 MessageDlg(Err, mtWarning, [mbOk], 0);
707 if Pref.NeedConfirmBeforeSend and FScriptModified then
709 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
713 if not Pref.NoConfirm then begin
714 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
718 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text;
719 Command := TStringList.Create;
721 with Command do begin
722 Add('Command: sendBroadcast');
723 Add('Channel: ' + FNowChannel);
724 Add('LUID: ' + Pref.LUID);
725 Add('Agent: ' + VersionString);
726 if Ghost <> '' then Add('Ghost: ' + Ghost);
727 Add('Talk: ' + Talk);
729 PostCommand(Command);
734 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
735 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
736 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
740 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
745 procedure TfrmSender.BeginConnect;
747 if Pref.LUID = '' then begin
751 IdSlpp20.LUID := Pref.LUID;
752 self.Cursor := crHourGlass;
753 if IdSlpp20.Connected then IdSlpp20.Disconnect;
754 if Pref.UseHttpProxy then begin
755 IdSlpp20.Host := Pref.ProxyAddress;
756 IdSlpp20.Port := Pref.ProxyPort;
757 IdSlpp20.ProxyMode := true;
759 IdSlpp20.Host := Pref.BottleServer;
760 IdSlpp20.Port := Pref.BottleServerPort;
761 IdSlpp20.ProxyMode := false;
763 IdSlpp20.ConnectServer;
764 self.Cursor := crDefault;
767 procedure TfrmSender.EndConnect;
769 IdSlpp20.OnDisconnect := nil;
773 procedure TfrmSender.SetAdded(const Value: boolean);
775 if FAdded = Value then Exit;
778 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
781 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
783 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
787 procedure TfrmSender.HTTPSuccess(Sender: TObject);
788 var Str, ResStr, Command: String;
789 HeadValue: THeadValue;
791 SetChannel: TStringList;
794 Str := (Sender as THttpDownloadThread).RecvString;
798 HeadValue := THeadValue.Create(Str);
800 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89ð
\90Í
\82Å
\82«
\82È
\82¢
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
803 Command := HeadValue['Command'];
804 ResStr := HeadValue['Result'];
805 if ResStr = 'Err' then begin
806 if HeadValue['ExtraMessage'] <> '' then begin
808 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
809 HeadValue['ExtraMessage']);
812 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
815 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
816 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
817 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
818 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
819 if Pref.ResetIfGhostAfterSend then begin
820 actResetGhostExecute(Self);
822 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
823 if Pref.ClearAfterSend then begin
826 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
827 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
829 if (Command = 'getNewId') then begin
830 if ResStr = 'OK' then begin
831 Pref.LUID := HeadValue['NewID'];
832 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
833 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
834 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
835 'LUID: ' + Pref.LUID + #13#10 +
836 '
\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' +
837 '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' +
838 '
\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');
839 mnGetNewId.Enabled := false;
842 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
845 if (Command = 'voteMessage') then begin
846 if ResStr = 'OK' then begin
847 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
850 if (Command = 'getChannels') and (ResStr = 'OK') then begin
851 UpdateChannelInfo(HeadValue);
854 if FAutoAddAfterGetChannel then begin
855 SetChannel := TStringList.Create;
856 if JoinChannelsBackup <> nil then begin
857 //
\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
858 SetChannel.Assign(JoinChannelsBackup);
860 //
\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¾
861 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
862 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
863 SetChannel.Add(Pref.AutoJoinChannels[i]);
867 Application.CreateForm(TfrmChannelList, frmChannelList);
869 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
870 SetChannel := TStringList.Create;
871 SetChannel.Assign(frmChannelList.JoinList);
874 frmChannelList.Release;
877 if SetChannel <> nil then PostSetChannel(SetChannel);
879 if SetChannel <> nil then FreeAndNil(SetChannel);
882 if (Command = 'setChannels') then begin
883 if ResStr <> 'OK' then begin
885 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¢');
886 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
889 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
895 procedure TfrmSender.actStartClick(Sender: TObject);
897 if Pref.LUID = '' then begin
901 if not IdSlpp20.Connected then begin
902 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
906 FAutoAddAfterGetChannel := false;
907 PostCommand(['Command: getChannels']);
911 procedure TfrmSender.actStopExecute(Sender: TObject);
913 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
914 IdSlpp20.OnDisconnect := nil;
915 if IdSlpp20.Connected then IdSlpp20.Disconnect;
916 FAutoAddAfterGetChannel := true;
918 IdSlpp20.OnDisconnect := Slpp20Disconnect;
921 procedure TfrmSender.FormShow(Sender: TObject);
923 if FBooted or Application.Terminated then Exit;
924 //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
925 if Pref.LUID <> '' then BeginConnect
926 else mnGetNewIdClick(Self);
927 FAutoAddAfterGetChannel := Pref.AutoStart;
930 frmSurfacePreview.Show;
932 SakuraSeeker.BeginDetect;
933 SakuraSeekerDetectResultChanged(self);
934 if SakuraSeeker.Count = 0 then
935 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 +
936 '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 +
937 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
940 procedure TfrmSender.actAboutClick(Sender: TObject);
943 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
944 Str := Str + Format('Compiler Version: %f', [CompilerVersion]);
945 frmMessageBox.ShowMessage(Str);
948 procedure TfrmSender.actExitClientExecute(Sender: TObject);
953 procedure TfrmSender.actClearExecute(Sender: TObject);
955 Script, Default: String;
957 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
958 Default := StringReplace(Pref.DefaultScript, '|', '', [rfReplaceAll]);
959 Default := StringReplace(Default, #13#10, '', [rfReplaceAll]);
961 if (Pref.AutoClip) and (Length(GetScriptText) > 0) and (Script <> Default) then
962 actSendToLogWindow.Execute
967 procedure TfrmSender.memScriptChange(Sender: TObject);
972 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
973 Text := Format('%d
\83o
\83C
\83g/%d
\95b', [Length(Script), SsPlayTime.PlayTime(Script) div 1000]);
974 StatusBar.Panels[PanelBytes].Text := Text;
975 FScriptModified := true;
979 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
981 Pref.StayOnTop := not Pref.StayOnTop;
982 mnStayOnTop.Checked := Pref.StayOnTop;
983 if Pref.StayOnTop then begin
984 FormStyle := fsStayOnTop;
986 FormStyle := fsNormal;
991 function TfrmSender.GetScriptText: String;
993 Result := memScript.Lines.Text;
996 procedure TfrmSender.mnConstClick(Sender: TObject);
999 i := (Sender as TMenuItem).Tag;
1000 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
1003 procedure TfrmSender.actEditConstExecute(Sender: TObject);
1005 ScriptConstList.LoadFromDir(FConstDir);
1007 Application.CreateForm(TfrmConstEditor, frmConstEditor);
1008 frmConstEditor.Execute;
1009 ScriptConstList.Save;
1011 frmConstEditor.Release;
1013 ConstructMenu(false);
1016 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
1018 Application.Minimize;
1019 WindowState := wsNormal;
1022 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
1025 TaskTray.Registered := false;
1028 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
1031 Application.ShowMainForm := false;
1032 ShowWindow(Application.Handle, SW_HIDE);
1035 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
1037 Application.ShowMainForm := true;
1041 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1043 Application.Restore;
1046 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1048 Application.Restore;
1051 procedure TfrmSender.FormActivate(Sender: TObject);
1056 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1058 Application.Restore;
1059 actClearExecute(Sender);
1062 procedure TfrmSender.ChangeTaskIcon;
1067 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1069 if Sleeping then IcoNum := IconSleepDisconnected
1070 else IcoNum := IconDisconnected;
1073 Ico := TIcon.Create;
1075 imgIcon.GetIcon(IcoNum, Ico);
1076 TaskTray.Icon := Ico;
1077 TaskTray.Registered := true;
1082 ; // 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
1083 //
\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
1084 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1088 procedure TfrmSender.SetStatusText(const Value: String);
1090 FStatusText := Value;
1091 StatusBar.Panels[PanelStatus].Text := Value;
1094 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1097 if Length(Application.Hint) > 0 then
1099 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1100 Application.HintColor := clInfoBk;
1101 if (Application.Hint = SendButtonLongHint)
1102 and (FNowChannel <> '') then
1104 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1105 Application.HintColor := clYellow;
1106 Application.ActivateHint(Mouse.CursorPos);
1108 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1110 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1111 DoSurfacePreview(id, spHint);
1115 StatusBar.Panels[PanelStatus].Text := FStatusText;
1116 frmSurfacePreview.HideAway;
1120 procedure TfrmSender.ConstructMenu(Simple: boolean);
1122 BuildMenu(mnPopConst, Simple);
1123 BuildMenu(mnPopUpConst.Items, Simple);
1124 BuildMenu(ConstBarMenu.Items, Simple);
1125 //ConstMenuBar.Menu := nil;
1126 ConstMenuBar.AutoSize := false;
1127 ConstMenuBar.Width := 1000;
1128 ConstMenuBar.Menu := ConstBarMenu;
1129 ConstMenuBar.AutoSize := true;
1132 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1133 Shift: TShiftState);
1135 Func: TReturnKeyFunction;
1137 if (Key = VK_RETURN) then begin
1138 if (ssShift in Shift) then
1139 Func := Pref.WhenShiftReturn
1140 else if (ssCtrl in Shift) then
1141 Func := Pref.WhenCtrlReturn
1143 Func := Pref.WhenReturn;
1146 with tbtnInsertConst do
1147 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1148 mnPopUpConst.Popup(Pos.X, Pos.Y);
1151 memScript.SelText := '\n';
1155 memScript.SelText := '\n'#13#10;
1158 memScript.SelText := #13#10
1164 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1166 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1167 Pref.ShowToolBar := mnShowToolBar.Checked;
1171 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1173 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1174 Pref.ShowConstBar := mnShowConstBar.Checked;
1178 procedure TfrmSender.UpdateLayout;
1180 with SakuraScriptFountain do begin
1181 TagColor.Color := Pref.MarkUpColor;
1182 TagErrorColor.Color := Pref.MarkErrorColor;
1183 Scope0Color.Color := Pref.TalkColorH;
1184 Scope1Color.Color := Pref.TalkColorU;
1185 SynchronizedColor.Color := Pref.TalkColorS;
1187 memScript.Ruler.Visible := Pref.ShowRuler;
1188 memScript.Ruler.Color := Pref.TextColor;
1189 memScript.Color := Pref.BgColor;
1191 ToolBar.Visible := Pref.ShowToolBar;
1192 ConstMenuBar.Visible := Pref.ShowConstBar;
1195 with tabChannel do begin
1196 TabPosition := Pref.TabPosition;
1197 case Pref.TabPosition of
1198 tpTop: Align := alTop;
1199 tpBottom: Align := alBottom;
1201 TabWidth := Pref.TabWidth;
1205 function TfrmSender.DoTrans(var Script: String;
1206 Options: TScriptTransOptions; out FoundURL: boolean): String;
1207 var UrlCancel, Mark: String;
1208 Url, UrlName: array[0..6] of String;
1209 i, j, u, UrlCount: integer;
1210 LastSurfaceH, LastSurfaceU: integer;
1211 UnyuTalking: boolean;
1212 QuickSection, Synchronize: boolean;
1213 Warnings: TStringList;
1218 UnyuTalking := false;
1219 QuickSection := false;
1220 Synchronize := false;
1221 SsParser.LeaveEscape := true;
1222 SsParser.EscapeInvalidMeta := false;
1223 SsParser.InputString := Script;
1225 Warnings := TStringList.Create;
1227 for i := 0 to SsParser.Count-1 do begin
1228 if SsParser[i] = '\t' then begin
1229 if not(toIgnoreTimeCritical in Options) then
1230 Script := Script + '\t';
1231 end else if SsParser[i] = '\e' then begin
1233 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1234 if toConvertURL in Options then begin
1235 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1236 for u := 7 downto 1 do begin
1237 if (SsParser.Match(SsParser[i],
1238 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1239 '-', '%b', [rfReplaceAll]))) > 0 then begin
1240 for j := 1 to u do begin
1241 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1242 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1243 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1244 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1247 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1248 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1250 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1251 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1252 Url[0] := SsParser.GetParam(SsParser[i], 1);
1253 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1254 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1255 if Pos('http://', Url[0]) > 0 then begin
1257 if not QuickSection then
1258 Script := Script + '\_q' + Url[0] + '\_q'
1260 Script := Script + Url[0];
1263 end else Script := Script + SsParser[i];
1265 Mark := SsParser[i];
1266 if Mark = '\h' then begin
1267 UnyuTalking := false;
1268 if toHUTagTo01Tag in Options then Mark := '\0';
1269 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1270 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');
1271 end else if Mark = '\u' then begin
1272 UnyuTalking := true;
1273 if toHUTagTo01Tag in Options then Mark := '\1';
1274 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1275 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');
1276 end else if Mark = '\_q' then begin
1277 QuickSection := not QuickSection;
1278 end else if Mark = '\_s' then begin
1279 Synchronize := not Synchronize;
1280 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1281 if UnyuTalking then begin
1282 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1285 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1288 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1289 if UnyuTalking then begin
1290 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1292 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1295 Script := Script + Mark;
1298 if UrlCount > 0 then begin
1300 Script := Script + '\h\n';
1301 if not (toNoChoice in Options) then begin
1302 for i := 0 to UrlCount-1 do begin
1303 Script := Script + Format('\q%d[%s][%s]',
1304 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1306 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1307 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1309 Script := Script + '\h';
1310 for i := 0 to UrlCount-1 do begin
1311 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1313 Script := Script + Format('\n{%s}', [UrlCancel]);
1317 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1318 if toWaitScriptEnd in Options then begin
1319 i := Pref.WaitScriptEnd;
1320 while i > 0 do begin
1322 Script := Script + '\w9';
1325 Script := Script + '\w' + IntToStr(i);
1331 Script := Script + '\e';
1332 RegExp.Subst('s/\r\n//gk', Script);
1334 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1335 for i := 0 to SsParser.Count-1 do begin
1336 if SsParser.MarkUpType[i] = mtTagErr then begin
1337 Result := '"' + SsParser[i] + '"'#13#10 +
1338 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1342 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1343 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1347 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1348 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1349 mbOkCancel, 0) = mrCancel then
1350 Result := Warnings.Text;
1357 function TfrmSender.DoTrans(var Script: String;
1358 Options: TScriptTransOptions): String;
1361 Result := DoTrans(Script, Options, dum);
1364 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1366 ShellExecute(Handle, 'open', PChar(Pref.HomePage), nil, nil, SW_SHOW);
1369 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1371 lblMessage.Caption := Mes;
1372 lblMessage.Font.Color := Col;
1373 lblMessage.Visible := true;
1374 LabelTimer.Enabled := false;
1375 LabelTimer.Enabled := true;
1378 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1380 LabelTimer.Enabled := false;
1381 lblmessage.Visible := false;
1384 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1388 Str := memScript.Lines.Text;
1389 Clip := ClipBoard();
1390 Clip.SetTextBuf(PChar(Str));
1393 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1397 Str := memScript.Lines.Text;
1398 RegExp.Subst('s/\r\n//gk', Str);
1399 Clip := ClipBoard();
1400 Clip.SetTextBuf(PChar(Str));
1403 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1404 const Param: String);
1405 var HeadValue: THeadValue;
1407 HeadValue := THeadValue.Create(Param);
1410 etScript, etForceBroadcast, etUnicast: begin
1411 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1412 DispatchBottle(EventType, HeadValue);
1414 etMemberCount: begin
1415 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1417 etChannelCount: begin
1419 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1424 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1426 FBeginConnectFailCount := 0;
1427 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1428 if not Connecting then
1429 PostCommand(['Command: getChannels']);
1430 SakuraSeeker.BeginDetect;
1432 etChannelList: begin
1433 UpdateJoinChannelList(HeadValue);
1434 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1435 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1436 JoinChannelsBackup.Assign(JoinChannels);
1438 etCloseChannel: begin
1439 with JoinChannels do
1440 if IndexOf(HeadValue['Channel']) >= 0 then
1441 Delete(IndexOf(HeadValue['Channel']));
1442 with tabChannel do begin
1443 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1444 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1445 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1446 tabChannelChange(self);
1448 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1450 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1451 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1453 etForceBroadcastInformation: begin
1454 if HeadValue['Type'] = 'Vote' then begin
1455 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1456 end else if HeadValue['Type'] = 'Agree' then begin
1457 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1466 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1468 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1470 TaskTray.TipString := 'SSTP Bottle Client (' +
1471 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1473 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1475 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1478 procedure TfrmSender.actSettingExecute(Sender: TObject);
1480 Application.CreateForm(TfrmSetting, frmSetting);
1490 BuildReplaceMenu(mnPresetReplaceRoot);
1493 frmLog.UpdateWindow;
1496 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1498 if (Key = #13) or (Key = #10) then Key := Char(0);
1501 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1504 UpdateJoinChannelList(nil);
1505 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1506 if not Application.Terminated then RetryBeginConnect;
1509 procedure TfrmSender.SetSleeping(const Value: boolean);
1512 FBottleSstp.ResendSleep := Value;
1516 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1519 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]),
1520 mtWarning, mbOkCancel, 0);
1521 if Re = mrOk then begin
1523 frmLog.AllBottleOpened;
1524 frmLog.UpdateWindow;
1528 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1530 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1533 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1535 Ch: TChannelListItem;
1538 for i := 1 to Dat.IntData['Count'] do begin
1539 Ch := TChannelListItem.Create;
1540 Ch.Name := Dat[Format('CH%d_name', [i])];
1541 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1542 Ch.Info := Dat[Format('CH%d_info', [i])];
1543 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1544 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1545 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1546 ChannelList.Add(Ch);
1551 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1553 PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1556 procedure TfrmSender.NoLuidError;
1559 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1560 '
\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+
1561 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1564 procedure TfrmSender.tabChannelChange(Sender: TObject);
1566 if tabChannel.TabIndex >= 0 then begin
1567 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1568 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1573 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1574 ConstructMenu(true);
1577 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1579 with tabChannel do begin
1580 if Tabs.Count = 0 then Exit;
1581 if TabIndex=0 then TabIndex := Tabs.Count-1
1582 else TabIndex := TabIndex-1;
1584 tabChannelChange(Self);
1587 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1589 with tabChannel do begin
1590 if Tabs.Count = 0 then Exit;
1591 if TabIndex=Tabs.Count-1 then TabIndex := 0
1592 else TabIndex := TabIndex+1;
1594 tabChannelChange(Self);
1597 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1601 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1602 if nodat then Dat := THeadValue.Create('');
1604 for i := 0 to Dat.Count-1 do
1605 if Dat.KeyAt[i] = 'Entry' then begin
1606 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1607 JoinChannels.Add(RegExp[1]);
1609 with tabChannel do begin
1614 for i := 0 to JoinChannels.Count-1 do begin
1615 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1616 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1617 Tabs.Add(JoinChannels[i]);
1620 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1621 //
\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)
1623 for i := 0 to Tabs.Count-1 do
1624 if Tabs[i] = FNowChannel then TabIndex := i;
1625 if Tabs.Count > 0 then begin
1626 FNowChannel := Tabs[TabIndex];
1627 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1630 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1632 Visible := Tabs.Count > 0;
1633 if Tabs.Count > 1 then begin
1634 actNextChannel.Enabled := true;
1635 actPrevChannel.Enabled := true;
1637 actNextChannel.Enabled := false;
1638 actPrevChannel.Enabled := false;
1640 OnChange := tabChannelChange;
1642 if nodat then Dat.Free;
1643 if JoinChannels.Count = 0 then begin
1644 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1645 actSend.Enabled := false;
1647 Self.Caption := FOriginalCaption;
1648 actSend.Enabled := true;
1652 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1654 SakuraSeeker.BeginDetect;
1658 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1661 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1664 procedure TfrmSender.actSleepExecute(Sender: TObject);
1666 if actSleep.Checked then begin
1667 actSleep.Checked := false;
1668 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1670 actSleep.Checked := true;
1671 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1673 Sleeping := actSleep.Checked;
1678 procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1680 var Opt: TSstpSendOptions;
1681 Event: TBottleChainBottleEvent;
1682 Script, Sender, Ghost, Channel, ErrorMes: String;
1683 BreakFlag, NoDispatch: boolean;
1684 Sound, LogName: String;
1685 i, j, k, SkipCount: integer;
1686 Rule: TBottleChainRule;
1687 Action: TBottleChainAction;
1688 LogNameList: TStringList;
1690 ReplaceHash: THeadValue;
1693 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1694 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1695 Channel := Dat['Channel'];
1697 etScript: Sender := Channel;
1698 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1699 etUnicast: Sender := Dat['SenderUID'];
1702 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1703 if Dat['IfGhost'] <> '' then begin
1704 Ghost := Dat['IfGhost'];
1706 if ChannelList.Channel[Channel] <> nil then
1707 Ghost := ChannelList.Channel[Channel].Ghost;
1709 Dat['TargetGhost'] := Ghost;
1711 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1712 ReplaceHash := THeadValue.Create;
1713 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1714 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1715 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1716 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1717 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1718 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1719 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1720 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1721 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1723 Event := TBottleChainBottleEvent.Create;
1726 if EventType = etScript then Event.LogType := ltBottle
1727 else Event.LogType := ltSystemLog;
1729 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1730 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1731 if ErrorMes <> '' then begin
1732 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'+
1733 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1738 NoDispatch := false;
1740 LogNameList := TStringList.Create;
1743 for i := 0 to BottleChainRuleList.Count-1 do begin
1744 if SkipCount > 0 then begin
1748 Rule := BottleChainRuleList[i];
1749 if not Rule.Enabled then Continue;
1750 if not Rule.Check(Event) then Continue;
1751 for j := 0 to Rule.Actions.Count-1 do begin
1752 Action := (Rule.Actions[j] as TBottleChainAction);
1753 if Action is TBottleChainAbortRuleAction then
1755 if Action is TBottleChainSkipRuleAction then
1756 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1757 if (Action is TBottleChainSoundAction) and (Sound = '') then
1759 Sound := (Action as TBottleChainSoundAction).SoundFile;
1760 Sound := StringReplaceEx(Sound, ReplaceHash);
1762 if Action is TBottleChainNoDispatchAction then
1764 if Action is TBottleChainLogAction then
1766 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1767 LogName := (Action as TBottleChainLogAction).LogNames[k];
1768 LogName := StringReplaceEx(LogName, ReplaceHash);
1769 LogNameList.Add(LogName);
1772 if Action is TBottleChainOverrideGhostAction then
1774 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1776 if Action is TBottleChainQuitAction then
1777 Application.Terminate;
1778 if Action is TBottleChainSaveTextLogAction then
1779 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1780 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1781 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]));
1782 if Action is TBottleChainSaveXMLLogAction then
1783 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1785 if Action is TBottleChainSurfaceReplaceAction then
1786 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1788 if BreakFlag then Break;
1791 if Dat['Script'] <> '' then begin
1792 for i := 0 to LogNameList.Count-1 do
1793 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost']);
1794 if NoDispatch then begin
1795 frmLog.SetBottleState(Dat['MID'], lsOpened);
1797 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1798 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1799 Script, Ghost, Now());
1801 FBottleSstp.Push(CueItem);
1808 if Dat['DialogMessage'] <> '' then begin
1810 frmMessageBox.ShowMessage(
1811 DateTimeToStr(Now) + #13#10 +
1812 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1813 for i := 0 to LogNameList.Count-1 do
1814 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1818 if (Sound <> '') then PlaySound(Sound);
1828 procedure TfrmSender.YenETrans;
1829 var St, Le, i: integer;
1832 St := memScript.SelStart;
1833 Le := memScript.SelLength;
1834 Orig := GetScriptText;
1835 RegExp.Subst('s/(\r\n)+$//kg', Orig);
1837 with SsParser do begin
1838 LeaveEscape := true;
1839 EscapeInvalidMeta := false;
1840 InputString := Orig;
1842 for i := 0 to SsParser.Count-1 do begin
1843 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
1846 Text := Text + '\e';
1848 if Orig <> Text then memScript.Lines.Text := Text;
1849 SsParser.InputString := Text;
1851 RegExp.Subst('s/\r\n//kg', Text);
1853 memScript.SelStart := St;
1854 memScript.SelLength := Le;
1857 procedure TfrmSender.PostCommand(const Command: array of String);
1858 var PostStr: TStringList;
1863 PostStr := TStringList.Create;
1864 for i := Low(Command) to High(Command) do begin
1865 PostStr.Add(Command[i]);
1867 PostCommand(PostStr);
1873 procedure TfrmSender.PostCommand(Command: TStrings);
1874 var PostStr: String;
1877 PostStr := Command.Text;
1878 PostStr := ParamsEncode(PostStr);
1880 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
1881 if Pref.UseHttpProxy then begin
1882 FHttp.ProxyServer := Pref.ProxyAddress;
1883 FHttp.ProxyPort := Pref.ProxyPort;
1885 FHttp.OnSuccess := HttpSuccess;
1886 FHttp.OnConnectionFailed := HttpFailure;
1887 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
1890 on EHeapException do begin
1891 Connecting := false;
1897 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
1900 if frmLog.lvwLog.Selected = nil then Exit;
1901 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1902 if Log = nil then Exit;
1903 if Log.LogType <> ltBottle then Exit;
1905 'Command: voteMessage',
1907 'LUID: ' + Pref.LUID,
1913 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
1916 if frmLog.lvwLog.Selected = nil then Exit;
1917 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1918 if Log = nil then Exit;
1919 if Log.LogType <> ltBottle then Exit;
1921 'Command: voteMessage',
1923 'LUID: ' + Pref.LUID,
1929 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
1931 if SakuraSeeker.ProcessByName[Ghost] <> nil then
1932 Result := SakuraSeeker.ProcessByName[Ghost].SetName
1937 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
1938 MousePos: TPoint; var Handled: Boolean);
1941 with tabChannel do begin
1942 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
1943 if Tag < 0 then Handled := true;
1948 procedure TfrmSender.PostSetChannel(Channels: TStrings);
1949 var PostStr: TStringList;
1952 PostStr := TStringList.Create;
1954 with PostStr do begin
1955 Add('Command: setChannels');
1956 Add('Agent: ' + VersionString);
1957 Add('LUID: ' + Pref.LUID);
1958 if Channels <> nil then
1959 for i := 0 to Channels.Count-1 do begin
1960 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
1963 PostCommand(PostStr);
1969 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
1973 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
1975 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
1976 Chs := TStringList.Create;
1978 //
\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ð
1979 //
\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é
1981 Chs.Assign(JoinChannels);
1982 while Chs.IndexOf(Ch) >= 0 do
1983 Chs.Delete(Chs.IndexOf(Ch));
1984 PostSetChannel(Chs);
1990 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
1992 ShellExecute(Handle, 'open', PChar(Pref.VotePage), nil, nil, SW_SHOW);
1995 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
1996 Shift: TShiftState; X, Y: Integer);
2000 with tabChannel do begin
2001 Index := IndexOfTabAt(X, Y);
2003 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2007 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2009 ShellExecute(Handle, 'open', PChar(Pref.HelpPage), nil, nil, SW_SHOW);
2012 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2013 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2016 with tabChannel do begin
2017 Index := IndexOfTabAt(X, Y);
2018 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2019 if Button = mbLeft then begin
2020 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2022 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2027 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2028 Y: Integer; State: TDragState; var Accept: Boolean);
2029 var TargetRect: TRect;
2032 Accept := Source = tabChannel;
2033 if not Accept then Exit;
2034 with tabChannel do begin
2035 OldDest := FDragTabDest;
2036 FDragTabDest := IndexOfTabAt(X, Y);
2037 if FDragTabDest = -1 then begin
2038 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2041 with Canvas do begin
2045 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2046 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2047 TargetRect := TabRect(OldDest);
2048 with Canvas do begin
2049 Brush.Style := bsClear;
2050 Rectangle(TargetRect.Left, TargetRect.Top,
2051 TargetRect.Right, TargetRect.Bottom);
2054 if (OldDest <> FDragTabDest) then begin
2055 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2056 TargetRect := TabRect(FDragTabDest);
2057 with Canvas do begin
2058 Brush.Style := bsClear;
2059 Rectangle(TargetRect.Left, TargetRect.Top,
2060 TargetRect.Right, TargetRect.Bottom);
2066 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2068 var DestIndex: integer;
2070 with tabChannel do begin
2071 DestIndex := IndexOfTabAt(X, Y);
2072 Tabs.Move(FDragTabIndex, DestIndex);
2076 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2079 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2080 tabChannel.Tabs.BeginUpdate;
2081 tabChannel.Tabs.EndUpdate;
2084 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2085 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2086 var AlignRight: boolean;
2089 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2090 with cbxTargetGhost do begin
2091 AlignRight := false;
2092 if Pref.HideGhosts and not FTargetGhostExpand and
2093 (Index = Items.Count-1) and (Index > 0) then
2095 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2096 Canvas.Font.Color := clWindowText;
2097 Canvas.Font.Style := [];
2099 end else if (Index > 0) then
2101 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2102 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2103 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2105 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2106 Canvas.Font.Style := [fsBold];
2109 Canvas.Font.Color := clWindowText;
2110 Canvas.Font.Style := [];
2112 if odSelected in State then
2113 Canvas.Font.Color := clHighlightText;
2117 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2118 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2119 cbxTargetGhost.Items[Index]);
2121 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2122 cbxTargetGhost.Items[Index]);
2126 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2127 var CanClose: Boolean);
2129 if (not Pref.ConfirmOnExit) or FEndSession then
2131 if MessageDlg('SSTP Bottle Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2132 mbOkCancel, 0) = mrCancel then
2136 procedure TfrmSender.UpdateIfGhostBox;
2140 HiddenCount: integer;
2142 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2143 Selected := cbxTargetGhost.Text;
2145 with cbxTargetGhost do begin
2148 Items.Add(ChannelDefault);
2149 for i := 0 to SakuraSeeker.Count-1 do begin
2150 //
\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é
2151 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2152 if Pref.HideGhosts and not FTargetGhostExpand then
2153 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2158 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2159 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2161 cbxTargetGhost.ItemIndex := 0;
2162 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2163 with cbxTargetGhost do begin
2164 for i := 1 to Items.Count-1 do begin
2165 if Items[i] = Selected then
2168 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2169 if ItemIndex = 0 then begin
2170 Items.Add(Selected);
2171 ItemIndex := Items.Count - 1;
2175 if Pref.HideGhosts and not FTargetGhostExpand then
2176 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2181 procedure TfrmSender.HTTPFailure(Sender: TObject);
2185 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2186 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2187 (Sender as THTTPDownloadThread).LastErrorMessage);
2188 Connecting := false;
2191 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2194 SakuraSeeker.BeginDetect;
2196 i := cbxTargetGhost.ItemIndex;
2200 i := cbxTargetGhost.Items.Count-1;
2201 if Pref.HideGhosts and not FTargetGhostExpand then
2204 cbxTargetGhost.ItemIndex := i;
2205 cbxTargetGhostChange(self);
2208 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2211 SakuraSeeker.BeginDetect;
2213 i := cbxTargetGhost.ItemIndex;
2215 if Pref.HideGhosts and not FTargetGhostExpand then
2217 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2220 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2222 cbxTargetGhost.ItemIndex := i;
2223 cbxTargetGhostChange(self);
2226 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2228 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2229 FTargetGhostExpand := false;
2230 if Visible then memScript.SetFocus;
2231 cbxTargetGhostChange(self);
2234 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2236 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2238 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2239 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2241 if not IdSlpp20.Connected then begin
2243 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2245 //
\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
2246 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2252 procedure TfrmSender.RetryBeginConnect;
2254 if FBeginConnectFailCount < 3 then begin
2255 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2256 FAutoAddAfterGetChannel := true;
2258 end else if FBeginConnectFailCount = 3 then begin
2259 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2260 frmMessageBox.ShowMessage(
2261 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2262 '
\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+
2263 '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'
2265 Inc(FBeginConnectFailCount);
2269 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2270 var BottleLog: TBottleLogList;
2272 Cond: TBottleLogDownloadCondition;
2274 function TimeStr(Mins: integer): String;
2275 var day, hour, min: integer;
2277 day := Mins div (60 * 24);
2278 hour := (Mins div 60) mod 24;
2281 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2282 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2283 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2286 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2288 if frmLogDownload.Execute then begin
2289 with frmLogDownload do begin
2290 if IsRange then begin
2291 if CompareDate(DateLo, DateHi) = 0 then
2292 Title := FormatDateTime('yy-mm-dd', DateLo)
2294 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2296 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2298 if Channel <> '' then Title := Title + '(' + Channel + ')';
2300 BottleLog := TBottleLogList.Create(Title);
2302 BottleLog.OnLoaded := frmLog.LogLoaded;
2303 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2304 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2305 with frmLogDownload do begin
2306 Cond.IsRange := IsRange;
2307 Cond.RecentCount := RecentCount;
2308 Cond.DateLo := DateLo;
2309 Cond.DateHi := DateHi;
2310 Cond.MinVote := MinVote;
2311 Cond.MinAgree := MinAgree;
2312 Cond.Channel := Channel;
2314 BottleLog.LoadFromWeb(Cond);
2316 FreeAndNil(BottleLog);
2318 if BottleLog <> nil then begin
2319 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2321 frmLog.tabBottleLog.TabIndex := NewIndex;
2322 frmLog.UpdateWindow;
2326 frmLogDownload.Release;
2330 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2331 Ghost: String): boolean;
2338 Cond := Token(IfGhost, ',', i);
2339 if Cond <> '' then begin
2340 if Cond[1] = '!' then begin
2341 Cond := Copy(Cond, 2, High(integer));
2342 if Cond = Ghost then Result := false;
2344 if Cond <> Ghost then Result := false;
2351 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2352 var i, j, k, count: integer;
2353 ConstData: TScriptConst;
2354 Menu1, Menu2: TMenuItem;
2357 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2358 // 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
2359 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2360 else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2362 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2363 if Simple then begin
2364 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2365 for i := Root.Count-1 downto 0 do begin
2366 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2370 //
\91S
\95\94\8dí
\8f\9c
2374 for i := 0 to ScriptConstList.Count-1 do begin
2375 for j := 0 to ScriptConstList[i].Count-1 do begin
2376 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2377 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2379 // 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
2380 if Simple and (count < Root.Count) then
2381 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2385 Menu1 := TMenuItem.Create(Root);
2388 Caption := ScriptConstList[i][j].Caption;
2389 Hint := ScriptConstList[i][j].Caption;
2390 AutoHotkeys := maManual;
2391 Tag := ScriptConstList[i][j].ID;
2392 OnClick := mnConstGroupClick;
2395 if not Simple then begin
2398 if count < Root.Count-1 then
2399 Root.Insert(count, Menu1)
2404 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2405 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2406 ConstData := ScriptConstList[i][j][k];
2407 Menu2 := TMenuItem.Create(Root);
2408 Menu2.Caption := ConstData.Caption;
2409 Menu2.Hint := ConstData.ConstText;
2410 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2411 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2412 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2413 Menu2.ShortCut := ConstData.ShortCut;
2414 Menu2.OnClick := mnConstClick;
2415 Menu2.AutoHotkeys := maManual;
2416 Menu2.Tag := ConstData.ID;
2417 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2424 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2426 //
\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
2427 if Pref.HideGhosts and not FTargetGhostExpand then
2429 with cbxTargetGhost do
2431 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2432 //
\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
2433 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2435 FTargetGhostExpand := true;
2438 DroppedDown := true;
2442 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2443 ConstructMenu(true);
2444 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2448 procedure TfrmSender.PlaySound(const FileName: String);
2450 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2452 MediaPlayer.FileName := FileName;
2456 on E: EMCIDeviceError do begin
2457 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2462 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2465 if not Assigned(frmFMOExplorer) then
2466 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2469 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2472 frmFMOExplorer.Show;
2475 procedure TfrmSender.SaveChainRuleList;
2476 var Str: TStringList;
2478 Str := TStringList.Create;
2480 Str.Text := ComponentToString(BottleChainRuleList);
2481 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2487 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2489 frmLog.SetBottleState(MID, lsOpened);
2492 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2494 frmLog.SetBottleState(MID, lsPlaying);
2497 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2498 var InsertItem: TLogItem;
2499 i, errCount, Res: integer;
2500 Log: TBottleLogList;
2501 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2503 if FBottleSstp.CueCount > 0 then begin
2504 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'+
2505 '
\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+
2506 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2507 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2510 frmLog.AllBottleOpened;
2511 if frmLog.lvwLog.Selected = nil then Exit;
2512 Log := frmLog.SelectedBottleLog;
2513 if Log = nil then Exit;
2514 FBottleSSTP.OnResendCountChange := nil;
2516 for i := frmLog.lvwLog.Selected.Index downto 0 do begin
2517 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2518 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2520 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2521 if ErrorMes <> '' then
2523 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2524 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2527 raise Exception.Create('Script Syntax Error')
2528 else if Res = mrCancel then
2532 frmLog.AllBottleOpened;
2536 if InsertItem.Ghost = '' then begin
2537 if ChannelList.Channel[InsertItem.Channel] <> nil then
2538 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2540 FBottleSSTP.Push(InsertItem);
2541 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2547 if errCount > 0 then
2548 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]));
2549 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2550 BottleSstpResendCountChange(self);
2551 frmLog.lvwLog.Invalidate;
2554 function TfrmSender.ScriptTransForSSTP(const Script: String;
2555 out Error: String): String;
2556 var TransOpt: TScriptTransOptions;
2558 if Pref.NoTransURL then
2559 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2561 TransOpt := [toConvertURL, toWaitScriptEnd];
2562 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2563 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2564 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2566 Error := DoTrans(Result, TransOpt);
2569 procedure TfrmSender.FormResize(Sender: TObject);
2572 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2573 if memScript.ColWidth <> 0 then
2577 w := Width - LeftMargin - ColWidth div 2;
2578 if ScrollBars in [ssVertical, ssBoth] then
2579 w := w - GetSystemMetrics(SM_CYVSCROLL);
2580 WrapOption.WrapByte := w div ColWidth;
2585 procedure TfrmSender.actCopyExecute(Sender: TObject);
2587 memScript.CopyToClipboard;
2590 procedure TfrmSender.actPasteExecute(Sender: TObject);
2592 memScript.PasteFromClipboard;
2595 procedure TfrmSender.actCutExecute(Sender: TObject);
2597 memScript.CutToClipboard;
2600 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2602 memScript.SelectAll;
2605 procedure TfrmSender.actUndoExecute(Sender: TObject);
2610 procedure TfrmSender.actRedoExecute(Sender: TObject);
2615 function TfrmSender.IsSurfaceTag(const Script: String;
2616 var ID: integer): boolean;
2619 if SsParser.Match(Script, '\s%d') = 3 then
2622 ID := Ord(Script[3]) - Ord('0')
2624 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2627 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2631 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2632 Shift: TShiftState; X, Y: Integer);
2636 //
\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[
2637 if not Pref.SurfacePreviewOnScriptPoint then
2639 token := memScript.TokenStringFromPos(Point(X, Y));
2640 if IsSurfaceTag(token, id) then
2642 DoSurfacePreview(id, spEditor);
2645 frmSurfacePreview.HideAway;
2649 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2650 const Kind: TSurfacePreviewType);
2655 if cbxTargetGhost.ItemIndex > 0 then
2656 ghost := cbxTargetGhost.Text
2657 else if FNowChannel <> '' then
2658 ghost := ChannelList.Channel[FNowChannel].Ghost;
2660 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2661 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2662 not (frmSurfacePreview.IsHidden) then
2669 Bmp := TBitmap.Create;
2671 if Spps.TryGetImage(ghost, Surface, Bmp) then
2675 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2677 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2679 CPos := Point(0, 0);
2681 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2682 FVisiblePreviewGhost := Ghost;
2683 FVisiblePreviewSurface := Surface;
2685 frmSurfacePreview.HideAway;
2692 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2693 {var MousePoint: TPoint;
2696 //
\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é
2697 //
\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Å
2698 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2699 {GetCursorPos(MousePoint);
2700 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2701 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2702 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2703 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2706 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2707 var MousePoint: TPoint;
2709 GetCursorPos(MousePoint);
2710 case Pref.SurfacePreviewOnScriptPointPosition of
2711 spspMainWindowRight:
2712 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2714 Result := Point(Self.Left - w, MousePoint.Y);
2718 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2720 if (Sender is TMenuItem) then
2721 FVisibleMenuItem := Sender as TMenuItem;
2724 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2726 if FScriptBuffer.Count = 0 then
2728 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2729 memScriptChange(Self);
2730 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2733 procedure TfrmSender.EditorPreview;
2734 var Ghost, Script: String;
2736 if frmEditorTalkShow <> nil then
2737 if frmEditorTalkShow.Visible then
2739 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2741 if cbxTargetGhost.ItemIndex > 0 then
2742 Ghost := cbxTargetGhost.Text
2743 else if FNowChannel <> '' then
2744 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2745 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2749 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2751 if frmEditorTalkShow <> nil then
2752 frmEditorTalkShow.Show
2755 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
2756 frmEditorTalkShow.Show;
2761 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
2762 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
2764 Spps.ClearImagePool;
2765 Spps.LoadFromDirectory(FSppDir);
2768 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
2770 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
2773 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2774 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
2775 function TfrmSender.TagReplace(Script: String; Before,
2776 After: array of String): String;
2777 var BeforeList, AfterList: TStringList;
2780 BeforeList := TStringList.Create;
2781 AfterList := TStringList.Create;
2783 for i := Low(Before) to High(Before) do
2784 BeforeList.Add(Before[i]);
2785 for i := Low(After) to High(After) do
2786 AfterList.Add(After[i]);
2787 Result := TagReplace(Script, BeforeList, AfterList);
2794 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2795 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
2796 //
\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¢)
2797 function TfrmSender.TagReplace(Script: String; Before,
2798 After: TStrings): String;
2800 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
2806 OldStr := InputString;
2807 OldLeaveEscape := LeaveEscape;
2808 OldEscapeInvalidMeta := EscapeInvalidMeta;
2809 LeaveEscape := true;
2810 EscapeInvalidMeta := false;
2811 InputString := Script;
2813 for i := 0 to SsParser.Count-1 do
2816 for j := 0 to Before.Count-1 do
2818 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
2821 Result := Result + After[j];
2825 Result := Result + SsParser[i];
2829 LeaveEscape := OldLeaveEscape;
2830 EscapeInvalidMeta := OldEscapeInvalidMeta;
2831 InputString := OldStr;
2835 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
2836 //
\91Î
\89\9e\82·
\82é
2837 procedure TfrmSender.WndProc(var Message: TMessage);
2839 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
2841 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
2842 //
\8bC
\82Ã
\82©
\82¹
\82é
2850 procedure TfrmSender.actReplaceExecute(Sender: TObject);
2852 Form: TfrmStrReplaceDialog;
2854 Options: TReplaceFlags;
2856 Application.CreateForm(TfrmStrReplaceDialog, Form);
2858 if Form.Execute then
2862 Lines := memScript.Lines.Text;
2863 Options := [rfReplaceAll];
2865 Options := Options + [rfIgnoreCase];
2867 Lines := StringReplaceRegExp(Lines, BeforeStr, AfterStr, Options)
2869 Lines := StringReplace(Lines, BeforeStr, AfterStr, Options);
2871 if Lines <> memScript.Lines.Text then
2873 memScript.SelectAll;
2874 memScript.SelText := Lines;
2882 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
2885 if frmLog.lvwLog.Selected = nil then Exit;
2886 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2887 if Log = nil then Exit;
2888 CopyFromLogToEditor(Log);
2891 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
2892 var Ghost, Script: String;
2895 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2896 if cbxTargetGhost.ItemIndex > 0 then
2897 Ghost := cbxTargetGhost.Text
2900 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost);
2904 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
2905 Y: Integer; State: TDragState; var Accept: Boolean);
2907 //
\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é
2908 if Source is TBottleLogDragObject then
2909 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
2912 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
2914 var Src: TBottleLogDragObject;
2917 //
\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é
2918 if not (Source is TBottleLogDragObject) then
2920 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
2922 Src := Source as TBottleLogDragObject;
2924 CopyFromLogToEditor(Log);
2927 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
2929 if Log.LogType <> ltBottle then Exit;
2930 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Ä)
2931 memScript.Lines.Clear;
2932 memScript.Lines.Add(Log.Script);
2933 if Log.Ghost <> '' then
2935 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
2936 //
\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Å
2937 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
2938 cbxTargetGhost.Items.Add(Log.Ghost);
2939 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
2941 cbxTargetGhost.Invalidate;
2943 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
2947 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
2949 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
2950 if frmLog.SelectedBottleLog = nil then
2952 if frmLog.lvwLog.Selected = nil then
2954 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
2955 frmLog.UpdateWindow;
2956 frmLog.lvwLogChange(Self, nil, ctState);
2959 procedure TfrmSender.ClearEditor;
2960 var TmpScript: String;
2962 DoSaveBuffer: boolean;
2963 SavedScript: TStringList;
2965 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
2966 //
\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é
2967 DoSaveBuffer := false;
2968 if FScriptBuffer.Count = 0 then
2969 DoSaveBuffer := true
2970 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
2971 DoSaveBuffer := true;
2972 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
2973 DoSaveBuffer := false;
2974 if DoSaveBuffer then
2976 SavedScript := TStringList.Create;
2977 SavedScript.Text := GetScriptText;
2978 FScriptBuffer.Insert(0, SavedScript);
2980 if FScriptBuffer.Count >= 4 then
2981 FScriptBuffer.Delete(FScriptBuffer.Count-1);
2982 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
2984 TmpScript := Pref.DefaultScript;
2985 Position := Pos('|', TmpScript);
2986 if Position < 1 then Position := 1;
2987 TmpScript := StringReplace(TmpScript, '|', '', []);
2988 memScript.Lines.Text := TmpScript;
2989 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
2990 memScript.SelStart := Position-1;
2992 if Visible then memScript.SetFocus;
2993 FScriptModified := false;
2994 memScriptChange(self);
2997 procedure TfrmSender.AppendTextLog(const FileName, Line: String);
3001 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3003 ForceDirectories(ExtractFileDir(FileName));
3004 AssignFile(F, FileName);
3005 if FileExists(FileName) then
3014 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3018 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3023 Impl: TDomImplementation;
3024 Parser: TXmlToDomParser;
3027 try // Long try block to handle all kinds of exception in this method
3028 if not FileExists(FileName) then
3030 // Create empty XML log file
3031 Impl := TDomImplementation.create(nil);
3033 ForceDirectories(ExtractFileDir(FileName));
3034 Parser := TXmlToDomParser.create(nil);
3035 Parser.DOMImpl := Impl;
3038 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3041 documentElement.setAttribute('saved',
3042 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3043 documentElement.setAttribute('generator', VersionString);
3044 documentElement.setAttribute('version', '1.0');
3046 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3047 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3049 DOM.writeCodeAsShiftJIS(F);
3054 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3057 Parser.DOMImpl.freeDocument(DOM);
3064 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3070 F.Seek(P, soFromEnd);
3072 if Buf = '</bottlelog>' then
3077 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3080 F.Seek(P, soFromEnd);
3081 Buf := Format('<message mid="%s">', [Args['MID']]);
3082 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3083 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3084 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3085 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3086 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3087 Buf := Buf + '</message>';
3088 Buf := Buf + '</bottlelog>';
3089 F.Write(Buf[1], Length(Buf));
3096 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3100 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3105 SelText := memScript.SelText;
3106 if SelText <> '' then
3108 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3111 memScriptChange(Self);
3115 function TfrmSender.ReplaceSurface(Script: String;
3116 Params: TCollection): String;
3118 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3119 OldStr, Tag: String;
3120 i, j, k, Cur: integer;
3121 Item: TSurfaceReplaceItem;
3122 Before: TSurfaceReplaceBeforeItem;
3128 OldStr := InputString;
3129 OldLeaveEscape := LeaveEscape;
3130 OldEscapeInvalidMeta := EscapeInvalidMeta;
3131 LeaveEscape := true;
3132 EscapeInvalidMeta := false;
3133 InputString := Script;
3135 for i := 0 to SsParser.Count-1 do
3137 if SsParser.MarkUpType[i] <> mtTag then
3139 Result := Result + SsParser.Str[i];
3142 Tag := SsParser.Str[i];
3143 if SsParser.Match(Tag, '\s%d') = 2 then
3144 Cur := Ord(Tag[3]) - Ord('0')
3145 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3146 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3149 Result := Result + Tag;
3153 for j := 0 to Params.Count-1 do
3155 Item := Params.Items[j] as TSurfaceReplaceItem;
3156 for k := 0 to Item.Before.Count-1 do
3158 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3159 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3162 Result := Result + Format('\s[%d]', [Item.After]);
3170 Result := Result + Tag;
3174 LeaveEscape := OldLeaveEscape;
3175 EscapeInvalidMeta := OldEscapeInvalidMeta;
3176 InputString := OldStr;
3180 procedure TfrmSender.WMQueryEndSession(var msg: TWMQueryEndSession);
3182 // Windows
\82ª
\8fI
\97¹
\82µ
\82æ
\82¤
\82Æ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82ð
\8a´
\92m
\82·
\82é
3183 FEndSession := true;
3187 procedure TfrmSender.IdSLPP20ConnectFailed(Sender: TObject);
3190 if FBeginConnectFailCount = 0 then
3193 if Pref.UseHttpProxy then
3194 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 +
3195 '
\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 +
3196 '
\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')
3198 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3199 '
\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 +
3200 '
\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');
3202 ShowHintLabel('SSTP Bottle Server
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
3203 Inc(FBeginConnectFailCount);
3206 procedure TfrmSender.BuildReplaceMenu(Root: TMenuItem);
3209 Presets: TReplacePresetCollection;
3213 Presets := Pref.ReplacePresets.Presets;
3214 for i := 0 to Presets.Count-1 do
3216 NewItem := TMenuItem.Create(Root);
3219 Caption := Presets[i].Title;
3220 ShortCut := Presets[i].ShortCut;
3221 AutoHotkeys := maManual;
3222 Hint := Presets[i].Pairs.StringExpression;
3224 OnClick := mnPresetReplaceClick;
3228 Root.Enabled := Presets.Count > 0;
3231 procedure TfrmSender.mnPresetReplaceClick(Sender: TObject);
3233 Preset: TReplacePreset;
3236 //
\83v
\83\8a\83Z
\83b
\83g
\92u
\8a·
\82ð
\8eÀ
\8ds
3237 Preset := Pref.ReplacePresets.Presets[(Sender as TMenuItem).Tag];
3238 Lines := memScript.Lines.Text;
3239 New := Preset.Pairs.ExecuteReplace(Lines);
3240 if New <> Lines then
3242 memScript.SelectAll;
3243 memScript.SelText := New;
3245 if Preset.ConfirmAfterReplace then