4 \83A
\83v
\83\8a\83P
\81[
\83V
\83\87\83\93\82Ì
\83\81\83C
\83\93\83t
\83H
\81[
\83\80\81B
5 \91\97\90M
\81E
\8eó
\90M
\81E
\83{
\83g
\83\8b\94z
\91\97\8aÖ
\8cW
\82Ì
\82¢
\82ë
\82¢
\82ë
\82È
\8f\88\97\9d\82ð
\8ds
\82¤
\81B
11 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
12 Menus, StdCtrls, ComCtrls, BRegExp, BottleDef, BottleSstp,
13 DirectSstp, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
14 IdSLPP20, SsParser, ImgList, AppEvnts, TaskTray, StdActns,
15 ActnList, MPlayer, MenuBar, ToolWin,
16 IniFiles, ExtCtrls, ShellAPI, Contnrs,
17 ConstEditor, Buttons, Clipbrd, HeadValue, Logs, MultipleChoiceEditor,
18 IdException, HttpThread, IdHTTP, LogDownload,
19 ScriptConsts, DateUtils, BottleChainRule, BottleChainEvent,
20 SakuraSeekerInstance, HEditor, HTSearch, heClasses, heFountain,
21 SakuraScriptFountain, SppList, SurfacePreview, XDOM_2_3_J3, SsPlayTime,
22 RegexUtils, StrReplace, StrReplaceDialog;
25 TSurfacePreviewType = (spHint, spEditor);
27 TfrmSender = class(TForm)
31 mnRegister: TMenuItem;
34 StatusBar: TStatusBar;
37 mnEditConst: TMenuItem;
38 ActionList: TActionList;
40 mnPopPaste: TMenuItem;
43 mnPopSelectAll: TMenuItem;
45 mnPopConst: TMenuItem;
50 mnSelectAll: TMenuItem;
52 ApplicationEvents: TApplicationEvents;
53 mnPopUpTaskTray: TPopupMenu;
54 mnTaskStart: TMenuItem;
56 mnTaskRestore: TMenuItem;
57 mnTaskNewMessage: TMenuItem;
61 mnTaskExit: TMenuItem;
69 mnPopupConst: TPopupMenu;
70 actEditConst: TAction;
72 mnShowToolBar: TMenuItem;
73 mnShowConstBar: TMenuItem;
74 ConstBarMenu: TMainMenu;
76 tbtnClear: TToolButton;
77 tbtnConfirm: TToolButton;
78 tbtnSend: TToolButton;
79 tbtnSeparator: TToolButton;
80 tbtnStart: TToolButton;
81 tbtnSeparator2: TToolButton;
82 tbtnInsertConst: TToolButton;
83 ConstMenuBar: TMenuBar;
88 actCopyAllNoReturn: TAction;
89 mnCopyAllNoReturn: TMenuItem;
90 mnPopCopyAll: TMenuItem;
91 mnPopCopyAllNoReturn: TMenuItem;
93 tbtnSetting: TToolButton;
94 mnStayOnTop: TMenuItem;
96 actExitClient: TAction;
98 tbtnEditConst: TToolButton;
99 actClearBottles: TAction;
100 mnClearBottles: TMenuItem;
101 MediaPlayer: TMediaPlayer;
102 mnGetNewId: TMenuItem;
103 actNextChannel: TAction;
104 actPrevChannel: TAction;
106 mnNextChannel: TMenuItem;
107 mnPrevChannel: TMenuItem;
110 tbtnShowLog: TToolButton;
111 tbtnSleep: TToolButton;
115 mnTaskSleep: TMenuItem;
117 tabChannel: TTabControl;
120 cbxTargetGhost: TComboBox;
121 actVoteMessage: TAction;
122 mnPopUpChannelTab: TPopupMenu;
123 mnLeaveThisChannel: TMenuItem;
125 mnGotoVote: TMenuItem;
126 mnGoToHelp: TMenuItem;
130 mnExitAllChannels: TMenuItem;
131 actAgreeMessage: TAction;
134 actPrevGhost: TAction;
135 actNextGhost: TAction;
136 mnPrevGhost: TMenuItem;
137 mnNextGhost: TMenuItem;
138 actResetGhost: TAction;
139 mnResetGhost: TMenuItem;
140 timDisconnectCheckTimer: TTimer;
141 DirectSstp: TDirectSstp;
142 actDownloadLog: TAction;
143 actFMOExplorer: TAction;
144 tbtnFMOExplorer: TToolButton;
145 mnFMOExplorer: TMenuItem;
147 actInsertCue: TAction;
148 SakuraScriptFountain: TSakuraScriptFountain;
153 actSelectAll: TAction;
154 actRecallScriptBuffer: TAction;
156 mnRecallScriptBuffer: TMenuItem;
157 tbtnEditorPreview: TToolButton;
158 actEditorPreview: TAction;
159 mnEditorPreview: TMenuItem;
160 actResetPlugins: TAction;
162 mnResetPlugins: TMenuItem;
165 mnReplace: TMenuItem;
166 actSendToEditor: TAction;
167 actSendToLogWindow: TAction;
168 mnSendLogWindow: TMenuItem;
169 actDeleteLogItem: TAction;
171 actEditCopy: TEditCopy;
172 tbtnSendToLogWindow: TToolButton;
173 SsPlayTime: TSsPlayTime;
179 procedure actConfirmExecute(Sender: TObject);
180 procedure FormCreate(Sender: TObject);
181 procedure FormDestroy(Sender: TObject);
182 procedure actSendExecute(Sender: TObject);
183 procedure HTTPSuccess(Sender: TObject);
184 procedure HTTPFailure(Sender: TObject);
185 procedure actStartClick(Sender: TObject);
186 procedure actStopExecute(Sender: TObject);
187 procedure FormShow(Sender: TObject);
188 procedure actAboutClick(Sender: TObject);
189 procedure actExitClientExecute(Sender: TObject);
190 procedure actClearExecute(Sender: TObject);
191 procedure memScriptChange(Sender: TObject);
192 procedure mnStayOnTopClick(Sender: TObject);
193 procedure actEditConstExecute(Sender: TObject);
194 procedure mnTaskBarClick(Sender: TObject);
195 procedure FormClose(Sender: TObject; var Action: TCloseAction);
196 procedure ApplicationEventsMinimize(Sender: TObject);
197 procedure ApplicationEventsRestore(Sender: TObject);
198 procedure mnTaskRestoreClick(Sender: TObject);
199 procedure TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
200 procedure FormActivate(Sender: TObject);
201 procedure mnTaskNewMessageClick(Sender: TObject);
202 procedure ApplicationEventsHint(Sender: TObject);
203 procedure memScriptKeyDown(Sender: TObject; var Key: Word;
205 procedure mnShowToolBarClick(Sender: TObject);
206 procedure mnShowConstBarClick(Sender: TObject);
207 procedure mnGoToHPClick(Sender: TObject);
208 procedure LabelTimerTimer(Sender: TObject);
209 procedure actCopyAllExecute(Sender: TObject);
210 procedure actCopyAllNoReturnExecute(Sender: TObject);
211 procedure Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
212 const Param: String);
213 procedure actSettingExecute(Sender: TObject);
214 procedure memScriptKeyPress(Sender: TObject; var Key: Char);
215 procedure Slpp20Disconnect(Sender: TObject);
216 procedure actClearBottlesExecute(Sender: TObject);
217 procedure SakuraSeekerDetectResultChanged(Sender: TObject);
218 procedure mnGetNewIdClick(Sender: TObject);
219 procedure tabChannelChange(Sender: TObject);
220 procedure actPrevChannelExecute(Sender: TObject);
221 procedure actNextChannelExecute(Sender: TObject);
222 procedure cbxTargetGhostDropDown(Sender: TObject);
223 procedure actShowLogExecute(Sender: TObject);
224 procedure actSleepExecute(Sender: TObject);
225 procedure actVoteMessageExecute(Sender: TObject);
226 procedure tabChannelContextPopup(Sender: TObject; MousePos: TPoint;
227 var Handled: Boolean);
228 procedure mnLeaveThisChannelClick(Sender: TObject);
229 procedure mnGotoVoteClick(Sender: TObject);
230 procedure tabChannelMouseMove(Sender: TObject; Shift: TShiftState; X,
232 procedure mnGoToHelpClick(Sender: TObject);
233 procedure tabChannelMouseDown(Sender: TObject; Button: TMouseButton;
234 Shift: TShiftState; X, Y: Integer);
235 procedure tabChannelDragOver(Sender, Source: TObject; X, Y: Integer;
236 State: TDragState; var Accept: Boolean);
237 procedure tabChannelDragDrop(Sender, Source: TObject; X, Y: Integer);
238 procedure tabChannelEndDrag(Sender, Target: TObject; X, Y: Integer);
239 procedure cbxTargetGhostDrawItem(Control: TWinControl; Index: Integer;
240 Rect: TRect; State: TOwnerDrawState);
241 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
242 procedure actAgreeMessageExecute(Sender: TObject);
243 procedure actPrevGhostExecute(Sender: TObject);
244 procedure actNextGhostExecute(Sender: TObject);
245 procedure actResetGhostExecute(Sender: TObject);
246 procedure timDisconnectCheckTimerTimer(Sender: TObject);
247 procedure actDownloadLogExecute(Sender: TObject);
248 procedure cbxTargetGhostChange(Sender: TObject);
249 procedure actFMOExplorerExecute(Sender: TObject);
250 procedure actInsertCueExecute(Sender: TObject);
251 procedure FormResize(Sender: TObject);
252 procedure actCopyExecute(Sender: TObject);
253 procedure actPasteExecute(Sender: TObject);
254 procedure actCutExecute(Sender: TObject);
255 procedure actSelectAllExecute(Sender: TObject);
256 procedure memScriptMouseMove(Sender: TObject; Shift: TShiftState; X,
258 procedure actRecallScriptBufferExecute(Sender: TObject);
259 procedure actEditorPreviewExecute(Sender: TObject);
260 procedure actResetPluginsExecute(Sender: TObject);
261 procedure IdSLPP20Connect(Sender: TObject);
262 procedure actReplaceExecute(Sender: TObject);
263 procedure actSendToEditorExecute(Sender: TObject);
264 procedure actSendToLogWindowExecute(Sender: TObject);
265 procedure memScriptDragOver(Sender, Source: TObject; X, Y: Integer;
266 State: TDragState; var Accept: Boolean);
267 procedure memScriptDragDrop(Sender, Source: TObject; X, Y: Integer);
268 procedure actDeleteLogItemExecute(Sender: TObject);
269 procedure memScriptSelectionChange(Sender: TObject; Selected: Boolean);
270 procedure actUndoExecute(Sender: TObject);
271 procedure actRedoExecute(Sender: TObject);
273 FSleeping: boolean; //
\94z
\91\97\83X
\83\8a\81[
\83v
\92\86\82©
\82Ç
\82¤
\82©
275 FConnecting: boolean;
277 FBooted: boolean; //
\8f\89\89ñ
\8bN
\93®
\92Ê
\90M
\97p
278 FOriginalCaption: String;
279 FAutoAddAfterGetChannel: boolean; //
\83`
\83\83\83\93\83l
\83\8b\8eæ
\93¾
\8cã
\82É
\83_
\83C
\83A
\83\8d\83O
\82È
\82µ
\82É
280 //
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82·
\82é
\82©
\82Ç
\82¤
\82©
284 FMutex: THandle; //Mutex
\83I
\83u
\83W
\83F
\83N
\83g
\81c
\93ñ
\8fd
\8bN
\93®
\96h
\8e~
\97p
286 FNowChannel: String; //
\8c»
\8dÝ
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b
287 JoinChannelsBackup: TStringList; //
\88ê
\8e\9e\8eg
\97p
289 FScriptModified: boolean; //
\83X
\83N
\83\8a\83v
\83g
\82ª
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\81B
290 //
\83\8d\81[
\83J
\83\8b\8am
\94F
\8b
\90§
\97p
\83t
\83\89\83O
\81BTRichEdit.Modified
\82Í
291 //
\95Ê
\82Ì
\97p
\93r
\82Å
\8eg
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8eg
\82¦
\82È
\82¢
293 FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
294 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)
296 FBottleSstp: TBottleSstp; //
\8dÄ
\91\97\83v
\83\8d\83O
\83\89\83\80
298 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Ý)
299 FBeginConnectFailCount: integer; //
\89½
\93x
\82à
\90Ú
\91±
\8e¸
\94s
\82µ
\82½
\82ç
\83\8a\83g
\83\89\83C
\92\86\8e~
301 FVisiblePreviewGhost: String;
302 FVisiblePreviewSurface: integer; //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82Å
\8c©
\82¦
\82Ä
\82¢
\82é
\82à
\82Ì
303 FVisibleMenuItem: TMenuItem; //
\83N
\83\8a\83b
\83N
\82³
\82ê
\82½
\83\81\83j
\83\85\81[
\83A
\83C
\83e
\83\80\81B
304 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82ª
\83\81\83j
\83\85\81[
\82Ì
\89º
\82É
305 //
\89B
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\8bL
\89¯
\82µ
\82Ä
\82¨
\82
307 FTargetGhostExpand: boolean; //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ª
\81A
308 //
\88ê
\8e\9e\93I
\82É
\91S
\95\94\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\82Ì
\83t
\83\89\83O
310 FScriptBuffer: TObjectList; //
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
312 FWM_TaskBarCreated: WORD; //
\83^
\83X
\83N
\83o
\81[
\93o
\98^
\97p
\83E
\83B
\83\93\83h
\83E
\83\81\83b
\83Z
\81[
\83WID
314 procedure SetStatusText(const Value: String);
315 procedure SetSleeping(const Value: boolean);
317 procedure SetConnecting(const Value: boolean);
318 procedure SetAdded(const Value: boolean);
319 procedure mnConstClick(Sender: TObject);
320 procedure mnConstGroupClick(Sender: TObject);
321 property Added: boolean read FAdded write SetAdded;
322 property Sleeping: boolean read FSleeping write SetSleeping;
323 property StatusText: String read FStatusText write SetStatusText;
324 function GetScriptText: String;
325 procedure ChangeTaskIcon;
326 procedure ShowHintLabel(const Mes: String; Col: TColor = clBlue);
327 procedure UpdateLayout;
328 procedure DispatchBottle(EventType: TIdSlppEventType; Dat: THeadValue);
329 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
330 procedure UpdateChannelInfo(Dat: THeadValue);
331 procedure UpdateJoinChannelList(Dat: THeadValue);
332 procedure NoLuidError;
333 procedure UpdateIfGhostBox;
334 function BuildMenuConditionCheck(const IfGhost, Ghost: String): boolean;
335 procedure BuildMenu(Root: TMenuItem; Simple: boolean);
336 procedure PlaySound(const FileName: String);
337 //TBottleSstp
\8aÖ
\8cW
\83C
\83x
\83\93\83g
\83n
\83\93\83h
\83\89
338 procedure BottleSstpResendCountChange(Sender: TObject);
339 procedure BottleSstpResendTrying(Sender: TObject; MID: String);
340 procedure BottleSstpResendEnd(Sender: TObject; MID: String);
341 function IsSurfaceTag(const Script: String; var ID: integer): boolean;
342 procedure DoSurfacePreview(Surface: integer; const Kind:
343 TSurfacePreviewType);
344 function GetSurfacePreviewPositionHint(w, h: integer): TPoint;
345 function GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
346 procedure EditorPreview;
347 //
\83^
\83O
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\95Ï
\8a·
\82·
\82é
348 function TagReplace(Script: String;
349 Before, After: array of String): String; overload;
350 function TagReplace(Script: String;
351 Before, After: TStrings): String; overload;
352 //
\83T
\81[
\83t
\83B
\83X
\82ð
\95Ï
\8a·
\82·
\82é
353 function ReplaceSurface(Script: String; Params: TCollection): String;
354 procedure ClearEditor;
355 procedure CopyFromLogToEditor(Log: TLogItem);
357 procedure AppendTextLog(const FileName, Line: String);
358 procedure AppendXMLLog(const FileName: String; Args: THeadValue);
360 procedure WndProc(var Message: TMessage); override;
362 function DoTrans(var Script: String;
363 Options: TScriptTransOptions): String; overload;
364 function DoTrans(var Script: String;
365 Options: TScriptTransOptions; out FoundURL: boolean): String; overload;
366 function ScriptTransForSSTP(const Script: String;
367 out Error: String): String; overload;
368 procedure BeginConnect;
369 procedure RetryBeginConnect;
370 procedure EndConnect;
371 procedure ConstructMenu(Simple: boolean);
372 property Connecting: boolean read FConnecting write SetConnecting;
373 property BottleSstp: TBottleSstp read FBottleSstp;
374 function GhostNameToSetName(const Ghost: String): String;
375 procedure PostCommand(const Command: array of String); overload;
376 procedure PostCommand(Command: TStrings); overload;
377 procedure PostSetChannel(Channels: TStrings);
378 procedure SaveChainRuleList;
383 frmSender: TfrmSender;
386 PanelConnecting = 0; //
\81u
\90Ú
\91±
\92\86\81v
\95\
\8e¦
\97p
387 PanelBytes = 1; //
\81\9b\81\9b\83o
\83C
\83g
388 PanelCount = 2; //Local Proxy
\81A
\8c»
\8dÝ
\81\9b\8c\8f\91Ò
\82¿
389 PanelMembers = 3; //
\81\9b\81\9b\90l
390 PanelStatus = 4; //SSTP Bottle
\83T
\81[
\83o
\82É
\93o
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81c
\82È
\82Ç
393 IconDisconnected = 18;
395 IconSleepDisconnected = 20;
397 WarningColor = clRed;
399 SendButtonLongHint = 'Bottle
\82Ì
\91\97\90M';
401 function Token(const Str: String; const Delimiter: char;
402 const Index: integer): String;
404 function StringReplaceEx(const Before: String; List: THeadValue): String;
408 uses SendConfirm, SettingForm, ChannelListForm, LogForm,
409 MessageBox, FMOExplorer, EditorTalkShow;
413 //
\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
414 function Token(const Str: String; const Delimiter: char;
415 const Index: integer): String;
416 var i, c, len: integer;
422 while i <= len do begin
423 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
425 if c > Index then Break;
426 end else if c = Index then Result := Result + Str[i];
431 //
\95¶
\8e\9a\97ñ
\82ð
\92u
\82«
\8a·
\82¦
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
432 function StringReplaceEx(const Before: String; List: THeadValue): String;
434 i, MinPos, MinKey, p: integer;
443 for i := 0 to List.Count-1 do
445 p := Pos(List.KeyAt[i], Work);
446 if (p > 0) and ((p < MinPos) or (MinPos < 0)) then
454 Result := Result + Work;
458 Result := Result + Copy(Work, 1, MinPos-1) + List.ValueAt[MinKey];
459 Delete(Work, 1, (MinPos - 1) + Length(List.KeyAt[MinKey]));
466 procedure TfrmSender.actConfirmExecute(Sender: TObject);
468 AScript, Err, AGhost: String;
472 // Partial Confirmation
473 if memScript.SelText <> '' then
476 if not Pref.AutoPartialConfirm then
477 if not MultipleChoiceEdit('
\8am
\94F', ['
\91I
\91ð
\95\94\95ª
\82Ì
\82Ý', '
\83X
\83N
\83\8a\83v
\83g
\91S
\91Ì'], Choice) then
481 AScript := memScript.SelText;
482 AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
484 AScript := GetScriptText;
486 AScript := GetScriptText;
487 AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
489 if Length(AScript) = 0 then Exit;
491 AScript := ScriptTransForSSTP(AScript, Err);
498 if cbxTargetGhost.ItemIndex > 0 then
499 AGhost := cbxTargetGhost.Text
500 else if FNowChannel <> '' then
501 AGhost := ChannelList.Channel[FNowChannel].Ghost
505 if Pref.IgnoreTimeCritical then
506 AScript := TagReplace(AScript, ['\t'], ['']);
508 Item := TLogItem.Create;
514 Channel := '
\81y
\8am
\94F
\81z';
517 BottleSstp.Unshift(Item);
522 FScriptModified := false;
525 procedure TfrmSender.FormCreate(Sender: TObject);
526 var Str: TStringList;
528 FScriptBuffer := TObjectList.Create(true);
530 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
531 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
532 ScriptConstList.LoadFromDir(FConstDir);
533 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
534 Spps.LoadFromDirectory(FSppDir);
535 ConstructMenu(false);
537 Str := TStringList.Create;
540 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
541 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
544 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
545 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
547 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');
548 Application.Terminate;
549 Application.ProcessMessages;
557 FOriginalCaption := Self.Caption;
560 ShowMessage('
\93ñ
\8fd
\8bN
\93®
\8b\96\89Â
\83o
\81[
\83W
\83\87\83\93\82Å
\82·
\81B'#13#10 + VersionString);
562 FMutex := CreateMutex(nil, true, 'SSTPBottleClient2');
563 if GetLastError = ERROR_ALREADY_EXISTS then begin
565 ShowMessage('SSTP Bottle Client
\82Í
\93ñ
\8fd
\8bN
\93®
\82Å
\82«
\82Ü
\82¹
\82ñ');
567 Application.Terminate;
568 Application.ProcessMessages; //WM_QUIT
\82ð
\97¬
\82·
574 mnShowToolBar.Checked := Pref.ShowToolBar;
575 mnShowConstBar.Checked := Pref.ShowConstBar;
576 if Pref.StayOnTop then begin
577 FormStyle := fsStayOnTop;
578 mnStayOnTop.Checked := true;
580 FormStyle := fsNormal;
581 mnStayOnTop.Checked := false;
584 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
585 mnGoToHP.Hint := Pref.HomePage;
586 mnGotoVote.Hint := Pref.VotePage;
587 mnGotoHelp.Hint := Pref.HelpPage;
589 mnGetNewId.Enabled := (Pref.LUID = '');
591 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
593 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
594 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
596 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
597 Application.Terminate;
600 //
\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è
601 SsPlayTime.PlayTimeParams := Pref.PlayTimeParams;
603 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
604 with Pref.SenderWindowPosition do begin
607 Self.Width := Right - Left + 1;
608 Self.Height := Bottom - Top + 1;
611 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
612 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
614 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
615 actClearExecute(Sender);
616 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
618 //
\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»)
619 UpdateJoinChannelList(nil);
621 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
622 FBottleSstp := TBottleSstp.Create(false);
623 with FBottleSstp do begin
624 OnResendCountChange := BottleSstpResendCountChange;
625 OnResendTrying := BottleSstpResendTrying;
626 OnResendEnd := BottleSstpResendEnd;
630 procedure TfrmSender.FormDestroy(Sender: TObject);
632 if FScriptBuffer <> nil then
635 if FBottleSstp <> nil then begin
636 FBottleSstp.Terminate;
640 with Pref.SenderWindowPosition do begin
643 Right := Self.Left + Self.Width - 1;
644 Bottom := Self.Top + Self.Height - 1;
647 if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
649 ScriptConstList.Save;
652 BottleChainRuleList.Free;
655 ReleaseMutex(FMutex);
660 procedure TfrmSender.SetConnecting(const Value: boolean);
662 FConnecting := Value;
664 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
665 actStart.Enabled := false;
666 actStop.Enabled := false;
667 actSend.Enabled := false;
668 actVoteMessage.Enabled := false;
669 actAgreeMessage.Enabled := false;
670 mnGetNewId.Enabled := false;
671 Screen.Cursor := crAppStart;
673 StatusBar.Panels[PanelConnecting].Text := '';
674 actStart.Enabled := true;
675 actStop.Enabled := true;
676 actSend.Enabled := true;
677 frmLog.lvwLogChange(Self, nil, ctState);
678 mnGetNewId.Enabled := Pref.LUID = '';
679 Screen.Cursor := crDefault;
683 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
684 procedure TfrmSender.actSendExecute(Sender: TObject);
685 var Talk, Ghost: String;
686 Command: TStringList;
690 if Length(GetScriptText) = 0 then begin
691 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
695 if Pref.LUID = '' then begin
699 if tabChannel.TabIndex < 0 then begin
700 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
701 '
\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');
704 if ChannelList.Channel[FNowChannel].NoPost then begin
706 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
711 Talk := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
712 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
713 if Err <> '' then begin
714 MessageDlg(Err, mtWarning, [mbOk], 0);
718 if Pref.NeedConfirmBeforeSend and FScriptModified then
720 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
724 if not Pref.NoConfirm then begin
725 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
729 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text;
730 Command := TStringList.Create;
732 with Command do begin
733 Add('Command: sendBroadcast');
734 Add('Channel: ' + FNowChannel);
735 Add('LUID: ' + Pref.LUID);
736 Add('Agent: ' + VersionString);
737 if Ghost <> '' then Add('Ghost: ' + Ghost);
738 Add('Talk: ' + Talk);
740 PostCommand(Command);
745 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
746 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
747 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
751 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
756 procedure TfrmSender.BeginConnect;
758 if Pref.LUID = '' then begin
762 IdSlpp20.LUID := Pref.LUID;
763 self.Cursor := crHourGlass;
765 if IdSlpp20.Connected then IdSlpp20.Disconnect;
766 if Pref.UseHttpProxy then begin
767 IdSlpp20.Host := Pref.ProxyAddress;
768 IdSlpp20.Port := Pref.ProxyPort;
769 IdSlpp20.ProxyMode := true;
771 IdSlpp20.Host := Pref.BottleServer;
772 IdSlpp20.Port := Pref.BottleServerPort;
773 IdSlpp20.ProxyMode := false;
777 on EIdException do begin
779 if FBeginConnectFailCount = 0 then begin
780 Inc(FBeginConnectFailCount);
782 if Pref.UseHttpProxy then
783 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 +
784 '
\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 +
785 '
\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')
787 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
788 '
\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 +
789 '
\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');
791 Inc(FBeginConnectFailCount);
794 self.Cursor := crDefault;
797 procedure TfrmSender.EndConnect;
799 IdSlpp20.OnDisconnect := nil;
803 procedure TfrmSender.SetAdded(const Value: boolean);
805 if FAdded = Value then Exit;
808 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
811 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
813 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
817 procedure TfrmSender.HTTPSuccess(Sender: TObject);
818 var Str, ResStr, Command: String;
819 HeadValue: THeadValue;
821 SetChannel: TStringList;
824 Str := (Sender as THttpDownloadThread).RecvString;
828 HeadValue := THeadValue.Create(Str);
830 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89ð
\90Í
\82Å
\82«
\82È
\82¢
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
833 Command := HeadValue['Command'];
834 ResStr := HeadValue['Result'];
835 if ResStr = 'Err' then begin
836 if HeadValue['ExtraMessage'] <> '' then begin
838 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
839 HeadValue['ExtraMessage']);
842 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
845 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
846 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
847 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
848 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
849 if Pref.ResetIfGhostAfterSend then begin
850 actResetGhostExecute(Self);
852 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
853 if Pref.ClearAfterSend then begin
856 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
857 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
859 if (Command = 'getNewId') then begin
860 if ResStr = 'OK' then begin
861 Pref.LUID := HeadValue['NewID'];
862 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
863 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
864 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
865 'LUID: ' + Pref.LUID + #13#10 +
866 '
\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' +
867 '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' +
868 '
\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');
869 mnGetNewId.Enabled := false;
872 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
875 if (Command = 'voteMessage') then begin
876 if ResStr = 'OK' then begin
877 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
880 if (Command = 'getChannels') and (ResStr = 'OK') then begin
881 UpdateChannelInfo(HeadValue);
884 if FAutoAddAfterGetChannel then begin
885 SetChannel := TStringList.Create;
886 if JoinChannelsBackup <> nil then begin
887 //
\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
888 SetChannel.Assign(JoinChannelsBackup);
890 //
\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¾
891 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
892 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
893 SetChannel.Add(Pref.AutoJoinChannels[i]);
897 Application.CreateForm(TfrmChannelList, frmChannelList);
899 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
900 SetChannel := TStringList.Create;
901 SetChannel.Assign(frmChannelList.JoinList);
904 frmChannelList.Release;
907 if SetChannel <> nil then PostSetChannel(SetChannel);
909 if SetChannel <> nil then FreeAndNil(SetChannel);
912 if (Command = 'setChannels') then begin
913 if ResStr <> 'OK' then begin
915 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¢');
916 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
919 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
925 procedure TfrmSender.actStartClick(Sender: TObject);
927 if Pref.LUID = '' then begin
931 if not IdSlpp20.Connected then begin
932 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
936 FAutoAddAfterGetChannel := false;
937 PostCommand(['Command: getChannels']);
941 procedure TfrmSender.actStopExecute(Sender: TObject);
943 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
944 IdSlpp20.OnDisconnect := nil;
945 if IdSlpp20.Connected then IdSlpp20.Disconnect;
946 FAutoAddAfterGetChannel := true;
948 IdSlpp20.OnDisconnect := Slpp20Disconnect;
951 procedure TfrmSender.FormShow(Sender: TObject);
953 if FBooted or Application.Terminated then Exit;
954 //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
955 if Pref.LUID <> '' then BeginConnect
956 else mnGetNewIdClick(Self);
957 FAutoAddAfterGetChannel := Pref.AutoStart;
960 frmSurfacePreview.Show;
962 SakuraSeeker.BeginDetect;
963 SakuraSeekerDetectResultChanged(self);
964 if SakuraSeeker.Count = 0 then
965 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 +
966 '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 +
967 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
970 procedure TfrmSender.actAboutClick(Sender: TObject);
973 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
974 Str := Str + Format('Compiler Version: %f', [CompilerVersion]);
975 frmMessageBox.ShowMessage(Str);
978 procedure TfrmSender.actExitClientExecute(Sender: TObject);
983 procedure TfrmSender.actClearExecute(Sender: TObject);
985 Script, Default: String;
987 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
988 Default := StringReplace(Pref.DefaultScript, '|', '', [rfReplaceAll]);
989 Default := StringReplace(Default, #13#10, '', [rfReplaceAll]);
991 if (Pref.AutoClip) and (Length(GetScriptText) > 0) and (Script <> Default) then
992 actSendToLogWindow.Execute
997 procedure TfrmSender.memScriptChange(Sender: TObject);
1002 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
1003 Text := Format('%d
\83o
\83C
\83g/%d
\95b', [Length(Script), SsPlayTime.PlayTime(Script) div 1000]);
1004 StatusBar.Panels[PanelBytes].Text := Text;
1005 FScriptModified := true;
1009 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
1011 Pref.StayOnTop := not Pref.StayOnTop;
1012 mnStayOnTop.Checked := Pref.StayOnTop;
1013 if Pref.StayOnTop then begin
1014 FormStyle := fsStayOnTop;
1016 FormStyle := fsNormal;
1021 function TfrmSender.GetScriptText: String;
1023 Result := memScript.Lines.Text;
1026 procedure TfrmSender.mnConstClick(Sender: TObject);
1029 i := (Sender as TMenuItem).Tag;
1030 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
1033 procedure TfrmSender.actEditConstExecute(Sender: TObject);
1035 ScriptConstList.LoadFromDir(FConstDir);
1037 Application.CreateForm(TfrmConstEditor, frmConstEditor);
1038 frmConstEditor.Execute;
1039 ScriptConstList.Save;
1041 frmConstEditor.Release;
1043 ConstructMenu(false);
1046 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
1048 Application.Minimize;
1049 WindowState := wsNormal;
1052 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
1055 TaskTray.Registered := false;
1058 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
1061 Application.ShowMainForm := false;
1062 ShowWindow(Application.Handle, SW_HIDE);
1065 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
1067 Application.ShowMainForm := true;
1071 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1073 Application.Restore;
1076 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1078 Application.Restore;
1081 procedure TfrmSender.FormActivate(Sender: TObject);
1086 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1088 Application.Restore;
1089 actClearExecute(Sender);
1092 procedure TfrmSender.ChangeTaskIcon;
1097 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1099 if Sleeping then IcoNum := IconSleepDisconnected
1100 else IcoNum := IconDisconnected;
1103 Ico := TIcon.Create;
1105 imgIcon.GetIcon(IcoNum, Ico);
1106 TaskTray.Icon := Ico;
1107 TaskTray.Registered := true;
1112 ; // 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
1113 //
\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
1114 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1118 procedure TfrmSender.SetStatusText(const Value: String);
1120 FStatusText := Value;
1121 StatusBar.Panels[PanelStatus].Text := Value;
1124 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1127 if Length(Application.Hint) > 0 then
1129 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1130 Application.HintColor := clInfoBk;
1131 if (Application.Hint = SendButtonLongHint)
1132 and (FNowChannel <> '') then
1134 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1135 Application.HintColor := clYellow;
1136 Application.ActivateHint(Mouse.CursorPos);
1138 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1140 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1141 DoSurfacePreview(id, spHint);
1145 StatusBar.Panels[PanelStatus].Text := FStatusText;
1146 frmSurfacePreview.HideAway;
1150 procedure TfrmSender.ConstructMenu(Simple: boolean);
1152 BuildMenu(mnPopConst, Simple);
1153 BuildMenu(mnPopUpConst.Items, Simple);
1154 BuildMenu(ConstBarMenu.Items, Simple);
1155 //ConstMenuBar.Menu := nil;
1156 ConstMenuBar.AutoSize := false;
1157 ConstMenuBar.Width := 1000;
1158 ConstMenuBar.Menu := ConstBarMenu;
1159 ConstMenuBar.AutoSize := true;
1162 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1163 Shift: TShiftState);
1165 Func: TReturnKeyFunction;
1167 if (Key = VK_RETURN) then begin
1168 if (ssShift in Shift) then
1169 Func := Pref.WhenShiftReturn
1170 else if (ssCtrl in Shift) then
1171 Func := Pref.WhenCtrlReturn
1173 Func := Pref.WhenReturn;
1176 with tbtnInsertConst do
1177 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1178 mnPopUpConst.Popup(Pos.X, Pos.Y);
1181 memScript.SelText := '\n';
1185 memScript.SelText := '\n'#13#10;
1188 memScript.SelText := #13#10
1194 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1196 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1197 Pref.ShowToolBar := mnShowToolBar.Checked;
1201 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1203 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1204 Pref.ShowConstBar := mnShowConstBar.Checked;
1208 procedure TfrmSender.UpdateLayout;
1210 with SakuraScriptFountain do begin
1211 TagColor.Color := Pref.MarkUpColor;
1212 TagErrorColor.Color := Pref.MarkErrorColor;
1213 Scope0Color.Color := Pref.TalkColorH;
1214 Scope1Color.Color := Pref.TalkColorU;
1215 SynchronizedColor.Color := Pref.TalkColorS;
1217 memScript.Ruler.Visible := Pref.ShowRuler;
1218 memScript.Ruler.Color := Pref.TextColor;
1219 memScript.Color := Pref.BgColor;
1221 ToolBar.Visible := Pref.ShowToolBar;
1222 ConstMenuBar.Visible := Pref.ShowConstBar;
1225 with tabChannel do begin
1226 TabPosition := Pref.TabPosition;
1227 case Pref.TabPosition of
1228 tpTop: Align := alTop;
1229 tpBottom: Align := alBottom;
1231 TabWidth := Pref.TabWidth;
1235 function TfrmSender.DoTrans(var Script: String;
1236 Options: TScriptTransOptions; out FoundURL: boolean): String;
1237 var UrlCancel, Mark: String;
1238 Url, UrlName: array[0..6] of String;
1239 i, j, u, UrlCount: integer;
1240 LastSurfaceH, LastSurfaceU: integer;
1241 UnyuTalking: boolean;
1242 QuickSection, Synchronize: boolean;
1243 Warnings: TStringList;
1248 UnyuTalking := false;
1249 QuickSection := false;
1250 Synchronize := false;
1251 SsParser.LeaveEscape := true;
1252 SsParser.EscapeInvalidMeta := false;
1253 SsParser.InputString := Script;
1255 Warnings := TStringList.Create;
1257 for i := 0 to SsParser.Count-1 do begin
1258 if SsParser[i] = '\t' then begin
1259 if not(toIgnoreTimeCritical in Options) then
1260 Script := Script + '\t';
1261 end else if SsParser[i] = '\e' then begin
1263 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1264 if toConvertURL in Options then begin
1265 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1266 for u := 7 downto 1 do begin
1267 if (SsParser.Match(SsParser[i],
1268 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1269 '-', '%b', [rfReplaceAll]))) > 0 then begin
1270 for j := 1 to u do begin
1271 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1272 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1273 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1274 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1277 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1278 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1280 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1281 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1282 Url[0] := SsParser.GetParam(SsParser[i], 1);
1283 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1284 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1285 if Pos('http://', Url[0]) > 0 then begin
1287 if not QuickSection then
1288 Script := Script + '\_q' + Url[0] + '\_q'
1290 Script := Script + Url[0];
1293 end else Script := Script + SsParser[i];
1295 Mark := SsParser[i];
1296 if Mark = '\h' then begin
1297 UnyuTalking := false;
1298 if toHUTagTo01Tag in Options then Mark := '\0';
1299 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1300 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');
1301 end else if Mark = '\u' then begin
1302 UnyuTalking := true;
1303 if toHUTagTo01Tag in Options then Mark := '\1';
1304 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1305 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');
1306 end else if Mark = '\_q' then begin
1307 QuickSection := not QuickSection;
1308 end else if Mark = '\_s' then begin
1309 Synchronize := not Synchronize;
1310 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1311 if UnyuTalking then begin
1312 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1315 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1318 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1319 if UnyuTalking then begin
1320 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1322 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1325 Script := Script + Mark;
1328 if UrlCount > 0 then begin
1330 Script := Script + '\h\n';
1331 if not (toNoChoice in Options) then begin
1332 for i := 0 to UrlCount-1 do begin
1333 Script := Script + Format('\q%d[%s][%s]',
1334 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1336 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1337 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1339 Script := Script + '\h';
1340 for i := 0 to UrlCount-1 do begin
1341 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1343 Script := Script + Format('\n{%s}', [UrlCancel]);
1347 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1348 if toWaitScriptEnd in Options then begin
1349 i := Pref.WaitScriptEnd;
1350 while i > 0 do begin
1352 Script := Script + '\w9';
1355 Script := Script + '\w' + IntToStr(i);
1361 Script := Script + '\e';
1362 RegExp.Subst('s/\r\n//gk', Script);
1364 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1365 for i := 0 to SsParser.Count-1 do begin
1366 if SsParser.MarkUpType[i] = mtTagErr then begin
1367 Result := '"' + SsParser[i] + '"'#13#10 +
1368 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1372 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1373 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1377 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1378 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1379 mbOkCancel, 0) = mrCancel then
1380 Result := Warnings.Text;
1387 function TfrmSender.DoTrans(var Script: String;
1388 Options: TScriptTransOptions): String;
1391 Result := DoTrans(Script, Options, dum);
1394 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1396 ShellExecute(Handle, 'open', PChar(Pref.HomePage), nil, nil, SW_SHOW);
1399 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1401 lblMessage.Caption := Mes;
1402 lblMessage.Font.Color := Col;
1403 lblMessage.Visible := true;
1404 LabelTimer.Enabled := false;
1405 LabelTimer.Enabled := true;
1408 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1410 LabelTimer.Enabled := false;
1411 lblmessage.Visible := false;
1414 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1418 Str := memScript.Lines.Text;
1419 Clip := ClipBoard();
1420 Clip.SetTextBuf(PChar(Str));
1423 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1427 Str := memScript.Lines.Text;
1428 RegExp.Subst('s/\r\n//gk', Str);
1429 Clip := ClipBoard();
1430 Clip.SetTextBuf(PChar(Str));
1433 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1434 const Param: String);
1435 var HeadValue: THeadValue;
1437 HeadValue := THeadValue.Create(Param);
1440 etScript, etForceBroadcast, etUnicast: begin
1441 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1442 DispatchBottle(EventType, HeadValue);
1444 etMemberCount: begin
1445 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1447 etChannelCount: begin
1449 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1454 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1456 FBeginConnectFailCount := 0;
1457 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1458 if not Connecting then
1459 PostCommand(['Command: getChannels']);
1460 SakuraSeeker.BeginDetect;
1462 etChannelList: begin
1463 UpdateJoinChannelList(HeadValue);
1464 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1465 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1466 JoinChannelsBackup.Assign(JoinChannels);
1468 etCloseChannel: begin
1469 with JoinChannels do
1470 if IndexOf(HeadValue['Channel']) >= 0 then
1471 Delete(IndexOf(HeadValue['Channel']));
1472 with tabChannel do begin
1473 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1474 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1475 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1476 tabChannelChange(self);
1478 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1480 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1481 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1483 etForceBroadcastInformation: begin
1484 if HeadValue['Type'] = 'Vote' then begin
1485 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1486 end else if HeadValue['Type'] = 'Agree' then begin
1487 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1496 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1498 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1500 TaskTray.TipString := 'SSTP Bottle Client (' +
1501 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1503 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1505 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1508 procedure TfrmSender.actSettingExecute(Sender: TObject);
1510 Application.CreateForm(TfrmSetting, frmSetting);
1522 frmLog.UpdateWindow;
1525 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1527 if (Key = #13) or (Key = #10) then Key := Char(0);
1530 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1533 UpdateJoinChannelList(nil);
1534 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1535 if not Application.Terminated then RetryBeginConnect;
1538 procedure TfrmSender.SetSleeping(const Value: boolean);
1541 FBottleSstp.ResendSleep := Value;
1545 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1548 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]),
1549 mtWarning, mbOkCancel, 0);
1550 if Re = mrOk then begin
1552 frmLog.AllBottleOpened;
1553 frmLog.UpdateWindow;
1557 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1559 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1562 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1564 Ch: TChannelListItem;
1567 for i := 1 to Dat.IntData['Count'] do begin
1568 Ch := TChannelListItem.Create;
1569 Ch.Name := Dat[Format('CH%d_name', [i])];
1570 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1571 Ch.Info := Dat[Format('CH%d_info', [i])];
1572 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1573 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1574 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1575 ChannelList.Add(Ch);
1580 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1582 PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1585 procedure TfrmSender.NoLuidError;
1588 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1589 '
\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+
1590 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1593 procedure TfrmSender.tabChannelChange(Sender: TObject);
1595 if tabChannel.TabIndex >= 0 then begin
1596 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1597 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1602 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1603 ConstructMenu(true);
1606 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1608 with tabChannel do begin
1609 if Tabs.Count = 0 then Exit;
1610 if TabIndex=0 then TabIndex := Tabs.Count-1
1611 else TabIndex := TabIndex-1;
1613 tabChannelChange(Self);
1616 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1618 with tabChannel do begin
1619 if Tabs.Count = 0 then Exit;
1620 if TabIndex=Tabs.Count-1 then TabIndex := 0
1621 else TabIndex := TabIndex+1;
1623 tabChannelChange(Self);
1626 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1630 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1631 if nodat then Dat := THeadValue.Create('');
1633 for i := 0 to Dat.Count-1 do
1634 if Dat.KeyAt[i] = 'Entry' then begin
1635 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1636 JoinChannels.Add(RegExp[1]);
1638 with tabChannel do begin
1643 for i := 0 to JoinChannels.Count-1 do begin
1644 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1645 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1646 Tabs.Add(JoinChannels[i]);
1649 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1650 //
\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)
1652 for i := 0 to Tabs.Count-1 do
1653 if Tabs[i] = FNowChannel then TabIndex := i;
1654 if Tabs.Count > 0 then begin
1655 FNowChannel := Tabs[TabIndex];
1656 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1659 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1661 Visible := Tabs.Count > 0;
1662 if Tabs.Count > 1 then begin
1663 actNextChannel.Enabled := true;
1664 actPrevChannel.Enabled := true;
1666 actNextChannel.Enabled := false;
1667 actPrevChannel.Enabled := false;
1669 OnChange := tabChannelChange;
1671 if nodat then Dat.Free;
1672 if JoinChannels.Count = 0 then begin
1673 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1674 actSend.Enabled := false;
1676 Self.Caption := FOriginalCaption;
1677 actSend.Enabled := true;
1681 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1683 SakuraSeeker.BeginDetect;
1687 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1690 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1693 procedure TfrmSender.actSleepExecute(Sender: TObject);
1695 if actSleep.Checked then begin
1696 actSleep.Checked := false;
1697 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1699 actSleep.Checked := true;
1700 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1702 Sleeping := actSleep.Checked;
1707 procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1709 var Opt: TSstpSendOptions;
1710 Event: TBottleChainBottleEvent;
1711 Script, Sender, Ghost, Channel, ErrorMes: String;
1712 BreakFlag, NoDispatch: boolean;
1713 Sound, LogName: String;
1714 i, j, k, SkipCount: integer;
1715 Rule: TBottleChainRule;
1716 Action: TBottleChainAction;
1717 LogNameList: TStringList;
1719 ReplaceHash: THeadValue;
1722 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1723 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1724 Channel := Dat['Channel'];
1726 etScript: Sender := Channel;
1727 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1728 etUnicast: Sender := Dat['SenderUID'];
1731 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1732 if Dat['IfGhost'] <> '' then begin
1733 Ghost := Dat['IfGhost'];
1735 if ChannelList.Channel[Channel] <> nil then
1736 Ghost := ChannelList.Channel[Channel].Ghost;
1738 Dat['TargetGhost'] := Ghost;
1740 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1741 ReplaceHash := THeadValue.Create;
1742 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1743 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1744 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1745 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1746 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1747 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1748 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1749 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1750 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1752 Event := TBottleChainBottleEvent.Create;
1755 if EventType = etScript then Event.LogType := ltBottle
1756 else Event.LogType := ltSystemLog;
1758 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1759 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1760 if ErrorMes <> '' then begin
1761 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'+
1762 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1767 NoDispatch := false;
1769 LogNameList := TStringList.Create;
1772 for i := 0 to BottleChainRuleList.Count-1 do begin
1773 if SkipCount > 0 then begin
1777 Rule := BottleChainRuleList[i];
1778 if not Rule.Enabled then Continue;
1779 if not Rule.Check(Event) then Continue;
1780 for j := 0 to Rule.Actions.Count-1 do begin
1781 Action := (Rule.Actions[j] as TBottleChainAction);
1782 if Action is TBottleChainAbortRuleAction then
1784 if Action is TBottleChainSkipRuleAction then
1785 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1786 if (Action is TBottleChainSoundAction) and (Sound = '') then
1788 Sound := (Action as TBottleChainSoundAction).SoundFile;
1789 Sound := StringReplaceEx(Sound, ReplaceHash);
1791 if Action is TBottleChainNoDispatchAction then
1793 if Action is TBottleChainLogAction then
1795 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1796 LogName := (Action as TBottleChainLogAction).LogNames[k];
1797 LogName := StringReplaceEx(LogName, ReplaceHash);
1798 LogNameList.Add(LogName);
1801 if Action is TBottleChainOverrideGhostAction then
1803 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1805 if Action is TBottleChainQuitAction then
1806 Application.Terminate;
1807 if Action is TBottleChainSaveTextLogAction then
1808 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1809 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1810 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]));
1811 if Action is TBottleChainSaveXMLLogAction then
1812 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1814 if Action is TBottleChainSurfaceReplaceAction then
1815 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1817 if BreakFlag then Break;
1820 if Dat['Script'] <> '' then begin
1821 for i := 0 to LogNameList.Count-1 do
1822 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost']);
1823 if NoDispatch then begin
1824 frmLog.SetBottleState(Dat['MID'], lsOpened);
1826 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1827 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1828 Script, Ghost, Now());
1830 FBottleSstp.Push(CueItem);
1837 if Dat['DialogMessage'] <> '' then begin
1839 frmMessageBox.ShowMessage(
1840 DateTimeToStr(Now) + #13#10 +
1841 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1842 for i := 0 to LogNameList.Count-1 do
1843 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1847 if (Sound <> '') then PlaySound(Sound);
1857 procedure TfrmSender.YenETrans;
1858 var St, Le, i: integer;
1861 St := memScript.SelStart;
1862 Le := memScript.SelLength;
1863 Orig := GetScriptText;
1864 RegExp.Subst('s/(\r\n)+$//kg', Orig);
1866 with SsParser do begin
1867 LeaveEscape := true;
1868 EscapeInvalidMeta := false;
1869 InputString := Orig;
1871 for i := 0 to SsParser.Count-1 do begin
1872 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
1875 Text := Text + '\e';
1877 if Orig <> Text then memScript.Lines.Text := Text;
1878 SsParser.InputString := Text;
1880 RegExp.Subst('s/\r\n//kg', Text);
1882 memScript.SelStart := St;
1883 memScript.SelLength := Le;
1886 procedure TfrmSender.PostCommand(const Command: array of String);
1887 var PostStr: TStringList;
1892 PostStr := TStringList.Create;
1893 for i := Low(Command) to High(Command) do begin
1894 PostStr.Add(Command[i]);
1896 PostCommand(PostStr);
1902 procedure TfrmSender.PostCommand(Command: TStrings);
1903 var PostStr: String;
1906 PostStr := Command.Text;
1907 PostStr := ParamsEncode(PostStr);
1909 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
1910 if Pref.UseHttpProxy then begin
1911 FHttp.ProxyServer := Pref.ProxyAddress;
1912 FHttp.ProxyPort := Pref.ProxyPort;
1914 FHttp.OnSuccess := HttpSuccess;
1915 FHttp.OnConnectionFailed := HttpFailure;
1916 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
1919 on EHeapException do begin
1920 Connecting := false;
1926 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
1929 if frmLog.lvwLog.Selected = nil then Exit;
1930 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1931 if Log = nil then Exit;
1932 if Log.LogType <> ltBottle then Exit;
1934 'Command: voteMessage',
1936 'LUID: ' + Pref.LUID,
1942 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
1945 if frmLog.lvwLog.Selected = nil then Exit;
1946 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1947 if Log = nil then Exit;
1948 if Log.LogType <> ltBottle then Exit;
1950 'Command: voteMessage',
1952 'LUID: ' + Pref.LUID,
1958 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
1960 if SakuraSeeker.ProcessByName[Ghost] <> nil then
1961 Result := SakuraSeeker.ProcessByName[Ghost].SetName
1966 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
1967 MousePos: TPoint; var Handled: Boolean);
1970 with tabChannel do begin
1971 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
1972 if Tag < 0 then Handled := true;
1977 procedure TfrmSender.PostSetChannel(Channels: TStrings);
1978 var PostStr: TStringList;
1981 PostStr := TStringList.Create;
1983 with PostStr do begin
1984 Add('Command: setChannels');
1985 Add('Agent: ' + VersionString);
1986 Add('LUID: ' + Pref.LUID);
1987 if Channels <> nil then
1988 for i := 0 to Channels.Count-1 do begin
1989 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
1992 PostCommand(PostStr);
1998 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
2002 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
2004 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
2005 Chs := TStringList.Create;
2007 //
\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ð
2008 //
\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é
2010 Chs.Assign(JoinChannels);
2011 while Chs.IndexOf(Ch) >= 0 do
2012 Chs.Delete(Chs.IndexOf(Ch));
2013 PostSetChannel(Chs);
2019 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
2021 ShellExecute(Handle, 'open', PChar(Pref.VotePage), nil, nil, SW_SHOW);
2024 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
2025 Shift: TShiftState; X, Y: Integer);
2029 with tabChannel do begin
2030 Index := IndexOfTabAt(X, Y);
2032 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2036 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2038 ShellExecute(Handle, 'open', PChar(Pref.HelpPage), nil, nil, SW_SHOW);
2041 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2042 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2045 with tabChannel do begin
2046 Index := IndexOfTabAt(X, Y);
2047 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2048 if Button = mbLeft then begin
2049 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2051 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2056 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2057 Y: Integer; State: TDragState; var Accept: Boolean);
2058 var TargetRect: TRect;
2061 Accept := Source = tabChannel;
2062 if not Accept then Exit;
2063 with tabChannel do begin
2064 OldDest := FDragTabDest;
2065 FDragTabDest := IndexOfTabAt(X, Y);
2066 if FDragTabDest = -1 then begin
2067 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2070 with Canvas do begin
2074 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2075 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2076 TargetRect := TabRect(OldDest);
2077 with Canvas do begin
2078 Brush.Style := bsClear;
2079 Rectangle(TargetRect.Left, TargetRect.Top,
2080 TargetRect.Right, TargetRect.Bottom);
2083 if (OldDest <> FDragTabDest) then begin
2084 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2085 TargetRect := TabRect(FDragTabDest);
2086 with Canvas do begin
2087 Brush.Style := bsClear;
2088 Rectangle(TargetRect.Left, TargetRect.Top,
2089 TargetRect.Right, TargetRect.Bottom);
2095 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2097 var DestIndex: integer;
2099 with tabChannel do begin
2100 DestIndex := IndexOfTabAt(X, Y);
2101 Tabs.Move(FDragTabIndex, DestIndex);
2105 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2108 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2109 tabChannel.Tabs.BeginUpdate;
2110 tabChannel.Tabs.EndUpdate;
2113 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2114 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2115 var AlignRight: boolean;
2118 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2119 with cbxTargetGhost do begin
2120 AlignRight := false;
2121 if Pref.HideGhosts and not FTargetGhostExpand and
2122 (Index = Items.Count-1) and (Index > 0) then
2124 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2125 Canvas.Font.Color := clWindowText;
2126 Canvas.Font.Style := [];
2128 end else if (Index > 0) then
2130 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2131 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2132 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2134 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2135 Canvas.Font.Style := [fsBold];
2138 Canvas.Font.Color := clWindowText;
2139 Canvas.Font.Style := [];
2141 if odSelected in State then
2142 Canvas.Font.Color := clHighlightText;
2146 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2147 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2148 cbxTargetGhost.Items[Index]);
2150 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2151 cbxTargetGhost.Items[Index]);
2155 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2156 var CanClose: Boolean);
2158 if not Pref.ConfirmOnExit then Exit;
2159 if MessageDlg('SSTP Bottle Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2160 mbOkCancel, 0) = mrCancel then CanClose := false;
2163 procedure TfrmSender.UpdateIfGhostBox;
2167 HiddenCount: integer;
2169 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2170 Selected := cbxTargetGhost.Text;
2172 with cbxTargetGhost do begin
2175 Items.Add(ChannelDefault);
2176 for i := 0 to SakuraSeeker.Count-1 do begin
2177 //
\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é
2178 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2179 if Pref.HideGhosts and not FTargetGhostExpand then
2180 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2185 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2186 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2188 cbxTargetGhost.ItemIndex := 0;
2189 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2190 with cbxTargetGhost do begin
2191 for i := 1 to Items.Count-1 do begin
2192 if Items[i] = Selected then
2195 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2196 if ItemIndex = 0 then begin
2197 Items.Add(Selected);
2198 ItemIndex := Items.Count - 1;
2202 if Pref.HideGhosts and not FTargetGhostExpand then
2203 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2208 procedure TfrmSender.HTTPFailure(Sender: TObject);
2212 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2213 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2214 (Sender as THTTPDownloadThread).LastErrorMessage);
2215 Connecting := false;
2218 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2221 SakuraSeeker.BeginDetect;
2223 i := cbxTargetGhost.ItemIndex;
2227 i := cbxTargetGhost.Items.Count-1;
2228 if Pref.HideGhosts and not FTargetGhostExpand then
2231 cbxTargetGhost.ItemIndex := i;
2232 cbxTargetGhostChange(self);
2235 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2238 SakuraSeeker.BeginDetect;
2240 i := cbxTargetGhost.ItemIndex;
2242 if Pref.HideGhosts and not FTargetGhostExpand then
2244 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2247 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2249 cbxTargetGhost.ItemIndex := i;
2250 cbxTargetGhostChange(self);
2253 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2255 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2256 FTargetGhostExpand := false;
2257 if Visible then memScript.SetFocus;
2258 cbxTargetGhostChange(self);
2261 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2263 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2265 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2266 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2268 if not IdSlpp20.Connected then begin
2270 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2272 //
\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
2273 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2279 procedure TfrmSender.RetryBeginConnect;
2281 if FBeginConnectFailCount < 3 then begin
2282 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2283 FAutoAddAfterGetChannel := true;
2285 end else if FBeginConnectFailCount = 3 then begin
2286 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2287 frmMessageBox.ShowMessage(
2288 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2289 '
\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+
2290 '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'
2292 Inc(FBeginConnectFailCount);
2296 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2297 var BottleLog: TBottleLogList;
2299 Cond: TBottleLogDownloadCondition;
2301 function TimeStr(Mins: integer): String;
2302 var day, hour, min: integer;
2304 day := Mins div (60 * 24);
2305 hour := (Mins div 60) mod 24;
2308 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2309 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2310 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2313 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2315 if frmLogDownload.Execute then begin
2316 with frmLogDownload do begin
2317 if IsRange then begin
2318 if CompareDate(DateLo, DateHi) = 0 then
2319 Title := FormatDateTime('yy-mm-dd', DateLo)
2321 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2323 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2325 if Channel <> '' then Title := Title + '(' + Channel + ')';
2327 BottleLog := TBottleLogList.Create(Title);
2329 BottleLog.OnLoaded := frmLog.LogLoaded;
2330 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2331 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2332 with frmLogDownload do begin
2333 Cond.IsRange := IsRange;
2334 Cond.RecentCount := RecentCount;
2335 Cond.DateLo := DateLo;
2336 Cond.DateHi := DateHi;
2337 Cond.MinVote := MinVote;
2338 Cond.MinAgree := MinAgree;
2339 Cond.Channel := Channel;
2341 BottleLog.LoadFromWeb(Cond);
2343 FreeAndNil(BottleLog);
2345 if BottleLog <> nil then begin
2346 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2348 frmLog.tabBottleLog.TabIndex := NewIndex;
2349 frmLog.UpdateWindow;
2353 frmLogDownload.Release;
2357 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2358 Ghost: String): boolean;
2365 Cond := Token(IfGhost, ',', i);
2366 if Cond <> '' then begin
2367 if Cond[1] = '!' then begin
2368 Cond := Copy(Cond, 2, High(integer));
2369 if Cond = Ghost then Result := false;
2371 if Cond <> Ghost then Result := false;
2378 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2379 var i, j, k, count: integer;
2380 ConstData: TScriptConst;
2381 Menu1, Menu2: TMenuItem;
2384 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2385 // 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
2386 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2387 else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2389 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2390 if Simple then begin
2391 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2392 for i := Root.Count-1 downto 0 do begin
2393 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2397 //
\91S
\95\94\8dí
\8f\9c
2398 for i := Root.Count-1 downto 0 do begin
2404 for i := 0 to ScriptConstList.Count-1 do begin
2405 for j := 0 to ScriptConstList[i].Count-1 do begin
2406 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2407 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2409 // 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
2410 if Simple and (count < Root.Count) then
2411 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2415 Menu1 := TMenuItem.Create(Root);
2416 Menu1.Caption := ScriptConstList[i][j].Caption;
2417 Menu1.Hint := ScriptConstList[i][j].Caption;
2418 Menu1.AutoHotkeys := maManual;
2419 Menu1.Tag := ScriptConstList[i][j].ID;
2420 Menu1.OnClick := mnConstGroupClick;
2422 if not Simple then begin
2425 if count < Root.Count-1 then
2426 Root.Insert(count, Menu1)
2431 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2432 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2433 ConstData := ScriptConstList[i][j][k];
2434 Menu2 := TMenuItem.Create(Root);
2435 Menu2.Caption := ConstData.Caption;
2436 Menu2.Hint := ConstData.ConstText;
2437 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2438 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2439 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2440 Menu2.ShortCut := ConstData.ShortCut;
2441 Menu2.OnClick := mnConstClick;
2442 Menu2.AutoHotkeys := maManual;
2443 Menu2.Tag := ConstData.ID;
2444 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2451 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2453 //
\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
2454 if Pref.HideGhosts and not FTargetGhostExpand then
2456 with cbxTargetGhost do
2458 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2459 //
\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
2460 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2462 FTargetGhostExpand := true;
2465 DroppedDown := true;
2469 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2470 ConstructMenu(true);
2471 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2475 procedure TfrmSender.PlaySound(const FileName: String);
2477 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2479 MediaPlayer.FileName := FileName;
2483 on E: EMCIDeviceError do begin
2484 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2489 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2492 if not Assigned(frmFMOExplorer) then
2493 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2496 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2499 frmFMOExplorer.Show;
2502 procedure TfrmSender.SaveChainRuleList;
2503 var Str: TStringList;
2505 Str := TStringList.Create;
2507 Str.Text := ComponentToString(BottleChainRuleList);
2508 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2514 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2516 frmLog.SetBottleState(MID, lsOpened);
2519 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2521 frmLog.SetBottleState(MID, lsPlaying);
2524 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2525 var InsertItem: TLogItem;
2526 i, errCount, Res: integer;
2527 Log: TBottleLogList;
2528 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2530 if FBottleSstp.CueCount > 0 then begin
2531 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'+
2532 '
\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+
2533 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2534 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2537 frmLog.AllBottleOpened;
2538 if frmLog.lvwLog.Selected = nil then Exit;
2539 Log := frmLog.SelectedBottleLog;
2540 if Log = nil then Exit;
2541 FBottleSSTP.OnResendCountChange := nil;
2543 for i := frmLog.lvwLog.Selected.Index downto 0 do begin
2544 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2545 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2547 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2548 if ErrorMes <> '' then
2550 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2551 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2554 raise Exception.Create('Script Syntax Error')
2555 else if Res = mrCancel then
2559 frmLog.AllBottleOpened;
2563 if InsertItem.Ghost = '' then begin
2564 if ChannelList.Channel[InsertItem.Channel] <> nil then
2565 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2567 FBottleSSTP.Push(InsertItem);
2568 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2574 if errCount > 0 then
2575 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]));
2576 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2577 BottleSstpResendCountChange(self);
2578 frmLog.lvwLog.Invalidate;
2581 function TfrmSender.ScriptTransForSSTP(const Script: String;
2582 out Error: String): String;
2583 var TransOpt: TScriptTransOptions;
2585 if Pref.NoTransURL then
2586 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2588 TransOpt := [toConvertURL, toWaitScriptEnd];
2589 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2590 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2591 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2593 Error := DoTrans(Result, TransOpt);
2596 procedure TfrmSender.FormResize(Sender: TObject);
2599 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2600 if memScript.ColWidth <> 0 then
2604 w := Width - LeftMargin - ColWidth div 2;
2605 if ScrollBars in [ssVertical, ssBoth] then
2606 w := w - GetSystemMetrics(SM_CYVSCROLL);
2607 WrapOption.WrapByte := w div ColWidth;
2612 procedure TfrmSender.actCopyExecute(Sender: TObject);
2614 memScript.CopyToClipboard;
2617 procedure TfrmSender.actPasteExecute(Sender: TObject);
2619 memScript.PasteFromClipboard;
2622 procedure TfrmSender.actCutExecute(Sender: TObject);
2624 memScript.CutToClipboard;
2627 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2629 memScript.SelectAll;
2632 procedure TfrmSender.actUndoExecute(Sender: TObject);
2637 procedure TfrmSender.actRedoExecute(Sender: TObject);
2642 function TfrmSender.IsSurfaceTag(const Script: String;
2643 var ID: integer): boolean;
2646 if SsParser.Match(Script, '\s%d') = 3 then
2649 ID := Ord(Script[3]) - Ord('0')
2651 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2654 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2658 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2659 Shift: TShiftState; X, Y: Integer);
2663 //
\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[
2664 if not Pref.SurfacePreviewOnScriptPoint then
2666 token := memScript.TokenStringFromPos(Point(X, Y));
2667 if IsSurfaceTag(token, id) then
2669 DoSurfacePreview(id, spEditor);
2672 frmSurfacePreview.HideAway;
2676 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2677 const Kind: TSurfacePreviewType);
2682 if cbxTargetGhost.ItemIndex > 0 then
2683 ghost := cbxTargetGhost.Text
2684 else if FNowChannel <> '' then
2685 ghost := ChannelList.Channel[FNowChannel].Ghost;
2687 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2688 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2689 not (frmSurfacePreview.IsHidden) then
2696 Bmp := TBitmap.Create;
2698 if Spps.TryGetImage(ghost, Surface, Bmp) then
2702 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2704 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2706 CPos := Point(0, 0);
2708 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2709 FVisiblePreviewGhost := Ghost;
2710 FVisiblePreviewSurface := Surface;
2712 frmSurfacePreview.HideAway;
2719 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2720 {var MousePoint: TPoint;
2723 //
\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é
2724 //
\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Å
2725 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2726 {GetCursorPos(MousePoint);
2727 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2728 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2729 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2730 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2733 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2734 var MousePoint: TPoint;
2736 GetCursorPos(MousePoint);
2737 case Pref.SurfacePreviewOnScriptPointPosition of
2738 spspMainWindowRight:
2739 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2741 Result := Point(Self.Left - w, MousePoint.Y);
2745 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2747 if (Sender is TMenuItem) then
2748 FVisibleMenuItem := Sender as TMenuItem;
2751 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2753 if FScriptBuffer.Count = 0 then
2755 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2756 memScriptChange(Self);
2757 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2760 procedure TfrmSender.EditorPreview;
2761 var Ghost, Script: String;
2763 if frmEditorTalkShow <> nil then
2764 if frmEditorTalkShow.Visible then
2766 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2768 if cbxTargetGhost.ItemIndex > 0 then
2769 Ghost := cbxTargetGhost.Text
2770 else if FNowChannel <> '' then
2771 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2772 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2776 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2778 if frmEditorTalkShow <> nil then
2779 frmEditorTalkShow.Show
2782 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
2783 frmEditorTalkShow.Show;
2788 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
2789 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
2791 Spps.ClearImagePool;
2792 Spps.LoadFromDirectory(FSppDir);
2795 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
2797 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
2800 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2801 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
2802 function TfrmSender.TagReplace(Script: String; Before,
2803 After: array of String): String;
2804 var BeforeList, AfterList: TStringList;
2807 BeforeList := TStringList.Create;
2808 AfterList := TStringList.Create;
2810 for i := Low(Before) to High(Before) do
2811 BeforeList.Add(Before[i]);
2812 for i := Low(After) to High(After) do
2813 AfterList.Add(After[i]);
2814 Result := TagReplace(Script, BeforeList, AfterList);
2821 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2822 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
2823 //
\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¢)
2824 function TfrmSender.TagReplace(Script: String; Before,
2825 After: TStrings): String;
2827 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
2833 OldStr := InputString;
2834 OldLeaveEscape := LeaveEscape;
2835 OldEscapeInvalidMeta := EscapeInvalidMeta;
2836 LeaveEscape := true;
2837 EscapeInvalidMeta := false;
2838 InputString := Script;
2840 for i := 0 to SsParser.Count-1 do
2843 for j := 0 to Before.Count-1 do
2845 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
2848 Result := Result + After[j];
2852 Result := Result + SsParser[i];
2856 LeaveEscape := OldLeaveEscape;
2857 EscapeInvalidMeta := OldEscapeInvalidMeta;
2858 InputString := OldStr;
2862 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
2863 //
\91Î
\89\9e\82·
\82é
2864 procedure TfrmSender.WndProc(var Message: TMessage);
2866 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
2868 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
2869 //
\8bC
\82Ã
\82©
\82¹
\82é
2877 procedure TfrmSender.actReplaceExecute(Sender: TObject);
2879 Form: TfrmStrReplaceDialog;
2881 Pair: TReplacePairRec;
2882 Options: TReplaceFlags;
2884 Application.CreateForm(TfrmStrReplaceDialog, Form);
2886 if Form.Execute then
2888 Pair := Form.PairRec;
2891 Lines := memScript.Lines.Text;
2892 Options := [rfReplaceAll];
2894 Options := Options + [rfIgnoreCase];
2896 Lines := StringReplaceRegExp(Lines, BeforeStr, AfterStr, Options)
2898 Lines := StringReplace(Lines, BeforeStr, AfterStr, Options);
2900 if Lines <> memScript.Lines.Text then
2902 memScript.SelectAll;
2903 memScript.SelText := Lines;
2911 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
2914 if frmLog.lvwLog.Selected = nil then Exit;
2915 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2916 if Log = nil then Exit;
2917 CopyFromLogToEditor(Log);
2920 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
2921 var Ghost, Script: String;
2924 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2925 if cbxTargetGhost.ItemIndex > 0 then
2926 Ghost := cbxTargetGhost.Text
2929 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost);
2933 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
2934 Y: Integer; State: TDragState; var Accept: Boolean);
2936 //
\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é
2937 if Source is TBottleLogDragObject then
2938 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
2941 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
2943 var Src: TBottleLogDragObject;
2946 //
\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é
2947 if not (Source is TBottleLogDragObject) then
2949 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
2951 Src := Source as TBottleLogDragObject;
2953 CopyFromLogToEditor(Log);
2956 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
2958 if Log.LogType <> ltBottle then Exit;
2959 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Ä)
2960 memScript.Lines.Clear;
2961 memScript.Lines.Add(Log.Script);
2962 if Log.Ghost <> '' then
2964 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
2965 //
\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Å
2966 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
2967 cbxTargetGhost.Items.Add(Log.Ghost);
2968 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
2970 cbxTargetGhost.Invalidate;
2972 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
2976 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
2978 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
2979 if frmLog.SelectedBottleLog = nil then
2981 if frmLog.lvwLog.Selected = nil then
2983 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
2984 frmLog.UpdateWindow;
2985 frmLog.lvwLogChange(Self, nil, ctState);
2988 procedure TfrmSender.ClearEditor;
2989 var TmpScript: String;
2991 DoSaveBuffer: boolean;
2992 SavedScript: TStringList;
2994 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
2995 //
\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é
2996 DoSaveBuffer := false;
2997 if FScriptBuffer.Count = 0 then
2998 DoSaveBuffer := true
2999 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
3000 DoSaveBuffer := true;
3001 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
3002 DoSaveBuffer := false;
3003 if DoSaveBuffer then
3005 SavedScript := TStringList.Create;
3006 SavedScript.Text := GetScriptText;
3007 FScriptBuffer.Insert(0, SavedScript);
3009 if FScriptBuffer.Count >= 4 then
3010 FScriptBuffer.Delete(FScriptBuffer.Count-1);
3011 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
3013 TmpScript := Pref.DefaultScript;
3014 Position := Pos('|', TmpScript);
3015 if Position < 1 then Position := 1;
3016 TmpScript := StringReplace(TmpScript, '|', '', []);
3017 memScript.Lines.Text := TmpScript;
3018 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
3019 memScript.SelStart := Position-1;
3021 if Visible then memScript.SetFocus;
3022 FScriptModified := false;
3023 memScriptChange(self);
3026 procedure TfrmSender.AppendTextLog(const FileName, Line: String);
3030 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3032 ForceDirectories(ExtractFileDir(FileName));
3033 AssignFile(F, FileName);
3034 if FileExists(FileName) then
3043 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3047 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3052 Impl: TDomImplementation;
3053 Parser: TXmlToDomParser;
3056 try // Long try block to handle all kinds of exception in this method
3057 if not FileExists(FileName) then
3059 // Create empty XML log file
3060 Impl := TDomImplementation.create(nil);
3062 ForceDirectories(ExtractFileDir(FileName));
3063 Parser := TXmlToDomParser.create(nil);
3064 Parser.DOMImpl := Impl;
3067 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3070 documentElement.setAttribute('saved',
3071 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3072 documentElement.setAttribute('generator', VersionString);
3073 documentElement.setAttribute('version', '1.0');
3075 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3076 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3078 DOM.writeCodeAsShiftJIS(F);
3083 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3086 Parser.DOMImpl.freeDocument(DOM);
3093 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3099 F.Seek(P, soFromEnd);
3101 if Buf = '</bottlelog>' then
3106 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3109 F.Seek(P, soFromEnd);
3110 Buf := Format('<message mid="%s">', [Args['MID']]);
3111 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3112 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3113 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3114 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3115 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3116 Buf := Buf + '</message>';
3117 Buf := Buf + '</bottlelog>';
3118 F.Write(Buf[1], Length(Buf));
3125 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3129 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3134 SelText := memScript.SelText;
3135 if SelText <> '' then
3137 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3140 memScriptChange(Self);
3144 function TfrmSender.ReplaceSurface(Script: String;
3145 Params: TCollection): String;
3147 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3148 OldStr, Tag: String;
3149 i, j, k, Cur: integer;
3150 Item: TSurfaceReplaceItem;
3151 Before: TSurfaceReplaceBeforeItem;
3157 OldStr := InputString;
3158 OldLeaveEscape := LeaveEscape;
3159 OldEscapeInvalidMeta := EscapeInvalidMeta;
3160 LeaveEscape := true;
3161 EscapeInvalidMeta := false;
3162 InputString := Script;
3164 for i := 0 to SsParser.Count-1 do
3166 if SsParser.MarkUpType[i] <> mtTag then
3168 Result := Result + SsParser.Str[i];
3171 Tag := SsParser.Str[i];
3172 if SsParser.Match(Tag, '\s%d') = 2 then
3173 Cur := Ord(Tag[3]) - Ord('0')
3174 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3175 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3178 Result := Result + Tag;
3182 for j := 0 to Params.Count-1 do
3184 Item := Params.Items[j] as TSurfaceReplaceItem;
3185 for k := 0 to Item.Before.Count-1 do
3187 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3188 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3191 Result := Result + Format('\s[%d]', [Item.After]);
3199 Result := Result + Tag;
3203 LeaveEscape := OldLeaveEscape;
3204 EscapeInvalidMeta := OldEscapeInvalidMeta;
3205 InputString := OldStr;