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, DirectSstp,
13 // IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdSLPP20,
14 SsParser, ImgList, AppEvnts, TaskTray, StdActns,
15 ActnList, MPlayer, MenuBar, ToolWin,
16 IniFiles, ExtCtrls, ShellAPI, Contnrs,
17 ConstEditor, Buttons, Clipbrd, HeadValue, Logs, MultipleChoiceEditor,
18 // IdException, HttpThread, IdHTTP, LogDownload,
19 ScriptConsts, DateUtils, BottleChainRule, BottleChainEvent,
20 SakuraSeekerInstance, HEditor, HTSearch, heClasses, heFountain,
21 SakuraScriptFountain, SppList, SurfacePreview, XDOM_2_3_J3, SsPlayTime,
22 RegexUtils, StrReplace, StrReplaceDialog, ReplacePresetEditor;
25 TSurfacePreviewType = (spHint, spEditor);
27 TfrmSender = class(TForm)
31 mnRegister: TMenuItem;
34 StatusBar: TStatusBar;
37 mnEditConst: TMenuItem;
38 ActionList: TActionList;
40 mnPopPaste: TMenuItem;
43 mnPopSelectAll: TMenuItem;
45 mnPopConst: TMenuItem;
50 mnSelectAll: TMenuItem;
52 ApplicationEvents: TApplicationEvents;
53 mnPopUpTaskTray: TPopupMenu;
54 mnTaskStart: TMenuItem;
56 mnTaskRestore: TMenuItem;
57 mnTaskNewMessage: TMenuItem;
61 mnTaskExit: TMenuItem;
69 mnPopupConst: TPopupMenu;
70 actEditConst: TAction;
72 mnShowToolBar: TMenuItem;
73 mnShowConstBar: TMenuItem;
74 ConstBarMenu: TMainMenu;
76 tbtnClear: TToolButton;
77 tbtnConfirm: TToolButton;
78 tbtnSend: TToolButton;
79 tbtnSeparator: TToolButton;
80 tbtnStart: TToolButton;
81 tbtnSeparator2: TToolButton;
82 tbtnInsertConst: TToolButton;
83 ConstMenuBar: TMenuBar;
88 actCopyAllNoReturn: TAction;
89 mnCopyAllNoReturn: TMenuItem;
90 mnPopCopyAll: TMenuItem;
91 mnPopCopyAllNoReturn: TMenuItem;
93 tbtnSetting: TToolButton;
94 mnStayOnTop: TMenuItem;
96 actExitClient: TAction;
98 tbtnEditConst: TToolButton;
99 actClearBottles: TAction;
100 mnClearBottles: TMenuItem;
101 MediaPlayer: TMediaPlayer;
102 mnGetNewId: TMenuItem;
103 actNextChannel: TAction;
104 actPrevChannel: TAction;
106 mnNextChannel: TMenuItem;
107 mnPrevChannel: TMenuItem;
110 tbtnShowLog: TToolButton;
111 tbtnSleep: TToolButton;
115 mnTaskSleep: TMenuItem;
117 tabChannel: TTabControl;
120 cbxTargetGhost: TComboBox;
121 actVoteMessage: TAction;
122 mnPopUpChannelTab: TPopupMenu;
123 mnLeaveThisChannel: TMenuItem;
125 mnGotoVote: TMenuItem;
126 mnGoToHelp: TMenuItem;
130 mnExitAllChannels: TMenuItem;
131 actAgreeMessage: TAction;
133 actPrevGhost: TAction;
134 actNextGhost: TAction;
135 mnPrevGhost: TMenuItem;
136 mnNextGhost: TMenuItem;
137 actResetGhost: TAction;
138 mnResetGhost: TMenuItem;
139 DirectSstp: TDirectSstp;
140 actDownloadLog: TAction;
141 actFMOExplorer: TAction;
142 tbtnFMOExplorer: TToolButton;
143 mnFMOExplorer: TMenuItem;
145 actInsertCue: TAction;
146 SakuraScriptFountain: TSakuraScriptFountain;
151 actSelectAll: TAction;
152 actRecallScriptBuffer: TAction;
154 mnRecallScriptBuffer: TMenuItem;
155 tbtnEditorPreview: TToolButton;
156 actEditorPreview: TAction;
157 mnEditorPreview: TMenuItem;
158 actResetPlugins: TAction;
160 mnResetPlugins: TMenuItem;
163 mnReplace: TMenuItem;
164 actSendToEditor: TAction;
165 actSendToLogWindow: TAction;
166 mnSendLogWindow: TMenuItem;
167 actDeleteLogItem: TAction;
169 actEditCopy: TEditCopy;
170 tbtnSendToLogWindow: TToolButton;
171 SsPlayTime: TSsPlayTime;
177 ScriptBackUp: TTimer;
178 mnPresetReplaceRoot: TMenuItem;
179 OpenDialog: TOpenDialog;
180 mnFileOpen: TMenuItem;
181 actFileOpen: TAction;
182 actFileSaveAs: TAction;
184 SaveDialog: TSaveDialog;
187 actFileSave: TAction;
188 procedure actConfirmExecute(Sender: TObject);
189 procedure FormCreate(Sender: TObject);
190 procedure FormDestroy(Sender: TObject);
191 procedure actSendExecute(Sender: TObject);
192 // procedure HTTPSuccess(Sender: TObject);
193 // procedure HTTPFailure(Sender: TObject);
194 procedure actStartClick(Sender: TObject);
195 procedure actStopExecute(Sender: TObject);
196 procedure FormShow(Sender: TObject);
197 procedure actAboutClick(Sender: TObject);
198 procedure actExitClientExecute(Sender: TObject);
199 procedure actClearExecute(Sender: TObject);
200 procedure memScriptChange(Sender: TObject);
201 procedure mnStayOnTopClick(Sender: TObject);
202 procedure actEditConstExecute(Sender: TObject);
203 procedure mnTaskBarClick(Sender: TObject);
204 procedure FormClose(Sender: TObject; var Action: TCloseAction);
205 procedure ApplicationEventsMinimize(Sender: TObject);
206 procedure ApplicationEventsRestore(Sender: TObject);
207 procedure mnTaskRestoreClick(Sender: TObject);
208 procedure TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
209 procedure FormActivate(Sender: TObject);
210 procedure mnTaskNewMessageClick(Sender: TObject);
211 procedure ApplicationEventsHint(Sender: TObject);
212 procedure memScriptKeyDown(Sender: TObject; var Key: Word;
214 procedure mnShowToolBarClick(Sender: TObject);
215 procedure mnShowConstBarClick(Sender: TObject);
216 procedure mnGoToHPClick(Sender: TObject);
217 procedure LabelTimerTimer(Sender: TObject);
218 procedure actCopyAllExecute(Sender: TObject);
219 procedure actCopyAllNoReturnExecute(Sender: TObject);
220 // procedure Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
221 // const Param: String);
222 procedure actSettingExecute(Sender: TObject);
223 procedure memScriptKeyPress(Sender: TObject; var Key: Char);
224 // procedure Slpp20Disconnect(Sender: TObject);
225 procedure actClearBottlesExecute(Sender: TObject);
226 procedure SakuraSeekerDetectResultChanged(Sender: TObject);
227 procedure mnGetNewIdClick(Sender: TObject);
228 procedure tabChannelChange(Sender: TObject);
229 procedure actPrevChannelExecute(Sender: TObject);
230 procedure actNextChannelExecute(Sender: TObject);
231 procedure cbxTargetGhostDropDown(Sender: TObject);
232 procedure actShowLogExecute(Sender: TObject);
233 procedure actSleepExecute(Sender: TObject);
234 procedure actVoteMessageExecute(Sender: TObject);
235 procedure tabChannelContextPopup(Sender: TObject; MousePos: TPoint;
236 var Handled: Boolean);
237 procedure mnLeaveThisChannelClick(Sender: TObject);
238 procedure mnGotoVoteClick(Sender: TObject);
239 procedure tabChannelMouseMove(Sender: TObject; Shift: TShiftState; X,
241 procedure mnGoToHelpClick(Sender: TObject);
242 procedure tabChannelMouseDown(Sender: TObject; Button: TMouseButton;
243 Shift: TShiftState; X, Y: Integer);
244 procedure tabChannelDragOver(Sender, Source: TObject; X, Y: Integer;
245 State: TDragState; var Accept: Boolean);
246 procedure tabChannelDragDrop(Sender, Source: TObject; X, Y: Integer);
247 procedure tabChannelEndDrag(Sender, Target: TObject; X, Y: Integer);
248 procedure cbxTargetGhostDrawItem(Control: TWinControl; Index: Integer;
249 Rect: TRect; State: TOwnerDrawState);
250 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
251 procedure actAgreeMessageExecute(Sender: TObject);
252 procedure actPrevGhostExecute(Sender: TObject);
253 procedure actNextGhostExecute(Sender: TObject);
254 procedure actResetGhostExecute(Sender: TObject);
255 // procedure timDisconnectCheckTimerTimer(Sender: TObject);
256 procedure actDownloadLogExecute(Sender: TObject);
257 procedure cbxTargetGhostChange(Sender: TObject);
258 procedure actFMOExplorerExecute(Sender: TObject);
259 //
\8eÀ
\8dÛ
\82Ì
\8f\88\97\9d\82ÍLogInsertCue
\82Ö
\88Ú
\93®
260 procedure actInsertCueExecute(Sender: TObject);
261 procedure FormResize(Sender: TObject);
262 procedure actCopyExecute(Sender: TObject);
263 procedure actPasteExecute(Sender: TObject);
264 procedure actCutExecute(Sender: TObject);
265 procedure actSelectAllExecute(Sender: TObject);
266 procedure memScriptMouseMove(Sender: TObject; Shift: TShiftState; X,
268 procedure actRecallScriptBufferExecute(Sender: TObject);
269 procedure actEditorPreviewExecute(Sender: TObject);
270 procedure actResetPluginsExecute(Sender: TObject);
271 // procedure IdSLPP20Connect(Sender: TObject);
272 procedure actReplaceExecute(Sender: TObject);
273 procedure actSendToEditorExecute(Sender: TObject);
274 procedure actSendToLogWindowExecute(Sender: TObject);
275 procedure memScriptDragOver(Sender, Source: TObject; X, Y: Integer;
276 State: TDragState; var Accept: Boolean);
277 procedure memScriptDragDrop(Sender, Source: TObject; X, Y: Integer);
278 procedure actDeleteLogItemExecute(Sender: TObject);
279 procedure memScriptSelectionChange(Sender: TObject; Selected: Boolean);
280 procedure actUndoExecute(Sender: TObject);
281 procedure actRedoExecute(Sender: TObject);
282 // procedure IdSLPP20ConnectFailed(Sender: TObject);
283 procedure ScriptBackUpTimer(Sender: TObject);
284 procedure actFileOpenExecute(Sender: TObject);
285 procedure actFileSaveAsExecute(Sender: TObject);
286 procedure actFileSaveExecute(Sender: TObject);
288 FSleeping: boolean; //
\94z
\91\97\83X
\83\8a\81[
\83v
\92\86\82©
\82Ç
\82¤
\82©
290 // FConnecting: boolean;
292 FBooted: boolean; //
\8f\89\89ñ
\8bN
\93®
\92Ê
\90M
\97p
293 FEndSession: Boolean; // Windows
\8fI
\97¹
\82ð
\8c\9f\92m
\82µ
\82Ätrue
\82É
\82È
\82é
294 FOriginalCaption: String;
295 // FAutoAddAfterGetChannel: boolean; //
\83`
\83\83\83\93\83l
\83\8b\8eæ
\93¾
\8cã
\82É
\83_
\83C
\83A
\83\8d\83O
\82È
\82µ
\82É
296 //
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82·
\82é
\82©
\82Ç
\82¤
\82©
300 // FNowChannel: String; //
\8c»
\8dÝ
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b
301 // JoinChannelsBackup: TStringList; //
\88ê
\8e\9e\8eg
\97p
303 // FScriptModified: boolean; //
\83X
\83N
\83\8a\83v
\83g
\82ª
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\81B
304 // //
\83\8d\81[
\83J
\83\8b\8am
\94F
\8b
\90§
\97p
\83t
\83\89\83O
\81BTRichEdit.Modified
\82Í
305 // //
\95Ê
\82Ì
\97p
\93r
\82Å
\8eg
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8eg
\82¦
\82È
\82¢
307 FScriptBackModified: boolean; //
\83X
\83N
\83\8a\83v
\83g
\8e©
\93®
\95Û
\91¶
\83t
\83\89\83O
308 FFileModified: boolean; //
\83t
\83@
\83C
\83\8b\93à
\97e
\82ª
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\81B
309 FFileName: string; //
\90V
\8bK
\82©
\8aù
\91¶
\83t
\83@
\83C
\83\8b\82Ì
\94»
\92f
\81A
\82Ü
\82½
\82Í
\8aù
\91¶
\83t
\83@
\83C
\83\8b\82Ì
\8fê
\8f\8a
311 // FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
312 // 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)
314 FBottleSstp: TBottleSstp; //
\8dÄ
\91\97\83v
\83\8d\83O
\83\89\83\80
316 // 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Ý)
317 // FBeginConnectFailCount: integer; //
\89½
\93x
\82à
\90Ú
\91±
\8e¸
\94s
\82µ
\82½
\82ç
\83\8a\83g
\83\89\83C
\92\86\8e~
319 FVisiblePreviewGhost: String;
320 FVisiblePreviewSurface: integer; //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82Å
\8c©
\82¦
\82Ä
\82¢
\82é
\82à
\82Ì
321 FVisibleMenuItem: TMenuItem; //
\83N
\83\8a\83b
\83N
\82³
\82ê
\82½
\83\81\83j
\83\85\81[
\83A
\83C
\83e
\83\80\81B
322 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82ª
\83\81\83j
\83\85\81[
\82Ì
\89º
\82É
323 //
\89B
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\8bL
\89¯
\82µ
\82Ä
\82¨
\82
325 FTargetGhostExpand: boolean; //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ª
\81A
326 //
\88ê
\8e\9e\93I
\82É
\91S
\95\94\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\82Ì
\83t
\83\89\83O
328 FScriptBuffer: TObjectList; //
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
330 FWM_TaskBarCreated: WORD; //
\83^
\83X
\83N
\83o
\81[
\93o
\98^
\97p
\83E
\83B
\83\93\83h
\83E
\83\81\83b
\83Z
\81[
\83WID
332 // procedure SetStatusText(const Value: String);
333 procedure SetSleeping(const Value: boolean);
335 // procedure SetConnecting(const Value: boolean);
336 // procedure SetAdded(const Value: boolean);
337 procedure mnConstClick(Sender: TObject);
338 procedure mnConstGroupClick(Sender: TObject);
339 procedure mnPresetReplaceClick(Sender: TObject);
340 // property Added: boolean read FAdded write SetAdded;
341 property Sleeping: boolean read FSleeping write SetSleeping;
342 // property StatusText: String read FStatusText write SetStatusText;
343 function GetScriptText: String;
344 procedure ChangeTaskIcon;
345 procedure ShowHintLabel(const Mes: String; Col: TColor = clBlue);
346 procedure UpdateLayout;
347 // procedure DispatchBottle(EventType: TIdSlppEventType; Dat: THeadValue);
348 procedure DispatchBottle(Dat: THeadValue; LogTime: TDateTime;
349 Vote, Agree: integer);
350 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
351 // procedure UpdateChannelInfo(Dat: THeadValue);
352 // procedure UpdateJoinChannelList(Dat: THeadValue);
353 procedure UpdateJoinChannelList;
354 procedure UpdateChannelList;
355 // procedure NoLuidError;
356 procedure UpdateIfGhostBox;
357 function BuildMenuConditionCheck(const IfGhost, Ghost: String): boolean;
358 procedure BuildMenu(Root: TMenuItem; Simple: boolean);
359 procedure BuildReplaceMenu(Root: TMenuItem);
360 procedure PlaySound(const FileName: String);
361 //TBottleSstp
\8aÖ
\8cW
\83C
\83x
\83\93\83g
\83n
\83\93\83h
\83\89
362 procedure BottleSstpResendCountChange(Sender: TObject);
363 procedure BottleSstpResendTrying(Sender: TObject; MID: String);
364 procedure BottleSstpResendEnd(Sender: TObject; MID: String);
365 function IsSurfaceTag(const Script: String; var ID: integer): boolean;
366 procedure DoSurfacePreview(Surface: integer; const Kind:
367 TSurfacePreviewType);
368 function GetSurfacePreviewPositionHint(w, h: integer): TPoint;
369 function GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
370 procedure EditorPreview;
371 //
\83^
\83O
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\95Ï
\8a·
\82·
\82é
372 function TagReplace(Script: String;
373 Before, After: array of String): String; overload;
374 function TagReplace(Script: String;
375 Before, After: TStrings): String; overload;
376 //
\83T
\81[
\83t
\83B
\83X
\82ð
\95Ï
\8a·
\82·
\82é
377 function ReplaceSurface(Script: String; Params: TCollection): String;
378 procedure ClearEditor;
379 procedure CopyFromLogToEditor(Log: TLogItem);
381 procedure AppendTextLog(const FileName, Line: String; FAppend: boolean);
382 procedure AppendXMLLog(const FileName: String; Args: THeadValue);
383 //
\8e©
\93®
\95Û
\91¶
\90Ý
\92è
384 procedure SetScriptAutoBackUp;
385 //
\92P
\91Ì
\83t
\83@
\83C
\83\8b\93ü
\8fo
\97Í
\8aÖ
\8cW
386 procedure PerformFileOpen(const AFileName: string);
387 procedure PerformFileSave(const AFileName: string);
388 procedure SetFileName(const FileName: String; const Value: boolean);
389 function CheckFileModified(Sender: TObject): integer;
390 function FileSave(Sender: TObject): integer;
391 function FileSaveAs(Sender: TObject): integer;
392 procedure EditerStatusChange;
393 procedure SetFileModified(const Value: boolean);
394 function CheckFileExt(const AFileName: string): boolean;
397 procedure WndProc(var Message: TMessage); override;
398 procedure WMQueryEndSession(var msg: TWMQueryEndSession);
399 message WM_QUERYENDSESSION;
401 procedure CopyDataMessage(var WMCopyData: TWMCopyData); message WM_COPYDATA;
404 function DoTrans(var Script: String;
405 Options: TScriptTransOptions): String; overload;
406 function DoTrans(var Script: String;
407 Options: TScriptTransOptions; out FoundURL: boolean): String; overload;
408 function ScriptTransForSSTP(const Script: String;
409 out Error: String): String; overload;
410 // procedure BeginConnect;
411 // procedure RetryBeginConnect;
412 // procedure EndConnect;
413 procedure ConstructMenu(Simple: boolean);
414 // property Connecting: boolean read FConnecting write SetConnecting;
415 property BottleSstp: TBottleSstp read FBottleSstp;
416 function GhostNameToSetName(const Ghost: String): String;
417 // procedure PostCommand(const Command: array of String); overload;
418 // procedure PostCommand(Command: TStrings); overload;
419 // procedure PostSetChannel(Channels: TStrings);
420 procedure SaveChainRuleList;
421 //DispatchBottle()
\82Ö
\83o
\83C
\83p
\83X
422 procedure BottleCnv(Log: TLogItem);
423 //
\83u
\83\89\83E
\83U
\94»
\92f
\82ÆURL
\88ø
\93n
\82µ
424 procedure OpenBrowser(const Url: string);
425 //Log
\83E
\83B
\83\93\83h
\83E
\82©
\82ç
\8fð
\8c\8f\95t
\82Å
\8cÄ
\82Î
\82ê
\82é
426 procedure LogInsertCue(TestAction: boolean);
431 frmSender: TfrmSender;
434 PanelConnecting = 0; //
\81u
\90Ú
\91±
\92\86\81v
\95\
\8e¦
\97p
435 PanelBytes = 1; //
\81\9b\81\9b\83o
\83C
\83g
436 PanelCount = 2; //Local Proxy
\81A
\8c»
\8dÝ
\81\9b\8c\8f\91Ò
\82¿
437 PanelMembers = 3; //
\81\9b\81\9b\90l
438 PanelStatus = 4; //SSTP Bottle
\83T
\81[
\83o
\82É
\93o
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81c
\82È
\82Ç
441 IconDisconnected = 47; //
\8b\8c18
\8e¸
\94s
\8fó
\91Ô
\82ð
\8fí
\82É
\8eg
\97p
443 IconSleepDisconnected = 47; //
\8b\8c20
445 WarningColor = clRed;
447 SendButtonLongHint = 'Bottle
\82Ì
\91\97\90M';
448 NewFileTitle = '
\96¼
\8fÌ
\96¢
\92è'; //
\90V
\8bK
\83^
\83C
\83g
\83\8b
449 AutoSaveFile = 'Script.bak'; // FileCheck
\8ew
\92è
\82Ì
\8ag
\92£
\8eq
\82ð
\8eg
\82¤
451 function Token(const Str: String; const Delimiter: char;
452 const Index: integer): String;
454 function StringReplaceEx(const Before: String; List: THeadValue): String;
458 uses SettingForm, LogForm,
459 MessageBox, FMOExplorer, EditorTalkShow;
460 //SendConfirm, ChannelListForm,
464 //
\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
465 function Token(const Str: String; const Delimiter: char;
466 const Index: integer): String;
467 var i, c, len: integer;
473 while i <= len do begin
474 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
476 if c > Index then Break;
477 end else if c = Index then Result := Result + Str[i];
482 //
\95¶
\8e\9a\97ñ
\82ð
\92u
\82«
\8a·
\82¦
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
483 function StringReplaceEx(const Before: String; List: THeadValue): String;
485 i, MinPos, MinKey, p: integer;
494 for i := 0 to List.Count-1 do
496 p := Pos(List.KeyAt[i], Work);
497 if (p > 0) and ((p < MinPos) or (MinPos < 0)) then
505 Result := Result + Work;
509 Result := Result + Copy(Work, 1, MinPos-1) + List.ValueAt[MinKey];
510 Delete(Work, 1, (MinPos - 1) + Length(List.KeyAt[MinKey]));
517 procedure TfrmSender.actConfirmExecute(Sender: TObject);
519 AScript, Err, AGhost: String;
523 // Partial Confirmation
524 if memScript.SelText <> '' then
527 if not Pref.AutoPartialConfirm then
528 if not MultipleChoiceEdit('
\8am
\94F', ['
\91I
\91ð
\95\94\95ª
\82Ì
\82Ý', '
\83X
\83N
\83\8a\83v
\83g
\91S
\91Ì'], Choice) then
532 AScript := memScript.SelText;
533 AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
535 AScript := GetScriptText;
537 AScript := GetScriptText;
538 AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
540 if Length(AScript) = 0 then Exit;
542 AScript := ScriptTransForSSTP(AScript, Err);
549 if cbxTargetGhost.ItemIndex > 0 then
550 AGhost := cbxTargetGhost.Text
551 {
\95K
\82¸
\8ew
\92è
\82³
\82ê
\82é
\82Í
\82¸
552 else if FNowChannel <> '' then
553 AGhost := ChannelList.Channel[FNowChannel].Ghost
558 if Pref.IgnoreTimeCritical then
559 AScript := TagReplace(AScript, ['\t'], ['']);
561 Item := TLogItem.Create;
567 Channel := '
\81y
\8am
\94F
\81z';
570 BottleSstp.Unshift(Item);
575 // FScriptModified := false;
578 procedure TfrmSender.FormCreate(Sender: TObject);
579 var Str: TStringList;
581 FScriptBuffer := TObjectList.Create(true);
583 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
584 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
585 ScriptConstList.LoadFromDir(FConstDir);
586 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
587 Spps.LoadFromDirectory(FSppDir);
588 ConstructMenu(false);
589 BuildReplaceMenu(mnPresetReplaceRoot);
591 Str := TStringList.Create;
594 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
595 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
598 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
599 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
601 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');
602 Application.Terminate;
603 Application.ProcessMessages;
611 FOriginalCaption := Self.Caption;
614 mnShowToolBar.Checked := Pref.ShowToolBar;
615 mnShowConstBar.Checked := Pref.ShowConstBar;
616 if Pref.StayOnTop then begin
617 FormStyle := fsStayOnTop;
618 mnStayOnTop.Checked := true;
620 FormStyle := fsNormal;
621 mnStayOnTop.Checked := false;
624 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
625 mnGoToHP.Hint := Pref.HomePage;
626 mnGotoVote.Hint := Pref.VotePage;
627 mnGotoHelp.Hint := Pref.HelpPage;
629 mnGetNewId.Enabled := (Pref.LUID = '');
631 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
633 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
634 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
636 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
637 Application.Terminate;
640 //
\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è
641 SsPlayTime.PlayTimeParams := Pref.PlayTimeParams;
643 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
644 with Pref.SenderWindowPosition do begin
647 Self.Width := Right - Left + 1;
648 Self.Height := Bottom - Top + 1;
651 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
652 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
654 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
655 actClearExecute(Sender);
656 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
658 //
\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»)
659 // UpdateJoinChannelList(nil);
661 UpdateJoinChannelList;
663 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
664 FBottleSstp := TBottleSstp.Create(false);
665 with FBottleSstp do begin
666 OnResendCountChange := BottleSstpResendCountChange;
667 OnResendTrying := BottleSstpResendTrying;
668 OnResendEnd := BottleSstpResendEnd;
672 procedure TfrmSender.FormDestroy(Sender: TObject);
674 if FScriptBuffer <> nil then
677 if FBottleSstp <> nil then begin
678 FBottleSstp.Terminate;
682 with Pref.SenderWindowPosition do begin
685 Right := Self.Left + Self.Width - 1;
686 Bottom := Self.Top + Self.Height - 1;
689 // if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
691 ScriptConstList.Save;
694 BottleChainRuleList.Free;
700 procedure TfrmSender.SetConnecting(const Value: boolean);
702 FConnecting := Value;
704 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
705 actStart.Enabled := false;
706 actStop.Enabled := false;
707 actSend.Enabled := false;
708 actVoteMessage.Enabled := false;
709 actAgreeMessage.Enabled := false;
710 mnGetNewId.Enabled := false;
711 Screen.Cursor := crAppStart;
713 StatusBar.Panels[PanelConnecting].Text := '';
714 actStart.Enabled := true;
715 actStop.Enabled := true;
716 actSend.Enabled := true;
717 frmLog.lvwLogChange(Self, nil, ctState);
718 mnGetNewId.Enabled := Pref.LUID = '';
719 Screen.Cursor := crDefault;
724 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
725 procedure TfrmSender.actSendExecute(Sender: TObject);
727 Talk, AGhost: String;
728 // Command: TStringList;
734 if not Pref.SendAction then
736 ShowHintLabel('
\93®
\8dì
\82ª
\96¢
\90Ý
\92è
\82Å
\82·');
739 if Length(GetScriptText) = 0 then
741 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
746 if Pref.LUID = '' then begin
750 if tabChannel.TabIndex < 0 then begin
751 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
752 '
\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');
755 if ChannelList.Channel[FNowChannel].NoPost then begin
757 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
763 Talk := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
764 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
767 MessageDlg(Err, mtWarning, [mbOk], 0);
772 if Pref.NeedConfirmBeforeSend and FScriptModified then
774 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
778 if not Pref.NoConfirm then begin
779 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
784 if cbxTargetGhost.ItemIndex > 0 then AGhost := cbxTargetGhost.Text;
785 //
\92P
\91Ì
\83A
\83N
\83V
\83\87\83\93
786 Item := TLogItem.Create;
802 ShowHintLabel('[local]
\82Ö
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
805 Command := TStringList.Create;
807 with Command do begin
808 Add('Command: sendBroadcast');
809 Add('Channel: ' + FNowChannel);
810 Add('LUID: ' + Pref.LUID);
811 Add('Agent: ' + VersionString);
812 if Ghost <> '' then Add('Ghost: ' + Ghost);
813 Add('Talk: ' + Talk);
815 PostCommand(Command);
820 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
821 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
822 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
826 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
833 procedure TfrmSender.BeginConnect;
835 if Pref.LUID = '' then begin
839 IdSlpp20.LUID := Pref.LUID;
840 self.Cursor := crHourGlass;
841 if IdSlpp20.Connected then IdSlpp20.Disconnect;
842 if Pref.UseHttpProxy then begin
843 IdSlpp20.Host := Pref.ProxyAddress;
844 IdSlpp20.Port := Pref.ProxyPort;
845 IdSlpp20.ProxyMode := true;
847 IdSlpp20.Host := Pref.BottleServer;
848 IdSlpp20.Port := Pref.BottleServerPort;
849 IdSlpp20.ProxyMode := false;
851 IdSlpp20.ConnectServer;
852 self.Cursor := crDefault;
857 procedure TfrmSender.EndConnect;
859 IdSlpp20.OnDisconnect := nil;
865 procedure TfrmSender.SetAdded(const Value: boolean);
867 if FAdded = Value then Exit;
870 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
873 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
875 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
881 procedure TfrmSender.HTTPSuccess(Sender: TObject);
882 var Str, ResStr, Command: String;
883 HeadValue: THeadValue;
885 SetChannel: TStringList;
888 Str := (Sender as THttpDownloadThread).RecvString;
892 HeadValue := THeadValue.Create(Str);
895 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89ð
\90Í
\82Å
\82«
\82È
\82¢
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
898 Command := HeadValue['Command'];
899 ResStr := HeadValue['Result'];
900 if ResStr = 'Err' then begin
901 if HeadValue['ExtraMessage'] <> '' then begin
903 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
904 HeadValue['ExtraMessage']);
907 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
910 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
911 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
912 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
913 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
914 if Pref.ResetIfGhostAfterSend then begin
915 actResetGhostExecute(Self);
917 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
918 if Pref.ClearAfterSend then begin
921 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
922 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
924 if (Command = 'getNewId') then begin
925 if ResStr = 'OK' then begin
926 Pref.LUID := HeadValue['NewID'];
927 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
928 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
929 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
930 'LUID: ' + Pref.LUID + #13#10 +
931 '
\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' +
932 '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' +
933 '
\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');
934 mnGetNewId.Enabled := false;
937 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
940 if (Command = 'voteMessage') then begin
941 if ResStr = 'OK' then begin
942 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
945 if (Command = 'getChannels') and (ResStr = 'OK') then begin
946 UpdateChannelInfo(HeadValue);
949 if FAutoAddAfterGetChannel then begin
950 SetChannel := TStringList.Create;
951 if JoinChannelsBackup <> nil then begin
952 //
\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
953 SetChannel.Assign(JoinChannelsBackup);
955 //
\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¾
956 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
957 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
958 SetChannel.Add(Pref.AutoJoinChannels[i]);
962 Application.CreateForm(TfrmChannelList, frmChannelList);
964 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
965 SetChannel := TStringList.Create;
966 SetChannel.Assign(frmChannelList.JoinList);
969 frmChannelList.Release;
972 if SetChannel <> nil then PostSetChannel(SetChannel);
974 if SetChannel <> nil then FreeAndNil(SetChannel);
977 if (Command = 'setChannels') then begin
978 if ResStr <> 'OK' then begin
980 frmMessageBox.ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½
\81B
\82à
\82¤
\88ê
\93x
\93o
\98^
\82µ
\82È
\82¨
\82µ
\82Ä
\82
\82¾
\82³
\82¢');
981 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
984 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
991 procedure TfrmSender.actStartClick(Sender: TObject);
993 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82É
\82Í
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
995 if Pref.LUID = '' then begin
999 if not IdSlpp20.Connected then begin
1000 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
1004 FAutoAddAfterGetChannel := false;
1005 PostCommand(['Command: getChannels']);
1010 procedure TfrmSender.actStopExecute(Sender: TObject);
1012 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82É
\82Í
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
1014 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
1015 IdSlpp20.OnDisconnect := nil;
1016 if IdSlpp20.Connected then IdSlpp20.Disconnect;
1017 FAutoAddAfterGetChannel := true;
1019 IdSlpp20.OnDisconnect := Slpp20Disconnect;
1023 procedure TfrmSender.FormShow(Sender: TObject);
1025 if FBooted or Application.Terminated then Exit;
1027 //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
1028 if Pref.LUID <> '' then BeginConnect
1029 else mnGetNewIdClick(Self);
1030 FAutoAddAfterGetChannel := Pref.AutoStart;
1033 if NOT Pref.NotShowLog then frmLog.Show;
1034 frmSurfacePreview.Show;
1036 SakuraSeeker.BeginDetect;
1037 SakuraSeekerDetectResultChanged(self);
1038 //
\8e©
\93®
\95Û
\91¶
\90Ý
\92è
\82Ì
\83\8d\81[
\83h
1039 SetScriptAutoBackUp;
1041 if SakuraSeeker.Count = 0 then
1042 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 +
1043 '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 +
1044 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
1048 procedure TfrmSender.actAboutClick(Sender: TObject);
1051 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
1052 Str := Str + Format('Compiler Version: %f', [CompilerVersion]);
1053 frmMessageBox.ShowMessage(Str);
1056 procedure TfrmSender.actExitClientExecute(Sender: TObject);
1061 procedure TfrmSender.actClearExecute(Sender: TObject);
1063 Script, Default: String;
1065 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
1066 Default := StringReplace(Pref.DefaultScript, '|', '', [rfReplaceAll]);
1067 Default := StringReplace(Default, #13#10, '', [rfReplaceAll]);
1069 if (Pref.AutoClip) and (Length(GetScriptText) > 0) and (Script <> Default) then
1070 actSendToLogWindow.Execute
1075 procedure TfrmSender.memScriptChange(Sender: TObject);
1077 //
\83G
\83f
\83B
\83^
\93à
\97e
\82ª
\95Ï
\8dX
\82³
\82ê
\82½
\82Æ
\82«
1079 FScriptBackModified := true; //
\8e©
\93®
\95Û
\91¶
\8dÄ
\8aJ
1080 SetFileModified(true); //
\83t
\83@
\83C
\83\8b\95Ï
\8dX
\83t
\83\89\83O
1083 procedure TfrmSender.EditerStatusChange;
1089 //
\83X
\83e
\81[
\83^
\83X
\95Ï
\8dX
\82¾
\82¯
1090 //
\93à
\97e
\82ª
\83h
\83\89\83b
\83O
\82³
\82ê
\82½
\82Æ
\82«
\82à
\8cÄ
\82Ñ
\8fo
\82³
\82ê
\82é
1091 Script := GetScriptText;
1092 Len := Length(Script);
1093 //
\94»
\92è
\82·
\82é
\95ª
\8fd
\82¢
\82©
\82à
\81H
1094 if Pref.NotScriptTime AND (Len > Pref.NotScriptTimeLen) then
1095 Text := Format('%d
\83o
\83C
\83g/?', [Len])
1098 Script := StringReplace(Script, #13#10, '', [rfReplaceAll]);
1099 Text := Format('%d
\83o
\83C
\83g/%d
\95b', [Length(Script), SsPlayTime.PlayTime(Script) div 1000])
1101 StatusBar.Panels[PanelBytes].Text := Text;
1102 // FScriptModified := true;
1106 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
1108 Pref.StayOnTop := not Pref.StayOnTop;
1109 mnStayOnTop.Checked := Pref.StayOnTop;
1110 if Pref.StayOnTop then begin
1111 FormStyle := fsStayOnTop;
1113 FormStyle := fsNormal;
1118 function TfrmSender.GetScriptText: String;
1120 Result := memScript.Lines.Text;
1123 procedure TfrmSender.mnConstClick(Sender: TObject);
1126 i := (Sender as TMenuItem).Tag;
1127 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
1130 procedure TfrmSender.actEditConstExecute(Sender: TObject);
1132 ScriptConstList.LoadFromDir(FConstDir);
1134 Application.CreateForm(TfrmConstEditor, frmConstEditor);
1135 frmConstEditor.Execute;
1136 ScriptConstList.Save;
1138 frmConstEditor.Release;
1140 ConstructMenu(false);
1143 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
1145 Application.Minimize;
1146 WindowState := wsNormal;
1149 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
1152 TaskTray.Registered := false;
1155 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
1158 Application.ShowMainForm := false;
1159 ShowWindow(Application.Handle, SW_HIDE);
1162 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
1164 Application.ShowMainForm := true;
1168 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1170 Application.Restore;
1173 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1175 Application.Restore;
1178 procedure TfrmSender.FormActivate(Sender: TObject);
1183 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1185 Application.Restore;
1186 actClearExecute(Sender);
1189 procedure TfrmSender.ChangeTaskIcon;
1195 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1197 if Sleeping then IcoNum := IconSleepDisconnected
1198 else IcoNum := IconDisconnected;
1201 //
\83^
\83X
\83N
\83A
\83C
\83R
\83\93\82Ì
\8fó
\91Ô
\81i
\8e¸
\94s
\8fó
\91Ô
\8eg
\97p
\81j
1202 if Sleeping then IcoNum := IconSleepDisconnected
1203 else IcoNum := IconDisconnected;
1205 Ico := TIcon.Create;
1207 imgIcon.GetIcon(IcoNum, Ico);
1208 TaskTray.Icon := Ico;
1209 TaskTray.Registered := true;
1214 ; // 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
1215 //
\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
1216 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1221 procedure TfrmSender.SetStatusText(const Value: String);
1223 FStatusText := Value;
1224 StatusBar.Panels[PanelStatus].Text := Value;
1228 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1231 if Length(Application.Hint) > 0 then
1233 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1234 Application.HintColor := clInfoBk;
1235 {
\91\97\90M
\83{
\83^
\83\93\8aÖ
\98A
1236 if (Application.Hint = SendButtonLongHint)
1237 and (FNowChannel <> '') then
1239 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1240 Application.HintColor := clYellow;
1241 Application.ActivateHint(Mouse.CursorPos);
1244 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1246 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1247 DoSurfacePreview(id, spHint);
1251 StatusBar.Panels[PanelStatus].Text := FStatusText;
1252 frmSurfacePreview.HideAway;
1256 procedure TfrmSender.ConstructMenu(Simple: boolean);
1258 BuildMenu(mnPopConst, Simple);
1259 BuildMenu(mnPopUpConst.Items, Simple);
1260 BuildMenu(ConstBarMenu.Items, Simple);
1261 //
\96\88\89ñ
\8f\89\8aú
\89»?
1262 if Pref.EConstBar then ConstMenuBar.Menu := nil;
1263 ConstMenuBar.AutoSize := false;
1264 ConstMenuBar.Width := 1000;
1265 ConstMenuBar.Menu := ConstBarMenu;
1266 ConstMenuBar.AutoSize := true;
1269 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1270 Shift: TShiftState);
1272 Func: TReturnKeyFunction;
1274 if (Key = VK_RETURN) then begin
1275 if (ssShift in Shift) then
1276 Func := Pref.WhenShiftReturn
1277 else if (ssCtrl in Shift) then
1278 Func := Pref.WhenCtrlReturn
1280 Func := Pref.WhenReturn;
1283 with tbtnInsertConst do
1284 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1285 mnPopUpConst.Popup(Pos.X, Pos.Y);
1288 memScript.SelText := '\n';
1292 memScript.SelText := '\n'#13#10;
1295 memScript.SelText := #13#10
1301 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1303 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1304 Pref.ShowToolBar := mnShowToolBar.Checked;
1308 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1310 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1311 Pref.ShowConstBar := mnShowConstBar.Checked;
1315 procedure TfrmSender.UpdateLayout;
1317 with SakuraScriptFountain do begin
1318 TagColor.Color := Pref.MarkUpColor;
1319 TagErrorColor.Color := Pref.MarkErrorColor;
1320 Scope0Color.Color := Pref.TalkColorH;
1321 Scope1Color.Color := Pref.TalkColorU;
1322 SynchronizedColor.Color := Pref.TalkColorS;
1324 memScript.Ruler.Visible := Pref.ShowRuler;
1325 memScript.Ruler.Color := Pref.TextColor;
1326 memScript.Color := Pref.BgColor;
1328 ToolBar.Visible := Pref.ShowToolBar;
1329 ConstMenuBar.Visible := Pref.ShowConstBar;
1332 with tabChannel do begin
1333 TabPosition := Pref.TabPosition;
1334 case Pref.TabPosition of
1335 tpTop: Align := alTop;
1336 tpBottom: Align := alBottom;
1338 TabWidth := Pref.TabWidth;
1342 function TfrmSender.DoTrans(var Script: String;
1343 Options: TScriptTransOptions; out FoundURL: boolean): String;
1344 var UrlCancel, Mark: String;
1345 Url, UrlName: array[0..6] of String;
1346 i, j, u, UrlCount: integer;
1347 LastSurfaceH, LastSurfaceU: integer;
1348 UnyuTalking: boolean;
1349 QuickSection, Synchronize: boolean;
1350 Warnings: TStringList;
1355 UnyuTalking := false;
1356 QuickSection := false;
1357 Synchronize := false;
1358 SsParser.LeaveEscape := true;
1359 SsParser.EscapeInvalidMeta := false;
1360 SsParser.InputString := Script;
1362 Warnings := TStringList.Create;
1364 for i := 0 to SsParser.Count-1 do begin
1365 if SsParser[i] = '\t' then begin
1366 if not(toIgnoreTimeCritical in Options) then
1367 Script := Script + '\t';
1368 end else if SsParser[i] = '\e' then begin
1370 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1371 if toConvertURL in Options then begin
1372 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1373 for u := 7 downto 1 do begin
1374 if (SsParser.Match(SsParser[i],
1375 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1376 '-', '%b', [rfReplaceAll]))) > 0 then begin
1377 for j := 1 to u do begin
1378 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1379 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1380 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1381 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1384 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1385 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1387 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1388 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1389 Url[0] := SsParser.GetParam(SsParser[i], 1);
1390 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1391 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1392 if Pos('http://', Url[0]) > 0 then begin
1394 if not QuickSection then
1395 Script := Script + '\_q' + Url[0] + '\_q'
1397 Script := Script + Url[0];
1400 end else Script := Script + SsParser[i];
1402 Mark := SsParser[i];
1403 if Mark = '\h' then begin
1404 UnyuTalking := false;
1405 if toHUTagTo01Tag in Options then Mark := '\0';
1406 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1407 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');
1408 end else if Mark = '\u' then begin
1409 UnyuTalking := true;
1410 if toHUTagTo01Tag in Options then Mark := '\1';
1411 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1412 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');
1413 end else if Mark = '\_q' then begin
1414 QuickSection := not QuickSection;
1415 end else if Mark = '\_s' then begin
1416 Synchronize := not Synchronize;
1417 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1418 if UnyuTalking then begin
1419 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1422 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1425 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1426 if UnyuTalking then begin
1427 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1429 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1432 Script := Script + Mark;
1435 if UrlCount > 0 then begin
1437 Script := Script + '\h\n';
1438 if not (toNoChoice in Options) then begin
1439 for i := 0 to UrlCount-1 do begin
1440 Script := Script + Format('\q%d[%s][%s]',
1441 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1443 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1444 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1446 Script := Script + '\h';
1447 for i := 0 to UrlCount-1 do begin
1448 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1450 Script := Script + Format('\n{%s}', [UrlCancel]);
1454 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1455 if toWaitScriptEnd in Options then begin
1456 i := Pref.WaitScriptEnd;
1457 while i > 0 do begin
1459 Script := Script + '\w9';
1462 Script := Script + '\w' + IntToStr(i);
1468 Script := Script + '\e';
1469 RegExp.Subst('s/\r\n//gk', Script);
1471 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1472 for i := 0 to SsParser.Count-1 do begin
1473 if SsParser.MarkUpType[i] = mtTagErr then begin
1474 Result := '"' + SsParser[i] + '"'#13#10 +
1475 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1479 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1480 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1484 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1485 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1486 mbOkCancel, 0) = mrCancel then
1487 Result := Warnings.Text;
1494 function TfrmSender.DoTrans(var Script: String;
1495 Options: TScriptTransOptions): String;
1498 Result := DoTrans(Script, Options, dum);
1501 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1503 OpenBrowser(Pref.HomePage);
1506 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1508 lblMessage.Caption := Mes;
1509 lblMessage.Font.Color := Col;
1510 lblMessage.Visible := true;
1511 LabelTimer.Enabled := false;
1512 LabelTimer.Enabled := true;
1515 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1517 LabelTimer.Enabled := false;
1518 lblmessage.Visible := false;
1521 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1525 Str := memScript.Lines.Text;
1526 Clip := ClipBoard();
1527 Clip.SetTextBuf(PChar(Str));
1530 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1534 Str := memScript.Lines.Text;
1535 RegExp.Subst('s/\r\n//gk', Str);
1536 Clip := ClipBoard();
1537 Clip.SetTextBuf(PChar(Str));
1541 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1542 const Param: String);
1543 var HeadValue: THeadValue;
1545 HeadValue := THeadValue.Create(Param);
1548 etScript, etForceBroadcast, etUnicast: begin
1549 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1550 DispatchBottle(EventType, HeadValue);
1552 etMemberCount: begin
1553 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1555 etChannelCount: begin
1557 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1562 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1564 FBeginConnectFailCount := 0;
1565 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1566 if not Connecting then
1567 PostCommand(['Command: getChannels']);
1568 SakuraSeeker.BeginDetect;
1570 etChannelList: begin
1571 UpdateJoinChannelList(HeadValue);
1572 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1573 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1574 JoinChannelsBackup.Assign(JoinChannels);
1576 etCloseChannel: begin
1577 with JoinChannels do
1578 if IndexOf(HeadValue['Channel']) >= 0 then
1579 Delete(IndexOf(HeadValue['Channel']));
1580 with tabChannel do begin
1581 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1582 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1583 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1584 tabChannelChange(self);
1586 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1588 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1589 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1591 etForceBroadcastInformation: begin
1592 if HeadValue['Type'] = 'Vote' then begin
1593 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1594 end else if HeadValue['Type'] = 'Agree' then begin
1595 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1605 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1607 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1609 TaskTray.TipString := 'Yasagure Client (' +
1610 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1612 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1614 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1617 procedure TfrmSender.actSettingExecute(Sender: TObject);
1619 Application.CreateForm(TfrmSetting, frmSetting);
1629 BuildReplaceMenu(mnPresetReplaceRoot);
1632 frmLog.UpdateWindow;
1633 SetScriptAutoBackUp; //
\83X
\83N
\83\8a\83v
\83g
\8e©
\93®
\95Û
\91¶
\90Ý
\92è
\8dX
\90V
1634 UpdateChannelList; //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\8dÄ
\83\8d\81[
\83h
1637 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1639 if (Key = #13) or (Key = #10) then Key := Char(0);
1643 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1646 UpdateJoinChannelList(nil);
1647 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1648 if not Application.Terminated then RetryBeginConnect;
1652 procedure TfrmSender.SetSleeping(const Value: boolean);
1655 FBottleSstp.ResendSleep := Value;
1659 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1662 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]),
1663 mtWarning, mbOkCancel, 0);
1664 if Re = mrOk then begin
1666 frmLog.AllBottleOpened;
1667 frmLog.UpdateWindow;
1671 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1673 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1677 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1679 Ch: TChannelListItem;
1682 for i := 1 to Dat.IntData['Count'] do begin
1683 Ch := TChannelListItem.Create;
1684 Ch.Name := Dat[Format('CH%d_name', [i])];
1685 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1686 Ch.Info := Dat[Format('CH%d_info', [i])];
1687 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1688 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1689 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1690 ChannelList.Add(Ch);
1696 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1698 ShowHintLabel('LUID
\82Ì
\8eæ
\93¾
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
1699 // PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1703 procedure TfrmSender.NoLuidError;
1706 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1707 '
\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+
1708 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1712 procedure TfrmSender.tabChannelChange(Sender: TObject);
1715 if tabChannel.TabIndex >= 0 then begin
1716 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1717 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1722 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1723 ConstructMenu(true);
1727 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1730 with tabChannel do begin
1731 if Tabs.Count = 0 then Exit;
1732 if TabIndex=0 then TabIndex := Tabs.Count-1
1733 else TabIndex := TabIndex-1;
1735 tabChannelChange(Self);
1739 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1742 with tabChannel do begin
1743 if Tabs.Count = 0 then Exit;
1744 if TabIndex=Tabs.Count-1 then TabIndex := 0
1745 else TabIndex := TabIndex+1;
1747 tabChannelChange(Self);
1752 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1756 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1757 if nodat then Dat := THeadValue.Create('');
1759 for i := 0 to Dat.Count-1 do
1760 if Dat.KeyAt[i] = 'Entry' then begin
1761 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1762 JoinChannels.Add(RegExp[1]);
1764 with tabChannel do begin
1769 for i := 0 to JoinChannels.Count-1 do begin
1770 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1771 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1772 Tabs.Add(JoinChannels[i]);
1775 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1776 //
\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)
1778 for i := 0 to Tabs.Count-1 do
1779 if Tabs[i] = FNowChannel then TabIndex := i;
1780 if Tabs.Count > 0 then begin
1781 FNowChannel := Tabs[TabIndex];
1782 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1785 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1787 Visible := Tabs.Count > 0;
1788 if Tabs.Count > 1 then begin
1789 actNextChannel.Enabled := true;
1790 actPrevChannel.Enabled := true;
1792 actNextChannel.Enabled := false;
1793 actPrevChannel.Enabled := false;
1795 OnChange := tabChannelChange;
1797 if nodat then Dat.Free;
1798 if JoinChannels.Count = 0 then begin
1799 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1800 actSend.Enabled := false;
1802 Self.Caption := FOriginalCaption;
1803 actSend.Enabled := true;
1808 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1810 SakuraSeeker.BeginDetect;
1814 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1817 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1820 procedure TfrmSender.actSleepExecute(Sender: TObject);
1822 if actSleep.Checked then begin
1823 actSleep.Checked := false;
1824 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1826 actSleep.Checked := true;
1827 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1829 Sleeping := actSleep.Checked;
1834 procedure TfrmSender.DispatchBottle(Dat: THeadValue; LogTime: TDateTime;
1835 Vote, Agree: integer);
1836 //procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1837 // Dat: THeadValue);
1838 var Opt: TSstpSendOptions;
1839 Event: TBottleChainBottleEvent;
1840 Script, Sender, Ghost, Channel, ErrorMes: String;
1841 BreakFlag, NoDispatch: boolean;
1842 Sound, LogName: String;
1843 i, j, k, SkipCount: integer;
1844 Rule: TBottleChainRule;
1845 Action: TBottleChainAction;
1846 LogNameList: TStringList;
1848 ReplaceHash: THeadValue;
1851 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1852 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1853 Channel := Dat['Channel'];
1856 etScript: Sender := Channel;
1857 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1858 etUnicast: Sender := Dat['SenderUID'];
1861 Sender := Channel; //
\92Ê
\8fí
1863 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1864 if Dat['IfGhost'] <> '' then begin
1865 Ghost := Dat['IfGhost'];
1867 if ChannelList.Channel[Channel] <> nil then
1868 Ghost := ChannelList.Channel[Channel].Ghost
1872 Dat['TargetGhost'] := Ghost;
1874 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1875 ReplaceHash := THeadValue.Create;
1876 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1877 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1878 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1879 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1880 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1881 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1882 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1883 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1884 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1886 Event := TBottleChainBottleEvent.Create;
1890 if EventType = etScript then Event.LogType := ltBottle
1891 else Event.LogType := ltSystemLog;
1893 Event.LogType := ltBottle; //
\92Ê
\8fí
1895 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1896 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1897 //
\96â
\91è
\82Ì
\97L
\82é
\95r
\82É
\91Î
\82·
\82é
\93®
\8dì
1898 if (ErrorMes <> '') AND (NOT Pref.ErrScript) then
1900 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'+
1901 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1906 NoDispatch := false;
1908 LogNameList := TStringList.Create;
1911 for i := 0 to BottleChainRuleList.Count-1 do begin
1912 if SkipCount > 0 then begin
1916 Rule := BottleChainRuleList[i];
1917 if not Rule.Enabled then Continue;
1918 if not Rule.Check(Event) then Continue;
1919 for j := 0 to Rule.Actions.Count-1 do begin
1920 Action := (Rule.Actions[j] as TBottleChainAction);
1921 if Action is TBottleChainAbortRuleAction then
1923 if Action is TBottleChainSkipRuleAction then
1924 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1925 if (Action is TBottleChainSoundAction) and (Sound = '') then
1927 Sound := (Action as TBottleChainSoundAction).SoundFile;
1928 Sound := StringReplaceEx(Sound, ReplaceHash);
1930 if Action is TBottleChainNoDispatchAction then
1932 if Action is TBottleChainLogAction then
1934 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1935 LogName := (Action as TBottleChainLogAction).LogNames[k];
1936 LogName := StringReplaceEx(LogName, ReplaceHash);
1937 LogNameList.Add(LogName);
1940 if Action is TBottleChainOverrideGhostAction then
1942 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1944 if Action is TBottleChainQuitAction then
1945 Application.Terminate;
1946 if Action is TBottleChainSaveTextLogAction then
1947 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1948 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1949 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]), true);
1950 if Action is TBottleChainSaveXMLLogAction then
1951 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1953 if Action is TBottleChainSurfaceReplaceAction then
1954 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1956 if BreakFlag then Break;
1959 if Dat['Script'] <> '' then begin
1960 for i := 0 to LogNameList.Count-1 do
1961 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost'],
1962 LogTime, Vote, Agree);
1963 if NoDispatch or Pref.NotSSTP then begin
1964 frmLog.SetBottleState(Dat['MID'], lsOpened);
1966 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1967 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1968 Script, Ghost, Now());
1970 FBottleSstp.Push(CueItem);
1978 if Dat['DialogMessage'] <> '' then begin
1980 frmMessageBox.ShowMessage(
1981 DateTimeToStr(Now) + #13#10 +
1982 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1983 for i := 0 to LogNameList.Count-1 do
1984 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1989 if (Sound <> '') then PlaySound(Sound);
1999 procedure TfrmSender.YenETrans;
2000 var St, Le, i: integer;
2003 if Pref.NotYenETrans then exit; // \e
\83`
\83F
\83b
\83N
\82µ
\82È
\82¢
2004 St := memScript.SelStart;
2005 Le := memScript.SelLength;
2006 Orig := GetScriptText;
2007 RegExp.Subst('s/(\r\n)+$//kg', Orig);
2009 with SsParser do begin
2010 LeaveEscape := true;
2011 EscapeInvalidMeta := false;
2012 InputString := Orig;
2014 for i := 0 to SsParser.Count-1 do begin
2015 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
2018 Text := Text + '\e';
2020 if Orig <> Text then memScript.Lines.Text := Text;
2021 SsParser.InputString := Text;
2023 RegExp.Subst('s/\r\n//kg', Text);
2025 memScript.SelStart := St;
2026 memScript.SelLength := Le;
2030 procedure TfrmSender.PostCommand(const Command: array of String);
2031 var PostStr: TStringList;
2036 PostStr := TStringList.Create;
2037 for i := Low(Command) to High(Command) do begin
2038 PostStr.Add(Command[i]);
2040 PostCommand(PostStr);
2048 procedure TfrmSender.PostCommand(Command: TStrings);
2049 var PostStr: String;
2052 PostStr := Command.Text;
2053 PostStr := ParamsEncode(PostStr);
2055 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
2056 if Pref.UseHttpProxy then begin
2057 FHttp.ProxyServer := Pref.ProxyAddress;
2058 FHttp.ProxyPort := Pref.ProxyPort;
2060 FHttp.OnSuccess := HttpSuccess;
2061 FHttp.OnConnectionFailed := HttpFailure;
2062 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
2065 on EHeapException do begin
2066 Connecting := false;
2073 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
2074 //var Log: TLogItem;
2076 ShowHintLabel('
\93\8a\95[
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
2078 if frmLog.lvwLog.Selected = nil then Exit;
2079 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2080 if Log = nil then Exit;
2081 if Log.LogType <> ltBottle then Exit;
2083 'Command: voteMessage',
2085 'LUID: ' + Pref.LUID,
2092 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
2093 //var Log: TLogItem;
2095 ShowHintLabel('
\93¯
\88Ó
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
2097 if frmLog.lvwLog.Selected = nil then Exit;
2098 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2099 if Log = nil then Exit;
2100 if Log.LogType <> ltBottle then Exit;
2102 'Command: voteMessage',
2104 'LUID: ' + Pref.LUID,
2111 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
2113 if SakuraSeeker.ProcessByName[Ghost] <> nil then
2114 Result := SakuraSeeker.ProcessByName[Ghost].SetName
2119 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
2120 MousePos: TPoint; var Handled: Boolean);
2124 with tabChannel do begin
2125 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
2126 if Tag < 0 then Handled := true;
2133 procedure TfrmSender.PostSetChannel(Channels: TStrings);
2134 var PostStr: TStringList;
2137 PostStr := TStringList.Create;
2139 with PostStr do begin
2140 Add('Command: setChannels');
2141 Add('Agent: ' + VersionString);
2142 Add('LUID: ' + Pref.LUID);
2143 if Channels <> nil then
2144 for i := 0 to Channels.Count-1 do begin
2145 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
2148 PostCommand(PostStr);
2155 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
2157 // Chs: TStringList;
2160 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
2162 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
2163 Chs := TStringList.Create;
2165 //
\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ð
2166 //
\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é
2168 Chs.Assign(JoinChannels);
2169 while Chs.IndexOf(Ch) >= 0 do
2170 Chs.Delete(Chs.IndexOf(Ch));
2171 PostSetChannel(Chs);
2178 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
2180 OpenBrowser(Pref.VotePage);
2183 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
2184 Shift: TShiftState; X, Y: Integer);
2185 //var Index: integer;
2189 with tabChannel do begin
2190 Index := IndexOfTabAt(X, Y);
2192 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2197 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2199 OpenBrowser(Pref.HelpPage);
2202 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2203 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2204 //var Index: integer;
2207 with tabChannel do begin
2208 Index := IndexOfTabAt(X, Y);
2209 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2210 if Button = mbLeft then begin
2211 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2213 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2219 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2220 Y: Integer; State: TDragState; var Accept: Boolean);
2221 //var TargetRect: TRect;
2222 // OldDest: integer;
2225 Accept := Source = tabChannel;
2226 if not Accept then Exit;
2227 with tabChannel do begin
2228 OldDest := FDragTabDest;
2229 FDragTabDest := IndexOfTabAt(X, Y);
2230 if FDragTabDest = -1 then begin
2231 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2234 with Canvas do begin
2238 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2239 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2240 TargetRect := TabRect(OldDest);
2241 with Canvas do begin
2242 Brush.Style := bsClear;
2243 Rectangle(TargetRect.Left, TargetRect.Top,
2244 TargetRect.Right, TargetRect.Bottom);
2247 if (OldDest <> FDragTabDest) then begin
2248 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2249 TargetRect := TabRect(FDragTabDest);
2250 with Canvas do begin
2251 Brush.Style := bsClear;
2252 Rectangle(TargetRect.Left, TargetRect.Top,
2253 TargetRect.Right, TargetRect.Bottom);
2260 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2262 //var DestIndex: integer;
2265 with tabChannel do begin
2266 DestIndex := IndexOfTabAt(X, Y);
2267 Tabs.Move(FDragTabIndex, DestIndex);
2272 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2276 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2277 tabChannel.Tabs.BeginUpdate;
2278 tabChannel.Tabs.EndUpdate;
2282 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2283 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2284 var AlignRight: boolean;
2287 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2288 with cbxTargetGhost do begin
2289 AlignRight := false;
2290 if Pref.HideGhosts and not FTargetGhostExpand and
2291 (Index = Items.Count-1) and (Index > 0) then
2293 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2294 Canvas.Font.Color := clWindowText;
2295 Canvas.Font.Style := [];
2297 end else if (Index > 0) then
2299 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2300 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2301 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2303 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2304 Canvas.Font.Style := [fsBold];
2307 Canvas.Font.Color := clWindowText;
2308 Canvas.Font.Style := [];
2310 if odSelected in State then
2311 Canvas.Font.Color := clHighlightText;
2315 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2316 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2317 cbxTargetGhost.Items[Index]);
2319 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2320 cbxTargetGhost.Items[Index]);
2324 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2325 var CanClose: Boolean);
2327 //
\83t
\83@
\83C
\83\8b\82Ì
\8dX
\90V
\83`
\83F
\83b
\83N
\81i
\83G
\83f
\83B
\83^
\95\94\81j
2328 if CheckFileModified(Self) = idCancel then
2333 //
\83\8d\83O
\81i
\83^
\83u
\81j
\93à
\97e
\82Ì
\95Ï
\8dX
\83`
\83F
\83b
\83N
2334 if frmLog.CheckLog(Self) = idCancel then
2339 if (not Pref.ConfirmOnExit) or FEndSession then
2341 if MessageDlg('Yasagure Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2342 mbOkCancel, 0) = mrCancel then
2346 procedure TfrmSender.UpdateIfGhostBox;
2350 HiddenCount: integer;
2352 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2353 Selected := cbxTargetGhost.Text;
2355 with cbxTargetGhost do begin
2358 Items.Add(ChannelDefault);
2359 for i := 0 to SakuraSeeker.Count-1 do begin
2360 //
\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é
2361 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2362 if Pref.HideGhosts and not FTargetGhostExpand then
2363 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2368 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2369 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2371 cbxTargetGhost.ItemIndex := 0;
2372 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2373 with cbxTargetGhost do begin
2374 for i := 1 to Items.Count-1 do begin
2375 if Items[i] = Selected then
2378 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2379 if ItemIndex = 0 then begin
2380 Items.Add(Selected);
2381 ItemIndex := Items.Count - 1;
2385 if Pref.HideGhosts and not FTargetGhostExpand then
2386 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2392 procedure TfrmSender.HTTPFailure(Sender: TObject);
2396 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2397 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2398 (Sender as THTTPDownloadThread).LastErrorMessage);
2399 Connecting := false;
2403 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2406 SakuraSeeker.BeginDetect;
2408 i := cbxTargetGhost.ItemIndex;
2412 i := cbxTargetGhost.Items.Count-1;
2413 if Pref.HideGhosts and not FTargetGhostExpand then
2416 cbxTargetGhost.ItemIndex := i;
2417 cbxTargetGhostChange(self);
2420 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2423 SakuraSeeker.BeginDetect;
2425 i := cbxTargetGhost.ItemIndex;
2427 if Pref.HideGhosts and not FTargetGhostExpand then
2429 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2432 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2434 cbxTargetGhost.ItemIndex := i;
2435 cbxTargetGhostChange(self);
2438 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2440 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2441 FTargetGhostExpand := false;
2442 if Visible then memScript.SetFocus;
2443 cbxTargetGhostChange(self);
2447 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2449 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2451 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2452 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2454 if not IdSlpp20.Connected then begin
2456 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2458 //
\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
2459 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2467 procedure TfrmSender.RetryBeginConnect;
2469 if FBeginConnectFailCount < 3 then begin
2470 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2471 FAutoAddAfterGetChannel := true;
2473 end else if FBeginConnectFailCount = 3 then begin
2474 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2475 frmMessageBox.ShowMessage(
2476 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2477 '
\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+
2478 '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'
2480 Inc(FBeginConnectFailCount);
2485 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2487 var BottleLog: TBottleLogList;
2489 Cond: TBottleLogDownloadCondition;
2491 function TimeStr(Mins: integer): String;
2492 var day, hour, min: integer;
2494 day := Mins div (60 * 24);
2495 hour := (Mins div 60) mod 24;
2498 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2499 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2500 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2504 ShowHintLabel('
\83\8d\83O
\82Ì
\83_
\83E
\83\93\83\8d\81[
\83h
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
2506 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2508 if frmLogDownload.Execute then begin
2509 with frmLogDownload do begin
2510 if IsRange then begin
2511 if CompareDate(DateLo, DateHi) = 0 then
2512 Title := FormatDateTime('yy-mm-dd', DateLo)
2514 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2516 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2518 if Channel <> '' then Title := Title + '(' + Channel + ')';
2520 BottleLog := TBottleLogList.Create(Title);
2522 BottleLog.OnLoaded := frmLog.LogLoaded;
2523 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2524 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2525 with frmLogDownload do begin
2526 Cond.IsRange := IsRange;
2527 Cond.RecentCount := RecentCount;
2528 Cond.DateLo := DateLo;
2529 Cond.DateHi := DateHi;
2530 Cond.MinVote := MinVote;
2531 Cond.MinAgree := MinAgree;
2532 Cond.Channel := Channel;
2534 BottleLog.LoadFromWeb(Cond);
2536 FreeAndNil(BottleLog);
2538 if BottleLog <> nil then begin
2539 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2541 frmLog.tabBottleLog.TabIndex := NewIndex;
2542 frmLog.UpdateWindow;
2546 frmLogDownload.Release;
2551 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2552 Ghost: String): boolean;
2559 Cond := Token(IfGhost, ',', i);
2560 if Cond <> '' then begin
2561 if Cond[1] = '!' then begin
2562 Cond := Copy(Cond, 2, High(integer));
2563 if Cond = Ghost then Result := false;
2565 if Cond <> Ghost then Result := false;
2572 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2573 var i, j, k, count: integer;
2574 ConstData: TScriptConst;
2575 Menu1, Menu2: TMenuItem;
2578 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2579 // 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
2580 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2581 // else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2585 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2586 if Simple then begin
2587 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2588 for i := Root.Count-1 downto 0 do begin
2589 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2593 //
\91S
\95\94\8dí
\8f\9c
2597 for i := 0 to ScriptConstList.Count-1 do begin
2598 for j := 0 to ScriptConstList[i].Count-1 do begin
2599 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2600 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2602 // 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
2603 if Simple and (count < Root.Count) then
2604 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2608 Menu1 := TMenuItem.Create(Root);
2611 Caption := ScriptConstList[i][j].Caption;
2612 Hint := ScriptConstList[i][j].Caption;
2613 AutoHotkeys := maManual;
2614 Tag := ScriptConstList[i][j].ID;
2615 OnClick := mnConstGroupClick;
2618 if not Simple then begin
2621 if count < Root.Count-1 then
2622 Root.Insert(count, Menu1)
2627 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2628 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2629 ConstData := ScriptConstList[i][j][k];
2630 Menu2 := TMenuItem.Create(Root);
2631 Menu2.Caption := ConstData.Caption;
2632 Menu2.Hint := ConstData.ConstText;
2633 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2634 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2635 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2636 Menu2.ShortCut := ConstData.ShortCut;
2637 Menu2.OnClick := mnConstClick;
2638 Menu2.AutoHotkeys := maManual;
2639 Menu2.Tag := ConstData.ID;
2640 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2647 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2649 //
\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
2650 if Pref.HideGhosts and not FTargetGhostExpand then
2652 with cbxTargetGhost do
2654 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2655 //
\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
2656 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2658 FTargetGhostExpand := true;
2661 DroppedDown := true;
2665 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2666 ConstructMenu(true);
2667 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2671 procedure TfrmSender.PlaySound(const FileName: String);
2673 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2675 MediaPlayer.FileName := FileName;
2679 on E: EMCIDeviceError do begin
2680 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2685 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2688 if not Assigned(frmFMOExplorer) then
2689 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2692 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2695 frmFMOExplorer.Show;
2698 procedure TfrmSender.SaveChainRuleList;
2699 var Str: TStringList;
2701 Str := TStringList.Create;
2703 Str.Text := ComponentToString(BottleChainRuleList);
2704 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2710 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2712 frmLog.SetBottleState(MID, lsOpened);
2715 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2717 frmLog.SetBottleState(MID, lsPlaying);
2720 procedure TfrmSender.LogInsertCue(TestAction: boolean);
2721 var InsertItem: TLogItem;
2722 i, errCount, Res: integer;
2723 Log: TBottleLogList;
2724 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2726 if FBottleSstp.CueCount > 0 then begin
2727 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'+
2728 '
\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+
2729 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2730 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2733 frmLog.AllBottleOpened;
2734 if frmLog.lvwLog.Selected = nil then Exit;
2735 Log := frmLog.SelectedBottleLog;
2736 if Log = nil then Exit;
2737 FBottleSSTP.OnResendCountChange := nil;
2739 for i := frmLog.lvwLog.Selected.Index downto 0 do begin
2740 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2741 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2743 //
\83A
\83N
\83V
\83\87\83\93\82ª
\97L
\8cø
\82Å
\82 \82ê
\82Î
\83X
\83N
\83\8a\83v
\83g
\82Ì
\95Ï
\8a·
\82µ
\82È
\82¢
2747 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2749 if ErrorMes <> '' then
2751 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2752 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2755 raise Exception.Create('Script Syntax Error')
2756 else if Res = mrCancel then
2760 frmLog.AllBottleOpened;
2764 //
\83A
\83N
\83V
\83\87\83\93\82ª
\97L
\8cø
\82Å
\82 \82ê
\82Î
\92Ê
\8fí
\8f\88\97\9d\8fÈ
\97ª
2766 //
\8c^
\95Ï
\8a·
\82Æ
\8eó
\90M
2767 BottleCnv(InsertItem)
2770 //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\91Î
\8dô
2771 if InsertItem.Ghost = '' then
2772 if ChannelList.Channel[InsertItem.Channel] <> nil then
2773 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2774 FBottleSSTP.Push(InsertItem);
2775 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2782 if errCount > 0 then
2783 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]));
2784 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2785 BottleSstpResendCountChange(self);
2786 frmLog.lvwLog.Invalidate;
2789 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2791 LogInsertCue(false); //
\92Ê
\8fí
\82Ì
\98A
\91±
\8dÄ
\90¶
\82ð
\82·
\82é
2794 function TfrmSender.ScriptTransForSSTP(const Script: String;
2795 out Error: String): String;
2796 var TransOpt: TScriptTransOptions;
2798 if Pref.NoTransURL then
2799 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2801 TransOpt := [toConvertURL, toWaitScriptEnd];
2802 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2803 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2804 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2806 Error := DoTrans(Result, TransOpt);
2809 procedure TfrmSender.FormResize(Sender: TObject);
2812 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2813 if memScript.ColWidth <> 0 then
2817 w := Width - LeftMargin - ColWidth div 2;
2818 if ScrollBars in [ssVertical, ssBoth] then
2819 w := w - GetSystemMetrics(SM_CYVSCROLL);
2820 WrapOption.WrapByte := w div ColWidth;
2825 procedure TfrmSender.actCopyExecute(Sender: TObject);
2827 memScript.CopyToClipboard;
2830 procedure TfrmSender.actPasteExecute(Sender: TObject);
2832 memScript.PasteFromClipboard;
2835 procedure TfrmSender.actCutExecute(Sender: TObject);
2837 memScript.CutToClipboard;
2840 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2842 memScript.SelectAll;
2845 procedure TfrmSender.actUndoExecute(Sender: TObject);
2850 procedure TfrmSender.actRedoExecute(Sender: TObject);
2855 function TfrmSender.IsSurfaceTag(const Script: String;
2856 var ID: integer): boolean;
2859 if SsParser.Match(Script, '\s%d') = 3 then
2862 ID := Ord(Script[3]) - Ord('0')
2864 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2867 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2871 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2872 Shift: TShiftState; X, Y: Integer);
2876 //
\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[
2877 if not Pref.SurfacePreviewOnScriptPoint then
2879 token := memScript.TokenStringFromPos(Point(X, Y));
2880 if IsSurfaceTag(token, id) then
2882 DoSurfacePreview(id, spEditor);
2885 frmSurfacePreview.HideAway;
2889 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2890 const Kind: TSurfacePreviewType);
2895 if cbxTargetGhost.ItemIndex > 0 then
2896 ghost := cbxTargetGhost.Text
2899 {
\8eè
\93®
\82Ì
\82Í
\82¸
2900 else if FNowChannel <> '' then
2901 ghost := ChannelList.Channel[FNowChannel].Ghost;
2904 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2905 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2906 not (frmSurfacePreview.IsHidden) then
2913 Bmp := TBitmap.Create;
2915 if Spps.TryGetImage(ghost, Surface, Bmp) then
2919 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2921 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2923 CPos := Point(0, 0);
2925 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2926 FVisiblePreviewGhost := Ghost;
2927 FVisiblePreviewSurface := Surface;
2929 frmSurfacePreview.HideAway;
2936 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2937 {var MousePoint: TPoint;
2940 //
\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é
2941 //
\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Å
2942 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2943 {GetCursorPos(MousePoint);
2944 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2945 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2946 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2947 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2950 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2951 var MousePoint: TPoint;
2953 GetCursorPos(MousePoint);
2954 case Pref.SurfacePreviewOnScriptPointPosition of
2955 spspMainWindowRight:
2956 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2958 Result := Point(Self.Left - w, MousePoint.Y);
2962 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2964 if (Sender is TMenuItem) then
2965 FVisibleMenuItem := Sender as TMenuItem;
2968 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2970 if FScriptBuffer.Count = 0 then
2972 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2974 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2977 procedure TfrmSender.EditorPreview;
2978 var Ghost, Script: String;
2980 if frmEditorTalkShow <> nil then
2981 if frmEditorTalkShow.Visible then
2983 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2985 if cbxTargetGhost.ItemIndex > 0 then
2986 Ghost := cbxTargetGhost.Text;
2987 {
\8eè
\93®
\82Å
\8ew
\92è
\82³
\82ê
\82é
2988 else if FNowChannel <> '' then
2989 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2991 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2995 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2997 if frmEditorTalkShow <> nil then
2998 frmEditorTalkShow.Show
3001 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
3002 frmEditorTalkShow.Show;
3007 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
3008 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
3010 Spps.ClearImagePool;
3011 Spps.LoadFromDirectory(FSppDir);
3015 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
3017 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
3021 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
3022 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
3023 function TfrmSender.TagReplace(Script: String; Before,
3024 After: array of String): String;
3025 var BeforeList, AfterList: TStringList;
3028 BeforeList := TStringList.Create;
3029 AfterList := TStringList.Create;
3031 for i := Low(Before) to High(Before) do
3032 BeforeList.Add(Before[i]);
3033 for i := Low(After) to High(After) do
3034 AfterList.Add(After[i]);
3035 Result := TagReplace(Script, BeforeList, AfterList);
3042 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
3043 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
3044 //
\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¢)
3045 function TfrmSender.TagReplace(Script: String; Before,
3046 After: TStrings): String;
3048 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3054 OldStr := InputString;
3055 OldLeaveEscape := LeaveEscape;
3056 OldEscapeInvalidMeta := EscapeInvalidMeta;
3057 LeaveEscape := true;
3058 EscapeInvalidMeta := false;
3059 InputString := Script;
3061 for i := 0 to SsParser.Count-1 do
3064 for j := 0 to Before.Count-1 do
3066 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
3069 Result := Result + After[j];
3073 Result := Result + SsParser[i];
3077 LeaveEscape := OldLeaveEscape;
3078 EscapeInvalidMeta := OldEscapeInvalidMeta;
3079 InputString := OldStr;
3083 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
3084 //
\91Î
\89\9e\82·
\82é
3085 procedure TfrmSender.WndProc(var Message: TMessage);
3087 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
3089 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
3090 //
\8bC
\82Ã
\82©
\82¹
\82é
3098 procedure TfrmSender.actReplaceExecute(Sender: TObject);
3100 Form: TfrmStrReplaceDialog;
3102 Options: TReplaceFlags;
3104 Application.CreateForm(TfrmStrReplaceDialog, Form);
3106 if Form.Execute then
3110 Lines := memScript.Lines.Text;
3111 Options := [rfReplaceAll];
3113 Options := Options + [rfIgnoreCase];
3115 Lines := StringReplaceRegExp(Lines, BeforeStr, AfterStr, Options)
3117 Lines := StringReplace(Lines, BeforeStr, AfterStr, Options);
3119 if Lines <> memScript.Lines.Text then
3121 memScript.SelectAll;
3122 memScript.SelText := Lines;
3130 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
3133 if frmLog.lvwLog.Selected = nil then Exit;
3134 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
3135 if Log = nil then Exit;
3136 CopyFromLogToEditor(Log);
3139 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
3140 var Ghost, Script: String;
3143 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
3144 if cbxTargetGhost.ItemIndex > 0 then
3145 Ghost := cbxTargetGhost.Text
3148 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost, Now(), 0, 0);
3152 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
3153 Y: Integer; State: TDragState; var Accept: Boolean);
3155 //
\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é
3156 if Source is TBottleLogDragObject then
3157 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
3160 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
3162 var Src: TBottleLogDragObject;
3165 //
\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é
3166 if not (Source is TBottleLogDragObject) then
3168 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
3170 Src := Source as TBottleLogDragObject;
3172 CopyFromLogToEditor(Log);
3175 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
3179 if Log.LogType <> ltBottle then Exit;
3180 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Ä)
3181 memScript.Lines.Clear;
3182 memScript.Lines.Add(Log.Script);
3183 SetFileName(Log.MID, false); //
\83^
\83C
\83g
\83\8b\82¾
\82¯
\95Ï
\8dX
3184 SetFileModified(false); //
\95Ï
\8dX
\96³
\82µ
\82É
3185 FScriptBackModified := false; //
\8e©
\93®
\95Û
\91¶
\88ê
\8e\9e\92â
\8e~
3187 //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\91Î
\8dô
3189 if ChannelList.Channel[Log.Channel] <> nil then
3190 Ghost := ChannelList.Channel[Log.Channel].Ghost;
3193 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
3194 //
\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Å
3195 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
3196 cbxTargetGhost.Items.Add(Ghost);
3197 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
3199 cbxTargetGhost.Invalidate;
3201 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
3205 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
3207 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
3208 if frmLog.SelectedBottleLog = nil then
3210 if frmLog.lvwLog.Selected = nil then
3212 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
3213 frmLog.UpdateWindow;
3214 frmLog.lvwLogChange(Self, nil, ctState);
3215 frmLog.SelectedBottleLog.LogModified := true; //
\95Ï
\8dX
\82³
\82ê
\82½
3218 procedure TfrmSender.ClearEditor;
3219 var TmpScript: String;
3221 DoSaveBuffer: boolean;
3222 SavedScript: TStringList;
3224 //
\90Ý
\92è
\82É
\82æ
\82è
\83N
\83\8a\83A
\8e\9e\82É
\83t
\83@
\83C
\83\8b\83Z
\81[
\83u
\82·
\82é
\82©
\8am
\94F
\82·
\82é
3225 //
\8e©
\93®
\83N
\83\8a\83b
\83v
\82ª
\97L
\8cø
\82Å
\82 \82ê
\82Î
\83X
\83L
\83b
\83v
\82·
\82é
3226 if (NOT Pref.NotCheckClear) AND (NOT Pref.AutoClip) then
3227 if CheckFileModified(Self) = idCancel then abort;
3228 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
3229 //
\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é
3230 DoSaveBuffer := false;
3231 if FScriptBuffer.Count = 0 then
3232 DoSaveBuffer := true
3233 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
3234 DoSaveBuffer := true;
3235 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
3236 DoSaveBuffer := false;
3237 if DoSaveBuffer then
3239 SavedScript := TStringList.Create;
3240 SavedScript.Text := GetScriptText;
3241 FScriptBuffer.Insert(0, SavedScript);
3243 if FScriptBuffer.Count >= 4 then
3244 FScriptBuffer.Delete(FScriptBuffer.Count-1);
3245 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
3247 TmpScript := Pref.DefaultScript;
3248 Position := Pos('|', TmpScript);
3249 if Position < 1 then Position := 1;
3250 TmpScript := StringReplace(TmpScript, '|', '', []);
3251 memScript.Lines.Text := TmpScript;
3252 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
3253 memScript.SelStart := Position-1;
3255 if Visible then memScript.SetFocus;
3256 // FScriptModified := false;
3257 FScriptBackModified := false; //
\8e©
\93®
\95Û
\91¶
\88ê
\8e\9e\92â
\8e~
3258 SetFileName(NewFileTitle, true); //
\83t
\83@
\83C
\83\8b\82ð
\90V
\8bK
\88µ
\82¢
\82É
\82·
\82é
3259 SetFileModified(false); //
\95Ï
\8dX
\96³
\82µ
3260 EditerStatusChange; //
\83X
\83e
\81[
\83^
\83X
\8dX
\90V
3263 procedure TfrmSender.AppendTextLog(const FileName, Line: String; FAppend: boolean);
3267 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3269 ForceDirectories(ExtractFileDir(FileName));
3270 AssignFile(F, FileName);
3271 if FileExists(FileName) AND FAppend then //
\92Ç
\8bL
\82©
\8fã
\8f\91\82«
\94»
\92è
3280 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3284 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3289 Impl: TDomImplementation;
3290 Parser: TXmlToDomParser;
3293 try // Long try block to handle all kinds of exception in this method
3294 if not FileExists(FileName) then
3296 // Create empty XML log file
3297 Impl := TDomImplementation.create(nil);
3299 ForceDirectories(ExtractFileDir(FileName));
3300 Parser := TXmlToDomParser.create(nil);
3301 Parser.DOMImpl := Impl;
3304 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3307 documentElement.setAttribute('saved',
3308 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3309 documentElement.setAttribute('generator', VersionString);
3310 documentElement.setAttribute('version', '1.0');
3312 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3313 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3315 DOM.writeCodeAsShiftJIS(F);
3320 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3323 Parser.DOMImpl.freeDocument(DOM);
3330 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3336 F.Seek(P, soFromEnd);
3338 if Buf = '</bottlelog>' then
3343 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3346 F.Seek(P, soFromEnd);
3347 Buf := Format('<message mid="%s">', [Args['MID']]);
3348 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3349 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3350 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3351 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3352 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3353 Buf := Buf + '</message>';
3354 Buf := Buf + '</bottlelog>';
3355 F.Write(Buf[1], Length(Buf));
3362 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3366 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3371 SelText := memScript.SelText;
3372 if SelText <> '' then
3374 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3381 function TfrmSender.ReplaceSurface(Script: String;
3382 Params: TCollection): String;
3384 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3385 OldStr, Tag: String;
3386 i, j, k, Cur: integer;
3387 Item: TSurfaceReplaceItem;
3388 Before: TSurfaceReplaceBeforeItem;
3394 OldStr := InputString;
3395 OldLeaveEscape := LeaveEscape;
3396 OldEscapeInvalidMeta := EscapeInvalidMeta;
3397 LeaveEscape := true;
3398 EscapeInvalidMeta := false;
3399 InputString := Script;
3401 for i := 0 to SsParser.Count-1 do
3403 if SsParser.MarkUpType[i] <> mtTag then
3405 Result := Result + SsParser.Str[i];
3408 Tag := SsParser.Str[i];
3409 if SsParser.Match(Tag, '\s%d') = 2 then
3410 Cur := Ord(Tag[3]) - Ord('0')
3411 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3412 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3415 Result := Result + Tag;
3419 for j := 0 to Params.Count-1 do
3421 Item := Params.Items[j] as TSurfaceReplaceItem;
3422 for k := 0 to Item.Before.Count-1 do
3424 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3425 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3428 Result := Result + Format('\s[%d]', [Item.After]);
3436 Result := Result + Tag;
3440 LeaveEscape := OldLeaveEscape;
3441 EscapeInvalidMeta := OldEscapeInvalidMeta;
3442 InputString := OldStr;
3446 procedure TfrmSender.WMQueryEndSession(var msg: TWMQueryEndSession);
3448 // Windows
\82ª
\8fI
\97¹
\82µ
\82æ
\82¤
\82Æ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82ð
\8a´
\92m
\82·
\82é
3449 FEndSession := true;
3454 procedure TfrmSender.IdSLPP20ConnectFailed(Sender: TObject);
3457 if FBeginConnectFailCount = 0 then
3460 if Pref.UseHttpProxy then
3461 frmMessageBox.ShowMessage('HTTP Proxy
\82ð
\92Ê
\82¶
\82ÄSSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3462 '
\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 +
3463 '
\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')
3465 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3466 '
\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 +
3467 '
\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');
3469 ShowHintLabel('SSTP Bottle Server
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
3470 Inc(FBeginConnectFailCount);
3474 procedure TfrmSender.BuildReplaceMenu(Root: TMenuItem);
3477 Presets: TReplacePresetCollection;
3481 Presets := Pref.ReplacePresets.Presets;
3482 for i := 0 to Presets.Count-1 do
3484 NewItem := TMenuItem.Create(Root);
3487 Caption := Presets[i].Title;
3488 ShortCut := Presets[i].ShortCut;
3489 AutoHotkeys := maManual;
3490 Hint := Presets[i].Pairs.StringExpression;
3492 OnClick := mnPresetReplaceClick;
3496 Root.Enabled := Presets.Count > 0;
3499 procedure TfrmSender.mnPresetReplaceClick(Sender: TObject);
3501 Preset: TReplacePreset;
3504 //
\83v
\83\8a\83Z
\83b
\83g
\92u
\8a·
\82ð
\8eÀ
\8ds
3505 Preset := Pref.ReplacePresets.Presets[(Sender as TMenuItem).Tag];
3506 Lines := memScript.Lines.Text;
3507 New := Preset.Pairs.ExecuteReplace(Lines);
3508 if New <> Lines then
3510 memScript.SelectAll;
3511 memScript.SelText := New;
3513 if Preset.ConfirmAfterReplace then
3519 procedure TfrmSender.BottleCnv(Log: TLogItem);
3521 HeadValue: THeadValue;
3524 HeadValue := THeadValue.Create;
3525 HeadValue['MID'] := Log.MID;
3526 HeadValue['Channel'] := Log.Channel;
3527 // HeadValue['SEND'] := 'SSTP/1.4';
3528 // HeadValue['Sender'] := 'SSTP Bottle ' + Log.Channel;
3529 HeadValue['IfGhost'] := Log.Ghost;
3530 HeadValue['Script'] := Log.Script;
3531 // HeadValue['Charset'] := 'Shift_JIS';
3532 // HeadValue['DialogMessage'] := Log.Script;
3534 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
\8f\88\97\9d\82Ö
3535 DispatchBottle(HeadValue, Log.LogTime, Log.Votes, Log.Agrees);
3541 procedure TfrmSender.SetScriptAutoBackUp;
3543 //
\83o
\83b
\83N
\83A
\83b
\83v
\83^
\83C
\83}
\81[
\82Ö
\92l
\82Ì
\83Z
\83b
\83g
3544 frmSender.ScriptBackUp.Enabled := Pref.ScriptBackUp;
3545 frmSender.ScriptBackUp.Interval := Pref.ScriptBackUpTime * 60000;
3548 procedure TfrmSender.ScriptBackUpTimer(Sender: TObject);
3552 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8e©
\93®
\83o
\83b
\83N
\83A
\83b
\83v
3553 if FScriptBackModified then
3555 Script := FormatDateTime('yy/mm/dd hh:nn:ss', Now) + #13#10 + GetScriptText;
3556 AppendTextLog(ExtractFilePath(Application.ExeName) + AutoSaveFile,
3557 Script, Pref.ScriptBackUpMode);
3558 ShowHintLabel('
\83o
\83b
\83N
\83A
\83b
\83v
\8eÀ
\8ds');
3559 FScriptBackModified := False;
3563 procedure TfrmSender.UpdateChannelList;
3565 Ch: TChannelListItem;
3568 //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\92è
\8b`
3570 //
\83t
\83\89\83O
\82ð
\8c©
\82Ä
\94»
\92f
3571 if NOT Pref.GhostCh then exit;
3572 if (Pref.GhostChList.Count mod 2) = 1 then
3574 Pref.GhostChList.Add(''); //
\95s
\91«
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Å
\93K
\93\96\82É
\92Ç
\89Á
3575 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82ð
\8dÄ
\90Ý
\92è
\82µ
\82Ä
\82
\82¾
\82³
\82¢');
3579 while i < Pref.GhostChList.Count-1 do
3581 Ch := TChannelListItem.Create;
3582 Ch.Name := Pref.GhostChList.Strings[i];
3583 Ch.Ghost := Pref.GhostChList.Strings[i+1];
3587 Ch.WarnPost:= false;
3588 ChannelList.Add(Ch);
3593 procedure TfrmSender.UpdateJoinChannelList;
3595 UpdateChannelList; //
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
3596 with tabChannel do //
\96¢
\8eg
\97p
3602 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
3603 actNextChannel.Enabled := false;
3604 actPrevChannel.Enabled := false;
3605 OnChange := tabChannelChange;
3609 procedure TfrmSender.PerformFileOpen(const AFileName: string);
3611 //
\8eÀ
\8dÛ
\82É
\83t
\83@
\83C
\83\8b\82ð
\8aJ
\82
3612 Screen.Cursor := crHourGlass;
3614 memScript.Lines.LoadFromFile(AFileName);
3615 SetFileModified(false);
3616 SetFileName(AFileName, true);
3617 Pref.TextDir := ExtractFileDir(AFileName);
3621 ShowMessage('
\83G
\83\89\81[:'#13#10#13#10 + E.Message);
3622 SetFileName(NewFileTitle, true); //
\8e¸
\94s
\82µ
\82½
\8e\9e\82Í
\83^
\83C
\83g
\83\8b\8f\89\8aú
\89»
\81B
3625 Screen.Cursor := crDefault;
3630 procedure TfrmSender.PerformFileSave(const AFileName: string);
3632 //
\8eÀ
\8dÛ
\82É
\95Û
\91¶
\82·
\82é
3633 Screen.Cursor := crHourGlass;
3635 memScript.Lines.SaveToFile(AFileName);
3636 SetFileModified(false);
3637 Pref.TextDir := ExtractFileDir(AFileName);
3640 ShowMessage('
\83G
\83\89\81[:'#13#10#13#10 + E.Message);
3642 Screen.Cursor := crDefault;
3645 procedure TfrmSender.actFileOpenExecute(Sender: TObject);
3648 if CheckFileModified(Self) = idCancel then exit;
3649 OpenDialog.InitialDir := Pref.TextDir;
3650 if OpenDialog.Execute then
3651 if CheckFileExt(OpenDialog.FileName) then //
\8ag
\92£
\8eq
\82Ì
\83`
\83F
\83b
\83N
3652 PerformFileOpen(OpenDialog.FileName);
3655 procedure TfrmSender.SetFileName(const FileName: String; const Value: boolean);
3657 //
\83^
\83C
\83g
\83\8b\95Ï
\8dX
\82Æ
\83t
\83@
\83C
\83\8b\83p
\83X
\83Z
\83b
\83g
3658 //
\82à
\82µ
\81A
\91æ
\93ñ
\88ø
\90\94\82ªfalse
\82È
\82ç
\83^
\83C
\83g
\83\8b\82¾
\82¯
\95Ï
\8dX
3659 if Value then FFileName := FileName;
3660 Self.Caption := Format('%s - %s', [ExtractFileName(FileName), FOriginalCaption]);
3663 function TfrmSender.CheckFileModified(Sender: TObject): integer;
3667 //
\83t
\83@
\83C
\83\8b\82Ì
\95Ï
\8dX
\82ð
\8am
\94F
3668 // Result := idCancel
\82Å
\8fI
\97¹
\91j
\8e~
3669 if FFileModified then
3671 Res := MessageDlg(Format('
\83t
\83@
\83C
\83\8b %s
\82Í
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81B'#13#10#13#10 +
3672 '
\95Û
\91¶
\82µ
\82Ü
\82·
\82©
\81H', [FFileName]), mtConfirmation, mbYesNoCancel, 0);
3673 if Res = idYes then Res := FileSave(Self);
3679 function TfrmSender.FileSave(Sender: TObject): integer;
3684 if FFileName = NewFileTitle then
3685 Res := FileSaveAs(Sender) //
\83p
\83X
\96¼
\82ª
\8ew
\92è
\82³
\82ê
\82Ä
\82¢
\81¨
\90V
\8bK
3688 PerformFileSave(FFileName);
3694 function TfrmSender.FileSaveAs(Sender: TObject): integer;
3698 //
\96¼
\91O
\82ð
\95t
\82¯
\82Ä
\95Û
\91¶
3700 SaveDialog.FileName := ExtractFileName(FFileName);
3701 SaveDialog.InitialDir := Pref.TextDir;
3702 if SaveDialog.Execute then
3704 if CheckFileExt(SaveDialog.FileName) = false then //
\8ag
\92£
\8eq
\83`
\83F
\83b
\83N
3709 if FileExists(SaveDialog.FileName) then
3710 Res := MessageDlg(Format('%s
\82Í
\8aù
\82É
\91¶
\8dÝ
\82µ
\82Ä
\82¢
\82Ü
\82·
\81B'#13#10 + '
\8fã
\8f\91\82«
\82µ
\82Ü
\82·
\82©
\81H',
3711 [SaveDialog.FileName]), mtConfirmation, mbYesNoCancel, 0);
3714 PerformFileSave(SaveDialog.FileName);
3715 SetFileName(SaveDialog.FileName, true);
3722 procedure TfrmSender.actFileSaveAsExecute(Sender: TObject);
3724 //
\96¼
\91O
\82ð
\95t
\82¯
\82Ä
\95Û
\91¶
\8cÄ
\82Ñ
\8fo
\82µ
3728 procedure TfrmSender.actFileSaveExecute(Sender: TObject);
3730 //
\8fã
\8f\91\82«
\95Û
\91¶
\8cÄ
\82Ñ
\8fo
\82µ
3734 procedure TfrmSender.SetFileModified(const Value: boolean);
3736 //
\83t
\83@
\83C
\83\8b\95Ï
\8dX
\83t
\83\89\83O
\82Æ
\95\
\8e¦
\95Ï
\8dX
3738 StatusBar.Panels[PanelConnecting].Text := '
\95Ï
\8dX'
3740 StatusBar.Panels[PanelConnecting].Text := '';
3741 FFileModified := Value;
3744 procedure TfrmSender.OpenBrowser(const Url: string);
3748 if Pref.BrowserExeName = '' then
3750 ShellExecute(Handle, 'open', PChar(Url), nil, nil, SW_SHOW);
3753 Command := Pref.BrowserExeName + ' ' + Url;
3754 WinExec(PChar(Command), SW_SHOW);
3758 function TfrmSender.CheckFileExt(const AFileName: string): boolean;
3762 //
\8ag
\92£
\8eq.bak
\82Ì
\83t
\83@
\83C
\83\8b\82Í
\93Ç
\8f\91\82«
\82µ
\82È
\82¢
\81B
3764 if LowerCase(ExtractFileExt(AFileName)) = '.bak' then
3767 ShowMessage('
\8ag
\92£
\8eqbak
\82Í
\88µ
\82¦
\82Ü
\82¹
\82ñ
\81B'#13#10 + '
\91¼
\82Ì
\83G
\83f
\83B
\83^
\82ð
\8eg
\97p
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B');
3774 procedure TfrmSender.CopyDataMessage(var WMCopyData: TWMCopyData);
3777 HeadValue: THeadValue;
3780 if WMCopyData.CopyDataStruct.dwData = 1 then
3782 Param := PChar(WMCopyData.CopyDataStruct.lpData);
3783 HeadValue := THeadValue.Create(Param);
3785 if HeadValue['Script'] <> '' then
3786 DispatchBottle(HeadValue, Now(), 0, 0)
3787 else if HeadValue['Type'] = 'Vote' then
3788 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0))
3789 else if HeadValue['Type'] = 'Agree' then
3790 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0))
3791 else if (HeadValue['Num'] <> '') AND (HeadValue['Channel'] = '') AND
3792 (HeadValue['Entry'] = '') then
3793 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l';