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');
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 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1292 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1293 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1295 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1296 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1297 Url[0] := SsParser.GetParam(SsParser[i], 1);
1298 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1299 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1300 if Pos('http://', Url[0]) > 0 then begin
1302 if not QuickSection then
1303 Script := Script + '\_q' + Url[0] + '\_q'
1305 Script := Script + Url[0];
1308 end else Script := Script + SsParser[i];
1310 Mark := SsParser[i];
1311 if Mark = '\h' then begin
1312 UnyuTalking := false;
1313 if toHUTagTo01Tag in Options then Mark := '\0';
1314 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1315 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');
1316 end else if Mark = '\u' then begin
1317 UnyuTalking := true;
1318 if toHUTagTo01Tag in Options then Mark := '\1';
1319 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1320 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');
1321 end else if Mark = '\_q' then begin
1322 QuickSection := not QuickSection;
1323 end else if Mark = '\_s' then begin
1324 Synchronize := not Synchronize;
1325 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1326 if UnyuTalking then begin
1327 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1330 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1333 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1334 if UnyuTalking then begin
1335 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1337 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1340 Script := Script + Mark;
1343 if UrlCount > 0 then begin
1345 Script := Script + '\h\n';
1346 if not (toNoChoice in Options) then begin
1347 for i := 0 to UrlCount-1 do begin
1348 Script := Script + Format('\q%d[%s][%s]',
1349 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1351 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1352 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1354 Script := Script + '\h';
1355 for i := 0 to UrlCount-1 do begin
1356 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1358 Script := Script + Format('\n{%s}', [UrlCancel]);
1362 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1363 if toWaitScriptEnd in Options then begin
1364 i := Pref.WaitScriptEnd;
1365 while i > 0 do begin
1367 Script := Script + '\w9';
1370 Script := Script + '\w' + IntToStr(i);
1376 Script := Script + '\e';
1377 RegExp.Subst('s/\r\n//gk', Script);
1379 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1380 for i := 0 to SsParser.Count-1 do begin
1381 if SsParser.MarkUpType[i] = mtTagErr then begin
1382 Result := '"' + SsParser[i] + '"'#13#10 +
1383 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1387 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1388 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1392 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1393 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1394 mbOkCancel, 0) = mrCancel then
1395 Result := Warnings.Text;
1402 function TfrmSender.DoTrans(var Script: String;
1403 Options: TScriptTransOptions): String;
1406 Result := DoTrans(Script, Options, dum);
1409 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1411 OpenBrowser(Pref.HomePage);
1414 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1416 lblMessage.Caption := Mes;
1417 lblMessage.Font.Color := Col;
1418 lblMessage.Visible := true;
1419 LabelTimer.Enabled := false;
1420 LabelTimer.Enabled := true;
1423 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1425 LabelTimer.Enabled := false;
1426 lblmessage.Visible := false;
1429 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1433 Str := memScript.Lines.Text;
1434 Clip := ClipBoard();
1435 Clip.SetTextBuf(PChar(Str));
1438 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1442 Str := memScript.Lines.Text;
1443 RegExp.Subst('s/\r\n//gk', Str);
1444 Clip := ClipBoard();
1445 Clip.SetTextBuf(PChar(Str));
1448 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1449 const Param: String);
1450 var HeadValue: THeadValue;
1452 HeadValue := THeadValue.Create(Param);
1455 etScript, etForceBroadcast, etUnicast: begin
1456 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1457 DispatchBottle(EventType, HeadValue);
1460 etMemberCount: begin
1461 //
\91\8d\8eQ
\89Á
\8eÒ
\90\94
1462 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1465 etChannelCount: begin
1466 //
\83`
\83\83\83\93\83l
\83\8b\95Ê
\8eQ
\89Á
\8eÒ
\90\94
1468 if HeadValue['Channel'] <> '' then begin
1469 if ChannelList.Channel[HeadValue['Channel']] <> nil then begin
1470 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1478 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1480 FBeginConnectFailCount := 0;
1481 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1482 if not Connecting then
1483 PostCommand(['Command: getChannels']);
1485 SakuraSeeker.BeginDetect;
1487 on E: Exception do ShowHintLabel(E.Message,WarningColor);
1491 etChannelList: begin
1492 UpdateJoinChannelList(HeadValue);
1493 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1494 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1495 JoinChannelsBackup.Assign(JoinChannels);
1498 etCloseChannel: begin
1499 //
\83`
\83\83\83\93\83l
\83\8b\94p
\8e~
1500 if HeadValue['Channel'] <> '' then begin
1501 with JoinChannels do
1502 if IndexOf(HeadValue['Channel']) >= 0 then
1503 Delete(IndexOf(HeadValue['Channel']));
1504 with tabChannel do begin
1505 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1506 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1507 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1508 tabChannelChange(self);
1510 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1512 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1513 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1517 etForceBroadcastInformation: begin
1518 //
\93\8a\95[
\81^
\93¯
\88Ó
\81^
\82»
\82Ì
\91¼
\83u
\83\8d\81[
\83h
\83L
\83\83\83X
\83g
\8fî
\95ñ
1519 if HeadValue['MID'] <> '' then begin
1520 try //Num
\82ª
\90\94\92l
\82Å
\82È
\82©
\82Á
\82½
\82Æ
\82«
\91Î
\8dô
1521 if HeadValue['Type'] = 'Vote' then begin
1522 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1523 end else if HeadValue['Type'] = 'Agree' then begin
1524 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1536 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1538 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1540 TaskTray.TipString := 'SSTP Bottle Client (' +
1541 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1543 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1545 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1548 procedure TfrmSender.actSettingExecute(Sender: TObject);
1550 Application.CreateForm(TfrmSetting, frmSetting);
1560 BuildReplaceMenu(mnPresetReplaceRoot);
1563 frmLog.UpdateWindow;
1566 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1568 if (Key = #13) or (Key = #10) then Key := Char(0);
1571 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1574 UpdateJoinChannelList(nil);
1575 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1576 if not Application.Terminated then RetryBeginConnect;
1579 procedure TfrmSender.SetSleeping(const Value: boolean);
1582 FBottleSstp.ResendSleep := Value;
1586 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1589 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]),
1590 mtWarning, mbOkCancel, 0);
1591 if Re = mrOk then begin
1593 frmLog.AllBottleOpened;
1594 frmLog.UpdateWindow;
1598 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1600 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1603 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1605 Ch: TChannelListItem;
1608 for i := 1 to Dat.IntData['Count'] do begin
1609 Ch := TChannelListItem.Create;
1610 Ch.Name := Dat[Format('CH%d_name', [i])];
1611 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1612 Ch.Info := Dat[Format('CH%d_info', [i])];
1613 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1614 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1615 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1616 ChannelList.Add(Ch);
1621 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1623 PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1626 procedure TfrmSender.NoLuidError;
1629 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1630 '
\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+
1631 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1634 procedure TfrmSender.tabChannelChange(Sender: TObject);
1636 if tabChannel.TabIndex >= 0 then begin
1637 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1638 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1643 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1644 ConstructMenu(true);
1647 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1649 with tabChannel do begin
1650 if Tabs.Count = 0 then Exit;
1651 if TabIndex=0 then TabIndex := Tabs.Count-1
1652 else TabIndex := TabIndex-1;
1654 tabChannelChange(Self);
1657 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1659 with tabChannel do begin
1660 if Tabs.Count = 0 then Exit;
1661 if TabIndex=Tabs.Count-1 then TabIndex := 0
1662 else TabIndex := TabIndex+1;
1664 tabChannelChange(Self);
1667 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1671 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1672 if nodat then Dat := THeadValue.Create('');
1674 for i := 0 to Dat.Count-1 do
1675 if Dat.KeyAt[i] = 'Entry' then begin
1676 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1677 JoinChannels.Add(RegExp[1]);
1679 with tabChannel do begin
1684 for i := 0 to JoinChannels.Count-1 do begin
1685 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1686 if ChannelList.Channel[JoinChannels[i]] <> nil then
1687 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1688 Tabs.Add(JoinChannels[i]);
1691 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1692 //
\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)
1694 for i := 0 to Tabs.Count-1 do
1695 if Tabs[i] = FNowChannel then TabIndex := i;
1696 if Tabs.Count > 0 then begin
1697 FNowChannel := Tabs[TabIndex];
1698 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1701 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1703 Visible := Tabs.Count > 0;
1704 if Tabs.Count > 1 then begin
1705 actNextChannel.Enabled := true;
1706 actPrevChannel.Enabled := true;
1708 actNextChannel.Enabled := false;
1709 actPrevChannel.Enabled := false;
1711 OnChange := tabChannelChange;
1713 if nodat then Dat.Free;
1714 if JoinChannels.Count = 0 then begin
1715 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1716 actSend.Enabled := false;
1718 Self.Caption := FOriginalCaption;
1719 actSend.Enabled := true;
1723 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1725 SakuraSeeker.BeginDetect;
1729 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1732 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1735 procedure TfrmSender.actSleepExecute(Sender: TObject);
1737 if actSleep.Checked then begin
1738 actSleep.Checked := false;
1739 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1741 actSleep.Checked := true;
1742 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1744 Sleeping := actSleep.Checked;
1749 procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1751 var Opt: TSstpSendOptions;
1752 Event: TBottleChainBottleEvent;
1753 Script, Sender, Ghost, Channel, ErrorMes: String;
1754 BreakFlag, NoDispatch: boolean;
1755 Sound, LogName: String;
1756 i, j, k, SkipCount: integer;
1757 Rule: TBottleChainRule;
1758 Action: TBottleChainAction;
1759 LogNameList: TStringList;
1761 ReplaceHash: THeadValue;
1763 Channel := Dat['Channel'];
1766 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1767 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1769 etScript: Sender := Channel;
1770 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1771 etUnicast: Sender := Dat['SenderUID'];
1774 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1775 if Dat['IfGhost'] <> '' then begin
1776 Ghost := Dat['IfGhost'];
1778 if ChannelList.Channel[Channel] <> nil then
1779 Ghost := ChannelList.Channel[Channel].Ghost;
1781 Dat['TargetGhost'] := Ghost;
1783 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1784 ReplaceHash := THeadValue.Create;
1785 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1786 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1787 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1788 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1789 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1790 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1791 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1792 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1793 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1795 Event := TBottleChainBottleEvent.Create;
1798 if EventType = etScript then Event.LogType := ltBottle
1799 else Event.LogType := ltSystemLog;
1801 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1802 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1803 if ErrorMes <> '' then begin
1804 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'+
1805 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1810 NoDispatch := false;
1812 LogNameList := TStringList.Create;
1815 for i := 0 to BottleChainRuleList.Count-1 do begin
1816 if SkipCount > 0 then begin
1820 Rule := BottleChainRuleList[i];
1821 if not Rule.Enabled then Continue;
1822 if not Rule.Check(Event) then Continue;
1823 for j := 0 to Rule.Actions.Count-1 do begin
1824 Action := (Rule.Actions[j] as TBottleChainAction);
1825 if Action is TBottleChainAbortRuleAction then
1827 if Action is TBottleChainSkipRuleAction then
1828 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1829 if (Action is TBottleChainSoundAction) and (Sound = '') then
1831 Sound := (Action as TBottleChainSoundAction).SoundFile;
1832 Sound := StringReplaceEx(Sound, ReplaceHash);
1834 if Action is TBottleChainNoDispatchAction then
1836 if Action is TBottleChainLogAction then
1838 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1839 LogName := (Action as TBottleChainLogAction).LogNames[k];
1840 LogName := StringReplaceEx(LogName, ReplaceHash);
1841 LogNameList.Add(LogName);
1844 if Action is TBottleChainOverrideGhostAction then
1846 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1848 if Action is TBottleChainQuitAction then
1849 Application.Terminate;
1850 if Action is TBottleChainSaveTextLogAction then
1851 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1852 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1853 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]));
1854 if Action is TBottleChainSaveXMLLogAction then
1855 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1857 if Action is TBottleChainSurfaceReplaceAction then
1858 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1860 if BreakFlag then Break;
1863 if Dat['Script'] <> '' then begin
1864 for i := 0 to LogNameList.Count-1 do
1865 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost']);
1866 if NoDispatch then begin
1867 frmLog.SetBottleState(Dat['MID'], lsOpened);
1869 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1870 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1871 Script, Ghost, Now());
1873 FBottleSstp.Push(CueItem);
1880 if Dat['DialogMessage'] <> '' then begin
1882 frmMessageBox.ShowMessage(
1883 DateTimeToStr(Now) + #13#10 +
1884 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1885 for i := 0 to LogNameList.Count-1 do
1886 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1890 if (Sound <> '') then PlaySound(Sound);
1900 procedure TfrmSender.YenETrans;
1901 var St, Le, i: integer;
1904 St := memScript.SelStart;
1905 Le := memScript.SelLength;
1906 Orig := GetScriptText;
1907 RegExp.Subst('s/(\r\n)+$//kg', Orig);
1909 with SsParser do begin
1910 LeaveEscape := true;
1911 EscapeInvalidMeta := false;
1912 InputString := Orig;
1914 for i := 0 to SsParser.Count-1 do begin
1915 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
1918 Text := Text + '\e';
1920 if Orig <> Text then memScript.Lines.Text := Text;
1921 SsParser.InputString := Text;
1923 RegExp.Subst('s/\r\n//kg', Text);
1925 memScript.SelStart := St;
1926 memScript.SelLength := Le;
1929 procedure TfrmSender.PostCommand(const Command: array of String);
1930 var PostStr: TStringList;
1935 PostStr := TStringList.Create;
1936 for i := Low(Command) to High(Command) do begin
1937 PostStr.Add(Command[i]);
1939 PostCommand(PostStr);
1945 procedure TfrmSender.PostCommand(Command: TStrings);
1946 var PostStr: String;
1949 PostStr := Command.Text;
1950 PostStr := ParamsEncode(PostStr);
1952 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
1953 if Pref.UseHttpProxy then begin
1954 FHttp.ProxyServer := Pref.ProxyAddress;
1955 FHttp.ProxyPort := Pref.ProxyPort;
1956 if Pref.ProxyNeedAuthentication then begin
1957 FHttp.ProxyUser := Pref.ProxyUser;
1958 FHttp.ProxyPass := Pref.ProxyPass;
1961 FHttp.OnSuccess := HttpSuccess;
1962 FHttp.OnConnectionFailed := HttpFailure;
1963 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
1966 on EHeapException do begin
1967 Connecting := false;
1973 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
1976 if frmLog.lvwLog.ItemIndex < 0 then Exit;
1977 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
1978 if Log = nil then Exit;
1979 if Log.LogType <> ltBottle then Exit;
1981 'Command: voteMessage',
1983 'LUID: ' + Pref.LUID,
1989 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
1992 if frmLog.lvwLog.ItemIndex < 0 then Exit;
1993 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
1994 if Log = nil then Exit;
1995 if Log.LogType <> ltBottle then Exit;
1997 'Command: voteMessage',
1999 'LUID: ' + Pref.LUID,
2005 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
2007 if SakuraSeeker.ProcessByName[Ghost] <> nil then
2008 Result := SakuraSeeker.ProcessByName[Ghost].SetName
2013 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
2014 MousePos: TPoint; var Handled: Boolean);
2017 with tabChannel do begin
2018 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
2019 if Tag < 0 then Handled := true;
2024 procedure TfrmSender.PostSetChannel(Channels: TStrings);
2025 var PostStr: TStringList;
2028 PostStr := TStringList.Create;
2030 with PostStr do begin
2031 Add('Command: setChannels');
2032 Add('Agent: ' + VersionString);
2033 Add('LUID: ' + Pref.LUID);
2034 if Channels <> nil then
2035 for i := 0 to Channels.Count-1 do begin
2036 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
2039 PostCommand(PostStr);
2045 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
2049 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
2051 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
2052 Chs := TStringList.Create;
2054 //
\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ð
2055 //
\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é
2057 Chs.Assign(JoinChannels);
2058 while Chs.IndexOf(Ch) >= 0 do
2059 Chs.Delete(Chs.IndexOf(Ch));
2060 PostSetChannel(Chs);
2066 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
2068 OpenBrowser(Pref.VotePage);
2071 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
2072 Shift: TShiftState; X, Y: Integer);
2076 with tabChannel do begin
2077 Index := IndexOfTabAt(X, Y);
2079 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2083 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2085 OpenBrowser(Pref.HelpPage);
2088 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2089 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2092 with tabChannel do begin
2093 Index := IndexOfTabAt(X, Y);
2094 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2095 if Button = mbLeft then begin
2096 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2098 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2103 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2104 Y: Integer; State: TDragState; var Accept: Boolean);
2105 var TargetRect: TRect;
2108 Accept := Source = tabChannel;
2109 if not Accept then Exit;
2110 with tabChannel do begin
2111 OldDest := FDragTabDest;
2112 FDragTabDest := IndexOfTabAt(X, Y);
2113 if FDragTabDest = -1 then begin
2114 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2117 with Canvas do begin
2121 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2122 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2123 TargetRect := TabRect(OldDest);
2124 with Canvas do begin
2125 Brush.Style := bsClear;
2126 Rectangle(TargetRect.Left, TargetRect.Top,
2127 TargetRect.Right, TargetRect.Bottom);
2130 if (OldDest <> FDragTabDest) then begin
2131 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2132 TargetRect := TabRect(FDragTabDest);
2133 with Canvas do begin
2134 Brush.Style := bsClear;
2135 Rectangle(TargetRect.Left, TargetRect.Top,
2136 TargetRect.Right, TargetRect.Bottom);
2142 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2144 var DestIndex: integer;
2146 with tabChannel do begin
2147 DestIndex := IndexOfTabAt(X, Y);
2148 Tabs.Move(FDragTabIndex, DestIndex);
2152 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2155 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2156 tabChannel.Tabs.BeginUpdate;
2157 tabChannel.Tabs.EndUpdate;
2160 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2161 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2162 var AlignRight: boolean;
2165 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2166 with cbxTargetGhost do begin
2167 AlignRight := false;
2168 if Pref.HideGhosts and not FTargetGhostExpand and
2169 (Index = Items.Count-1) and (Index > 0) then
2171 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2172 Canvas.Font.Color := clWindowText;
2173 Canvas.Font.Style := [];
2175 end else if (Index > 0) then
2177 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2178 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2179 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2181 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2182 Canvas.Font.Style := [fsBold];
2185 Canvas.Font.Color := clWindowText;
2186 Canvas.Font.Style := [];
2188 if odSelected in State then
2189 Canvas.Font.Color := clHighlightText;
2193 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2194 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2195 cbxTargetGhost.Items[Index]);
2197 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2198 cbxTargetGhost.Items[Index]);
2202 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2203 var CanClose: Boolean);
2205 if (not Pref.ConfirmOnExit) or FEndSession then
2207 if MessageDlg('SSTP Bottle Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2208 mbOkCancel, 0) = mrCancel then
2212 procedure TfrmSender.UpdateIfGhostBox;
2216 HiddenCount: integer;
2218 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2219 Selected := cbxTargetGhost.Text;
2221 with cbxTargetGhost do begin
2224 Items.Add(ChannelDefault);
2225 for i := 0 to SakuraSeeker.Count-1 do begin
2226 //
\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é
2227 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2228 if Pref.HideGhosts and not FTargetGhostExpand then
2229 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2234 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2235 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2237 cbxTargetGhost.ItemIndex := 0;
2238 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2239 with cbxTargetGhost do begin
2240 for i := 1 to Items.Count-1 do begin
2241 if Items[i] = Selected then
2244 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2245 if ItemIndex = 0 then begin
2246 Items.Add(Selected);
2247 ItemIndex := Items.Count - 1;
2251 if Pref.HideGhosts and not FTargetGhostExpand then
2252 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2257 procedure TfrmSender.HTTPFailure(Sender: TObject);
2261 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2262 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2263 (Sender as THTTPDownloadThread).LastErrorMessage);
2264 Connecting := false;
2267 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2270 SakuraSeeker.BeginDetect;
2272 i := cbxTargetGhost.ItemIndex;
2276 i := cbxTargetGhost.Items.Count-1;
2277 if Pref.HideGhosts and not FTargetGhostExpand then
2280 cbxTargetGhost.ItemIndex := i;
2281 cbxTargetGhostChange(self);
2284 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2287 SakuraSeeker.BeginDetect;
2289 i := cbxTargetGhost.ItemIndex;
2291 if Pref.HideGhosts and not FTargetGhostExpand then
2293 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2296 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2298 cbxTargetGhost.ItemIndex := i;
2299 cbxTargetGhostChange(self);
2302 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2304 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2305 FTargetGhostExpand := false;
2306 if Visible then memScript.SetFocus;
2307 cbxTargetGhostChange(self);
2310 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2312 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2314 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2315 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2317 if not IdSlpp20.Connected then begin
2319 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2321 //
\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
2322 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2328 procedure TfrmSender.RetryBeginConnect;
2330 if FBeginConnectFailCount < 3 then begin
2331 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2332 IdSlpp20.OnDisconnect := nil;
2333 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2334 FAutoAddAfterGetChannel := true;
2336 IdSlpp20.OnDisconnect := Slpp20Disconnect;
2337 end else if FBeginConnectFailCount = 3 then begin
2338 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2339 frmMessageBox.ShowMessage(
2340 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2341 '
\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+
2342 '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'
2344 Inc(FBeginConnectFailCount);
2348 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2349 var BottleLog: TBottleLogList;
2351 Cond: TBottleLogDownloadCondition;
2353 function TimeStr(Mins: integer): String;
2354 var day, hour, min: integer;
2356 day := Mins div (60 * 24);
2357 hour := (Mins div 60) mod 24;
2360 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2361 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2362 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2365 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2367 if frmLogDownload.Execute then begin
2368 with frmLogDownload do begin
2369 if IsRange then begin
2370 if CompareDate(DateLo, DateHi) = 0 then
2371 Title := FormatDateTime('yy-mm-dd', DateLo)
2373 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2375 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2377 if Channel <> '' then Title := Title + '(' + Channel + ')';
2379 BottleLog := TBottleLogList.Create(Title);
2381 BottleLog.OnLoaded := frmLog.LogLoaded;
2382 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2383 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2384 with frmLogDownload do begin
2385 Cond.IsRange := IsRange;
2386 Cond.RecentCount := RecentCount;
2387 Cond.DateLo := DateLo;
2388 Cond.DateHi := DateHi;
2389 Cond.MinVote := MinVote;
2390 Cond.MinAgree := MinAgree;
2391 Cond.Channel := Channel;
2393 BottleLog.LoadFromWeb(Cond);
2395 FreeAndNil(BottleLog);
2397 if BottleLog <> nil then begin
2398 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2400 frmLog.tabBottleLog.TabIndex := NewIndex;
2401 frmLog.UpdateWindow;
2405 frmLogDownload.Release;
2409 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2410 Ghost: String): boolean;
2417 Cond := Token(IfGhost, ',', i);
2418 if Cond <> '' then begin
2419 if Cond[1] = '!' then begin
2420 Cond := Copy(Cond, 2, High(integer));
2421 if Cond = Ghost then Result := false;
2423 if Cond <> Ghost then Result := false;
2430 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2431 var i, j, k, count: integer;
2432 ConstData: TScriptConst;
2433 Menu1, Menu2: TMenuItem;
2436 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2437 // 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
2438 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2439 else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2441 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2442 if Simple then begin
2443 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2444 for i := Root.Count-1 downto 0 do begin
2445 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2449 //
\91S
\95\94\8dí
\8f\9c
2453 for i := 0 to ScriptConstList.Count-1 do begin
2454 for j := 0 to ScriptConstList[i].Count-1 do begin
2455 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2456 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2458 // 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
2459 if Simple and (count < Root.Count) then
2460 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2464 Menu1 := TMenuItem.Create(Root);
2467 Caption := ScriptConstList[i][j].Caption;
2468 Hint := ScriptConstList[i][j].Caption;
2469 AutoHotkeys := maManual;
2470 Tag := ScriptConstList[i][j].ID;
2471 OnClick := mnConstGroupClick;
2474 if not Simple then begin
2477 if count < Root.Count-1 then
2478 Root.Insert(count, Menu1)
2483 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2484 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2485 ConstData := ScriptConstList[i][j][k];
2486 Menu2 := TMenuItem.Create(Root);
2487 Menu2.Caption := ConstData.Caption;
2488 Menu2.Hint := ConstData.ConstText;
2489 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2490 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2491 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2492 Menu2.ShortCut := ConstData.ShortCut;
2493 Menu2.OnClick := mnConstClick;
2494 Menu2.AutoHotkeys := maManual;
2495 Menu2.Tag := ConstData.ID;
2496 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2503 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2505 //
\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
2506 if Pref.HideGhosts and not FTargetGhostExpand then
2508 with cbxTargetGhost do
2510 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2511 //
\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
2512 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2514 FTargetGhostExpand := true;
2517 DroppedDown := true;
2521 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2522 ConstructMenu(true);
2523 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2527 procedure TfrmSender.PlaySound(const FileName: String);
2529 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2531 MediaPlayer.FileName := FileName;
2535 on E: EMCIDeviceError do begin
2536 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2541 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2544 if not Assigned(frmFMOExplorer) then
2545 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2548 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2551 frmFMOExplorer.Show;
2554 procedure TfrmSender.SaveChainRuleList;
2555 var Str: TStringList;
2557 Str := TStringList.Create;
2559 Str.Text := ComponentToString(BottleChainRuleList);
2560 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2566 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2568 frmLog.SetBottleState(MID, lsOpened);
2571 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2573 frmLog.SetBottleState(MID, lsPlaying);
2576 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2577 var InsertItem: TLogItem;
2578 i, errCount, Res: integer;
2579 Log: TBottleLogList;
2580 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2582 if FBottleSstp.CueCount > 0 then begin
2583 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'+
2584 '
\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+
2585 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2586 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2589 frmLog.AllBottleOpened;
2590 if frmLog.lvwLog.ItemIndex < 0 then Exit;
2591 Log := frmLog.SelectedBottleLog;
2592 if Log = nil then Exit;
2593 FBottleSSTP.OnResendCountChange := nil;
2595 for i := frmLog.lvwLog.ItemIndex downto 0 do begin
2596 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2597 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2599 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2600 if ErrorMes <> '' then
2602 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2603 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2606 raise Exception.Create('Script Syntax Error')
2607 else if Res = mrCancel then
2611 frmLog.AllBottleOpened;
2615 if InsertItem.Ghost = '' then begin
2616 if ChannelList.Channel[InsertItem.Channel] <> nil then
2617 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2619 FBottleSSTP.Push(InsertItem);
2620 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2626 if errCount > 0 then
2627 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]));
2628 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2629 BottleSstpResendCountChange(self);
2630 frmLog.lvwLog.Invalidate;
2633 function TfrmSender.ScriptTransForSSTP(const Script: String;
2634 out Error: String): String;
2635 var TransOpt: TScriptTransOptions;
2637 if Pref.NoTransURL then
2638 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2640 TransOpt := [toConvertURL, toWaitScriptEnd];
2641 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2642 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2643 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2645 Error := DoTrans(Result, TransOpt);
2648 procedure TfrmSender.FormResize(Sender: TObject);
2649 var w, SelS, SelL: integer;
2651 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2652 if memScript.ColWidth <> 0 then
2658 w := Width - LeftMargin - ColWidth div 2;
2659 if ScrollBars in [ssVertical, ssBoth] then
2660 w := w - GetSystemMetrics(SM_CYVSCROLL);
2661 WrapOption.WrapByte := w div ColWidth;
2668 procedure TfrmSender.actCopyExecute(Sender: TObject);
2670 memScript.CopyToClipboard;
2673 procedure TfrmSender.actPasteExecute(Sender: TObject);
2675 memScript.PasteFromClipboard;
2678 procedure TfrmSender.actCutExecute(Sender: TObject);
2680 memScript.CutToClipboard;
2683 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2685 memScript.SelectAll;
2688 procedure TfrmSender.actUndoExecute(Sender: TObject);
2693 procedure TfrmSender.actRedoExecute(Sender: TObject);
2698 function TfrmSender.IsSurfaceTag(const Script: String;
2699 var ID: integer): boolean;
2702 if SsParser.Match(Script, '\s%d') = 3 then
2705 ID := Ord(Script[3]) - Ord('0')
2707 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2710 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2714 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2715 Shift: TShiftState; X, Y: Integer);
2719 //
\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[
2720 if not Pref.SurfacePreviewOnScriptPoint then
2722 token := memScript.TokenStringFromPos(Point(X, Y));
2723 if IsSurfaceTag(token, id) then
2725 DoSurfacePreview(id, spEditor);
2728 frmSurfacePreview.HideAway;
2732 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2733 const Kind: TSurfacePreviewType);
2738 if cbxTargetGhost.ItemIndex > 0 then
2739 ghost := cbxTargetGhost.Text
2740 else if FNowChannel <> '' then
2741 ghost := ChannelList.Channel[FNowChannel].Ghost;
2743 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2744 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2745 not (frmSurfacePreview.IsHidden) then
2752 Bmp := TBitmap.Create;
2754 if Spps.TryGetImage(ghost, Surface, Bmp) then
2758 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2760 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2762 CPos := Point(0, 0);
2764 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2765 FVisiblePreviewGhost := Ghost;
2766 FVisiblePreviewSurface := Surface;
2768 frmSurfacePreview.HideAway;
2775 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2776 {var MousePoint: TPoint;
2779 //
\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é
2780 //
\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Å
2781 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2782 {GetCursorPos(MousePoint);
2783 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2784 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2785 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2786 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2789 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2790 var MousePoint: TPoint;
2792 GetCursorPos(MousePoint);
2793 case Pref.SurfacePreviewOnScriptPointPosition of
2794 spspMainWindowRight:
2795 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2797 Result := Point(Self.Left - w, MousePoint.Y);
2801 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2803 if (Sender is TMenuItem) then
2804 FVisibleMenuItem := Sender as TMenuItem;
2807 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2809 if FScriptBuffer.Count = 0 then
2811 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2812 memScriptChange(Self);
2813 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2816 procedure TfrmSender.EditorPreview;
2817 var Ghost, Script: String;
2819 if frmEditorTalkShow <> nil then
2820 if frmEditorTalkShow.Visible then
2822 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2824 if cbxTargetGhost.ItemIndex > 0 then
2825 Ghost := cbxTargetGhost.Text
2826 else if FNowChannel <> '' then
2827 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2828 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2832 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2834 if frmEditorTalkShow <> nil then
2835 frmEditorTalkShow.Show
2838 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
2839 frmEditorTalkShow.TalkShowFrame.SetPreviewFont(memScript.Font);
2840 frmEditorTalkShow.Show;
2842 Pref.ShowEditorPreviewWindow := True;
2846 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
2847 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
2849 Spps.ClearImagePool;
2850 Spps.LoadFromDirectory(FSppDir);
2853 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
2855 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
2858 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2859 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
2860 function TfrmSender.TagReplace(Script: String; Before,
2861 After: array of String): String;
2862 var BeforeList, AfterList: TStringList;
2865 BeforeList := TStringList.Create;
2866 AfterList := TStringList.Create;
2868 for i := Low(Before) to High(Before) do
2869 BeforeList.Add(Before[i]);
2870 for i := Low(After) to High(After) do
2871 AfterList.Add(After[i]);
2872 Result := TagReplace(Script, BeforeList, AfterList);
2879 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2880 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
2881 //
\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¢)
2882 function TfrmSender.TagReplace(Script: String; Before,
2883 After: TStrings): String;
2885 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
2891 OldStr := InputString;
2892 OldLeaveEscape := LeaveEscape;
2893 OldEscapeInvalidMeta := EscapeInvalidMeta;
2894 LeaveEscape := true;
2895 EscapeInvalidMeta := false;
2896 InputString := Script;
2898 for i := 0 to SsParser.Count-1 do
2901 for j := 0 to Before.Count-1 do
2903 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
2906 Result := Result + After[j];
2910 Result := Result + SsParser[i];
2914 LeaveEscape := OldLeaveEscape;
2915 EscapeInvalidMeta := OldEscapeInvalidMeta;
2916 InputString := OldStr;
2920 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
2921 //
\91Î
\89\9e\82·
\82é
2922 procedure TfrmSender.WndProc(var Message: TMessage);
2924 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
2926 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
2927 //
\8bC
\82Ã
\82©
\82¹
\82é
2935 procedure TfrmSender.actReplaceExecute(Sender: TObject);
2937 Form: TfrmStrReplaceDialog;
2939 Options: TReplaceFlags;
2941 Application.CreateForm(TfrmStrReplaceDialog, Form);
2943 if Form.Execute then
2947 Lines := memScript.Lines.Text;
2948 Options := [rfReplaceAll];
2950 Options := Options + [rfIgnoreCase];
2952 Lines := StringReplaceRegExp(Lines, BeforeStr, AfterStr, Options)
2954 Lines := StringReplace(Lines, BeforeStr, AfterStr, Options);
2956 if Lines <> memScript.Lines.Text then
2958 memScript.SelectAll;
2959 memScript.SelText := Lines;
2967 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
2970 if frmLog.lvwLog.ItemIndex < 0 then Exit;
2971 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
2972 if Log = nil then Exit;
2973 CopyFromLogToEditor(Log);
2976 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
2977 var Ghost, Script: String;
2980 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2981 if cbxTargetGhost.ItemIndex > 0 then
2982 Ghost := cbxTargetGhost.Text
2985 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost);
2989 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
2990 Y: Integer; State: TDragState; var Accept: Boolean);
2992 //
\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é
2993 if Source is TBottleLogDragObject then
2994 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
2997 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
2999 var Src: TBottleLogDragObject;
3002 //
\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é
3003 if not (Source is TBottleLogDragObject) then
3005 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
3007 Src := Source as TBottleLogDragObject;
3009 CopyFromLogToEditor(Log);
3012 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
3014 if Log.LogType <> ltBottle then Exit;
3015 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Ä)
3016 memScript.Lines.Clear;
3017 memScript.Lines.Add(Log.Script);
3018 if Log.Ghost <> '' then
3020 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
3021 //
\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Å
3022 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
3023 cbxTargetGhost.Items.Add(Log.Ghost);
3024 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
3026 cbxTargetGhost.Invalidate;
3028 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
3032 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
3034 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
3035 if frmLog.SelectedBottleLog = nil then
3037 if frmLog.lvwLog.ItemIndex = -1 then
3039 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.ItemIndex);
3040 frmLog.UpdateWindow;
3041 frmLog.lvwLogClick(Self);
3044 procedure TfrmSender.ClearEditor;
3045 var TmpScript: String;
3047 DoSaveBuffer: boolean;
3048 SavedScript: TStringList;
3050 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
3051 //
\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é
3052 DoSaveBuffer := false;
3053 if FScriptBuffer.Count = 0 then
3054 DoSaveBuffer := true
3055 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
3056 DoSaveBuffer := true;
3057 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
3058 DoSaveBuffer := false;
3059 if DoSaveBuffer then
3061 SavedScript := TStringList.Create;
3062 SavedScript.Text := GetScriptText;
3063 FScriptBuffer.Insert(0, SavedScript);
3065 if FScriptBuffer.Count >= 4 then
3066 FScriptBuffer.Delete(FScriptBuffer.Count-1);
3067 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
3069 TmpScript := Pref.DefaultScript;
3070 Position := Pos('|', TmpScript);
3071 if Position < 1 then Position := 1;
3072 TmpScript := StringReplace(TmpScript, '|', '', []);
3073 memScript.Lines.Text := TmpScript;
3074 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
3075 memScript.SelStart := Position-1;
3077 if Visible then memScript.SetFocus;
3078 FScriptModified := false;
3079 memScriptChange(self);
3082 procedure TfrmSender.AppendTextLog(const FileName, Line: String);
3086 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3088 ForceDirectories(ExtractFileDir(FileName));
3089 AssignFile(F, FileName);
3090 if FileExists(FileName) then
3099 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3103 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3108 Impl: TDomImplementation;
3109 Parser: TXmlToDomParser;
3112 try // Long try block to handle all kinds of exception in this method
3113 if not FileExists(FileName) then
3115 // Create empty XML log file
3116 Impl := TDomImplementation.create(nil);
3118 ForceDirectories(ExtractFileDir(FileName));
3119 Parser := TXmlToDomParser.create(nil);
3120 Parser.DOMImpl := Impl;
3123 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3126 documentElement.setAttribute('saved',
3127 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3128 documentElement.setAttribute('generator', VersionString);
3129 documentElement.setAttribute('version', '1.0');
3131 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3132 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3134 DOM.writeCodeAsShiftJIS(F);
3139 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3142 Parser.DOMImpl.freeDocument(DOM);
3149 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3155 F.Seek(P, soFromEnd);
3157 if Buf = '</bottlelog>' then
3162 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3165 F.Seek(P, soFromEnd);
3166 Buf := Format('<message mid="%s">', [Args['MID']]);
3167 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3168 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3169 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3170 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3171 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3172 Buf := Buf + '</message>';
3173 Buf := Buf + '</bottlelog>';
3174 F.Write(Buf[1], Length(Buf));
3181 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3185 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3190 SelText := memScript.SelText;
3191 if SelText <> '' then
3193 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3196 memScriptChange(Self);
3200 function TfrmSender.ReplaceSurface(Script: String;
3201 Params: TCollection): String;
3203 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3204 OldStr, Tag: String;
3205 i, j, k, Cur: integer;
3206 Item: TSurfaceReplaceItem;
3207 Before: TSurfaceReplaceBeforeItem;
3213 OldStr := InputString;
3214 OldLeaveEscape := LeaveEscape;
3215 OldEscapeInvalidMeta := EscapeInvalidMeta;
3216 LeaveEscape := true;
3217 EscapeInvalidMeta := false;
3218 InputString := Script;
3220 for i := 0 to SsParser.Count-1 do
3222 if SsParser.MarkUpType[i] <> mtTag then
3224 Result := Result + SsParser.Str[i];
3227 Tag := SsParser.Str[i];
3228 if SsParser.Match(Tag, '\s%d') = 2 then
3229 Cur := Ord(Tag[3]) - Ord('0')
3230 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3231 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3234 Result := Result + Tag;
3238 for j := 0 to Params.Count-1 do
3240 Item := Params.Items[j] as TSurfaceReplaceItem;
3241 for k := 0 to Item.Before.Count-1 do
3243 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3244 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3247 Result := Result + Format('\s[%d]', [Item.After]);
3255 Result := Result + Tag;
3259 LeaveEscape := OldLeaveEscape;
3260 EscapeInvalidMeta := OldEscapeInvalidMeta;
3261 InputString := OldStr;
3265 procedure TfrmSender.WMQueryEndSession(var msg: TWMQueryEndSession);
3267 // Windows
\82ª
\8fI
\97¹
\82µ
\82æ
\82¤
\82Æ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82ð
\8a´
\92m
\82·
\82é
3268 FEndSession := true;
3272 procedure TfrmSender.IdSLPP20ConnectFailed(Sender: TObject);
3275 if FBeginConnectFailCount = 0 then
3278 if Pref.UseHttpProxy then
3279 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 +
3280 '
\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 +
3281 '
\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')
3283 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3284 '
\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 +
3285 '
\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');
3287 ShowHintLabel('SSTP Bottle Server
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
3288 Inc(FBeginConnectFailCount);
3291 procedure TfrmSender.BuildReplaceMenu(Root: TMenuItem);
3294 Presets: TReplacePresetCollection;
3298 Presets := Pref.ReplacePresets.Presets;
3299 for i := 0 to Presets.Count-1 do
3301 NewItem := TMenuItem.Create(Root);
3304 Caption := Presets[i].Title;
3305 ShortCut := Presets[i].ShortCut;
3306 AutoHotkeys := maManual;
3307 Hint := Presets[i].Pairs.StringExpression;
3309 OnClick := mnPresetReplaceClick;
3313 Root.Enabled := Presets.Count > 0;
3316 procedure TfrmSender.mnPresetReplaceClick(Sender: TObject);
3318 Preset: TReplacePreset;
3321 //
\83v
\83\8a\83Z
\83b
\83g
\92u
\8a·
\82ð
\8eÀ
\8ds
3322 Preset := Pref.ReplacePresets.Presets[(Sender as TMenuItem).Tag];
3323 Lines := memScript.Lines.Text;
3324 New := Preset.Pairs.ExecuteReplace(Lines);
3325 if New <> Lines then
3327 memScript.SelectAll;
3328 memScript.SelText := New;
3330 if Preset.ConfirmAfterReplace then