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, SsPlayTime, heClasses, heFountain,
16 SakuraScriptFountain, HEditor,
17 IniFiles, ShellAPI, Contnrs,
18 ConstEditor, Buttons, Clipbrd, HeadValue, Logs, MultipleChoiceEditor,
19 IdException, HttpThread, IdHTTP, LogDownload,
20 ScriptConsts, DateUtils, BottleChainRule, BottleChainEvent,
21 SakuraSeekerInstance, HTSearch,
22 SppList, SurfacePreview, XDOM_2_3_J3,
23 RegexUtils, StrReplace, StrReplaceDialog, ReplacePresetEditor, ExtCtrls;
26 TSurfacePreviewType = (spHint, spEditor);
28 TfrmSender = class(TForm)
32 mnRegister: TMenuItem;
35 StatusBar: TStatusBar;
38 mnEditConst: TMenuItem;
39 ActionList: TActionList;
41 mnPopPaste: TMenuItem;
44 mnPopSelectAll: TMenuItem;
46 mnPopConst: TMenuItem;
51 mnSelectAll: TMenuItem;
53 ApplicationEvents: TApplicationEvents;
54 mnPopUpTaskTray: TPopupMenu;
55 mnTaskStart: TMenuItem;
57 mnTaskRestore: TMenuItem;
58 mnTaskNewMessage: TMenuItem;
62 mnTaskExit: TMenuItem;
70 mnPopupConst: TPopupMenu;
71 actEditConst: TAction;
73 mnShowToolBar: TMenuItem;
74 mnShowConstBar: TMenuItem;
75 ConstBarMenu: TMainMenu;
77 tbtnClear: TToolButton;
78 tbtnConfirm: TToolButton;
79 tbtnSend: TToolButton;
80 tbtnSeparator: TToolButton;
81 tbtnStart: TToolButton;
82 tbtnSeparator2: TToolButton;
83 tbtnInsertConst: TToolButton;
84 ConstMenuBar: TMenuBar;
89 actCopyAllNoReturn: TAction;
90 mnCopyAllNoReturn: TMenuItem;
91 mnPopCopyAll: TMenuItem;
92 mnPopCopyAllNoReturn: TMenuItem;
94 tbtnSetting: TToolButton;
95 mnStayOnTop: TMenuItem;
97 actExitClient: TAction;
99 tbtnEditConst: TToolButton;
100 actClearBottles: TAction;
101 mnClearBottles: TMenuItem;
102 MediaPlayer: TMediaPlayer;
103 mnGetNewId: TMenuItem;
104 actNextChannel: TAction;
105 actPrevChannel: TAction;
107 mnNextChannel: TMenuItem;
108 mnPrevChannel: TMenuItem;
111 tbtnShowLog: TToolButton;
112 tbtnSleep: TToolButton;
116 mnTaskSleep: TMenuItem;
118 tabChannel: TTabControl;
121 cbxTargetGhost: TComboBox;
122 actVoteMessage: TAction;
123 mnPopUpChannelTab: TPopupMenu;
124 mnLeaveThisChannel: TMenuItem;
126 mnGotoVote: TMenuItem;
127 mnGoToHelp: TMenuItem;
131 mnExitAllChannels: TMenuItem;
132 actAgreeMessage: TAction;
135 actPrevGhost: TAction;
136 actNextGhost: TAction;
137 mnPrevGhost: TMenuItem;
138 mnNextGhost: TMenuItem;
139 actResetGhost: TAction;
140 mnResetGhost: TMenuItem;
141 timDisconnectCheckTimer: TTimer;
142 DirectSstp: TDirectSstp;
143 actDownloadLog: TAction;
144 actFMOExplorer: TAction;
145 tbtnFMOExplorer: TToolButton;
146 mnFMOExplorer: TMenuItem;
148 actInsertCue: TAction;
149 SakuraScriptFountain: TSakuraScriptFountain;
154 actSelectAll: TAction;
155 actRecallScriptBuffer: TAction;
157 mnRecallScriptBuffer: TMenuItem;
158 tbtnEditorPreview: TToolButton;
159 actEditorPreview: TAction;
160 mnEditorPreview: TMenuItem;
161 actResetPlugins: TAction;
163 mnResetPlugins: TMenuItem;
166 mnReplace: TMenuItem;
167 actSendToEditor: TAction;
168 actSendToLogWindow: TAction;
169 mnSendLogWindow: TMenuItem;
170 actDeleteLogItem: TAction;
172 actEditCopy: TEditCopy;
173 tbtnSendToLogWindow: TToolButton;
174 SsPlayTime: TSsPlayTime;
180 mnPresetReplaceRoot: TMenuItem;
181 procedure actConfirmExecute(Sender: TObject);
182 procedure FormCreate(Sender: TObject);
183 procedure FormDestroy(Sender: TObject);
184 procedure actSendExecute(Sender: TObject);
185 procedure HTTPSuccess(Sender: TObject);
186 procedure HTTPFailure(Sender: TObject);
187 procedure actStartClick(Sender: TObject);
188 procedure actStopExecute(Sender: TObject);
189 procedure FormShow(Sender: TObject);
190 procedure actAboutClick(Sender: TObject);
191 procedure actExitClientExecute(Sender: TObject);
192 procedure actClearExecute(Sender: TObject);
193 procedure memScriptChange(Sender: TObject);
194 procedure mnStayOnTopClick(Sender: TObject);
195 procedure actEditConstExecute(Sender: TObject);
196 procedure mnTaskBarClick(Sender: TObject);
197 procedure FormClose(Sender: TObject; var Action: TCloseAction);
198 procedure ApplicationEventsMinimize(Sender: TObject);
199 procedure ApplicationEventsRestore(Sender: TObject);
200 procedure mnTaskRestoreClick(Sender: TObject);
201 procedure TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
202 procedure FormActivate(Sender: TObject);
203 procedure mnTaskNewMessageClick(Sender: TObject);
204 procedure ApplicationEventsHint(Sender: TObject);
205 procedure memScriptKeyDown(Sender: TObject; var Key: Word;
207 procedure mnShowToolBarClick(Sender: TObject);
208 procedure mnShowConstBarClick(Sender: TObject);
209 procedure mnGoToHPClick(Sender: TObject);
210 procedure LabelTimerTimer(Sender: TObject);
211 procedure actCopyAllExecute(Sender: TObject);
212 procedure actCopyAllNoReturnExecute(Sender: TObject);
213 procedure Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
214 const Param: String);
215 procedure actSettingExecute(Sender: TObject);
216 procedure memScriptKeyPress(Sender: TObject; var Key: Char);
217 procedure Slpp20Disconnect(Sender: TObject);
218 procedure actClearBottlesExecute(Sender: TObject);
219 procedure SakuraSeekerDetectResultChanged(Sender: TObject);
220 procedure mnGetNewIdClick(Sender: TObject);
221 procedure tabChannelChange(Sender: TObject);
222 procedure actPrevChannelExecute(Sender: TObject);
223 procedure actNextChannelExecute(Sender: TObject);
224 procedure cbxTargetGhostDropDown(Sender: TObject);
225 procedure actShowLogExecute(Sender: TObject);
226 procedure actSleepExecute(Sender: TObject);
227 procedure actVoteMessageExecute(Sender: TObject);
228 procedure tabChannelContextPopup(Sender: TObject; MousePos: TPoint;
229 var Handled: Boolean);
230 procedure mnLeaveThisChannelClick(Sender: TObject);
231 procedure mnGotoVoteClick(Sender: TObject);
232 procedure tabChannelMouseMove(Sender: TObject; Shift: TShiftState; X,
234 procedure mnGoToHelpClick(Sender: TObject);
235 procedure tabChannelMouseDown(Sender: TObject; Button: TMouseButton;
236 Shift: TShiftState; X, Y: Integer);
237 procedure tabChannelDragOver(Sender, Source: TObject; X, Y: Integer;
238 State: TDragState; var Accept: Boolean);
239 procedure tabChannelDragDrop(Sender, Source: TObject; X, Y: Integer);
240 procedure tabChannelEndDrag(Sender, Target: TObject; X, Y: Integer);
241 procedure cbxTargetGhostDrawItem(Control: TWinControl; Index: Integer;
242 Rect: TRect; State: TOwnerDrawState);
243 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
244 procedure actAgreeMessageExecute(Sender: TObject);
245 procedure actPrevGhostExecute(Sender: TObject);
246 procedure actNextGhostExecute(Sender: TObject);
247 procedure actResetGhostExecute(Sender: TObject);
248 procedure timDisconnectCheckTimerTimer(Sender: TObject);
249 procedure actDownloadLogExecute(Sender: TObject);
250 procedure cbxTargetGhostChange(Sender: TObject);
251 procedure actFMOExplorerExecute(Sender: TObject);
252 procedure actInsertCueExecute(Sender: TObject);
253 procedure FormResize(Sender: TObject);
254 procedure actCopyExecute(Sender: TObject);
255 procedure actPasteExecute(Sender: TObject);
256 procedure actCutExecute(Sender: TObject);
257 procedure actSelectAllExecute(Sender: TObject);
258 procedure memScriptMouseMove(Sender: TObject; Shift: TShiftState; X,
260 procedure actRecallScriptBufferExecute(Sender: TObject);
261 procedure actEditorPreviewExecute(Sender: TObject);
262 procedure actResetPluginsExecute(Sender: TObject);
263 procedure IdSLPP20Connect(Sender: TObject);
264 procedure actReplaceExecute(Sender: TObject);
265 procedure actSendToEditorExecute(Sender: TObject);
266 procedure actSendToLogWindowExecute(Sender: TObject);
267 procedure memScriptDragOver(Sender, Source: TObject; X, Y: Integer;
268 State: TDragState; var Accept: Boolean);
269 procedure memScriptDragDrop(Sender, Source: TObject; X, Y: Integer);
270 procedure actDeleteLogItemExecute(Sender: TObject);
271 procedure memScriptSelectionChange(Sender: TObject; Selected: Boolean);
272 procedure actUndoExecute(Sender: TObject);
273 procedure actRedoExecute(Sender: TObject);
274 procedure IdSLPP20ConnectFailed(Sender: TObject);
276 FSleeping: boolean; //
\94z
\91\97\83X
\83\8a\81[
\83v
\92\86\82©
\82Ç
\82¤
\82©
278 FConnecting: boolean;
280 FBooted: boolean; //
\8f\89\89ñ
\8bN
\93®
\92Ê
\90M
\97p
281 FEndSession: Boolean; // Windows
\8fI
\97¹
\82ð
\8c\9f\92m
\82µ
\82Ätrue
\82É
\82È
\82é
282 FOriginalCaption: String;
283 FAutoAddAfterGetChannel: boolean; //
\83`
\83\83\83\93\83l
\83\8b\8eæ
\93¾
\8cã
\82É
\83_
\83C
\83A
\83\8d\83O
\82È
\82µ
\82É
284 //
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82·
\82é
\82©
\82Ç
\82¤
\82©
288 FNowChannel: String; //
\8c»
\8dÝ
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b
289 JoinChannelsBackup: TStringList; //
\88ê
\8e\9e\8eg
\97p
291 FScriptModified: boolean; //
\83X
\83N
\83\8a\83v
\83g
\82ª
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\81B
292 //
\83\8d\81[
\83J
\83\8b\8am
\94F
\8b
\90§
\97p
\83t
\83\89\83O
\81BTRichEdit.Modified
\82Í
293 //
\95Ê
\82Ì
\97p
\93r
\82Å
\8eg
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8eg
\82¦
\82È
\82¢
295 FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
296 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)
298 FBottleSstp: TBottleSstp; //
\8dÄ
\91\97\83v
\83\8d\83O
\83\89\83\80
300 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Ý)
301 FBeginConnectFailCount: integer; //
\89½
\93x
\82à
\90Ú
\91±
\8e¸
\94s
\82µ
\82½
\82ç
\83\8a\83g
\83\89\83C
\92\86\8e~
303 FVisiblePreviewGhost: String;
304 FVisiblePreviewSurface: integer; //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82Å
\8c©
\82¦
\82Ä
\82¢
\82é
\82à
\82Ì
305 FVisibleMenuItem: TMenuItem; //
\83N
\83\8a\83b
\83N
\82³
\82ê
\82½
\83\81\83j
\83\85\81[
\83A
\83C
\83e
\83\80\81B
306 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82ª
\83\81\83j
\83\85\81[
\82Ì
\89º
\82É
307 //
\89B
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\8bL
\89¯
\82µ
\82Ä
\82¨
\82
309 FTargetGhostExpand: boolean; //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ª
\81A
310 //
\88ê
\8e\9e\93I
\82É
\91S
\95\94\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\82Ì
\83t
\83\89\83O
312 FScriptBuffer: TObjectList; //
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
314 FWM_TaskBarCreated: WORD; //
\83^
\83X
\83N
\83o
\81[
\93o
\98^
\97p
\83E
\83B
\83\93\83h
\83E
\83\81\83b
\83Z
\81[
\83WID
316 procedure SetStatusText(const Value: String);
317 procedure SetSleeping(const Value: boolean);
319 procedure SetConnecting(const Value: boolean);
320 procedure SetAdded(const Value: boolean);
321 procedure mnConstClick(Sender: TObject);
322 procedure mnConstGroupClick(Sender: TObject);
323 procedure mnPresetReplaceClick(Sender: TObject);
324 property Added: boolean read FAdded write SetAdded;
325 property Sleeping: boolean read FSleeping write SetSleeping;
326 property StatusText: String read FStatusText write SetStatusText;
327 function GetScriptText: String;
328 procedure ChangeTaskIcon;
329 procedure ShowHintLabel(const Mes: String; Col: TColor = clBlue);
330 procedure UpdateLayout;
331 procedure DispatchBottle(EventType: TIdSlppEventType; Dat: THeadValue);
332 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
333 procedure UpdateChannelInfo(Dat: THeadValue);
334 procedure UpdateJoinChannelList(Dat: THeadValue);
335 procedure NoLuidError;
336 procedure UpdateIfGhostBox;
337 function BuildMenuConditionCheck(const IfGhost, Ghost: String): boolean;
338 procedure BuildMenu(Root: TMenuItem; Simple: boolean);
339 procedure BuildReplaceMenu(Root: TMenuItem);
340 procedure PlaySound(const FileName: String);
341 //TBottleSstp
\8aÖ
\8cW
\83C
\83x
\83\93\83g
\83n
\83\93\83h
\83\89
342 procedure BottleSstpResendCountChange(Sender: TObject);
343 procedure BottleSstpResendTrying(Sender: TObject; MID: String);
344 procedure BottleSstpResendEnd(Sender: TObject; MID: String);
345 function IsSurfaceTag(const Script: String; var ID: integer): boolean;
346 procedure DoSurfacePreview(Surface: integer; const Kind:
347 TSurfacePreviewType);
348 function GetSurfacePreviewPositionHint(w, h: integer): TPoint;
349 function GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
350 procedure EditorPreview;
351 //
\83^
\83O
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\95Ï
\8a·
\82·
\82é
352 function TagReplace(Script: String;
353 Before, After: array of String): String; overload;
354 function TagReplace(Script: String;
355 Before, After: TStrings): String; overload;
356 //
\83T
\81[
\83t
\83B
\83X
\82ð
\95Ï
\8a·
\82·
\82é
357 function ReplaceSurface(Script: String; Params: TCollection): String;
358 procedure ClearEditor;
359 procedure CopyFromLogToEditor(Log: TLogItem);
361 procedure AppendTextLog(const FileName, Line: String);
362 procedure AppendXMLLog(const FileName: String; Args: THeadValue);
364 procedure WndProc(var Message: TMessage); override;
365 procedure WMQueryEndSession(var msg: TWMQueryEndSession);
366 message WM_QUERYENDSESSION;
368 function DoTrans(var Script: String;
369 Options: TScriptTransOptions): String; overload;
370 function DoTrans(var Script: String;
371 Options: TScriptTransOptions; out FoundURL: boolean): String; overload;
372 function ScriptTransForSSTP(const Script: String;
373 out Error: String): String; overload;
374 procedure BeginConnect;
375 procedure RetryBeginConnect;
376 procedure EndConnect;
377 procedure ConstructMenu(Simple: boolean);
378 property Connecting: boolean read FConnecting write SetConnecting;
379 property BottleSstp: TBottleSstp read FBottleSstp;
380 function GhostNameToSetName(const Ghost: String): String;
381 procedure PostCommand(const Command: array of String); overload;
382 procedure PostCommand(Command: TStrings); overload;
383 procedure PostSetChannel(Channels: TStrings);
384 procedure SaveChainRuleList;
389 frmSender: TfrmSender;
392 PanelConnecting = 0; //
\81u
\90Ú
\91±
\92\86\81v
\95\
\8e¦
\97p
393 PanelBytes = 1; //
\81\9b\81\9b\83o
\83C
\83g
394 PanelCount = 2; //Local Proxy
\81A
\8c»
\8dÝ
\81\9b\8c\8f\91Ò
\82¿
395 PanelMembers = 3; //
\81\9b\81\9b\90l
396 PanelStatus = 4; //SSTP Bottle
\83T
\81[
\83o
\82É
\93o
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81c
\82È
\82Ç
399 IconDisconnected = 18;
401 IconSleepDisconnected = 20;
403 WarningColor = clRed;
405 SendButtonLongHint = 'Bottle
\82Ì
\91\97\90M';
407 function Token(const Str: String; const Delimiter: char;
408 const Index: integer): String;
410 function StringReplaceEx(const Before: String; List: THeadValue): String;
411 procedure OpenBrowser(const Url: String);
415 uses SendConfirm, SettingForm, ChannelListForm, LogForm,
416 MessageBox, FMOExplorer, EditorTalkShow;
420 //
\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
421 function Token(const Str: String; const Delimiter: char;
422 const Index: integer): String;
423 var i, c, len: integer;
429 while i <= len do begin
430 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
432 if c > Index then Break;
433 end else if c = Index then Result := Result + Str[i];
438 //
\83u
\83\89\83E
\83U
\82ÅURL
\82ð
\8aJ
\82
\8f\88\97\9d
439 procedure OpenBrowser(const Url: String);
441 if Pref.BrowserExeName='' then
443 ShellExecute(HWND(nil), 'open', PChar(Url), nil, nil, SW_SHOW);
446 ShellExecute(HWND(nil), 'open', PChar(Pref.BrowserExeName), PChar(Url), nil, SW_SHOW);
450 //
\95¶
\8e\9a\97ñ
\82ð
\92u
\82«
\8a·
\82¦
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
451 function StringReplaceEx(const Before: String; List: THeadValue): String;
453 i, MinPos, MinKey, p: integer;
462 for i := 0 to List.Count-1 do
464 p := Pos(List.KeyAt[i], Work);
465 if (p > 0) and ((p < MinPos) or (MinPos < 0)) then
473 Result := Result + Work;
477 Result := Result + Copy(Work, 1, MinPos-1) + List.ValueAt[MinKey];
478 Delete(Work, 1, (MinPos - 1) + Length(List.KeyAt[MinKey]));
486 procedure TfrmSender.actConfirmExecute(Sender: TObject);
488 AScript, Err, AGhost: String;
492 // Partial Confirmation
493 if memScript.SelText <> '' then
496 if not Pref.AutoPartialConfirm then
497 if not MultipleChoiceEdit('
\8am
\94F', ['
\91I
\91ð
\95\94\95ª
\82Ì
\82Ý', '
\83X
\83N
\83\8a\83v
\83g
\91S
\91Ì'], Choice) then
501 AScript := memScript.SelText;
502 AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
504 AScript := GetScriptText;
506 AScript := GetScriptText;
507 AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
509 if Length(AScript) = 0 then Exit;
511 AScript := ScriptTransForSSTP(AScript, Err);
518 if cbxTargetGhost.ItemIndex > 0 then
519 AGhost := cbxTargetGhost.Text
520 else if FNowChannel <> '' then
521 AGhost := ChannelList.Channel[FNowChannel].Ghost
525 if Pref.IgnoreTimeCritical then
526 AScript := TagReplace(AScript, ['\t'], ['']);
528 Item := TLogItem.Create;
534 Channel := '
\81y
\8am
\94F
\81z';
537 BottleSstp.Unshift(Item);
542 FScriptModified := false;
545 procedure TfrmSender.FormCreate(Sender: TObject);
546 var Str: TStringList;
548 FScriptBuffer := TObjectList.Create(true);
550 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
551 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
552 ScriptConstList.LoadFromDir(FConstDir);
553 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
554 Spps.LoadFromDirectory(FSppDir);
555 ConstructMenu(false);
556 BuildReplaceMenu(mnPresetReplaceRoot);
558 Str := TStringList.Create;
561 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
562 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
565 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
566 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
568 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');
569 Application.Terminate;
570 Application.ProcessMessages;
578 FOriginalCaption := Self.Caption;
581 mnShowToolBar.Checked := Pref.ShowToolBar;
582 mnShowConstBar.Checked := Pref.ShowConstBar;
583 if Pref.StayOnTop then begin
584 FormStyle := fsStayOnTop;
585 mnStayOnTop.Checked := true;
587 FormStyle := fsNormal;
588 mnStayOnTop.Checked := false;
591 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
592 mnGoToHP.Hint := Pref.HomePage;
593 mnGotoVote.Hint := Pref.VotePage;
594 mnGotoHelp.Hint := Pref.HelpPage;
596 mnGetNewId.Enabled := (Pref.LUID = '');
598 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
600 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
601 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
603 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
604 Application.Terminate;
607 //
\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è
608 SsPlayTime.PlayTimeParams := Pref.PlayTimeParams;
610 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
611 with Pref.SenderWindowPosition do begin
614 Self.Width := Right - Left + 1;
615 Self.Height := Bottom - Top + 1;
618 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
619 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
621 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
622 actClearExecute(Sender);
623 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
625 //
\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»)
626 UpdateJoinChannelList(nil);
628 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
629 FBottleSstp := TBottleSstp.Create(false);
630 with FBottleSstp do begin
631 OnResendCountChange := BottleSstpResendCountChange;
632 OnResendTrying := BottleSstpResendTrying;
633 OnResendEnd := BottleSstpResendEnd;
637 procedure TfrmSender.FormDestroy(Sender: TObject);
639 if FScriptBuffer <> nil then
642 if FBottleSstp <> nil then begin
643 FBottleSstp.Terminate;
647 with Pref.SenderWindowPosition do begin
650 Right := Self.Left + Self.Width - 1;
651 Bottom := Self.Top + Self.Height - 1;
654 if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
656 ScriptConstList.Save;
659 BottleChainRuleList.Free;
664 procedure TfrmSender.SetConnecting(const Value: boolean);
666 FConnecting := Value;
668 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
669 actStart.Enabled := false;
670 actStop.Enabled := false;
671 actSend.Enabled := false;
672 actVoteMessage.Enabled := false;
673 actAgreeMessage.Enabled := false;
674 mnGetNewId.Enabled := false;
675 Screen.Cursor := crAppStart;
677 StatusBar.Panels[PanelConnecting].Text := '';
678 actStart.Enabled := true;
679 actStop.Enabled := true;
680 actSend.Enabled := true;
681 frmLog.lvwLogClick(Self);
682 mnGetNewId.Enabled := Pref.LUID = '';
683 Screen.Cursor := crDefault;
687 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
688 procedure TfrmSender.actSendExecute(Sender: TObject);
689 var Talk, Ghost: String;
690 Command: TStringList;
694 if Length(GetScriptText) = 0 then begin
695 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
699 if Pref.LUID = '' then begin
703 if tabChannel.TabIndex < 0 then begin
704 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
705 '
\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');
708 if ChannelList.Channel[FNowChannel].NoPost then begin
710 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
715 Talk := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
716 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
717 if Err <> '' then begin
718 MessageDlg(Err, mtWarning, [mbOk], 0);
722 if Pref.NeedConfirmBeforeSend and FScriptModified then
724 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
728 if Length(Talk) < Pref.MinScriptLength then
730 MessageDlg('
\8dÅ
\8f¬
\91\97\90M
\83o
\83C
\83g
\90\94\88È
\89º
\82Å
\82·
\81B', mtError, [mbOk], 0);
734 if not Pref.NoConfirm then begin
735 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
739 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text;
740 Command := TStringList.Create;
742 with Command do begin
743 Add('Command: sendBroadcast');
744 Add('Channel: ' + FNowChannel);
745 Add('LUID: ' + Pref.LUID);
746 Add('Agent: ' + VersionString);
747 if Ghost <> '' then Add('Ghost: ' + Ghost);
748 Add('Talk: ' + Talk);
750 PostCommand(Command);
755 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
756 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
757 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
761 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
766 procedure TfrmSender.BeginConnect;
768 if Pref.LUID = '' then begin
772 IdSlpp20.LUID := Pref.LUID;
773 self.Cursor := crHourGlass;
774 if IdSlpp20.Connected then IdSlpp20.Disconnect;
775 if Pref.UseHttpProxy then begin
776 IdSlpp20.Host := Pref.ProxyAddress;
777 IdSlpp20.Port := Pref.ProxyPort;
778 IdSlpp20.ProxyMode := true;
779 if Pref.ProxyNeedAuthentication then begin
780 IdSlpp20.ProxyUser := Pref.ProxyUser;
781 IdSlpp20.ProxyPass := Pref.ProxyPass;
783 IdSlpp20.ProxyUser := '';
784 IdSlpp20.ProxyPass := '';
787 IdSlpp20.Host := Pref.BottleServer;
788 IdSlpp20.Port := Pref.BottleServerPort;
789 IdSlpp20.ProxyMode := false;
791 IdSlpp20.ConnectServer;
792 self.Cursor := crDefault;
795 procedure TfrmSender.EndConnect;
797 IdSlpp20.OnDisconnect := nil;
801 procedure TfrmSender.SetAdded(const Value: boolean);
803 if FAdded = Value then Exit;
806 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
809 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
811 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
815 procedure TfrmSender.HTTPSuccess(Sender: TObject);
816 var Str, ResStr, Command: String;
817 HeadValue: THeadValue;
819 SetChannel: TStringList;
822 Str := (Sender as THttpDownloadThread).RecvString;
826 HeadValue := THeadValue.Create(Str);
829 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89ð
\90Í
\82Å
\82«
\82È
\82¢
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
832 Command := HeadValue['Command'];
833 ResStr := HeadValue['Result'];
834 if ResStr = 'Err' then begin
835 if HeadValue['ExtraMessage'] <> '' then begin
837 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
838 HeadValue['ExtraMessage']);
841 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 + '
\81i
\83R
\83}
\83\93\83h
\81u' + Command + '
\81v
\82ð
\8f\88\97\9d\92\86\81j');
844 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
845 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
846 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
847 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
848 if Pref.ResetIfGhostAfterSend then begin
849 actResetGhostExecute(Self);
851 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
852 if Pref.ClearAfterSend then begin
855 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
856 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
858 if (Command = 'getNewId') then begin
859 if ResStr = 'OK' then begin
860 Pref.LUID := HeadValue['NewID'];
861 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
862 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
863 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
864 'LUID: ' + Pref.LUID + #13#10 +
865 '
\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' +
866 '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' +
867 '
\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');
868 mnGetNewId.Enabled := false;
871 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
874 if (Command = 'voteMessage') then begin
875 if ResStr = 'OK' then begin
876 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
879 if (Command = 'getChannels') and (ResStr = 'OK') then begin
880 UpdateChannelInfo(HeadValue);
883 if FAutoAddAfterGetChannel then begin
884 SetChannel := TStringList.Create;
885 if JoinChannelsBackup <> nil then begin
886 //
\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
887 SetChannel.Assign(JoinChannelsBackup);
889 //
\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¾
890 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
891 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
892 SetChannel.Add(Pref.AutoJoinChannels[i]);
896 Application.CreateForm(TfrmChannelList, frmChannelList);
898 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
899 SetChannel := TStringList.Create;
900 SetChannel.Assign(frmChannelList.JoinList);
903 frmChannelList.Release;
906 if SetChannel <> nil then PostSetChannel(SetChannel);
908 if SetChannel <> nil then FreeAndNil(SetChannel);
911 if (Command = 'setChannels') then begin
912 if ResStr <> 'OK' then begin
914 frmMessageBox.ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½
\81B
\82à
\82¤
\88ê
\93x
\93o
\98^
\82µ
\82È
\82¨
\82µ
\82Ä
\82
\82¾
\82³
\82¢');
915 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
918 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
924 procedure TfrmSender.actStartClick(Sender: TObject);
926 if Pref.LUID = '' then begin
930 if not IdSlpp20.Connected then begin
931 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
935 FAutoAddAfterGetChannel := false;
936 PostCommand(['Command: getChannels']);
940 procedure TfrmSender.actStopExecute(Sender: TObject);
942 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
943 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
947 procedure TfrmSender.FormShow(Sender: TObject);
949 if FBooted or Application.Terminated then Exit;
950 //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
951 if Pref.LUID <> '' then BeginConnect
952 else mnGetNewIdClick(Self);
954 FAutoAddAfterGetChannel := Pref.AutoStart;
958 frmSurfacePreview.Show;
961 //
\83G
\83f
\83B
\83^
\83v
\83\8c\83r
\83\85\81[
\82ª
\91O
\89ñ
\95\
\8e¦
\8fó
\91Ô
\82È
\82ç
\82±
\82±
\82Å
\95\
\8e¦
\82·
\82é
962 if Pref.ShowEditorPreviewWindow then actEditorPreviewExecute(Sender);
964 SakuraSeeker.BeginDetect;
965 SakuraSeekerDetectResultChanged(self);
966 if (SakuraSeeker.Count = 0) and not Pref.NoWarnOfEmptyFMO then
967 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 +
968 '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 +
969 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
972 procedure TfrmSender.actAboutClick(Sender: TObject);
976 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
977 Str := Str + Format('Compiler Version: %f', [CompilerVersion]) + #13#10;
978 Str := Str + 'Indy Version: ' + IdSLPP20.Version;
979 frmMessageBox.ShowMessage(Str);
982 procedure TfrmSender.actExitClientExecute(Sender: TObject);
987 procedure TfrmSender.actClearExecute(Sender: TObject);
989 Script, Default: String;
991 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
992 Default := StringReplace(Pref.DefaultScript, '|', '', [rfReplaceAll]);
993 Default := StringReplace(Default, #13#10, '', [rfReplaceAll]);
995 if (Pref.AutoClip) and (Length(GetScriptText) > 0) and (Script <> Default) then
996 actSendToLogWindow.Execute
1001 procedure TfrmSender.memScriptChange(Sender: TObject);
1006 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
1007 Text := Format('%d
\83o
\83C
\83g/%d
\95b', [Length(Script), SsPlayTime.PlayTime(Script) div 1000]);
1008 StatusBar.Panels[PanelBytes].Text := Text;
1009 FScriptModified := true;
1013 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
1015 Pref.StayOnTop := not Pref.StayOnTop;
1016 mnStayOnTop.Checked := Pref.StayOnTop;
1017 if Pref.StayOnTop then begin
1018 FormStyle := fsStayOnTop;
1020 FormStyle := fsNormal;
1025 function TfrmSender.GetScriptText: String;
1027 Result := memScript.Lines.Text;
1030 procedure TfrmSender.mnConstClick(Sender: TObject);
1033 i := (Sender as TMenuItem).Tag;
1034 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
1037 procedure TfrmSender.actEditConstExecute(Sender: TObject);
1039 ScriptConstList.LoadFromDir(FConstDir);
1041 Application.CreateForm(TfrmConstEditor, frmConstEditor);
1042 frmConstEditor.Execute;
1043 ScriptConstList.Save;
1045 frmConstEditor.Release;
1047 ConstructMenu(false);
1050 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
1052 Application.Minimize;
1053 WindowState := wsNormal;
1056 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
1059 TaskTray.Registered := false;
1062 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
1065 Application.ShowMainForm := false;
1066 ShowWindow(Application.Handle, SW_HIDE);
1069 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
1071 Application.ShowMainForm := true;
1075 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1077 Application.Restore;
1080 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1082 Application.Restore;
1085 procedure TfrmSender.FormActivate(Sender: TObject);
1090 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1092 Application.Restore;
1093 actClearExecute(Sender);
1096 procedure TfrmSender.ChangeTaskIcon;
1101 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1103 if Sleeping then IcoNum := IconSleepDisconnected
1104 else IcoNum := IconDisconnected;
1107 Ico := TIcon.Create;
1109 imgIcon.GetIcon(IcoNum, Ico);
1110 TaskTray.Icon := Ico;
1111 TaskTray.Registered := true;
1116 ; // 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
1117 //
\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
1118 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1122 procedure TfrmSender.SetStatusText(const Value: String);
1124 FStatusText := Value;
1125 StatusBar.Panels[PanelStatus].Text := Value;
1128 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1131 if Length(Application.Hint) > 0 then
1133 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1134 Application.HintColor := clInfoBk;
1135 if (Application.Hint = SendButtonLongHint)
1136 and (FNowChannel <> '') then
1138 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1139 Application.HintColor := clYellow;
1140 Application.ActivateHint(Mouse.CursorPos);
1142 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1144 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1145 DoSurfacePreview(id, spHint);
1149 StatusBar.Panels[PanelStatus].Text := FStatusText;
1150 frmSurfacePreview.HideAway;
1154 procedure TfrmSender.ConstructMenu(Simple: boolean);
1156 BuildMenu(mnPopConst, Simple);
1157 BuildMenu(mnPopUpConst.Items, Simple);
1158 BuildMenu(ConstBarMenu.Items, Simple);
1160 {$IFDEF CONDITIONALEXPRESSIONS}
1161 {$IF Declared(CompilerVersion)}
1162 {$IF CompilerVersion < 15.0} // Delphi6
\88È
\89º
\82È
\82ç
1163 //
\83\81\83j
\83\85\81[
\82ð
\88ê
\93x
\8fÁ
\82·
1164 //
\82È
\82º
\82©2
\89ñ
\96Ú
\88È
\8d~
\82Ì
\95\
\8e¦
\82ª
\82¨
\82©
\82µ
\82
\82È
\82é
\96â
\91è
\82Ì
\8fC
\90³
1165 // ported from YasagureClient
1166 ConstMenuBar.AutoSize := false;
1167 ConstMenuBar.Menu := nil;
1172 ConstMenuBar.Menu := ConstBarMenu;
1173 ConstMenuBar.Width := 1000;
1174 ConstMenuBar.AutoSize := true;
1177 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1178 Shift: TShiftState);
1180 Func: TReturnKeyFunction;
1182 if (Key = VK_RETURN) then begin
1183 if (ssShift in Shift) then
1184 Func := Pref.WhenShiftReturn
1185 else if (ssCtrl in Shift) then
1186 Func := Pref.WhenCtrlReturn
1188 Func := Pref.WhenReturn;
1191 with tbtnInsertConst do
1192 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1193 mnPopUpConst.Popup(Pos.X, Pos.Y);
1196 memScript.SelText := '\n';
1200 memScript.SelText := '\n'#13#10;
1203 memScript.SelText := #13#10
1209 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1211 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1212 Pref.ShowToolBar := mnShowToolBar.Checked;
1216 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1218 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1219 Pref.ShowConstBar := mnShowConstBar.Checked;
1223 procedure TfrmSender.UpdateLayout;
1225 with SakuraScriptFountain do begin
1226 TagColor.Color := Pref.MarkUpColor;
1227 TagErrorColor.Color := Pref.MarkErrorColor;
1228 Scope0Color.Color := Pref.TalkColorH;
1229 Scope1Color.Color := Pref.TalkColorU;
1230 SynchronizedColor.Color := Pref.TalkColorS;
1232 memScript.Ruler.Visible := Pref.ShowRuler;
1233 memScript.Ruler.Color := Pref.TextColor;
1234 memScript.Color := Pref.BgColor;
1236 ToolBar.Visible := Pref.ShowToolBar;
1237 ConstMenuBar.Visible := Pref.ShowConstBar;
1240 with tabChannel do begin
1241 TabPosition := Pref.TabPosition;
1242 case Pref.TabPosition of
1243 tpTop: Align := alTop;
1244 tpBottom: Align := alBottom;
1246 TabWidth := Pref.TabWidth;
1250 function TfrmSender.DoTrans(var Script: String;
1251 Options: TScriptTransOptions; out FoundURL: boolean): String;
1252 var UrlCancel, Mark: String;
1253 Url, UrlName: array[0..6] of String;
1254 i, j, u, UrlCount: integer;
1255 LastSurfaceH, LastSurfaceU: integer;
1256 UnyuTalking: boolean;
1257 QuickSection, Synchronize: boolean;
1258 Warnings: TStringList;
1263 UnyuTalking := false;
1264 QuickSection := false;
1265 Synchronize := false;
1266 SsParser.LeaveEscape := true;
1267 SsParser.EscapeInvalidMeta := false;
1268 SsParser.InputString := Script;
1270 Warnings := TStringList.Create;
1272 for i := 0 to SsParser.Count-1 do begin
1273 if SsParser[i] = '\t' then begin
1274 if not(toIgnoreTimeCritical in Options) then
1275 Script := Script + '\t';
1276 end else if SsParser[i] = '\e' then begin
1278 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1279 if toConvertURL in Options then begin
1280 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1281 for u := 7 downto 1 do begin
1282 if (SsParser.Match(SsParser[i],
1283 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1284 '-', '%b', [rfReplaceAll]))) > 0 then begin
1285 for j := 1 to u do begin
1286 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1287 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1288 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1289 //https
\82È
\82Ç
\82ª
\92Ç
\89Á
\82³
\82ê
\82é
\8e\9e\91Î
\8dô
\81c
\81c://
\82ð
\8c\9f\8dõ
\82·
\82ê
\82Î
\82½
\82Ô
\82ñ
\91å
\8fä
\95v
1290 if Pos('://', Url[UrlCount]) > 0 then Inc(UrlCount);
1293 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1294 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1296 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1297 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1298 Url[0] := SsParser.GetParam(SsParser[i], 1);
1299 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1300 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1301 //https
\82È
\82Ç
\82ª
\92Ç
\89Á
\82³
\82ê
\82é
\8e\9e\91Î
\8dô
\81c
\81c://
\82ð
\8c\9f\8dõ
\82·
\82ê
\82Î
\82½
\82Ô
\82ñ
\91å
\8fä
\95v
1302 if Pos('://', Url[0]) > 0 then begin
1304 if not QuickSection then
1305 Script := Script + '\_q' + Url[0] + '\_q'
1307 Script := Script + Url[0];
1310 end else Script := Script + SsParser[i];
1312 Mark := SsParser[i];
1313 if Mark = '\h' then begin
1314 UnyuTalking := false;
1315 if toHUTagTo01Tag in Options then Mark := '\0';
1316 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1317 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');
1318 end else if Mark = '\u' then begin
1319 UnyuTalking := true;
1320 if toHUTagTo01Tag in Options then Mark := '\1';
1321 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1322 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');
1323 end else if Mark = '\_q' then begin
1324 QuickSection := not QuickSection;
1325 end else if Mark = '\_s' then begin
1326 Synchronize := not Synchronize;
1327 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1328 if UnyuTalking then begin
1329 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1332 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1335 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1336 if UnyuTalking then begin
1337 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1339 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1342 Script := Script + Mark;
1345 if UrlCount > 0 then begin
1347 Script := Script + '\h\n';
1348 if not (toNoChoice in Options) then begin
1349 for i := 0 to UrlCount-1 do begin
1350 Script := Script + Format('\q%d[%s][%s]',
1351 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1353 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1354 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1356 Script := Script + '\h';
1357 for i := 0 to UrlCount-1 do begin
1358 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1360 Script := Script + Format('\n{%s}', [UrlCancel]);
1364 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1365 if toWaitScriptEnd in Options then begin
1366 i := Pref.WaitScriptEnd;
1367 while i > 0 do begin
1369 Script := Script + '\w9';
1372 Script := Script + '\w' + IntToStr(i);
1378 Script := Script + '\e';
1379 RegExp.Subst('s/\r\n//gk', Script);
1381 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1382 for i := 0 to SsParser.Count-1 do begin
1383 if SsParser.MarkUpType[i] = mtTagErr then begin
1384 Result := '"' + SsParser[i] + '"'#13#10 +
1385 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1387 end else if SsParser.MarkUpType[i] = mtStr then begin
1388 if Pos(#9,SsParser[i]) > 0 then begin
1389 Result := '
\83^
\83u
\95¶
\8e\9a\82Í
\81ASSTP Bottle
\82Å
\8eg
\97p
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B';
1394 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1395 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1399 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1400 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1401 mbOkCancel, 0) = mrCancel then
1402 Result := Warnings.Text;
1409 function TfrmSender.DoTrans(var Script: String;
1410 Options: TScriptTransOptions): String;
1413 Result := DoTrans(Script, Options, dum);
1416 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1418 OpenBrowser(Pref.HomePage);
1421 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1423 lblMessage.Caption := Mes;
1424 lblMessage.Font.Color := Col;
1425 lblMessage.Visible := true;
1426 LabelTimer.Enabled := false;
1427 LabelTimer.Enabled := true;
1430 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1432 LabelTimer.Enabled := false;
1433 lblmessage.Visible := false;
1436 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1440 Str := memScript.Lines.Text;
1441 Clip := ClipBoard();
1442 Clip.SetTextBuf(PChar(Str));
1445 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1449 Str := memScript.Lines.Text;
1450 RegExp.Subst('s/\r\n//gk', Str);
1451 Clip := ClipBoard();
1452 Clip.SetTextBuf(PChar(Str));
1455 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1456 const Param: String);
1457 var HeadValue: THeadValue;
1459 HeadValue := THeadValue.Create(Param);
1462 etScript, etForceBroadcast, etUnicast: begin
1463 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1464 DispatchBottle(EventType, HeadValue);
1467 etMemberCount: begin
1468 //
\91\8d\8eQ
\89Á
\8eÒ
\90\94
1469 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1472 etChannelCount: begin
1473 //
\83`
\83\83\83\93\83l
\83\8b\95Ê
\8eQ
\89Á
\8eÒ
\90\94
1475 if HeadValue['Channel'] <> '' then begin
1476 if ChannelList.Channel[HeadValue['Channel']] <> nil then begin
1477 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1485 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1487 FBeginConnectFailCount := 0;
1488 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1489 if not Connecting then
1490 PostCommand(['Command: getChannels']);
1492 SakuraSeeker.BeginDetect;
1494 on E: Exception do ShowHintLabel(E.Message,WarningColor);
1498 etChannelList: begin
1499 UpdateJoinChannelList(HeadValue);
1500 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1501 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1502 JoinChannelsBackup.Assign(JoinChannels);
1505 etCloseChannel: begin
1506 //
\83`
\83\83\83\93\83l
\83\8b\94p
\8e~
1507 if HeadValue['Channel'] <> '' then begin
1508 with JoinChannels do
1509 if IndexOf(HeadValue['Channel']) >= 0 then
1510 Delete(IndexOf(HeadValue['Channel']));
1511 with tabChannel do begin
1512 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1513 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1514 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1515 tabChannelChange(self);
1517 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1519 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1520 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1524 etForceBroadcastInformation: begin
1525 //
\93\8a\95[
\81^
\93¯
\88Ó
\81^
\82»
\82Ì
\91¼
\83u
\83\8d\81[
\83h
\83L
\83\83\83X
\83g
\8fî
\95ñ
1526 if HeadValue['MID'] <> '' then begin
1527 try //Num
\82ª
\90\94\92l
\82Å
\82È
\82©
\82Á
\82½
\82Æ
\82«
\91Î
\8dô
1528 if HeadValue['Type'] = 'Vote' then begin
1529 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1530 end else if HeadValue['Type'] = 'Agree' then begin
1531 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1543 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1545 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1547 TaskTray.TipString := 'SSTP Bottle Client (' +
1548 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1550 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1552 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1555 procedure TfrmSender.actSettingExecute(Sender: TObject);
1557 Application.CreateForm(TfrmSetting, frmSetting);
1567 BuildReplaceMenu(mnPresetReplaceRoot);
1570 frmLog.UpdateWindow;
1573 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1575 if (Key = #13) or (Key = #10) then Key := Char(0);
1578 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1581 UpdateJoinChannelList(nil);
1582 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1583 if not Application.Terminated then RetryBeginConnect;
1586 procedure TfrmSender.SetSleeping(const Value: boolean);
1589 FBottleSstp.ResendSleep := Value;
1593 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1596 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]),
1597 mtWarning, mbOkCancel, 0);
1598 if Re = mrOk then begin
1600 frmLog.AllBottleOpened;
1601 frmLog.UpdateWindow;
1605 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1607 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1610 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1612 Ch: TChannelListItem;
1615 for i := 1 to Dat.IntData['Count'] do begin
1616 Ch := TChannelListItem.Create;
1617 Ch.Name := Dat[Format('CH%d_name', [i])];
1618 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1619 Ch.Info := Dat[Format('CH%d_info', [i])];
1620 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1621 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1622 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1623 ChannelList.Add(Ch);
1628 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1630 PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1633 procedure TfrmSender.NoLuidError;
1636 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1637 '
\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+
1638 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1641 procedure TfrmSender.tabChannelChange(Sender: TObject);
1643 if tabChannel.TabIndex >= 0 then begin
1644 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1645 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1650 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1651 ConstructMenu(true);
1654 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1656 with tabChannel do begin
1657 if Tabs.Count = 0 then Exit;
1658 if TabIndex=0 then TabIndex := Tabs.Count-1
1659 else TabIndex := TabIndex-1;
1661 tabChannelChange(Self);
1664 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1666 with tabChannel do begin
1667 if Tabs.Count = 0 then Exit;
1668 if TabIndex=Tabs.Count-1 then TabIndex := 0
1669 else TabIndex := TabIndex+1;
1671 tabChannelChange(Self);
1674 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1678 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1679 if nodat then Dat := THeadValue.Create('');
1681 for i := 0 to Dat.Count-1 do
1682 if Dat.KeyAt[i] = 'Entry' then begin
1683 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1684 JoinChannels.Add(RegExp[1]);
1686 with tabChannel do begin
1691 for i := 0 to JoinChannels.Count-1 do begin
1692 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1693 if ChannelList.Channel[JoinChannels[i]] <> nil then
1694 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1695 Tabs.Add(JoinChannels[i]);
1698 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1699 //
\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)
1701 for i := 0 to Tabs.Count-1 do
1702 if Tabs[i] = FNowChannel then TabIndex := i;
1703 if Tabs.Count > 0 then begin
1704 FNowChannel := Tabs[TabIndex];
1705 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1708 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1710 Visible := Tabs.Count > 0;
1711 if Tabs.Count > 1 then begin
1712 actNextChannel.Enabled := true;
1713 actPrevChannel.Enabled := true;
1715 actNextChannel.Enabled := false;
1716 actPrevChannel.Enabled := false;
1718 OnChange := tabChannelChange;
1720 if nodat then Dat.Free;
1721 if JoinChannels.Count = 0 then begin
1722 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1723 actSend.Enabled := false;
1725 Self.Caption := FOriginalCaption;
1726 actSend.Enabled := true;
1730 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1732 SakuraSeeker.BeginDetect;
1736 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1739 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1742 procedure TfrmSender.actSleepExecute(Sender: TObject);
1744 if actSleep.Checked then begin
1745 actSleep.Checked := false;
1746 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1748 actSleep.Checked := true;
1749 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1751 Sleeping := actSleep.Checked;
1756 procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1758 var Opt: TSstpSendOptions;
1759 Event: TBottleChainBottleEvent;
1760 Script, Sender, Ghost, Channel, ErrorMes: String;
1761 BreakFlag, NoDispatch: boolean;
1762 Sound, LogName: String;
1763 i, j, k, SkipCount: integer;
1764 Rule: TBottleChainRule;
1765 Action: TBottleChainAction;
1766 LogNameList: TStringList;
1768 ReplaceHash: THeadValue;
1770 Channel := Dat['Channel'];
1773 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1774 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1776 etScript: Sender := Channel;
1777 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1778 etUnicast: Sender := Dat['SenderUID'];
1781 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1782 if Dat['IfGhost'] <> '' then begin
1783 Ghost := Dat['IfGhost'];
1785 if ChannelList.Channel[Channel] <> nil then
1786 Ghost := ChannelList.Channel[Channel].Ghost;
1788 Dat['TargetGhost'] := Ghost;
1790 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1791 ReplaceHash := THeadValue.Create;
1792 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1793 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1794 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1795 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1796 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1797 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1798 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1799 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1800 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1802 Event := TBottleChainBottleEvent.Create;
1805 if EventType = etScript then Event.LogType := ltBottle
1806 else Event.LogType := ltSystemLog;
1808 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1809 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1810 if ErrorMes <> '' then begin
1811 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'+
1812 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1817 NoDispatch := false;
1819 LogNameList := TStringList.Create;
1822 for i := 0 to BottleChainRuleList.Count-1 do begin
1823 if SkipCount > 0 then begin
1827 Rule := BottleChainRuleList[i];
1828 if not Rule.Enabled then Continue;
1829 if not Rule.Check(Event) then Continue;
1830 for j := 0 to Rule.Actions.Count-1 do begin
1831 Action := (Rule.Actions[j] as TBottleChainAction);
1832 if Action is TBottleChainAbortRuleAction then
1834 if Action is TBottleChainSkipRuleAction then
1835 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1836 if (Action is TBottleChainSoundAction) and (Sound = '') then
1838 Sound := (Action as TBottleChainSoundAction).SoundFile;
1839 Sound := StringReplaceEx(Sound, ReplaceHash);
1841 if Action is TBottleChainNoDispatchAction then
1843 if Action is TBottleChainLogAction then
1845 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1846 LogName := (Action as TBottleChainLogAction).LogNames[k];
1847 LogName := StringReplaceEx(LogName, ReplaceHash);
1848 LogNameList.Add(LogName);
1851 if Action is TBottleChainOverrideGhostAction then
1853 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1855 if Action is TBottleChainQuitAction then
1856 Application.Terminate;
1857 if Action is TBottleChainSaveTextLogAction then
1858 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1859 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1860 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]));
1861 if Action is TBottleChainSaveXMLLogAction then
1862 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1864 if Action is TBottleChainSurfaceReplaceAction then
1865 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1867 if BreakFlag then Break;
1870 if Dat['Script'] <> '' then begin
1871 for i := 0 to LogNameList.Count-1 do
1872 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost']);
1873 if NoDispatch then begin
1874 frmLog.SetBottleState(Dat['MID'], lsOpened);
1876 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1877 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1878 Script, Ghost, Now());
1880 FBottleSstp.Push(CueItem);
1887 if Dat['DialogMessage'] <> '' then begin
1889 frmMessageBox.ShowMessage(
1890 DateTimeToStr(Now) + #13#10 +
1891 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1892 for i := 0 to LogNameList.Count-1 do
1893 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1897 if (Sound <> '') then PlaySound(Sound);
1907 procedure TfrmSender.YenETrans;
1908 var St, Le, i: integer;
1911 St := memScript.SelStart;
1912 Le := memScript.SelLength;
1913 Orig := GetScriptText;
1914 RegExp.Subst('s/(\r\n)+$//kg', Orig);
1916 with SsParser do begin
1917 LeaveEscape := true;
1918 EscapeInvalidMeta := false;
1919 InputString := Orig;
1921 for i := 0 to SsParser.Count-1 do begin
1922 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
1925 Text := Text + '\e';
1927 if Orig <> Text then memScript.Lines.Text := Text;
1928 SsParser.InputString := Text;
1930 RegExp.Subst('s/\r\n//kg', Text);
1932 memScript.SelStart := St;
1933 memScript.SelLength := Le;
1936 procedure TfrmSender.PostCommand(const Command: array of String);
1937 var PostStr: TStringList;
1942 PostStr := TStringList.Create;
1943 for i := Low(Command) to High(Command) do begin
1944 PostStr.Add(Command[i]);
1946 PostCommand(PostStr);
1952 procedure TfrmSender.PostCommand(Command: TStrings);
1953 var PostStr: String;
1956 PostStr := Command.Text;
1957 PostStr := ParamsEncode(PostStr);
1959 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
1960 if Pref.UseHttpProxy then begin
1961 FHttp.ProxyServer := Pref.ProxyAddress;
1962 FHttp.ProxyPort := Pref.ProxyPort;
1963 if Pref.ProxyNeedAuthentication then begin
1964 FHttp.ProxyUser := Pref.ProxyUser;
1965 FHttp.ProxyPass := Pref.ProxyPass;
1968 FHttp.OnSuccess := HttpSuccess;
1969 FHttp.OnConnectionFailed := HttpFailure;
1970 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
1973 on EHeapException do begin
1974 Connecting := false;
1980 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
1983 if frmLog.lvwLog.ItemIndex < 0 then Exit;
1984 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
1985 if Log = nil then Exit;
1986 if Log.LogType <> ltBottle then Exit;
1988 'Command: voteMessage',
1990 'LUID: ' + Pref.LUID,
1996 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
1999 if frmLog.lvwLog.ItemIndex < 0 then Exit;
2000 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
2001 if Log = nil then Exit;
2002 if Log.LogType <> ltBottle then Exit;
2004 'Command: voteMessage',
2006 'LUID: ' + Pref.LUID,
2012 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
2014 if SakuraSeeker.ProcessByName[Ghost] <> nil then
2015 Result := SakuraSeeker.ProcessByName[Ghost].SetName
2020 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
2021 MousePos: TPoint; var Handled: Boolean);
2024 with tabChannel do begin
2025 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
2026 if Tag < 0 then Handled := true;
2031 procedure TfrmSender.PostSetChannel(Channels: TStrings);
2032 var PostStr: TStringList;
2035 PostStr := TStringList.Create;
2037 with PostStr do begin
2038 Add('Command: setChannels');
2039 Add('Agent: ' + VersionString);
2040 Add('LUID: ' + Pref.LUID);
2041 if Channels <> nil then
2042 for i := 0 to Channels.Count-1 do begin
2043 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
2046 PostCommand(PostStr);
2052 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
2056 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
2058 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
2059 Chs := TStringList.Create;
2061 //
\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ð
2062 //
\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é
2064 Chs.Assign(JoinChannels);
2065 while Chs.IndexOf(Ch) >= 0 do
2066 Chs.Delete(Chs.IndexOf(Ch));
2067 PostSetChannel(Chs);
2073 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
2075 OpenBrowser(Pref.VotePage);
2078 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
2079 Shift: TShiftState; X, Y: Integer);
2083 with tabChannel do begin
2084 Index := IndexOfTabAt(X, Y);
2086 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2090 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2092 OpenBrowser(Pref.HelpPage);
2095 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2096 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2099 with tabChannel do begin
2100 Index := IndexOfTabAt(X, Y);
2101 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2102 if Button = mbLeft then begin
2103 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2105 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2110 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2111 Y: Integer; State: TDragState; var Accept: Boolean);
2112 var TargetRect: TRect;
2115 Accept := Source = tabChannel;
2116 if not Accept then Exit;
2117 with tabChannel do begin
2118 OldDest := FDragTabDest;
2119 FDragTabDest := IndexOfTabAt(X, Y);
2120 if FDragTabDest = -1 then begin
2121 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2124 with Canvas do begin
2128 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2129 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2130 TargetRect := TabRect(OldDest);
2131 with Canvas do begin
2132 Brush.Style := bsClear;
2133 Rectangle(TargetRect.Left, TargetRect.Top,
2134 TargetRect.Right, TargetRect.Bottom);
2137 if (OldDest <> FDragTabDest) then begin
2138 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2139 TargetRect := TabRect(FDragTabDest);
2140 with Canvas do begin
2141 Brush.Style := bsClear;
2142 Rectangle(TargetRect.Left, TargetRect.Top,
2143 TargetRect.Right, TargetRect.Bottom);
2149 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2151 var DestIndex: integer;
2153 with tabChannel do begin
2154 DestIndex := IndexOfTabAt(X, Y);
2155 Tabs.Move(FDragTabIndex, DestIndex);
2159 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2162 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2163 tabChannel.Tabs.BeginUpdate;
2164 tabChannel.Tabs.EndUpdate;
2167 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2168 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2169 var AlignRight: boolean;
2172 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2173 with cbxTargetGhost do begin
2174 AlignRight := false;
2175 if Pref.HideGhosts and not FTargetGhostExpand and
2176 (Index = Items.Count-1) and (Index > 0) then
2178 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2179 Canvas.Font.Color := clWindowText;
2180 Canvas.Font.Style := [];
2182 end else if (Index > 0) then
2184 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2185 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2186 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2188 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2189 Canvas.Font.Style := [fsBold];
2192 Canvas.Font.Color := clWindowText;
2193 Canvas.Font.Style := [];
2195 if odSelected in State then
2196 Canvas.Font.Color := clHighlightText;
2200 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2201 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2202 cbxTargetGhost.Items[Index]);
2204 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2205 cbxTargetGhost.Items[Index]);
2209 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2210 var CanClose: Boolean);
2212 if (not Pref.ConfirmOnExit) or FEndSession then
2214 if MessageDlg('SSTP Bottle Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2215 mbOkCancel, 0) = mrCancel then
2219 procedure TfrmSender.UpdateIfGhostBox;
2223 HiddenCount: integer;
2225 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2226 Selected := cbxTargetGhost.Text;
2228 with cbxTargetGhost do begin
2231 Items.Add(ChannelDefault);
2232 for i := 0 to SakuraSeeker.Count-1 do begin
2233 //
\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é
2234 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2235 if Pref.HideGhosts and not FTargetGhostExpand then
2236 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2241 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2242 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2244 cbxTargetGhost.ItemIndex := 0;
2245 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2246 with cbxTargetGhost do begin
2247 for i := 1 to Items.Count-1 do begin
2248 if Items[i] = Selected then
2251 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2252 if ItemIndex = 0 then begin
2253 Items.Add(Selected);
2254 ItemIndex := Items.Count - 1;
2258 if Pref.HideGhosts and not FTargetGhostExpand then
2259 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2264 procedure TfrmSender.HTTPFailure(Sender: TObject);
2268 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2269 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2270 (Sender as THTTPDownloadThread).LastErrorMessage);
2271 Connecting := false;
2274 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2277 SakuraSeeker.BeginDetect;
2279 i := cbxTargetGhost.ItemIndex;
2283 i := cbxTargetGhost.Items.Count-1;
2284 if Pref.HideGhosts and not FTargetGhostExpand then
2287 cbxTargetGhost.ItemIndex := i;
2288 cbxTargetGhostChange(self);
2291 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2294 SakuraSeeker.BeginDetect;
2296 i := cbxTargetGhost.ItemIndex;
2298 if Pref.HideGhosts and not FTargetGhostExpand then
2300 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2303 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2305 cbxTargetGhost.ItemIndex := i;
2306 cbxTargetGhostChange(self);
2309 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2311 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2312 FTargetGhostExpand := false;
2313 if Visible then memScript.SetFocus;
2314 cbxTargetGhostChange(self);
2317 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2319 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2321 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2322 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2324 if not IdSlpp20.Connected then begin
2326 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2328 //
\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
2329 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2335 procedure TfrmSender.RetryBeginConnect;
2337 if FBeginConnectFailCount < 3 then begin
2338 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2339 IdSlpp20.OnDisconnect := nil;
2340 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2341 FAutoAddAfterGetChannel := true;
2343 IdSlpp20.OnDisconnect := Slpp20Disconnect;
2344 end else if FBeginConnectFailCount = 3 then begin
2345 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2346 frmMessageBox.ShowMessage(
2347 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2348 '
\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+
2349 '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'
2351 Inc(FBeginConnectFailCount);
2355 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2356 var BottleLog: TBottleLogList;
2358 Cond: TBottleLogDownloadCondition;
2360 function TimeStr(Mins: integer): String;
2361 var day, hour, min: integer;
2363 day := Mins div (60 * 24);
2364 hour := (Mins div 60) mod 24;
2367 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2368 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2369 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2372 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2374 if frmLogDownload.Execute then begin
2375 with frmLogDownload do begin
2376 if IsRange then begin
2377 if CompareDate(DateLo, DateHi) = 0 then
2378 Title := FormatDateTime('yy-mm-dd', DateLo)
2380 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2382 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2384 if Channel <> '' then Title := Title + '(' + Channel + ')';
2386 BottleLog := TBottleLogList.Create(Title);
2388 BottleLog.OnLoaded := frmLog.LogLoaded;
2389 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2390 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2391 with frmLogDownload do begin
2392 Cond.IsRange := IsRange;
2393 Cond.RecentCount := RecentCount;
2394 Cond.DateLo := DateLo;
2395 Cond.DateHi := DateHi;
2396 Cond.MinVote := MinVote;
2397 Cond.MinAgree := MinAgree;
2398 Cond.Channel := Channel;
2400 BottleLog.LoadFromWeb(Cond);
2402 FreeAndNil(BottleLog);
2404 if BottleLog <> nil then begin
2405 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2407 frmLog.tabBottleLog.TabIndex := NewIndex;
2408 frmLog.UpdateWindow;
2412 frmLogDownload.Release;
2416 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2417 Ghost: String): boolean;
2424 Cond := Token(IfGhost, ',', i);
2425 if Cond <> '' then begin
2426 if Cond[1] = '!' then begin
2427 Cond := Copy(Cond, 2, High(integer));
2428 if Cond = Ghost then Result := false;
2430 if Cond <> Ghost then Result := false;
2437 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2438 var i, j, k, count: integer;
2439 ConstData: TScriptConst;
2440 Menu1, Menu2: TMenuItem;
2443 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2444 // 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
2445 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2446 else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2448 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2449 if Simple then begin
2450 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2451 for i := Root.Count-1 downto 0 do begin
2452 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2456 //
\91S
\95\94\8dí
\8f\9c
2460 for i := 0 to ScriptConstList.Count-1 do begin
2461 for j := 0 to ScriptConstList[i].Count-1 do begin
2462 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2463 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2465 // 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
2466 if Simple and (count < Root.Count) then
2467 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2471 Menu1 := TMenuItem.Create(Root);
2474 Caption := ScriptConstList[i][j].Caption;
2475 Hint := ScriptConstList[i][j].Caption;
2476 AutoHotkeys := maManual;
2477 Tag := ScriptConstList[i][j].ID;
2478 OnClick := mnConstGroupClick;
2481 if not Simple then begin
2484 if count < Root.Count-1 then
2485 Root.Insert(count, Menu1)
2490 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2491 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2492 ConstData := ScriptConstList[i][j][k];
2493 Menu2 := TMenuItem.Create(Root);
2494 Menu2.Caption := ConstData.Caption;
2495 Menu2.Hint := ConstData.ConstText;
2496 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2497 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2498 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2499 Menu2.ShortCut := ConstData.ShortCut;
2500 Menu2.OnClick := mnConstClick;
2501 Menu2.AutoHotkeys := maManual;
2502 Menu2.Tag := ConstData.ID;
2503 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2510 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2512 //
\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
2513 if Pref.HideGhosts and not FTargetGhostExpand then
2515 with cbxTargetGhost do
2517 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2518 //
\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
2519 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2521 FTargetGhostExpand := true;
2524 DroppedDown := true;
2528 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2529 ConstructMenu(true);
2530 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2534 procedure TfrmSender.PlaySound(const FileName: String);
2536 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2538 MediaPlayer.FileName := FileName;
2542 on E: EMCIDeviceError do begin
2543 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2548 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2551 if not Assigned(frmFMOExplorer) then
2552 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2555 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2558 frmFMOExplorer.Show;
2561 procedure TfrmSender.SaveChainRuleList;
2562 var Str: TStringList;
2564 Str := TStringList.Create;
2566 Str.Text := ComponentToString(BottleChainRuleList);
2567 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2573 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2575 frmLog.SetBottleState(MID, lsOpened);
2578 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2580 frmLog.SetBottleState(MID, lsPlaying);
2583 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2584 var InsertItem: TLogItem;
2585 i, errCount, Res: integer;
2586 Log: TBottleLogList;
2587 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2589 if FBottleSstp.CueCount > 0 then begin
2590 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'+
2591 '
\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+
2592 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2593 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2596 frmLog.AllBottleOpened;
2597 if frmLog.lvwLog.ItemIndex < 0 then Exit;
2598 Log := frmLog.SelectedBottleLog;
2599 if Log = nil then Exit;
2600 FBottleSSTP.OnResendCountChange := nil;
2602 for i := frmLog.lvwLog.ItemIndex downto 0 do begin
2603 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2604 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2606 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2607 if ErrorMes <> '' then
2609 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2610 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2613 raise Exception.Create('Script Syntax Error')
2614 else if Res = mrCancel then
2618 frmLog.AllBottleOpened;
2622 if InsertItem.Ghost = '' then begin
2623 if ChannelList.Channel[InsertItem.Channel] <> nil then
2624 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2626 FBottleSSTP.Push(InsertItem);
2627 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2633 if errCount > 0 then
2634 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]));
2635 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2636 BottleSstpResendCountChange(self);
2637 frmLog.lvwLog.Invalidate;
2640 function TfrmSender.ScriptTransForSSTP(const Script: String;
2641 out Error: String): String;
2642 var TransOpt: TScriptTransOptions;
2644 if Pref.NoTransURL then
2645 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2647 TransOpt := [toConvertURL, toWaitScriptEnd];
2648 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2649 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2650 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2652 Error := DoTrans(Result, TransOpt);
2655 procedure TfrmSender.FormResize(Sender: TObject);
2656 var w, SelS, SelL: integer;
2658 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2659 if memScript.ColWidth <> 0 then
2665 w := Width - LeftMargin - ColWidth div 2;
2666 if ScrollBars in [ssVertical, ssBoth] then
2667 w := w - GetSystemMetrics(SM_CYVSCROLL);
2668 WrapOption.WrapByte := w div ColWidth;
2675 procedure TfrmSender.actCopyExecute(Sender: TObject);
2677 memScript.CopyToClipboard;
2680 procedure TfrmSender.actPasteExecute(Sender: TObject);
2682 memScript.PasteFromClipboard;
2685 procedure TfrmSender.actCutExecute(Sender: TObject);
2687 memScript.CutToClipboard;
2690 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2692 memScript.SelectAll;
2695 procedure TfrmSender.actUndoExecute(Sender: TObject);
2700 procedure TfrmSender.actRedoExecute(Sender: TObject);
2705 function TfrmSender.IsSurfaceTag(const Script: String;
2706 var ID: integer): boolean;
2709 if SsParser.Match(Script, '\s%d') = 3 then
2712 ID := Ord(Script[3]) - Ord('0')
2714 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2717 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2721 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2722 Shift: TShiftState; X, Y: Integer);
2726 //
\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[
2727 if not Pref.SurfacePreviewOnScriptPoint then
2729 token := memScript.TokenStringFromPos(Point(X, Y));
2730 if IsSurfaceTag(token, id) then
2732 DoSurfacePreview(id, spEditor);
2735 frmSurfacePreview.HideAway;
2739 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2740 const Kind: TSurfacePreviewType);
2745 if cbxTargetGhost.ItemIndex > 0 then
2746 ghost := cbxTargetGhost.Text
2747 else if FNowChannel <> '' then
2748 ghost := ChannelList.Channel[FNowChannel].Ghost;
2750 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2751 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2752 not (frmSurfacePreview.IsHidden) then
2759 Bmp := TBitmap.Create;
2761 if Spps.TryGetImage(ghost, Surface, Bmp) then
2765 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2767 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2769 CPos := Point(0, 0);
2771 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2772 FVisiblePreviewGhost := Ghost;
2773 FVisiblePreviewSurface := Surface;
2775 frmSurfacePreview.HideAway;
2782 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2783 {var MousePoint: TPoint;
2786 //
\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é
2787 //
\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Å
2788 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2789 {GetCursorPos(MousePoint);
2790 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2791 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2792 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2793 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2796 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2797 var MousePoint: TPoint;
2799 GetCursorPos(MousePoint);
2800 case Pref.SurfacePreviewOnScriptPointPosition of
2801 spspMainWindowRight:
2802 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2804 Result := Point(Self.Left - w, MousePoint.Y);
2808 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2810 if (Sender is TMenuItem) then
2811 FVisibleMenuItem := Sender as TMenuItem;
2814 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2816 if FScriptBuffer.Count = 0 then
2818 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2819 memScriptChange(Self);
2820 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2823 procedure TfrmSender.EditorPreview;
2824 var Ghost, Script: String;
2826 if frmEditorTalkShow <> nil then
2827 if frmEditorTalkShow.Visible then
2829 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2831 if cbxTargetGhost.ItemIndex > 0 then
2832 Ghost := cbxTargetGhost.Text
2833 else if FNowChannel <> '' then
2834 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2835 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2839 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2841 if frmEditorTalkShow <> nil then
2842 frmEditorTalkShow.Show
2845 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
2846 frmEditorTalkShow.TalkShowFrame.SetPreviewFont(memScript.Font);
2847 frmEditorTalkShow.Show;
2849 Pref.ShowEditorPreviewWindow := True;
2853 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
2854 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
2856 Spps.ClearImagePool;
2857 Spps.LoadFromDirectory(FSppDir);
2860 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
2862 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
2865 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2866 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
2867 function TfrmSender.TagReplace(Script: String; Before,
2868 After: array of String): String;
2869 var BeforeList, AfterList: TStringList;
2872 BeforeList := TStringList.Create;
2873 AfterList := TStringList.Create;
2875 for i := Low(Before) to High(Before) do
2876 BeforeList.Add(Before[i]);
2877 for i := Low(After) to High(After) do
2878 AfterList.Add(After[i]);
2879 Result := TagReplace(Script, BeforeList, AfterList);
2886 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2887 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
2888 //
\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¢)
2889 function TfrmSender.TagReplace(Script: String; Before,
2890 After: TStrings): String;
2892 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
2898 OldStr := InputString;
2899 OldLeaveEscape := LeaveEscape;
2900 OldEscapeInvalidMeta := EscapeInvalidMeta;
2901 LeaveEscape := true;
2902 EscapeInvalidMeta := false;
2903 InputString := Script;
2905 for i := 0 to SsParser.Count-1 do
2908 for j := 0 to Before.Count-1 do
2910 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
2913 Result := Result + After[j];
2917 Result := Result + SsParser[i];
2921 LeaveEscape := OldLeaveEscape;
2922 EscapeInvalidMeta := OldEscapeInvalidMeta;
2923 InputString := OldStr;
2927 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
2928 //
\91Î
\89\9e\82·
\82é
2929 procedure TfrmSender.WndProc(var Message: TMessage);
2931 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
2933 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
2934 //
\8bC
\82Ã
\82©
\82¹
\82é
2942 procedure TfrmSender.actReplaceExecute(Sender: TObject);
2944 Form: TfrmStrReplaceDialog;
2946 Options: TReplaceFlags;
2948 Application.CreateForm(TfrmStrReplaceDialog, Form);
2950 if Form.Execute then
2954 Lines := memScript.Lines.Text;
2955 Options := [rfReplaceAll];
2957 Options := Options + [rfIgnoreCase];
2959 Lines := StringReplaceRegExp(Lines, BeforeStr, AfterStr, Options)
2961 Lines := StringReplace(Lines, BeforeStr, AfterStr, Options);
2963 if Lines <> memScript.Lines.Text then
2965 memScript.SelectAll;
2966 memScript.SelText := Lines;
2974 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
2977 if frmLog.lvwLog.ItemIndex < 0 then Exit;
2978 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
2979 if Log = nil then Exit;
2980 CopyFromLogToEditor(Log);
2983 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
2984 var Ghost, Script: String;
2987 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2988 if cbxTargetGhost.ItemIndex > 0 then
2989 Ghost := cbxTargetGhost.Text
2992 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost);
2996 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
2997 Y: Integer; State: TDragState; var Accept: Boolean);
2999 //
\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é
3000 if Source is TBottleLogDragObject then
3001 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
3004 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
3006 var Src: TBottleLogDragObject;
3009 //
\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é
3010 if not (Source is TBottleLogDragObject) then
3012 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
3014 Src := Source as TBottleLogDragObject;
3016 CopyFromLogToEditor(Log);
3019 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
3021 if Log.LogType <> ltBottle then Exit;
3022 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Ä)
3023 memScript.Lines.Clear;
3024 memScript.Lines.Add(Log.Script);
3025 if Log.Ghost <> '' then
3027 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
3028 //
\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Å
3029 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
3030 cbxTargetGhost.Items.Add(Log.Ghost);
3031 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
3033 cbxTargetGhost.Invalidate;
3035 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
3039 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
3041 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
3042 if frmLog.SelectedBottleLog = nil then
3044 if frmLog.lvwLog.ItemIndex = -1 then
3046 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.ItemIndex);
3047 frmLog.UpdateWindow;
3048 frmLog.lvwLogClick(Self);
3051 procedure TfrmSender.ClearEditor;
3052 var TmpScript: String;
3054 DoSaveBuffer: boolean;
3055 SavedScript: TStringList;
3057 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
3058 //
\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é
3059 DoSaveBuffer := false;
3060 if FScriptBuffer.Count = 0 then
3061 DoSaveBuffer := true
3062 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
3063 DoSaveBuffer := true;
3064 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
3065 DoSaveBuffer := false;
3066 if DoSaveBuffer then
3068 SavedScript := TStringList.Create;
3069 SavedScript.Text := GetScriptText;
3070 FScriptBuffer.Insert(0, SavedScript);
3072 if FScriptBuffer.Count >= 4 then
3073 FScriptBuffer.Delete(FScriptBuffer.Count-1);
3074 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
3076 TmpScript := Pref.DefaultScript;
3077 Position := Pos('|', TmpScript);
3078 if Position < 1 then Position := 1;
3079 TmpScript := StringReplace(TmpScript, '|', '', []);
3080 memScript.Lines.Text := TmpScript;
3081 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
3082 memScript.SelStart := Position-1;
3084 if Visible then memScript.SetFocus;
3085 FScriptModified := false;
3086 memScriptChange(self);
3089 procedure TfrmSender.AppendTextLog(const FileName, Line: String);
3093 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3095 ForceDirectories(ExtractFileDir(FileName));
3096 AssignFile(F, FileName);
3097 if FileExists(FileName) then
3106 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3110 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3115 Impl: TDomImplementation;
3116 Parser: TXmlToDomParser;
3119 try // Long try block to handle all kinds of exception in this method
3120 if not FileExists(FileName) then
3122 // Create empty XML log file
3123 Impl := TDomImplementation.create(nil);
3125 ForceDirectories(ExtractFileDir(FileName));
3126 Parser := TXmlToDomParser.create(nil);
3127 Parser.DOMImpl := Impl;
3130 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3133 documentElement.setAttribute('saved',
3134 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3135 documentElement.setAttribute('generator', VersionString);
3136 documentElement.setAttribute('version', '1.0');
3138 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3139 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3141 DOM.writeCodeAsShiftJIS(F);
3146 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3149 Parser.DOMImpl.freeDocument(DOM);
3156 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3162 F.Seek(P, soFromEnd);
3164 if Buf = '</bottlelog>' then
3169 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3172 F.Seek(P, soFromEnd);
3173 Buf := Format('<message mid="%s">', [Args['MID']]);
3174 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3175 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3176 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3177 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3178 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3179 Buf := Buf + '</message>';
3180 Buf := Buf + '</bottlelog>';
3181 F.Write(Buf[1], Length(Buf));
3188 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3192 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3197 SelText := memScript.SelText;
3198 if SelText <> '' then
3200 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3203 memScriptChange(Self);
3207 function TfrmSender.ReplaceSurface(Script: String;
3208 Params: TCollection): String;
3210 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3211 OldStr, Tag: String;
3212 i, j, k, Cur: integer;
3213 Item: TSurfaceReplaceItem;
3214 Before: TSurfaceReplaceBeforeItem;
3220 OldStr := InputString;
3221 OldLeaveEscape := LeaveEscape;
3222 OldEscapeInvalidMeta := EscapeInvalidMeta;
3223 LeaveEscape := true;
3224 EscapeInvalidMeta := false;
3225 InputString := Script;
3227 for i := 0 to SsParser.Count-1 do
3229 if SsParser.MarkUpType[i] <> mtTag then
3231 Result := Result + SsParser.Str[i];
3234 Tag := SsParser.Str[i];
3235 if SsParser.Match(Tag, '\s%d') = 2 then
3236 Cur := Ord(Tag[3]) - Ord('0')
3237 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3238 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3241 Result := Result + Tag;
3245 for j := 0 to Params.Count-1 do
3247 Item := Params.Items[j] as TSurfaceReplaceItem;
3248 for k := 0 to Item.Before.Count-1 do
3250 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3251 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3254 Result := Result + Format('\s[%d]', [Item.After]);
3262 Result := Result + Tag;
3266 LeaveEscape := OldLeaveEscape;
3267 EscapeInvalidMeta := OldEscapeInvalidMeta;
3268 InputString := OldStr;
3272 procedure TfrmSender.WMQueryEndSession(var msg: TWMQueryEndSession);
3274 // Windows
\82ª
\8fI
\97¹
\82µ
\82æ
\82¤
\82Æ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82ð
\8a´
\92m
\82·
\82é
3275 FEndSession := true;
3279 procedure TfrmSender.IdSLPP20ConnectFailed(Sender: TObject);
3282 if FBeginConnectFailCount = 0 then
3285 if Pref.UseHttpProxy then
3286 frmMessageBox.ShowMessage('HTTP Proxy
\82ð
\92Ê
\82¶
\82ÄSSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3287 '
\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 +
3288 '
\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')
3290 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3291 '
\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 +
3292 '
\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');
3294 ShowHintLabel('SSTP Bottle Server
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
3295 Inc(FBeginConnectFailCount);
3298 procedure TfrmSender.BuildReplaceMenu(Root: TMenuItem);
3301 Presets: TReplacePresetCollection;
3305 Presets := Pref.ReplacePresets.Presets;
3306 for i := 0 to Presets.Count-1 do
3308 NewItem := TMenuItem.Create(Root);
3311 Caption := Presets[i].Title;
3312 ShortCut := Presets[i].ShortCut;
3313 AutoHotkeys := maManual;
3314 Hint := Presets[i].Pairs.StringExpression;
3316 OnClick := mnPresetReplaceClick;
3320 Root.Enabled := Presets.Count > 0;
3323 procedure TfrmSender.mnPresetReplaceClick(Sender: TObject);
3325 Preset: TReplacePreset;
3328 //
\83v
\83\8a\83Z
\83b
\83g
\92u
\8a·
\82ð
\8eÀ
\8ds
3329 Preset := Pref.ReplacePresets.Presets[(Sender as TMenuItem).Tag];
3330 Lines := memScript.Lines.Text;
3331 New := Preset.Pairs.ExecuteReplace(Lines);
3332 if New <> Lines then
3334 memScript.SelectAll;
3335 memScript.SelText := New;
3337 if Preset.ConfirmAfterReplace then