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;
24 TSurfacePreviewType = (spHint, spEditor);
26 TfrmSender = class(TForm)
30 mnRegister: TMenuItem;
33 StatusBar: TStatusBar;
36 mnEditConst: TMenuItem;
37 ActionList: TActionList;
39 mnPopPaste: TMenuItem;
42 mnPopSelectAll: TMenuItem;
44 mnPopConst: TMenuItem;
49 mnSelectAll: TMenuItem;
51 ApplicationEvents: TApplicationEvents;
52 mnPopUpTaskTray: TPopupMenu;
53 mnTaskStart: TMenuItem;
55 mnTaskRestore: TMenuItem;
56 mnTaskNewMessage: TMenuItem;
60 mnTaskExit: TMenuItem;
68 mnPopupConst: TPopupMenu;
69 actEditConst: TAction;
71 mnShowToolBar: TMenuItem;
72 mnShowConstBar: TMenuItem;
73 ConstBarMenu: TMainMenu;
75 tbtnClear: TToolButton;
76 tbtnConfirm: TToolButton;
77 tbtnSend: TToolButton;
78 tbtnSeparator: TToolButton;
79 tbtnStart: TToolButton;
80 tbtnSeparator2: TToolButton;
81 tbtnInsertConst: TToolButton;
82 ConstMenuBar: TMenuBar;
87 actCopyAllNoReturn: TAction;
88 mnCopyAllNoReturn: TMenuItem;
89 mnPopCopyAll: TMenuItem;
90 mnPopCopyAllNoReturn: TMenuItem;
92 tbtnSetting: TToolButton;
93 mnStayOnTop: TMenuItem;
95 actExitClient: TAction;
97 tbtnEditConst: TToolButton;
98 actClearBottles: TAction;
99 mnClearBottles: TMenuItem;
100 MediaPlayer: TMediaPlayer;
101 mnGetNewId: TMenuItem;
102 actNextChannel: TAction;
103 actPrevChannel: TAction;
105 mnNextChannel: TMenuItem;
106 mnPrevChannel: TMenuItem;
109 tbtnShowLog: TToolButton;
110 tbtnSleep: TToolButton;
114 mnTaskSleep: TMenuItem;
116 tabChannel: TTabControl;
119 cbxTargetGhost: TComboBox;
120 actVoteMessage: TAction;
121 mnPopUpChannelTab: TPopupMenu;
122 mnLeaveThisChannel: TMenuItem;
124 mnGotoVote: TMenuItem;
125 mnGoToHelp: TMenuItem;
129 mnExitAllChannels: TMenuItem;
130 actAgreeMessage: TAction;
133 actPrevGhost: TAction;
134 actNextGhost: TAction;
135 mnPrevGhost: TMenuItem;
136 mnNextGhost: TMenuItem;
137 actResetGhost: TAction;
138 mnResetGhost: TMenuItem;
139 timDisconnectCheckTimer: TTimer;
140 DirectSstp: TDirectSstp;
141 actDownloadLog: TAction;
142 actFMOExplorer: TAction;
143 tbtnFMOExplorer: TToolButton;
144 mnFMOExplorer: TMenuItem;
146 actInsertCue: TAction;
147 SakuraScriptFountain: TSakuraScriptFountain;
152 actSelectAll: TAction;
153 actRecallScriptBuffer: TAction;
155 mnRecallScriptBuffer: TMenuItem;
156 tbtnEditorPreview: TToolButton;
157 actEditorPreview: TAction;
158 mnEditorPreview: TMenuItem;
159 actResetPlugins: TAction;
161 mnResetPlugins: TMenuItem;
162 ReplaceDialog: TReplaceDialog;
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 ReplaceDialogFind(Sender: TObject);
264 procedure ReplaceDialogReplace(Sender: TObject);
265 procedure actSendToEditorExecute(Sender: TObject);
266 procedure actSendToLogWindowExecute(Sender: TObject);
267 procedure memScriptDragOver(Sender, Source: TObject; X, Y: Integer;
268 State: TDragState; var Accept: Boolean);
269 procedure memScriptDragDrop(Sender, Source: TObject; X, Y: Integer);
270 procedure actDeleteLogItemExecute(Sender: TObject);
271 procedure memScriptSelectionChange(Sender: TObject; Selected: Boolean);
272 procedure actUndoExecute(Sender: TObject);
273 procedure actRedoExecute(Sender: TObject);
275 FSleeping: boolean; //
\94z
\91\97\83X
\83\8a\81[
\83v
\92\86\82©
\82Ç
\82¤
\82©
277 FConnecting: boolean;
279 FBooted: boolean; //
\8f\89\89ñ
\8bN
\93®
\92Ê
\90M
\97p
280 FOriginalCaption: String;
281 FAutoAddAfterGetChannel: boolean; //
\83`
\83\83\83\93\83l
\83\8b\8eæ
\93¾
\8cã
\82É
\83_
\83C
\83A
\83\8d\83O
\82È
\82µ
\82É
282 //
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82·
\82é
\82©
\82Ç
\82¤
\82©
286 FMutex: THandle; //Mutex
\83I
\83u
\83W
\83F
\83N
\83g
\81c
\93ñ
\8fd
\8bN
\93®
\96h
\8e~
\97p
288 FNowChannel: String; //
\8c»
\8dÝ
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b
289 JoinChannelsBackup: TStringList; //
\88ê
\8e\9e\8eg
\97p
291 FScriptModified: boolean; //
\83X
\83N
\83\8a\83v
\83g
\82ª
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\81B
292 //
\83\8d\81[
\83J
\83\8b\8am
\94F
\8b
\90§
\97p
\83t
\83\89\83O
\81BTRichEdit.Modified
\82Í
293 //
\95Ê
\82Ì
\97p
\93r
\82Å
\8eg
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8eg
\82¦
\82È
\82¢
295 FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
296 FDragTabDest: integer; //
\83h
\83\8d\83b
\83v
\82·
\82é
\88Ê
\92u(
\82·
\82®
\89E
\82É
\82
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X)
298 FBottleSstp: TBottleSstp; //
\8dÄ
\91\97\83v
\83\8d\83O
\83\89\83\80
300 FHttp: THTTPDownloadThread; //HTTP
\83_
\83E
\83\93\83\8d\81[
\83h
\83X
\83\8c\83b
\83h(
\83C
\83\93\83X
\83^
\83\93\83X
\82Í1
\8cÂ
\82Ì
\82Ý)
301 FBeginConnectFailCount: integer; //
\89½
\93x
\82à
\90Ú
\91±
\8e¸
\94s
\82µ
\82½
\82ç
\83\8a\83g
\83\89\83C
\92\86\8e~
303 FVisiblePreviewGhost: String;
304 FVisiblePreviewSurface: integer; //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82Å
\8c©
\82¦
\82Ä
\82¢
\82é
\82à
\82Ì
305 FVisibleMenuItem: TMenuItem; //
\83N
\83\8a\83b
\83N
\82³
\82ê
\82½
\83\81\83j
\83\85\81[
\83A
\83C
\83e
\83\80\81B
306 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82ª
\83\81\83j
\83\85\81[
\82Ì
\89º
\82É
307 //
\89B
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\8bL
\89¯
\82µ
\82Ä
\82¨
\82
309 FTargetGhostExpand: boolean; //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ª
\81A
310 //
\88ê
\8e\9e\93I
\82É
\91S
\95\94\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\82Ì
\83t
\83\89\83O
312 FScriptBuffer: TObjectList; //
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
314 FWM_TaskBarCreated: WORD; //
\83^
\83X
\83N
\83o
\81[
\93o
\98^
\97p
\83E
\83B
\83\93\83h
\83E
\83\81\83b
\83Z
\81[
\83WID
316 procedure SetStatusText(const Value: String);
317 procedure SetSleeping(const Value: boolean);
319 procedure SetConnecting(const Value: boolean);
320 procedure SetAdded(const Value: boolean);
321 procedure mnConstClick(Sender: TObject);
322 procedure mnConstGroupClick(Sender: TObject);
323 property Added: boolean read FAdded write SetAdded;
324 property Sleeping: boolean read FSleeping write SetSleeping;
325 property StatusText: String read FStatusText write SetStatusText;
326 function GetScriptText: String;
327 procedure ChangeTaskIcon;
328 procedure ShowHintLabel(const Mes: String; Col: TColor = clBlue);
329 procedure UpdateLayout;
330 procedure DispatchBottle(EventType: TIdSlppEventType; Dat: THeadValue);
331 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
332 procedure UpdateChannelInfo(Dat: THeadValue);
333 procedure UpdateJoinChannelList(Dat: THeadValue);
334 procedure NoLuidError;
335 procedure UpdateIfGhostBox;
336 function BuildMenuConditionCheck(const IfGhost, Ghost: String): boolean;
337 procedure BuildMenu(Root: TMenuItem; Simple: boolean);
338 procedure PlaySound(const FileName: String);
339 //TBottleSstp
\8aÖ
\8cW
\83C
\83x
\83\93\83g
\83n
\83\93\83h
\83\89
340 procedure BottleSstpResendCountChange(Sender: TObject);
341 procedure BottleSstpResendTrying(Sender: TObject; MID: String);
342 procedure BottleSstpResendEnd(Sender: TObject; MID: String);
343 function IsSurfaceTag(const Script: String; var ID: integer): boolean;
344 procedure DoSurfacePreview(Surface: integer; const Kind:
345 TSurfacePreviewType);
346 function GetSurfacePreviewPositionHint(w, h: integer): TPoint;
347 function GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
348 procedure EditorPreview;
349 //
\83^
\83O
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\95Ï
\8a·
\82·
\82é
350 function TagReplace(Script: String;
351 Before, After: array of String): String; overload;
352 function TagReplace(Script: String;
353 Before, After: TStrings): String; overload;
354 //
\83T
\81[
\83t
\83B
\83X
\82ð
\95Ï
\8a·
\82·
\82é
355 function ReplaceSurface(Script: String; Params: TCollection): String;
356 procedure ClearEditor;
357 procedure CopyFromLogToEditor(Log: TLogItem);
359 procedure AppendTextLog(const FileName, Line: String);
360 procedure AppendXMLLog(const FileName: String; Args: THeadValue);
362 procedure WndProc(var Message: TMessage); override;
364 function DoTrans(var Script: String;
365 Options: TScriptTransOptions): String; overload;
366 function DoTrans(var Script: String;
367 Options: TScriptTransOptions; out FoundURL: boolean): String; overload;
368 function ScriptTransForSSTP(const Script: String;
369 out Error: String): String; overload;
370 procedure BeginConnect;
371 procedure RetryBeginConnect;
372 procedure EndConnect;
373 procedure ConstructMenu(Simple: boolean);
374 property Connecting: boolean read FConnecting write SetConnecting;
375 property BottleSstp: TBottleSstp read FBottleSstp;
376 function GhostNameToSetName(const Ghost: String): String;
377 procedure PostCommand(const Command: array of String); overload;
378 procedure PostCommand(Command: TStrings); overload;
379 procedure PostSetChannel(Channels: TStrings);
380 procedure SaveChainRuleList;
385 frmSender: TfrmSender;
388 PanelConnecting = 0; //
\81u
\90Ú
\91±
\92\86\81v
\95\
\8e¦
\97p
389 PanelBytes = 1; //
\81\9b\81\9b\83o
\83C
\83g
390 PanelCount = 2; //Local Proxy
\81A
\8c»
\8dÝ
\81\9b\8c\8f\91Ò
\82¿
391 PanelMembers = 3; //
\81\9b\81\9b\90l
392 PanelStatus = 4; //SSTP Bottle
\83T
\81[
\83o
\82É
\93o
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81c
\82È
\82Ç
395 IconDisconnected = 18;
397 IconSleepDisconnected = 20;
399 WarningColor = clRed;
401 SendButtonLongHint = 'Bottle
\82Ì
\91\97\90M';
403 function Token(const Str: String; const Delimiter: char;
404 const Index: integer): String;
406 function StringReplaceEx(const Before: String; List: THeadValue): String;
410 uses SendConfirm, SettingForm, ChannelListForm, LogForm,
411 MessageBox, FMOExplorer, EditorTalkShow;
415 //
\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
416 function Token(const Str: String; const Delimiter: char;
417 const Index: integer): String;
418 var i, c, len: integer;
424 while i <= len do begin
425 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
427 if c > Index then Break;
428 end else if c = Index then Result := Result + Str[i];
433 //
\95¶
\8e\9a\97ñ
\82ð
\92u
\82«
\8a·
\82¦
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
434 function StringReplaceEx(const Before: String; List: THeadValue): String;
436 i, MinPos, MinKey, p: integer;
445 for i := 0 to List.Count-1 do
447 p := Pos(List.KeyAt[i], Work);
448 if (p > 0) and ((p < MinPos) or (MinPos < 0)) then
456 Result := Result + Work;
460 Result := Result + Copy(Work, 1, MinPos-1) + List.ValueAt[MinKey];
461 Delete(Work, 1, (MinPos - 1) + Length(List.KeyAt[MinKey]));
468 procedure TfrmSender.actConfirmExecute(Sender: TObject);
470 AScript, Err, AGhost: String;
474 // Partial Confirmation
475 if memScript.SelText <> '' then
478 if not Pref.AutoPartialConfirm then
479 if not MultipleChoiceEdit('
\8am
\94F', ['
\91I
\91ð
\95\94\95ª
\82Ì
\82Ý', '
\83X
\83N
\83\8a\83v
\83g
\91S
\91Ì'], Choice) then
483 AScript := memScript.SelText;
484 AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
486 AScript := GetScriptText;
488 AScript := GetScriptText;
489 AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
491 if Length(AScript) = 0 then Exit;
493 AScript := ScriptTransForSSTP(AScript, Err);
500 if cbxTargetGhost.ItemIndex > 0 then
501 AGhost := cbxTargetGhost.Text
502 else if FNowChannel <> '' then
503 AGhost := ChannelList.Channel[FNowChannel].Ghost
507 if Pref.IgnoreTimeCritical then
508 AScript := TagReplace(AScript, ['\t'], ['']);
510 Item := TLogItem.Create;
516 Channel := '
\81y
\8am
\94F
\81z';
519 BottleSstp.Unshift(Item);
524 FScriptModified := false;
527 procedure TfrmSender.FormCreate(Sender: TObject);
528 var Str: TStringList;
530 FScriptBuffer := TObjectList.Create(true);
532 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
533 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
534 ScriptConstList.LoadFromDir(FConstDir);
535 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
536 Spps.LoadFromDirectory(FSppDir);
537 ConstructMenu(false);
539 Str := TStringList.Create;
542 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
543 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
546 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
547 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
549 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');
550 Application.Terminate;
551 Application.ProcessMessages;
559 FOriginalCaption := Self.Caption;
562 ShowMessage('
\93ñ
\8fd
\8bN
\93®
\8b\96\89Â
\83o
\81[
\83W
\83\87\83\93\82Å
\82·
\81B'#13#10 + VersionString);
564 FMutex := CreateMutex(nil, true, 'SSTPBottleClient2');
565 if GetLastError = ERROR_ALREADY_EXISTS then begin
567 ShowMessage('SSTP Bottle Client
\82Í
\93ñ
\8fd
\8bN
\93®
\82Å
\82«
\82Ü
\82¹
\82ñ');
569 Application.Terminate;
570 Application.ProcessMessages; //WM_QUIT
\82ð
\97¬
\82·
576 mnShowToolBar.Checked := Pref.ShowToolBar;
577 mnShowConstBar.Checked := Pref.ShowConstBar;
578 if Pref.StayOnTop then begin
579 FormStyle := fsStayOnTop;
580 mnStayOnTop.Checked := true;
582 FormStyle := fsNormal;
583 mnStayOnTop.Checked := false;
586 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
587 mnGoToHP.Hint := Pref.HomePage;
588 mnGotoVote.Hint := Pref.VotePage;
589 mnGotoHelp.Hint := Pref.HelpPage;
591 mnGetNewId.Enabled := (Pref.LUID = '');
593 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
595 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
596 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
598 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
599 Application.Terminate;
602 //
\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è
603 SsPlayTime.PlayTimeParams := Pref.PlayTimeParams;
605 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
606 with Pref.SenderWindowPosition do begin
609 Self.Width := Right - Left + 1;
610 Self.Height := Bottom - Top + 1;
613 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
614 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
616 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
617 actClearExecute(Sender);
618 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
620 //
\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»)
621 UpdateJoinChannelList(nil);
623 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
624 FBottleSstp := TBottleSstp.Create(false);
625 with FBottleSstp do begin
626 OnResendCountChange := BottleSstpResendCountChange;
627 OnResendTrying := BottleSstpResendTrying;
628 OnResendEnd := BottleSstpResendEnd;
632 procedure TfrmSender.FormDestroy(Sender: TObject);
634 if FScriptBuffer <> nil then
637 if FBottleSstp <> nil then begin
638 FBottleSstp.Terminate;
642 with Pref.SenderWindowPosition do begin
645 Right := Self.Left + Self.Width - 1;
646 Bottom := Self.Top + Self.Height - 1;
649 if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
651 ScriptConstList.Save;
654 BottleChainRuleList.Free;
657 ReleaseMutex(FMutex);
662 procedure TfrmSender.SetConnecting(const Value: boolean);
664 FConnecting := Value;
666 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
667 actStart.Enabled := false;
668 actStop.Enabled := false;
669 actSend.Enabled := false;
670 actVoteMessage.Enabled := false;
671 actAgreeMessage.Enabled := false;
672 mnGetNewId.Enabled := false;
673 Screen.Cursor := crAppStart;
675 StatusBar.Panels[PanelConnecting].Text := '';
676 actStart.Enabled := true;
677 actStop.Enabled := true;
678 actSend.Enabled := true;
679 frmLog.lvwLogChange(Self, nil, ctState);
680 mnGetNewId.Enabled := Pref.LUID = '';
681 Screen.Cursor := crDefault;
685 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
686 procedure TfrmSender.actSendExecute(Sender: TObject);
687 var Talk, Ghost: String;
688 Command: TStringList;
692 if Length(GetScriptText) = 0 then begin
693 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
697 if Pref.LUID = '' then begin
701 if tabChannel.TabIndex < 0 then begin
702 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
703 '
\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');
706 if ChannelList.Channel[FNowChannel].NoPost then begin
708 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
713 Talk := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
714 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
715 if Err <> '' then begin
716 MessageDlg(Err, mtWarning, [mbOk], 0);
720 if Pref.NeedConfirmBeforeSend and FScriptModified then
722 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
726 if not Pref.NoConfirm then begin
727 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
731 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text;
732 Command := TStringList.Create;
734 with Command do begin
735 Add('Command: sendBroadcast');
736 Add('Channel: ' + FNowChannel);
737 Add('LUID: ' + Pref.LUID);
738 Add('Agent: ' + VersionString);
739 if Ghost <> '' then Add('Ghost: ' + Ghost);
740 Add('Talk: ' + Talk);
742 PostCommand(Command);
747 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
748 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
749 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
753 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
758 procedure TfrmSender.BeginConnect;
760 if Pref.LUID = '' then begin
764 IdSlpp20.LUID := Pref.LUID;
765 self.Cursor := crHourGlass;
767 if IdSlpp20.Connected then IdSlpp20.Disconnect;
768 if Pref.UseHttpProxy then begin
769 IdSlpp20.Host := Pref.ProxyAddress;
770 IdSlpp20.Port := Pref.ProxyPort;
771 IdSlpp20.ProxyMode := true;
773 IdSlpp20.Host := Pref.BottleServer;
774 IdSlpp20.Port := Pref.BottleServerPort;
775 IdSlpp20.ProxyMode := false;
779 on EIdException do begin
781 if FBeginConnectFailCount = 0 then begin
782 Inc(FBeginConnectFailCount);
784 if Pref.UseHttpProxy then
785 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 +
786 '
\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 +
787 '
\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')
789 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
790 '
\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 +
791 '
\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');
793 Inc(FBeginConnectFailCount);
796 self.Cursor := crDefault;
799 procedure TfrmSender.EndConnect;
801 IdSlpp20.OnDisconnect := nil;
805 procedure TfrmSender.SetAdded(const Value: boolean);
807 if FAdded = Value then Exit;
810 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
813 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
815 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
819 procedure TfrmSender.HTTPSuccess(Sender: TObject);
820 var Str, ResStr, Command: String;
821 HeadValue: THeadValue;
823 SetChannel: TStringList;
826 Str := (Sender as THttpDownloadThread).RecvString;
830 HeadValue := THeadValue.Create(Str);
832 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89ð
\90Í
\82Å
\82«
\82È
\82¢
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
835 Command := HeadValue['Command'];
836 ResStr := HeadValue['Result'];
837 if ResStr = 'Err' then begin
838 if HeadValue['ExtraMessage'] <> '' then begin
840 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
841 HeadValue['ExtraMessage']);
844 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
847 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
848 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
849 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
850 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
851 if Pref.ResetIfGhostAfterSend then begin
852 actResetGhostExecute(Self);
854 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
855 if Pref.ClearAfterSend then begin
858 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
859 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
861 if (Command = 'getNewId') then begin
862 if ResStr = 'OK' then begin
863 Pref.LUID := HeadValue['NewID'];
864 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
865 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
866 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
867 'LUID: ' + Pref.LUID + #13#10 +
868 '
\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' +
869 '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' +
870 '
\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');
871 mnGetNewId.Enabled := false;
874 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
877 if (Command = 'voteMessage') then begin
878 if ResStr = 'OK' then begin
879 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
882 if (Command = 'getChannels') and (ResStr = 'OK') then begin
883 UpdateChannelInfo(HeadValue);
886 if FAutoAddAfterGetChannel then begin
887 SetChannel := TStringList.Create;
888 if JoinChannelsBackup <> nil then begin
889 //
\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
890 SetChannel.Assign(JoinChannelsBackup);
892 //
\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¾
893 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
894 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
895 SetChannel.Add(Pref.AutoJoinChannels[i]);
899 Application.CreateForm(TfrmChannelList, frmChannelList);
901 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
902 SetChannel := TStringList.Create;
903 SetChannel.Assign(frmChannelList.JoinList);
906 frmChannelList.Release;
909 if SetChannel <> nil then PostSetChannel(SetChannel);
911 if SetChannel <> nil then FreeAndNil(SetChannel);
914 if (Command = 'setChannels') then begin
915 if ResStr <> 'OK' then begin
917 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¢');
918 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
921 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
927 procedure TfrmSender.actStartClick(Sender: TObject);
929 if Pref.LUID = '' then begin
933 if not IdSlpp20.Connected then begin
934 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
938 FAutoAddAfterGetChannel := false;
939 PostCommand(['Command: getChannels']);
943 procedure TfrmSender.actStopExecute(Sender: TObject);
945 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
946 IdSlpp20.OnDisconnect := nil;
947 if IdSlpp20.Connected then IdSlpp20.Disconnect;
948 FAutoAddAfterGetChannel := true;
950 IdSlpp20.OnDisconnect := Slpp20Disconnect;
953 procedure TfrmSender.FormShow(Sender: TObject);
955 if FBooted or Application.Terminated then Exit;
956 //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
957 if Pref.LUID <> '' then BeginConnect
958 else mnGetNewIdClick(Self);
959 FAutoAddAfterGetChannel := Pref.AutoStart;
962 frmSurfacePreview.Show;
964 SakuraSeeker.BeginDetect;
965 SakuraSeekerDetectResultChanged(self);
966 if SakuraSeeker.Count = 0 then
967 frmMessageBox.ShowMessage('
\83S
\81[
\83X
\83g(SSTP
\83T
\81[
\83o)
\82ª1
\82Â
\82à
\8bN
\93®
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10 +
968 'SSTP Bottle
\82ð
\97\98\97p
\82·
\82é
\82½
\82ß
\82É
\82Í
\81A
\83S
\81[
\83X
\83g
\82ð
\93¯
\8e\9e\82É
\8bN
\93®
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B'#13#10 +
969 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
972 procedure TfrmSender.actAboutClick(Sender: TObject);
975 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
976 Str := Str + Format('Compiler Version: %f', [CompilerVersion]);
977 frmMessageBox.ShowMessage(Str);
980 procedure TfrmSender.actExitClientExecute(Sender: TObject);
985 procedure TfrmSender.actClearExecute(Sender: TObject);
987 Script, Default: String;
989 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
990 Default := StringReplace(Pref.DefaultScript, '|', '', [rfReplaceAll]);
991 Default := StringReplace(Default, #13#10, '', [rfReplaceAll]);
993 if (Pref.AutoClip) and (Length(GetScriptText) > 0) and (Script <> Default) then
994 actSendToLogWindow.Execute
999 procedure TfrmSender.memScriptChange(Sender: TObject);
1004 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
1005 Text := Format('%d
\83o
\83C
\83g/%d
\95b', [Length(Script), SsPlayTime.PlayTime(Script) div 1000]);
1006 StatusBar.Panels[PanelBytes].Text := Text;
1007 FScriptModified := true;
1011 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
1013 Pref.StayOnTop := not Pref.StayOnTop;
1014 mnStayOnTop.Checked := Pref.StayOnTop;
1015 if Pref.StayOnTop then begin
1016 FormStyle := fsStayOnTop;
1018 FormStyle := fsNormal;
1023 function TfrmSender.GetScriptText: String;
1025 Result := memScript.Lines.Text;
1028 procedure TfrmSender.mnConstClick(Sender: TObject);
1031 i := (Sender as TMenuItem).Tag;
1032 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
1035 procedure TfrmSender.actEditConstExecute(Sender: TObject);
1037 ScriptConstList.LoadFromDir(FConstDir);
1039 Application.CreateForm(TfrmConstEditor, frmConstEditor);
1040 frmConstEditor.Execute;
1041 ScriptConstList.Save;
1043 frmConstEditor.Release;
1045 ConstructMenu(false);
1048 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
1050 Application.Minimize;
1051 WindowState := wsNormal;
1054 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
1057 TaskTray.Registered := false;
1060 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
1063 Application.ShowMainForm := false;
1064 ShowWindow(Application.Handle, SW_HIDE);
1067 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
1069 Application.ShowMainForm := true;
1073 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1075 Application.Restore;
1078 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1080 Application.Restore;
1083 procedure TfrmSender.FormActivate(Sender: TObject);
1088 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1090 Application.Restore;
1091 actClearExecute(Sender);
1094 procedure TfrmSender.ChangeTaskIcon;
1099 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1101 if Sleeping then IcoNum := IconSleepDisconnected
1102 else IcoNum := IconDisconnected;
1105 Ico := TIcon.Create;
1107 imgIcon.GetIcon(IcoNum, Ico);
1108 TaskTray.Icon := Ico;
1109 TaskTray.Registered := true;
1114 ; // 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
1115 //
\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
1116 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1120 procedure TfrmSender.SetStatusText(const Value: String);
1122 FStatusText := Value;
1123 StatusBar.Panels[PanelStatus].Text := Value;
1126 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1129 if Length(Application.Hint) > 0 then
1131 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1132 Application.HintColor := clInfoBk;
1133 if (Application.Hint = SendButtonLongHint)
1134 and (FNowChannel <> '') then
1136 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1137 Application.HintColor := clYellow;
1138 Application.ActivateHint(Mouse.CursorPos);
1140 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1142 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1143 DoSurfacePreview(id, spHint);
1147 StatusBar.Panels[PanelStatus].Text := FStatusText;
1148 frmSurfacePreview.HideAway;
1152 procedure TfrmSender.ConstructMenu(Simple: boolean);
1154 BuildMenu(mnPopConst, Simple);
1155 BuildMenu(mnPopUpConst.Items, Simple);
1156 BuildMenu(ConstBarMenu.Items, Simple);
1157 //ConstMenuBar.Menu := nil;
1158 ConstMenuBar.AutoSize := false;
1159 ConstMenuBar.Width := 1000;
1160 ConstMenuBar.Menu := ConstBarMenu;
1161 ConstMenuBar.AutoSize := true;
1164 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1165 Shift: TShiftState);
1167 Func: TReturnKeyFunction;
1169 if (Key = VK_RETURN) then begin
1170 if (ssShift in Shift) then
1171 Func := Pref.WhenShiftReturn
1172 else if (ssCtrl in Shift) then
1173 Func := Pref.WhenCtrlReturn
1175 Func := Pref.WhenReturn;
1178 with tbtnInsertConst do
1179 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1180 mnPopUpConst.Popup(Pos.X, Pos.Y);
1183 memScript.SelText := '\n';
1187 memScript.SelText := '\n'#13#10;
1190 memScript.SelText := #13#10
1196 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1198 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1199 Pref.ShowToolBar := mnShowToolBar.Checked;
1203 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1205 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1206 Pref.ShowConstBar := mnShowConstBar.Checked;
1210 procedure TfrmSender.UpdateLayout;
1212 with SakuraScriptFountain do begin
1213 TagColor.Color := Pref.MarkUpColor;
1214 TagErrorColor.Color := Pref.MarkErrorColor;
1215 Scope0Color.Color := Pref.TalkColorH;
1216 Scope1Color.Color := Pref.TalkColorU;
1217 SynchronizedColor.Color := Pref.TalkColorS;
1219 memScript.Ruler.Visible := Pref.ShowRuler;
1220 memScript.Ruler.Color := Pref.TextColor;
1221 memScript.Color := Pref.BgColor;
1223 ToolBar.Visible := Pref.ShowToolBar;
1224 ConstMenuBar.Visible := Pref.ShowConstBar;
1227 with tabChannel do begin
1228 TabPosition := Pref.TabPosition;
1229 case Pref.TabPosition of
1230 tpTop: Align := alTop;
1231 tpBottom: Align := alBottom;
1233 TabWidth := Pref.TabWidth;
1237 function TfrmSender.DoTrans(var Script: String;
1238 Options: TScriptTransOptions; out FoundURL: boolean): String;
1239 var UrlCancel, Mark: String;
1240 Url, UrlName: array[0..6] of String;
1241 i, j, u, UrlCount: integer;
1242 LastSurfaceH, LastSurfaceU: integer;
1243 UnyuTalking: boolean;
1244 QuickSection, Synchronize: boolean;
1245 Warnings: TStringList;
1250 UnyuTalking := false;
1251 QuickSection := false;
1252 Synchronize := false;
1253 SsParser.LeaveEscape := true;
1254 SsParser.EscapeInvalidMeta := false;
1255 SsParser.InputString := Script;
1257 Warnings := TStringList.Create;
1259 for i := 0 to SsParser.Count-1 do begin
1260 if SsParser[i] = '\t' then begin
1261 if not(toIgnoreTimeCritical in Options) then
1262 Script := Script + '\t';
1263 end else if SsParser[i] = '\e' then begin
1265 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1266 if toConvertURL in Options then begin
1267 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1268 for u := 7 downto 1 do begin
1269 if (SsParser.Match(SsParser[i],
1270 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1271 '-', '%b', [rfReplaceAll]))) > 0 then begin
1272 for j := 1 to u do begin
1273 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1274 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1275 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1276 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1279 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1280 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1282 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1283 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1284 Url[0] := SsParser.GetParam(SsParser[i], 1);
1285 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1286 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1287 if Pos('http://', Url[0]) > 0 then begin
1289 if not QuickSection then
1290 Script := Script + '\_q' + Url[0] + '\_q'
1292 Script := Script + Url[0];
1295 end else Script := Script + SsParser[i];
1297 Mark := SsParser[i];
1298 if Mark = '\h' then begin
1299 UnyuTalking := false;
1300 if toHUTagTo01Tag in Options then Mark := '\0';
1301 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1302 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');
1303 end else if Mark = '\u' then begin
1304 UnyuTalking := true;
1305 if toHUTagTo01Tag in Options then Mark := '\1';
1306 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1307 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');
1308 end else if Mark = '\_q' then begin
1309 QuickSection := not QuickSection;
1310 end else if Mark = '\_s' then begin
1311 Synchronize := not Synchronize;
1312 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1313 if UnyuTalking then begin
1314 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1317 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1320 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1321 if UnyuTalking then begin
1322 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1324 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1327 Script := Script + Mark;
1330 if UrlCount > 0 then begin
1332 Script := Script + '\h\n';
1333 if not (toNoChoice in Options) then begin
1334 for i := 0 to UrlCount-1 do begin
1335 Script := Script + Format('\q%d[%s][%s]',
1336 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1338 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1339 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1341 Script := Script + '\h';
1342 for i := 0 to UrlCount-1 do begin
1343 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1345 Script := Script + Format('\n{%s}', [UrlCancel]);
1349 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1350 if toWaitScriptEnd in Options then begin
1351 i := Pref.WaitScriptEnd;
1352 while i > 0 do begin
1354 Script := Script + '\w9';
1357 Script := Script + '\w' + IntToStr(i);
1363 Script := Script + '\e';
1364 RegExp.Subst('s/\r\n//gk', Script);
1366 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1367 for i := 0 to SsParser.Count-1 do begin
1368 if SsParser.MarkUpType[i] = mtTagErr then begin
1369 Result := '"' + SsParser[i] + '"'#13#10 +
1370 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1374 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1375 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1379 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1380 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1381 mbOkCancel, 0) = mrCancel then
1382 Result := Warnings.Text;
1389 function TfrmSender.DoTrans(var Script: String;
1390 Options: TScriptTransOptions): String;
1393 Result := DoTrans(Script, Options, dum);
1396 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1398 ShellExecute(Handle, 'open', PChar(Pref.HomePage), nil, nil, SW_SHOW);
1401 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1403 lblMessage.Caption := Mes;
1404 lblMessage.Font.Color := Col;
1405 lblMessage.Visible := true;
1406 LabelTimer.Enabled := false;
1407 LabelTimer.Enabled := true;
1410 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1412 LabelTimer.Enabled := false;
1413 lblmessage.Visible := false;
1416 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1420 Str := memScript.Lines.Text;
1421 Clip := ClipBoard();
1422 Clip.SetTextBuf(PChar(Str));
1425 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1429 Str := memScript.Lines.Text;
1430 RegExp.Subst('s/\r\n//gk', Str);
1431 Clip := ClipBoard();
1432 Clip.SetTextBuf(PChar(Str));
1435 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1436 const Param: String);
1437 var HeadValue: THeadValue;
1439 HeadValue := THeadValue.Create(Param);
1442 etScript, etForceBroadcast, etUnicast: begin
1443 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1444 DispatchBottle(EventType, HeadValue);
1446 etMemberCount: begin
1447 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1449 etChannelCount: begin
1451 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1456 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1458 FBeginConnectFailCount := 0;
1459 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1460 if not Connecting then
1461 PostCommand(['Command: getChannels']);
1462 SakuraSeeker.BeginDetect;
1464 etChannelList: begin
1465 UpdateJoinChannelList(HeadValue);
1466 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1467 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1468 JoinChannelsBackup.Assign(JoinChannels);
1470 etCloseChannel: begin
1471 with JoinChannels do
1472 if IndexOf(HeadValue['Channel']) >= 0 then
1473 Delete(IndexOf(HeadValue['Channel']));
1474 with tabChannel do begin
1475 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1476 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1477 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1478 tabChannelChange(self);
1480 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1482 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1483 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1485 etForceBroadcastInformation: begin
1486 if HeadValue['Type'] = 'Vote' then begin
1487 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1488 end else if HeadValue['Type'] = 'Agree' then begin
1489 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1498 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1500 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1502 TaskTray.TipString := 'SSTP Bottle Client (' +
1503 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1505 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1507 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1510 procedure TfrmSender.actSettingExecute(Sender: TObject);
1512 Application.CreateForm(TfrmSetting, frmSetting);
1524 frmLog.UpdateWindow;
1527 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1529 if (Key = #13) or (Key = #10) then Key := Char(0);
1532 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1535 UpdateJoinChannelList(nil);
1536 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1537 if not Application.Terminated then RetryBeginConnect;
1540 procedure TfrmSender.SetSleeping(const Value: boolean);
1543 FBottleSstp.ResendSleep := Value;
1547 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1550 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]),
1551 mtWarning, mbOkCancel, 0);
1552 if Re = mrOk then begin
1554 frmLog.AllBottleOpened;
1555 frmLog.UpdateWindow;
1559 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1561 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1564 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1566 Ch: TChannelListItem;
1569 for i := 1 to Dat.IntData['Count'] do begin
1570 Ch := TChannelListItem.Create;
1571 Ch.Name := Dat[Format('CH%d_name', [i])];
1572 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1573 Ch.Info := Dat[Format('CH%d_info', [i])];
1574 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1575 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1576 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1577 ChannelList.Add(Ch);
1582 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1584 PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1587 procedure TfrmSender.NoLuidError;
1590 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1591 '
\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+
1592 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1595 procedure TfrmSender.tabChannelChange(Sender: TObject);
1597 if tabChannel.TabIndex >= 0 then begin
1598 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1599 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1604 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1605 ConstructMenu(true);
1608 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1610 with tabChannel do begin
1611 if Tabs.Count = 0 then Exit;
1612 if TabIndex=0 then TabIndex := Tabs.Count-1
1613 else TabIndex := TabIndex-1;
1615 tabChannelChange(Self);
1618 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1620 with tabChannel do begin
1621 if Tabs.Count = 0 then Exit;
1622 if TabIndex=Tabs.Count-1 then TabIndex := 0
1623 else TabIndex := TabIndex+1;
1625 tabChannelChange(Self);
1628 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1632 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1633 if nodat then Dat := THeadValue.Create('');
1635 for i := 0 to Dat.Count-1 do
1636 if Dat.KeyAt[i] = 'Entry' then begin
1637 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1638 JoinChannels.Add(RegExp[1]);
1640 with tabChannel do begin
1645 for i := 0 to JoinChannels.Count-1 do begin
1646 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1647 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1648 Tabs.Add(JoinChannels[i]);
1651 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1652 //
\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)
1654 for i := 0 to Tabs.Count-1 do
1655 if Tabs[i] = FNowChannel then TabIndex := i;
1656 if Tabs.Count > 0 then begin
1657 FNowChannel := Tabs[TabIndex];
1658 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1661 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1663 Visible := Tabs.Count > 0;
1664 if Tabs.Count > 1 then begin
1665 actNextChannel.Enabled := true;
1666 actPrevChannel.Enabled := true;
1668 actNextChannel.Enabled := false;
1669 actPrevChannel.Enabled := false;
1671 OnChange := tabChannelChange;
1673 if nodat then Dat.Free;
1674 if JoinChannels.Count = 0 then begin
1675 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1676 actSend.Enabled := false;
1678 Self.Caption := FOriginalCaption;
1679 actSend.Enabled := true;
1683 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1685 SakuraSeeker.BeginDetect;
1689 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1692 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1695 procedure TfrmSender.actSleepExecute(Sender: TObject);
1697 if actSleep.Checked then begin
1698 actSleep.Checked := false;
1699 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1701 actSleep.Checked := true;
1702 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1704 Sleeping := actSleep.Checked;
1709 procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1711 var Opt: TSstpSendOptions;
1712 Event: TBottleChainBottleEvent;
1713 Script, Sender, Ghost, Channel, ErrorMes: String;
1714 BreakFlag, NoDispatch: boolean;
1715 Sound, LogName: String;
1716 i, j, k, SkipCount: integer;
1717 Rule: TBottleChainRule;
1718 Action: TBottleChainAction;
1719 LogNameList: TStringList;
1721 ReplaceHash: THeadValue;
1724 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1725 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1726 Channel := Dat['Channel'];
1728 etScript: Sender := Channel;
1729 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1730 etUnicast: Sender := Dat['SenderUID'];
1733 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1734 if Dat['IfGhost'] <> '' then begin
1735 Ghost := Dat['IfGhost'];
1737 if ChannelList.Channel[Channel] <> nil then
1738 Ghost := ChannelList.Channel[Channel].Ghost;
1740 Dat['TargetGhost'] := Ghost;
1742 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1743 ReplaceHash := THeadValue.Create;
1744 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1745 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1746 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1747 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1748 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1749 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1750 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1751 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1752 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1754 Event := TBottleChainBottleEvent.Create;
1757 if EventType = etScript then Event.LogType := ltBottle
1758 else Event.LogType := ltSystemLog;
1760 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1761 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1762 if ErrorMes <> '' then begin
1763 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'+
1764 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1769 NoDispatch := false;
1771 LogNameList := TStringList.Create;
1774 for i := 0 to BottleChainRuleList.Count-1 do begin
1775 if SkipCount > 0 then begin
1779 Rule := BottleChainRuleList[i];
1780 if not Rule.Enabled then Continue;
1781 if not Rule.Check(Event) then Continue;
1782 for j := 0 to Rule.Actions.Count-1 do begin
1783 Action := (Rule.Actions[j] as TBottleChainAction);
1784 if Action is TBottleChainAbortRuleAction then
1786 if Action is TBottleChainSkipRuleAction then
1787 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1788 if (Action is TBottleChainSoundAction) and (Sound = '') then
1790 Sound := (Action as TBottleChainSoundAction).SoundFile;
1791 Sound := StringReplaceEx(Sound, ReplaceHash);
1793 if Action is TBottleChainNoDispatchAction then
1795 if Action is TBottleChainLogAction then
1797 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1798 LogName := (Action as TBottleChainLogAction).LogNames[k];
1799 LogName := StringReplaceEx(LogName, ReplaceHash);
1800 LogNameList.Add(LogName);
1803 if Action is TBottleChainOverrideGhostAction then
1805 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1807 if Action is TBottleChainQuitAction then
1808 Application.Terminate;
1809 if Action is TBottleChainSaveTextLogAction then
1810 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1811 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1812 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]));
1813 if Action is TBottleChainSaveXMLLogAction then
1814 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1816 if Action is TBottleChainSurfaceReplaceAction then
1817 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1819 if BreakFlag then Break;
1822 if Dat['Script'] <> '' then begin
1823 for i := 0 to LogNameList.Count-1 do
1824 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost']);
1825 if NoDispatch then begin
1826 frmLog.SetBottleState(Dat['MID'], lsOpened);
1828 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1829 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1830 Script, Ghost, Now());
1832 FBottleSstp.Push(CueItem);
1839 if Dat['DialogMessage'] <> '' then begin
1841 frmMessageBox.ShowMessage(
1842 DateTimeToStr(Now) + #13#10 +
1843 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1844 for i := 0 to LogNameList.Count-1 do
1845 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1849 if (Sound <> '') then PlaySound(Sound);
1859 procedure TfrmSender.YenETrans;
1860 var St, Le, i: integer;
1863 St := memScript.SelStart;
1864 Le := memScript.SelLength;
1865 Orig := GetScriptText;
1866 RegExp.Subst('s/(\r\n)+$//kg', Orig);
1868 with SsParser do begin
1869 LeaveEscape := true;
1870 EscapeInvalidMeta := false;
1871 InputString := Orig;
1873 for i := 0 to SsParser.Count-1 do begin
1874 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
1877 Text := Text + '\e';
1879 if Orig <> Text then memScript.Lines.Text := Text;
1880 SsParser.InputString := Text;
1882 RegExp.Subst('s/\r\n//kg', Text);
1884 memScript.SelStart := St;
1885 memScript.SelLength := Le;
1888 procedure TfrmSender.PostCommand(const Command: array of String);
1889 var PostStr: TStringList;
1894 PostStr := TStringList.Create;
1895 for i := Low(Command) to High(Command) do begin
1896 PostStr.Add(Command[i]);
1898 PostCommand(PostStr);
1904 procedure TfrmSender.PostCommand(Command: TStrings);
1905 var PostStr: String;
1908 PostStr := Command.Text;
1909 PostStr := ParamsEncode(PostStr);
1911 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
1912 if Pref.UseHttpProxy then begin
1913 FHttp.ProxyServer := Pref.ProxyAddress;
1914 FHttp.ProxyPort := Pref.ProxyPort;
1916 FHttp.OnSuccess := HttpSuccess;
1917 FHttp.OnConnectionFailed := HttpFailure;
1918 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
1921 on EHeapException do begin
1922 Connecting := false;
1928 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
1931 if frmLog.lvwLog.Selected = nil then Exit;
1932 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1933 if Log = nil then Exit;
1934 if Log.LogType <> ltBottle then Exit;
1936 'Command: voteMessage',
1938 'LUID: ' + Pref.LUID,
1944 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
1947 if frmLog.lvwLog.Selected = nil then Exit;
1948 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
1949 if Log = nil then Exit;
1950 if Log.LogType <> ltBottle then Exit;
1952 'Command: voteMessage',
1954 'LUID: ' + Pref.LUID,
1960 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
1962 if SakuraSeeker.ProcessByName[Ghost] <> nil then
1963 Result := SakuraSeeker.ProcessByName[Ghost].SetName
1968 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
1969 MousePos: TPoint; var Handled: Boolean);
1972 with tabChannel do begin
1973 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
1974 if Tag < 0 then Handled := true;
1979 procedure TfrmSender.PostSetChannel(Channels: TStrings);
1980 var PostStr: TStringList;
1983 PostStr := TStringList.Create;
1985 with PostStr do begin
1986 Add('Command: setChannels');
1987 Add('Agent: ' + VersionString);
1988 Add('LUID: ' + Pref.LUID);
1989 if Channels <> nil then
1990 for i := 0 to Channels.Count-1 do begin
1991 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
1994 PostCommand(PostStr);
2000 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
2004 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
2006 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
2007 Chs := TStringList.Create;
2009 //
\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ð
2010 //
\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é
2012 Chs.Assign(JoinChannels);
2013 while Chs.IndexOf(Ch) >= 0 do
2014 Chs.Delete(Chs.IndexOf(Ch));
2015 PostSetChannel(Chs);
2021 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
2023 ShellExecute(Handle, 'open', PChar(Pref.VotePage), nil, nil, SW_SHOW);
2026 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
2027 Shift: TShiftState; X, Y: Integer);
2031 with tabChannel do begin
2032 Index := IndexOfTabAt(X, Y);
2034 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2038 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2040 ShellExecute(Handle, 'open', PChar(Pref.HelpPage), nil, nil, SW_SHOW);
2043 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2044 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2047 with tabChannel do begin
2048 Index := IndexOfTabAt(X, Y);
2049 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2050 if Button = mbLeft then begin
2051 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2053 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2058 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2059 Y: Integer; State: TDragState; var Accept: Boolean);
2060 var TargetRect: TRect;
2063 Accept := Source = tabChannel;
2064 if not Accept then Exit;
2065 with tabChannel do begin
2066 OldDest := FDragTabDest;
2067 FDragTabDest := IndexOfTabAt(X, Y);
2068 if FDragTabDest = -1 then begin
2069 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2072 with Canvas do begin
2076 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2077 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2078 TargetRect := TabRect(OldDest);
2079 with Canvas do begin
2080 Brush.Style := bsClear;
2081 Rectangle(TargetRect.Left, TargetRect.Top,
2082 TargetRect.Right, TargetRect.Bottom);
2085 if (OldDest <> FDragTabDest) then begin
2086 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2087 TargetRect := TabRect(FDragTabDest);
2088 with Canvas do begin
2089 Brush.Style := bsClear;
2090 Rectangle(TargetRect.Left, TargetRect.Top,
2091 TargetRect.Right, TargetRect.Bottom);
2097 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2099 var DestIndex: integer;
2101 with tabChannel do begin
2102 DestIndex := IndexOfTabAt(X, Y);
2103 Tabs.Move(FDragTabIndex, DestIndex);
2107 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2110 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2111 tabChannel.Tabs.BeginUpdate;
2112 tabChannel.Tabs.EndUpdate;
2115 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2116 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2117 var AlignRight: boolean;
2120 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2121 with cbxTargetGhost do begin
2122 AlignRight := false;
2123 if Pref.HideGhosts and not FTargetGhostExpand and
2124 (Index = Items.Count-1) and (Index > 0) then
2126 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2127 Canvas.Font.Color := clWindowText;
2128 Canvas.Font.Style := [];
2130 end else if (Index > 0) then
2132 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2133 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2134 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2136 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2137 Canvas.Font.Style := [fsBold];
2140 Canvas.Font.Color := clWindowText;
2141 Canvas.Font.Style := [];
2143 if odSelected in State then
2144 Canvas.Font.Color := clHighlightText;
2148 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2149 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2150 cbxTargetGhost.Items[Index]);
2152 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2153 cbxTargetGhost.Items[Index]);
2157 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2158 var CanClose: Boolean);
2160 if not Pref.ConfirmOnExit then Exit;
2161 if MessageDlg('SSTP Bottle Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2162 mbOkCancel, 0) = mrCancel then CanClose := false;
2165 procedure TfrmSender.UpdateIfGhostBox;
2169 HiddenCount: integer;
2171 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2172 Selected := cbxTargetGhost.Text;
2174 with cbxTargetGhost do begin
2177 Items.Add(ChannelDefault);
2178 for i := 0 to SakuraSeeker.Count-1 do begin
2179 //
\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é
2180 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2181 if Pref.HideGhosts and not FTargetGhostExpand then
2182 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2187 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2188 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2190 cbxTargetGhost.ItemIndex := 0;
2191 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2192 with cbxTargetGhost do begin
2193 for i := 1 to Items.Count-1 do begin
2194 if Items[i] = Selected then
2197 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2198 if ItemIndex = 0 then begin
2199 Items.Add(Selected);
2200 ItemIndex := Items.Count - 1;
2204 if Pref.HideGhosts and not FTargetGhostExpand then
2205 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2210 procedure TfrmSender.HTTPFailure(Sender: TObject);
2214 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2215 ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2216 (Sender as THTTPDownloadThread).LastErrorMessage);
2217 Connecting := false;
2220 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2223 SakuraSeeker.BeginDetect;
2225 i := cbxTargetGhost.ItemIndex;
2229 i := cbxTargetGhost.Items.Count-1;
2230 if Pref.HideGhosts and not FTargetGhostExpand then
2233 cbxTargetGhost.ItemIndex := i;
2234 cbxTargetGhostChange(self);
2237 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2240 SakuraSeeker.BeginDetect;
2242 i := cbxTargetGhost.ItemIndex;
2244 if Pref.HideGhosts and not FTargetGhostExpand then
2246 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2249 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2251 cbxTargetGhost.ItemIndex := i;
2252 cbxTargetGhostChange(self);
2255 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2257 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2258 FTargetGhostExpand := false;
2259 if Visible then memScript.SetFocus;
2260 cbxTargetGhostChange(self);
2263 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2265 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2267 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2268 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2270 if not IdSlpp20.Connected then begin
2272 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2274 //
\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
2275 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2281 procedure TfrmSender.RetryBeginConnect;
2283 if FBeginConnectFailCount < 3 then begin
2284 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2285 FAutoAddAfterGetChannel := true;
2287 end else if FBeginConnectFailCount = 3 then begin
2288 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2289 frmMessageBox.ShowMessage(
2290 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2291 '
\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+
2292 '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'
2294 Inc(FBeginConnectFailCount);
2298 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2299 var BottleLog: TBottleLogList;
2301 Cond: TBottleLogDownloadCondition;
2303 function TimeStr(Mins: integer): String;
2304 var day, hour, min: integer;
2306 day := Mins div (60 * 24);
2307 hour := (Mins div 60) mod 24;
2310 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2311 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2312 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2315 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2317 if frmLogDownload.Execute then begin
2318 with frmLogDownload do begin
2319 if IsRange then begin
2320 if CompareDate(DateLo, DateHi) = 0 then
2321 Title := FormatDateTime('yy-mm-dd', DateLo)
2323 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2325 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2327 if Channel <> '' then Title := Title + '(' + Channel + ')';
2329 BottleLog := TBottleLogList.Create(Title);
2331 BottleLog.OnLoaded := frmLog.LogLoaded;
2332 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2333 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2334 with frmLogDownload do begin
2335 Cond.IsRange := IsRange;
2336 Cond.RecentCount := RecentCount;
2337 Cond.DateLo := DateLo;
2338 Cond.DateHi := DateHi;
2339 Cond.MinVote := MinVote;
2340 Cond.MinAgree := MinAgree;
2341 Cond.Channel := Channel;
2343 BottleLog.LoadFromWeb(Cond);
2345 FreeAndNil(BottleLog);
2347 if BottleLog <> nil then begin
2348 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2350 frmLog.tabBottleLog.TabIndex := NewIndex;
2351 frmLog.UpdateWindow;
2355 frmLogDownload.Release;
2359 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2360 Ghost: String): boolean;
2367 Cond := Token(IfGhost, ',', i);
2368 if Cond <> '' then begin
2369 if Cond[1] = '!' then begin
2370 Cond := Copy(Cond, 2, High(integer));
2371 if Cond = Ghost then Result := false;
2373 if Cond <> Ghost then Result := false;
2380 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2381 var i, j, k, count: integer;
2382 ConstData: TScriptConst;
2383 Menu1, Menu2: TMenuItem;
2386 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2387 // 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
2388 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2389 else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2391 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2392 if Simple then begin
2393 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2394 for i := Root.Count-1 downto 0 do begin
2395 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2399 //
\91S
\95\94\8dí
\8f\9c
2400 for i := Root.Count-1 downto 0 do begin
2406 for i := 0 to ScriptConstList.Count-1 do begin
2407 for j := 0 to ScriptConstList[i].Count-1 do begin
2408 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2409 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2411 // 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
2412 if Simple and (count < Root.Count) then
2413 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2417 Menu1 := TMenuItem.Create(Root);
2418 Menu1.Caption := ScriptConstList[i][j].Caption;
2419 Menu1.Hint := ScriptConstList[i][j].Caption;
2420 Menu1.AutoHotkeys := maManual;
2421 Menu1.Tag := ScriptConstList[i][j].ID;
2422 Menu1.OnClick := mnConstGroupClick;
2424 if not Simple then begin
2427 if count < Root.Count-1 then
2428 Root.Insert(count, Menu1)
2433 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2434 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2435 ConstData := ScriptConstList[i][j][k];
2436 Menu2 := TMenuItem.Create(Root);
2437 Menu2.Caption := ConstData.Caption;
2438 Menu2.Hint := ConstData.ConstText;
2439 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2440 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2441 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2442 Menu2.ShortCut := ConstData.ShortCut;
2443 Menu2.OnClick := mnConstClick;
2444 Menu2.AutoHotkeys := maManual;
2445 Menu2.Tag := ConstData.ID;
2446 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2453 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2455 //
\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
2456 if Pref.HideGhosts and not FTargetGhostExpand then
2458 with cbxTargetGhost do
2460 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2461 //
\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
2462 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2464 FTargetGhostExpand := true;
2467 DroppedDown := true;
2471 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2472 ConstructMenu(true);
2473 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2477 procedure TfrmSender.PlaySound(const FileName: String);
2479 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2481 MediaPlayer.FileName := FileName;
2485 on E: EMCIDeviceError do begin
2486 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2491 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2494 if not Assigned(frmFMOExplorer) then
2495 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2498 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2501 frmFMOExplorer.Show;
2504 procedure TfrmSender.SaveChainRuleList;
2505 var Str: TStringList;
2507 Str := TStringList.Create;
2509 Str.Text := ComponentToString(BottleChainRuleList);
2510 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2516 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2518 frmLog.SetBottleState(MID, lsOpened);
2521 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2523 frmLog.SetBottleState(MID, lsPlaying);
2526 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2527 var InsertItem: TLogItem;
2528 i, errCount, Res: integer;
2529 Log: TBottleLogList;
2530 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2532 if FBottleSstp.CueCount > 0 then begin
2533 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'+
2534 '
\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+
2535 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2536 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2539 frmLog.AllBottleOpened;
2540 if frmLog.lvwLog.Selected = nil then Exit;
2541 Log := frmLog.SelectedBottleLog;
2542 if Log = nil then Exit;
2543 FBottleSSTP.OnResendCountChange := nil;
2545 for i := frmLog.lvwLog.Selected.Index downto 0 do begin
2546 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2547 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2549 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2550 if ErrorMes <> '' then
2552 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2553 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2556 raise Exception.Create('Script Syntax Error')
2557 else if Res = mrCancel then
2561 frmLog.AllBottleOpened;
2565 if InsertItem.Ghost = '' then begin
2566 if ChannelList.Channel[InsertItem.Channel] <> nil then
2567 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2569 FBottleSSTP.Push(InsertItem);
2570 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2576 if errCount > 0 then
2577 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]));
2578 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2579 BottleSstpResendCountChange(self);
2580 frmLog.lvwLog.Invalidate;
2583 function TfrmSender.ScriptTransForSSTP(const Script: String;
2584 out Error: String): String;
2585 var TransOpt: TScriptTransOptions;
2587 if Pref.NoTransURL then
2588 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2590 TransOpt := [toConvertURL, toWaitScriptEnd];
2591 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2592 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2593 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2595 Error := DoTrans(Result, TransOpt);
2598 procedure TfrmSender.FormResize(Sender: TObject);
2601 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2602 if memScript.ColWidth <> 0 then
2606 w := Width - LeftMargin - ColWidth div 2;
2607 if ScrollBars in [ssVertical, ssBoth] then
2608 w := w - GetSystemMetrics(SM_CYVSCROLL);
2609 WrapOption.WrapByte := w div ColWidth;
2614 procedure TfrmSender.actCopyExecute(Sender: TObject);
2616 memScript.CopyToClipboard;
2619 procedure TfrmSender.actPasteExecute(Sender: TObject);
2621 memScript.PasteFromClipboard;
2624 procedure TfrmSender.actCutExecute(Sender: TObject);
2626 memScript.CutToClipboard;
2629 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2631 memScript.SelectAll;
2634 procedure TfrmSender.actUndoExecute(Sender: TObject);
2639 procedure TfrmSender.actRedoExecute(Sender: TObject);
2644 function TfrmSender.IsSurfaceTag(const Script: String;
2645 var ID: integer): boolean;
2648 if SsParser.Match(Script, '\s%d') = 3 then
2651 ID := Ord(Script[3]) - Ord('0')
2653 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2656 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2660 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2661 Shift: TShiftState; X, Y: Integer);
2665 //
\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[
2666 if not Pref.SurfacePreviewOnScriptPoint then
2668 token := memScript.TokenStringFromPos(Point(X, Y));
2669 if IsSurfaceTag(token, id) then
2671 DoSurfacePreview(id, spEditor);
2674 frmSurfacePreview.HideAway;
2678 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2679 const Kind: TSurfacePreviewType);
2684 if cbxTargetGhost.ItemIndex > 0 then
2685 ghost := cbxTargetGhost.Text
2686 else if FNowChannel <> '' then
2687 ghost := ChannelList.Channel[FNowChannel].Ghost;
2689 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2690 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2691 not (frmSurfacePreview.IsHidden) then
2698 Bmp := TBitmap.Create;
2700 if Spps.TryGetImage(ghost, Surface, Bmp) then
2704 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2706 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2708 CPos := Point(0, 0);
2710 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2711 FVisiblePreviewGhost := Ghost;
2712 FVisiblePreviewSurface := Surface;
2714 frmSurfacePreview.HideAway;
2721 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2722 {var MousePoint: TPoint;
2725 //
\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é
2726 //
\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Å
2727 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2728 {GetCursorPos(MousePoint);
2729 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2730 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2731 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2732 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2735 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2736 var MousePoint: TPoint;
2738 GetCursorPos(MousePoint);
2739 case Pref.SurfacePreviewOnScriptPointPosition of
2740 spspMainWindowRight:
2741 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2743 Result := Point(Self.Left - w, MousePoint.Y);
2747 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2749 if (Sender is TMenuItem) then
2750 FVisibleMenuItem := Sender as TMenuItem;
2753 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2755 if FScriptBuffer.Count = 0 then
2757 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2758 memScriptChange(Self);
2759 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2762 procedure TfrmSender.EditorPreview;
2763 var Ghost, Script: String;
2765 if frmEditorTalkShow <> nil then
2766 if frmEditorTalkShow.Visible then
2768 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2770 if cbxTargetGhost.ItemIndex > 0 then
2771 Ghost := cbxTargetGhost.Text
2772 else if FNowChannel <> '' then
2773 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2774 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2778 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2780 if frmEditorTalkShow <> nil then
2781 frmEditorTalkShow.Show
2784 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
2785 frmEditorTalkShow.Show;
2790 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
2791 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
2793 Spps.ClearImagePool;
2794 Spps.LoadFromDirectory(FSppDir);
2797 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
2799 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
2802 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2803 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
2804 function TfrmSender.TagReplace(Script: String; Before,
2805 After: array of String): String;
2806 var BeforeList, AfterList: TStringList;
2809 BeforeList := TStringList.Create;
2810 AfterList := TStringList.Create;
2812 for i := Low(Before) to High(Before) do
2813 BeforeList.Add(Before[i]);
2814 for i := Low(After) to High(After) do
2815 AfterList.Add(After[i]);
2816 Result := TagReplace(Script, BeforeList, AfterList);
2823 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
2824 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
2825 //
\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¢)
2826 function TfrmSender.TagReplace(Script: String; Before,
2827 After: TStrings): String;
2829 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
2835 OldStr := InputString;
2836 OldLeaveEscape := LeaveEscape;
2837 OldEscapeInvalidMeta := EscapeInvalidMeta;
2838 LeaveEscape := true;
2839 EscapeInvalidMeta := false;
2840 InputString := Script;
2842 for i := 0 to SsParser.Count-1 do
2845 for j := 0 to Before.Count-1 do
2847 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
2850 Result := Result + After[j];
2854 Result := Result + SsParser[i];
2858 LeaveEscape := OldLeaveEscape;
2859 EscapeInvalidMeta := OldEscapeInvalidMeta;
2860 InputString := OldStr;
2864 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
2865 //
\91Î
\89\9e\82·
\82é
2866 procedure TfrmSender.WndProc(var Message: TMessage);
2868 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
2870 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
2871 //
\8bC
\82Ã
\82©
\82¹
\82é
2878 //
\8c\9f\8dõ
\81E
\92u
\8a·
\83_
\83C
\83A
\83\8d\83O
\82ð
\8f\89\8aú
\89»
\82µ
\82Ä
\95\
\8e¦
2879 procedure TfrmSender.actReplaceExecute(Sender: TObject);
2881 with ReplaceDialog do
2889 //
\8c\9f\8dõ
\81E
\92u
\8a·
2890 procedure TfrmSender.ReplaceDialogFind(Sender: TObject);
2891 var Opt: TSearchOptions;
2894 if frMatchCase in ReplaceDialog.Options then
2895 Opt := Opt + [sfrMatchCase];
2896 if frWholeWord in ReplaceDialog.Options then
2897 Opt := Opt + [sfrWholeWord];
2898 memScript.Search(ReplaceDialog.FindText, Opt);
2901 //
\8c\9f\8dõ
\81E
\92u
\8a·
2902 procedure TfrmSender.ReplaceDialogReplace(Sender: TObject);
2903 var Opt: TSearchOptions;
2906 if frMatchCase in ReplaceDialog.Options then
2907 Opt := Opt + [sfrMatchCase];
2908 if frWholeWord in ReplaceDialog.Options then
2909 Opt := Opt + [sfrWholeWord];
2910 if frReplaceAll in ReplaceDialog.Options then
2911 while memScript.Search(ReplaceDialog.FindText, Opt) do
2912 memScript.SelText := ReplaceDialog.ReplaceText
2915 if memScript.Search(ReplaceDialog.FindText, Opt) then
2916 memScript.SelText := ReplaceDialog.ReplaceText
2920 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
2923 if frmLog.lvwLog.Selected = nil then Exit;
2924 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2925 if Log = nil then Exit;
2926 CopyFromLogToEditor(Log);
2929 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
2930 var Ghost, Script: String;
2933 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2934 if cbxTargetGhost.ItemIndex > 0 then
2935 Ghost := cbxTargetGhost.Text
2938 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost);
2942 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
2943 Y: Integer; State: TDragState; var Accept: Boolean);
2945 //
\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é
2946 if Source is TBottleLogDragObject then
2947 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
2950 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
2952 var Src: TBottleLogDragObject;
2955 //
\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é
2956 if not (Source is TBottleLogDragObject) then
2958 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
2960 Src := Source as TBottleLogDragObject;
2962 CopyFromLogToEditor(Log);
2965 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
2967 if Log.LogType <> ltBottle then Exit;
2968 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Ä)
2969 memScript.Lines.Clear;
2970 memScript.Lines.Add(Log.Script);
2971 if Log.Ghost <> '' then
2973 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
2974 //
\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Å
2975 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
2976 cbxTargetGhost.Items.Add(Log.Ghost);
2977 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
2979 cbxTargetGhost.Invalidate;
2981 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
2985 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
2987 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
2988 if frmLog.SelectedBottleLog = nil then
2990 if frmLog.lvwLog.Selected = nil then
2992 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
2993 frmLog.UpdateWindow;
2994 frmLog.lvwLogChange(Self, nil, ctState);
2997 procedure TfrmSender.ClearEditor;
2998 var TmpScript: String;
3000 DoSaveBuffer: boolean;
3001 SavedScript: TStringList;
3003 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
3004 //
\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é
3005 DoSaveBuffer := false;
3006 if FScriptBuffer.Count = 0 then
3007 DoSaveBuffer := true
3008 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
3009 DoSaveBuffer := true;
3010 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
3011 DoSaveBuffer := false;
3012 if DoSaveBuffer then
3014 SavedScript := TStringList.Create;
3015 SavedScript.Text := GetScriptText;
3016 FScriptBuffer.Insert(0, SavedScript);
3018 if FScriptBuffer.Count >= 4 then
3019 FScriptBuffer.Delete(FScriptBuffer.Count-1);
3020 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
3022 TmpScript := Pref.DefaultScript;
3023 Position := Pos('|', TmpScript);
3024 if Position < 1 then Position := 1;
3025 TmpScript := StringReplace(TmpScript, '|', '', []);
3026 memScript.Lines.Text := TmpScript;
3027 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
3028 memScript.SelStart := Position-1;
3030 if Visible then memScript.SetFocus;
3031 FScriptModified := false;
3032 memScriptChange(self);
3035 procedure TfrmSender.AppendTextLog(const FileName, Line: String);
3039 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3041 ForceDirectories(ExtractFileDir(FileName));
3042 AssignFile(F, FileName);
3043 if FileExists(FileName) then
3052 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3056 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3061 Impl: TDomImplementation;
3062 Parser: TXmlToDomParser;
3065 try // Long try block to handle all kinds of exception in this method
3066 if not FileExists(FileName) then
3068 // Create empty XML log file
3069 Impl := TDomImplementation.create(nil);
3071 ForceDirectories(ExtractFileDir(FileName));
3072 Parser := TXmlToDomParser.create(nil);
3073 Parser.DOMImpl := Impl;
3076 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3079 documentElement.setAttribute('saved',
3080 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3081 documentElement.setAttribute('generator', VersionString);
3082 documentElement.setAttribute('version', '1.0');
3084 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3085 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3087 DOM.writeCodeAsShiftJIS(F);
3092 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3095 Parser.DOMImpl.freeDocument(DOM);
3102 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3108 F.Seek(P, soFromEnd);
3110 if Buf = '</bottlelog>' then
3115 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3118 F.Seek(P, soFromEnd);
3119 Buf := Format('<message mid="%s">', [Args['MID']]);
3120 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3121 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3122 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3123 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3124 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3125 Buf := Buf + '</message>';
3126 Buf := Buf + '</bottlelog>';
3127 F.Write(Buf[1], Length(Buf));
3134 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3138 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3143 SelText := memScript.SelText;
3144 if SelText <> '' then
3146 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3149 memScriptChange(Self);
3153 function TfrmSender.ReplaceSurface(Script: String;
3154 Params: TCollection): String;
3156 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3157 OldStr, Tag: String;
3158 i, j, k, Cur: integer;
3159 Item: TSurfaceReplaceItem;
3160 Before: TSurfaceReplaceBeforeItem;
3166 OldStr := InputString;
3167 OldLeaveEscape := LeaveEscape;
3168 OldEscapeInvalidMeta := EscapeInvalidMeta;
3169 LeaveEscape := true;
3170 EscapeInvalidMeta := false;
3171 InputString := Script;
3173 for i := 0 to SsParser.Count-1 do
3175 if SsParser.MarkUpType[i] <> mtTag then
3177 Result := Result + SsParser.Str[i];
3180 Tag := SsParser.Str[i];
3181 if SsParser.Match(Tag, '\s%d') = 2 then
3182 Cur := Ord(Tag[3]) - Ord('0')
3183 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3184 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3187 Result := Result + Tag;
3191 for j := 0 to Params.Count-1 do
3193 Item := Params.Items[j] as TSurfaceReplaceItem;
3194 for k := 0 to Item.Before.Count-1 do
3196 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3197 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3200 Result := Result + Format('\s[%d]', [Item.After]);
3208 Result := Result + Tag;
3212 LeaveEscape := OldLeaveEscape;
3213 EscapeInvalidMeta := OldEscapeInvalidMeta;
3214 InputString := OldStr;