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
310 //FSubFileName: string; //
\95Ê
\96¼
312 // FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
313 // 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)
315 FBottleSstp: TBottleSstp; //
\8dÄ
\91\97\83v
\83\8d\83O
\83\89\83\80
317 // 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Ý)
318 // FBeginConnectFailCount: integer; //
\89½
\93x
\82à
\90Ú
\91±
\8e¸
\94s
\82µ
\82½
\82ç
\83\8a\83g
\83\89\83C
\92\86\8e~
320 FVisiblePreviewGhost: String;
321 FVisiblePreviewSurface: integer; //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82Å
\8c©
\82¦
\82Ä
\82¢
\82é
\82à
\82Ì
322 FVisibleMenuItem: TMenuItem; //
\83N
\83\8a\83b
\83N
\82³
\82ê
\82½
\83\81\83j
\83\85\81[
\83A
\83C
\83e
\83\80\81B
323 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\82ª
\83\81\83j
\83\85\81[
\82Ì
\89º
\82É
324 //
\89B
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\8bL
\89¯
\82µ
\82Ä
\82¨
\82
326 FTargetGhostExpand: boolean; //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82ª
\81A
327 //
\88ê
\8e\9e\93I
\82É
\91S
\95\94\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\82©
\82Ç
\82¤
\82©
\82Ì
\83t
\83\89\83O
329 FScriptBuffer: TObjectList; //
\83X
\83N
\83\8a\83v
\83g
\83N
\83\8a\83A
\83o
\83b
\83t
\83@
331 FWM_TaskBarCreated: WORD; //
\83^
\83X
\83N
\83o
\81[
\93o
\98^
\97p
\83E
\83B
\83\93\83h
\83E
\83\81\83b
\83Z
\81[
\83WID
333 // procedure SetStatusText(const Value: String);
334 procedure SetSleeping(const Value: boolean);
336 // procedure SetConnecting(const Value: boolean);
337 // procedure SetAdded(const Value: boolean);
338 procedure mnConstClick(Sender: TObject);
339 procedure mnConstGroupClick(Sender: TObject);
340 procedure mnPresetReplaceClick(Sender: TObject);
341 // property Added: boolean read FAdded write SetAdded;
342 property Sleeping: boolean read FSleeping write SetSleeping;
343 // property StatusText: String read FStatusText write SetStatusText;
344 function GetScriptText: String;
345 procedure ChangeTaskIcon;
346 procedure ShowHintLabel(const Mes: String; Col: TColor = clBlue);
347 procedure UpdateLayout;
348 // procedure DispatchBottle(EventType: TIdSlppEventType; Dat: THeadValue);
349 procedure DispatchBottle(Dat: THeadValue; LogTime: TDateTime;
350 Vote, Agree: integer);
351 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
352 // procedure UpdateChannelInfo(Dat: THeadValue);
353 // procedure UpdateJoinChannelList(Dat: THeadValue);
354 procedure UpdateJoinChannelList;
355 procedure UpdateChannelList;
356 // procedure NoLuidError;
357 procedure UpdateIfGhostBox;
358 function BuildMenuConditionCheck(const IfGhost, Ghost: String): boolean;
359 procedure BuildMenu(Root: TMenuItem; Simple: boolean);
360 procedure BuildReplaceMenu(Root: TMenuItem);
361 procedure PlaySound(const FileName: String);
362 //TBottleSstp
\8aÖ
\8cW
\83C
\83x
\83\93\83g
\83n
\83\93\83h
\83\89
363 procedure BottleSstpResendCountChange(Sender: TObject);
364 procedure BottleSstpResendTrying(Sender: TObject; MID: String);
365 procedure BottleSstpResendEnd(Sender: TObject; MID: String);
366 function IsSurfaceTag(const Script: String; var ID: integer): boolean;
367 procedure DoSurfacePreview(Surface: integer; const Kind:
368 TSurfacePreviewType);
369 function GetSurfacePreviewPositionHint(w, h: integer): TPoint;
370 function GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
371 procedure EditorPreview;
372 //
\83^
\83O
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\95Ï
\8a·
\82·
\82é
373 function TagReplace(Script: String;
374 Before, After: array of String): String; overload;
375 function TagReplace(Script: String;
376 Before, After: TStrings): String; overload;
377 //
\83T
\81[
\83t
\83B
\83X
\82ð
\95Ï
\8a·
\82·
\82é
378 function ReplaceSurface(Script: String; Params: TCollection): String;
379 procedure ClearEditor;
380 procedure CopyFromLogToEditor(Log: TLogItem);
382 procedure AppendTextLog(const FileName, Line: String);
383 procedure AppendXMLLog(const FileName: String; Args: THeadValue);
384 //
\8e©
\93®
\95Û
\91¶
\90Ý
\92è
385 procedure SetScriptAutoBackUp;
386 //
\92P
\91Ì
\83t
\83@
\83C
\83\8b\93ü
\8fo
\97Í
\8aÖ
\8cW
387 procedure PerformFileOpen(AFileName: string);
388 procedure PerformFileSave(const AFileName: string);
389 procedure SetFileName(const FileName: String; const Value: boolean);
390 function CheckFileSave(Sender: TObject): integer;
391 function FileSave(Sender: TObject): integer;
392 function FileSaveAs(Sender: TObject): integer;
393 procedure EditerStatusChange;
394 procedure SetFileModified(const Value: boolean);
395 function FileCheck(const AFileName: string): boolean;
398 procedure WndProc(var Message: TMessage); override;
399 procedure WMQueryEndSession(var msg: TWMQueryEndSession);
400 message WM_QUERYENDSESSION;
402 procedure CopyDataMessage(var WMCopyData: TWMCopyData); message WM_COPYDATA;
405 function DoTrans(var Script: String;
406 Options: TScriptTransOptions): String; overload;
407 function DoTrans(var Script: String;
408 Options: TScriptTransOptions; out FoundURL: boolean): String; overload;
409 function ScriptTransForSSTP(const Script: String;
410 out Error: String): String; overload;
411 // procedure BeginConnect;
412 // procedure RetryBeginConnect;
413 // procedure EndConnect;
414 procedure ConstructMenu(Simple: boolean);
415 // property Connecting: boolean read FConnecting write SetConnecting;
416 property BottleSstp: TBottleSstp read FBottleSstp;
417 function GhostNameToSetName(const Ghost: String): String;
418 // procedure PostCommand(const Command: array of String); overload;
419 // procedure PostCommand(Command: TStrings); overload;
420 // procedure PostSetChannel(Channels: TStrings);
421 procedure SaveChainRuleList;
422 //DispatchBottle()
\82Ö
\83o
\83C
\83p
\83X
423 procedure BottleCnv(Log: TLogItem);
424 //
\83u
\83\89\83E
\83U
\94»
\92f
\82ÆURL
\88ø
\93n
\82µ
425 procedure OpenBrowser(const Url: string);
426 //Log
\83E
\83B
\83\93\83h
\83E
\82©
\82ç
\8fð
\8c\8f\95t
\82Å
\8cÄ
\82Î
\82ê
\82é
427 procedure LogInsertCue(const TestAction: boolean);
432 frmSender: TfrmSender;
435 PanelConnecting = 0; //
\81u
\90Ú
\91±
\92\86\81v
\95\
\8e¦
\97p
436 PanelBytes = 1; //
\81\9b\81\9b\83o
\83C
\83g
437 PanelCount = 2; //Local Proxy
\81A
\8c»
\8dÝ
\81\9b\8c\8f\91Ò
\82¿
438 PanelMembers = 3; //
\81\9b\81\9b\90l
439 PanelStatus = 4; //SSTP Bottle
\83T
\81[
\83o
\82É
\93o
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81c
\82È
\82Ç
442 IconDisconnected = 47; //
\8b\8c18
\8e¸
\94s
\8fó
\91Ô
\82ð
\8fí
\82É
\8eg
\97p
444 IconSleepDisconnected = 47; //
\8b\8c20
446 WarningColor = clRed;
448 SendButtonLongHint = 'Bottle
\82Ì
\91\97\90M';
449 NewFileTitle = '
\96¼
\8fÌ
\96¢
\92è';
450 AutoSaveFile = 'Script.bak';
452 function Token(const Str: String; const Delimiter: char;
453 const Index: integer): String;
455 function StringReplaceEx(const Before: String; List: THeadValue): String;
459 uses SettingForm, LogForm,
460 MessageBox, FMOExplorer, EditorTalkShow;
461 //SendConfirm, ChannelListForm,
465 //
\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
466 function Token(const Str: String; const Delimiter: char;
467 const Index: integer): String;
468 var i, c, len: integer;
474 while i <= len do begin
475 if (Str[i] = Delimiter) and (StrByteType(PChar(Str), i) <> mbTrailByte) then begin
477 if c > Index then Break;
478 end else if c = Index then Result := Result + Str[i];
483 //
\95¶
\8e\9a\97ñ
\82ð
\92u
\82«
\8a·
\82¦
\82é
\83\86\81[
\83e
\83B
\83\8a\83e
\83B
\8aÖ
\90\94
484 function StringReplaceEx(const Before: String; List: THeadValue): String;
486 i, MinPos, MinKey, p: integer;
495 for i := 0 to List.Count-1 do
497 p := Pos(List.KeyAt[i], Work);
498 if (p > 0) and ((p < MinPos) or (MinPos < 0)) then
506 Result := Result + Work;
510 Result := Result + Copy(Work, 1, MinPos-1) + List.ValueAt[MinKey];
511 Delete(Work, 1, (MinPos - 1) + Length(List.KeyAt[MinKey]));
518 procedure TfrmSender.actConfirmExecute(Sender: TObject);
520 AScript, Err, AGhost: String;
524 // Partial Confirmation
525 if memScript.SelText <> '' then
528 if not Pref.AutoPartialConfirm then
529 if not MultipleChoiceEdit('
\8am
\94F', ['
\91I
\91ð
\95\94\95ª
\82Ì
\82Ý', '
\83X
\83N
\83\8a\83v
\83g
\91S
\91Ì'], Choice) then
533 AScript := memScript.SelText;
534 AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
536 AScript := GetScriptText;
538 AScript := GetScriptText;
539 AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
541 if Length(AScript) = 0 then Exit;
543 AScript := ScriptTransForSSTP(AScript, Err);
550 if cbxTargetGhost.ItemIndex > 0 then
551 AGhost := cbxTargetGhost.Text
552 {
\95K
\82¸
\8ew
\92è
\82³
\82ê
\82é
\82Í
\82¸
553 else if FNowChannel <> '' then
554 AGhost := ChannelList.Channel[FNowChannel].Ghost
559 if Pref.IgnoreTimeCritical then
560 AScript := TagReplace(AScript, ['\t'], ['']);
562 Item := TLogItem.Create;
568 Channel := '
\81y
\8am
\94F
\81z';
571 BottleSstp.Unshift(Item);
576 // FScriptModified := false;
579 procedure TfrmSender.FormCreate(Sender: TObject);
580 var Str: TStringList;
582 FScriptBuffer := TObjectList.Create(true);
584 SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
585 FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
586 ScriptConstList.LoadFromDir(FConstDir);
587 FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
588 Spps.LoadFromDirectory(FSppDir);
589 ConstructMenu(false);
590 BuildReplaceMenu(mnPresetReplaceRoot);
592 Str := TStringList.Create;
595 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'rule.txt');
596 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
599 Str.LoadFromFile(ExtractFilePath(Application.ExeName)+'defrule.txt');
600 BottleChainRuleList := StringToComponent(Str.Text) as TBottleChainRuleList;
602 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');
603 Application.Terminate;
604 Application.ProcessMessages;
612 FOriginalCaption := Self.Caption;
615 mnShowToolBar.Checked := Pref.ShowToolBar;
616 mnShowConstBar.Checked := Pref.ShowConstBar;
617 if Pref.StayOnTop then begin
618 FormStyle := fsStayOnTop;
619 mnStayOnTop.Checked := true;
621 FormStyle := fsNormal;
622 mnStayOnTop.Checked := false;
625 // URL
\83W
\83\83\83\93\83v
\90æ
\82ð
\83q
\83\93\83g
\95¶
\8e\9a\97ñ
\82Æ
\82µ
\82Ä
\90Ý
\92è
626 mnGoToHP.Hint := Pref.HomePage;
627 mnGotoVote.Hint := Pref.VotePage;
628 mnGotoHelp.Hint := Pref.HelpPage;
630 mnGetNewId.Enabled := (Pref.LUID = '');
632 //
\82³
\82
\82ç
\83X
\83N
\83\8a\83v
\83g
\89ð
\90Í
\83p
\83^
\81[
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
634 SsParser.TagPattern.LoadFromFile(ExtractFilePath(Application.Exename) + 'tagpat.txt');
635 SsParser.MetaPattern.LoadFromFile(ExtractFilePath(Application.ExeName) + 'metapat.txt');
637 ShowMessage('tagpat.txt, metapat.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\81B');
638 Application.Terminate;
641 //
\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è
642 SsPlayTime.PlayTimeParams := Pref.PlayTimeParams;
644 //
\83\81\83C
\83\93\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82Æ
\83T
\83C
\83Y
\82ð
\95\9c\8bA
645 with Pref.SenderWindowPosition do begin
648 Self.Width := Right - Left + 1;
649 Self.Height := Bottom - Top + 1;
652 //
\83^
\83X
\83N
\83o
\81[
\82Ì
\8dÄ
\8bN
\93®(Explorer
\82ª
\97\8e\82¿
\82½
\82Æ
\82«)
\82ð
\8c\9f\8fo
\82·
\82é
653 FWM_TaskBarCreated := RegisterWindowMessage('TaskBarCreated');
655 //
\83X
\83N
\83\8a\83v
\83g
\95¶
\8e\9a\97ñ
\82Ì
\8f\89\8aú
\89»
656 actClearExecute(Sender);
657 //
\83^
\83X
\83N
\83g
\83\8c\83C
\82É
\83A
\83C
\83R
\83\93\82ð
\92Ç
\89Á
659 //
\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»)
660 // UpdateJoinChannelList(nil);
662 UpdateJoinChannelList;
664 // SSTP
\8dÄ
\91\97\83I
\83u
\83W
\83F
\83N
\83g
665 FBottleSstp := TBottleSstp.Create(false);
666 with FBottleSstp do begin
667 OnResendCountChange := BottleSstpResendCountChange;
668 OnResendTrying := BottleSstpResendTrying;
669 OnResendEnd := BottleSstpResendEnd;
673 procedure TfrmSender.FormDestroy(Sender: TObject);
675 if FScriptBuffer <> nil then
678 if FBottleSstp <> nil then begin
679 FBottleSstp.Terminate;
683 with Pref.SenderWindowPosition do begin
686 Right := Self.Left + Self.Width - 1;
687 Bottom := Self.Top + Self.Height - 1;
690 // if JoinChannelsBackup <> nil then JoinChannelsBackup.Free;
692 ScriptConstList.Save;
695 BottleChainRuleList.Free;
701 procedure TfrmSender.SetConnecting(const Value: boolean);
703 FConnecting := Value;
705 StatusBar.Panels[PanelConnecting].Text := '
\92Ê
\90M
\92\86';
706 actStart.Enabled := false;
707 actStop.Enabled := false;
708 actSend.Enabled := false;
709 actVoteMessage.Enabled := false;
710 actAgreeMessage.Enabled := false;
711 mnGetNewId.Enabled := false;
712 Screen.Cursor := crAppStart;
714 StatusBar.Panels[PanelConnecting].Text := '';
715 actStart.Enabled := true;
716 actStop.Enabled := true;
717 actSend.Enabled := true;
718 frmLog.lvwLogChange(Self, nil, ctState);
719 mnGetNewId.Enabled := Pref.LUID = '';
720 Screen.Cursor := crDefault;
725 //
\83\81\83b
\83Z
\81[
\83W
\91\97\90M
726 procedure TfrmSender.actSendExecute(Sender: TObject);
728 Talk, AGhost: String;
729 // Command: TStringList;
735 if not Pref.SendAction then
737 ShowHintLabel('
\93®
\8dì
\82ª
\96¢
\90Ý
\92è
\82Å
\82·');
740 if Length(GetScriptText) = 0 then
742 ShowMessage('
\83X
\83N
\83\8a\83v
\83g
\82ª
\8bó
\82Å
\82·
\81B');
747 if Pref.LUID = '' then begin
751 if tabChannel.TabIndex < 0 then begin
752 ShowMessage('
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
753 '
\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');
756 if ChannelList.Channel[FNowChannel].NoPost then begin
758 ShowMessage(FNowChannel + '
\82Í
\8eó
\90M
\90ê
\97p
\82Å
\82·');
764 Talk := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
765 Err := DoTrans(Talk, [toWarnMessySurface, toWarnCheck]);
768 MessageDlg(Err, mtWarning, [mbOk], 0);
773 if Pref.NeedConfirmBeforeSend and FScriptModified then
775 MessageDlg('
\91\97\90M
\91O
\82É
\83\8d\81[
\83J
\83\8b\8am
\94F
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B', mtError, [mbOk], 0);
779 if not Pref.NoConfirm then begin
780 if not SendConfirmDialog(FNowChannel, cbxTargetGhost.Text) then Exit;
785 if cbxTargetGhost.ItemIndex > 0 then AGhost := cbxTargetGhost.Text;
786 //
\92P
\91Ì
\83A
\83N
\83V
\83\87\83\93
787 Item := TLogItem.Create;
803 ShowHintLabel('[local]
\82Ö
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
806 Command := TStringList.Create;
808 with Command do begin
809 Add('Command: sendBroadcast');
810 Add('Channel: ' + FNowChannel);
811 Add('LUID: ' + Pref.LUID);
812 Add('Agent: ' + VersionString);
813 if Ghost <> '' then Add('Ghost: ' + Ghost);
814 Add('Talk: ' + Talk);
816 PostCommand(Command);
821 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
822 AssignFile(F, ExtractFilePath(Application.ExeName) + SentLogFile);
823 if FileExists(ExtractFilePath(Application.ExeName) + SentLogFile) then
827 WriteLn(F, Format('%s,%s,%s,%s', [FNowChannel, Ghost, FormatDateTime('yy/mm/dd hh:nn:ss', Now), Talk]));
834 procedure TfrmSender.BeginConnect;
836 if Pref.LUID = '' then begin
840 IdSlpp20.LUID := Pref.LUID;
841 self.Cursor := crHourGlass;
842 if IdSlpp20.Connected then IdSlpp20.Disconnect;
843 if Pref.UseHttpProxy then begin
844 IdSlpp20.Host := Pref.ProxyAddress;
845 IdSlpp20.Port := Pref.ProxyPort;
846 IdSlpp20.ProxyMode := true;
848 IdSlpp20.Host := Pref.BottleServer;
849 IdSlpp20.Port := Pref.BottleServerPort;
850 IdSlpp20.ProxyMode := false;
852 IdSlpp20.ConnectServer;
853 self.Cursor := crDefault;
858 procedure TfrmSender.EndConnect;
860 IdSlpp20.OnDisconnect := nil;
866 procedure TfrmSender.SetAdded(const Value: boolean);
868 if FAdded = Value then Exit;
871 StatusText := 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·';
874 StatusText := '
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\90Ø
\82ê
\82Ä
\82¢
\82Ü
\82·!';
876 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½!', WarningColor);
882 procedure TfrmSender.HTTPSuccess(Sender: TObject);
883 var Str, ResStr, Command: String;
884 HeadValue: THeadValue;
886 SetChannel: TStringList;
889 Str := (Sender as THttpDownloadThread).RecvString;
893 HeadValue := THeadValue.Create(Str);
896 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');
899 Command := HeadValue['Command'];
900 ResStr := HeadValue['Result'];
901 if ResStr = 'Err' then begin
902 if HeadValue['ExtraMessage'] <> '' then begin
904 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\8e\9f\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½:'#13#10 +
905 HeadValue['ExtraMessage']);
908 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82ª
\89½
\82ç
\82©
\82Ì
\83G
\83\89\81[
\82ð
\95Ô
\82µ
\82Ü
\82µ
\82½
\81B');
911 if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
912 ShowHintLabel(HeadValue['Channel'] + '
\82Ì ' + HeadValue['SentNum'] +
913 '
\90l
\82É
\91\97\90M
\82µ
\82Ü
\82µ
\82½');
914 //
\83S
\81[
\83X
\83g
\82ð
\83f
\83t
\83H
\83\8b\83g
\82É
\96ß
\82·
915 if Pref.ResetIfGhostAfterSend then begin
916 actResetGhostExecute(Self);
918 //
\83X
\83N
\83\8a\83v
\83g
\82ð
\83N
\83\8a\83A
919 if Pref.ClearAfterSend then begin
922 end else if (Command = 'sendBroadcast') and (ResStr <> 'OK') then begin
923 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82ð
\91\97\90M
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½', WarningColor);
925 if (Command = 'getNewId') then begin
926 if ResStr = 'OK' then begin
927 Pref.LUID := HeadValue['NewID'];
928 ShowHintLabel('LUID
\8eæ
\93¾
\8a®
\97¹
\81B');
929 frmMessageBox.ShowMessage('
\8f\89\89ñ
\8bN
\93®
\82Ì
\82½
\82ß
\81A' +
930 'SSTP Bottle
\83T
\81[
\83o
\90Ú
\91±
\97p
\82ÌID(LUID)
\82ð
\90V
\8bK
\8eæ
\93¾
\82µ
\82Ü
\82µ
\82½
\81B'#13#10 +
931 'LUID: ' + Pref.LUID + #13#10 +
932 '
\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' +
933 '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' +
934 '
\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');
935 mnGetNewId.Enabled := false;
938 ShowHintLabel('LUID
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
941 if (Command = 'voteMessage') then begin
942 if ResStr = 'OK' then begin
943 ShowHintLabel('
\83\81\83b
\83Z
\81[
\83W
\82É
\93\8a\95[/
\93¯
\88Ó
\82µ
\82Ü
\82µ
\82½
\81B
\95[
\90\94: ' + HeadValue['Votes']);
946 if (Command = 'getChannels') and (ResStr = 'OK') then begin
947 UpdateChannelInfo(HeadValue);
950 if FAutoAddAfterGetChannel then begin
951 SetChannel := TStringList.Create;
952 if JoinChannelsBackup <> nil then begin
953 //
\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
954 SetChannel.Assign(JoinChannelsBackup);
956 //
\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¾
957 for i := 0 to Pref.AutoJoinChannels.Count-1 do begin
958 if ChannelList.Channel[Pref.AutoJoinChannels[i]] <> nil then
959 SetChannel.Add(Pref.AutoJoinChannels[i]);
963 Application.CreateForm(TfrmChannelList, frmChannelList);
965 if frmChannelList.Execute(ChannelList, JoinChannels) then begin
966 SetChannel := TStringList.Create;
967 SetChannel.Assign(frmChannelList.JoinList);
970 frmChannelList.Release;
973 if SetChannel <> nil then PostSetChannel(SetChannel);
975 if SetChannel <> nil then FreeAndNil(SetChannel);
978 if (Command = 'setChannels') then begin
979 if ResStr <> 'OK' then begin
981 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¢');
982 ShowHintLabel('
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
985 if HeadValue['ExtraTip'] <> '' then ShowHintLabel(HeadValue['ExtraTip']);
992 procedure TfrmSender.actStartClick(Sender: TObject);
994 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82É
\82Í
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
996 if Pref.LUID = '' then begin
1000 if not IdSlpp20.Connected then begin
1001 FBeginConnectFailCount := 0; //
\8e©
\93®
\8dÄ
\90Ú
\91±
\83J
\83E
\83\93\83^
\83\8a\83Z
\83b
\83g
1005 FAutoAddAfterGetChannel := false;
1006 PostCommand(['Command: getChannels']);
1011 procedure TfrmSender.actStopExecute(Sender: TObject);
1013 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82É
\82Í
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
1015 //
\8b
\90§
\8dÄ
\90Ú
\91±
\82ð
\8ds
\82¤
1016 IdSlpp20.OnDisconnect := nil;
1017 if IdSlpp20.Connected then IdSlpp20.Disconnect;
1018 FAutoAddAfterGetChannel := true;
1020 IdSlpp20.OnDisconnect := Slpp20Disconnect;
1024 procedure TfrmSender.FormShow(Sender: TObject);
1026 if FBooted or Application.Terminated then Exit;
1028 //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
1029 if Pref.LUID <> '' then BeginConnect
1030 else mnGetNewIdClick(Self);
1031 FAutoAddAfterGetChannel := Pref.AutoStart;
1034 if NOT Pref.NotShowLog then frmLog.Show;
1035 frmSurfacePreview.Show;
1037 SakuraSeeker.BeginDetect;
1038 SakuraSeekerDetectResultChanged(self);
1039 //
\8e©
\93®
\95Û
\91¶
\90Ý
\92è
\82Ì
\83\8d\81[
\83h
1040 SetScriptAutoBackUp;
1042 if SakuraSeeker.Count = 0 then
1043 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 +
1044 '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 +
1045 '
\8fÚ
\8d×
\82Í
\83w
\83\8b\83v
\82ð
\82²
\97\97\89º
\82³
\82¢
\81B');
1049 procedure TfrmSender.actAboutClick(Sender: TObject);
1052 Str := VersionString + #13#10 + BottleDisclaimer + #13#10#13#10;
1053 Str := Str + Format('Compiler Version: %f', [CompilerVersion]);
1054 frmMessageBox.ShowMessage(Str);
1057 procedure TfrmSender.actExitClientExecute(Sender: TObject);
1062 procedure TfrmSender.actClearExecute(Sender: TObject);
1064 Script, Default: String;
1066 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
1067 Default := StringReplace(Pref.DefaultScript, '|', '', [rfReplaceAll]);
1068 Default := StringReplace(Default, #13#10, '', [rfReplaceAll]);
1070 if (Pref.AutoClip) and (Length(GetScriptText) > 0) and (Script <> Default) then
1071 actSendToLogWindow.Execute
1076 procedure TfrmSender.memScriptChange(Sender: TObject);
1078 //
\83G
\83f
\83B
\83^
\93à
\97e
\82ª
\95Ï
\8dX
\82³
\82ê
\82½
\82Æ
\82«
1080 FScriptBackModified := true; //
\8e©
\93®
\95Û
\91¶
\8dÄ
\8aJ
1081 SetFileModified(true); //
\83t
\83@
\83C
\83\8b\95Ï
\8dX
\83t
\83\89\83O
1084 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 //
\94»
\92è
\82·
\82é
\95ª
\8fd
\82¢
\82©
\82à
\81H
1093 if Pref.NotScriptTime AND (Length(Script) > Pref.NotScriptTimeLen) then
1094 Text := Format('%d
\83o
\83C
\83g/?', [Length(Script)])
1097 Script := StringReplace(Script, #13#10, '', [rfReplaceAll]);
1098 Text := Format('%d
\83o
\83C
\83g/%d
\95b', [Length(Script), SsPlayTime.PlayTime(Script) div 1000])
1100 StatusBar.Panels[PanelBytes].Text := Text;
1101 // FScriptModified := true;
1105 procedure TfrmSender.mnStayOnTopClick(Sender: TObject);
1107 Pref.StayOnTop := not Pref.StayOnTop;
1108 mnStayOnTop.Checked := Pref.StayOnTop;
1109 if Pref.StayOnTop then begin
1110 FormStyle := fsStayOnTop;
1112 FormStyle := fsNormal;
1117 function TfrmSender.GetScriptText: String;
1119 Result := memScript.Lines.Text;
1122 procedure TfrmSender.mnConstClick(Sender: TObject);
1125 i := (Sender as TMenuItem).Tag;
1126 memScript.SelText := ScriptConstList.GetConstByID(i).ConstText;
1129 procedure TfrmSender.actEditConstExecute(Sender: TObject);
1131 ScriptConstList.LoadFromDir(FConstDir);
1133 Application.CreateForm(TfrmConstEditor, frmConstEditor);
1134 frmConstEditor.Execute;
1135 ScriptConstList.Save;
1137 frmConstEditor.Release;
1139 ConstructMenu(false);
1142 procedure TfrmSender.mnTaskBarClick(Sender: TObject);
1144 Application.Minimize;
1145 WindowState := wsNormal;
1148 procedure TfrmSender.FormClose(Sender: TObject; var Action: TCloseAction);
1151 TaskTray.Registered := false;
1154 procedure TfrmSender.ApplicationEventsMinimize(Sender: TObject);
1157 Application.ShowMainForm := false;
1158 ShowWindow(Application.Handle, SW_HIDE);
1161 procedure TfrmSender.ApplicationEventsRestore(Sender: TObject);
1163 Application.ShowMainForm := true;
1167 procedure TfrmSender.mnTaskRestoreClick(Sender: TObject);
1169 Application.Restore;
1172 procedure TfrmSender.TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
1174 Application.Restore;
1177 procedure TfrmSender.FormActivate(Sender: TObject);
1182 procedure TfrmSender.mnTaskNewMessageClick(Sender: TObject);
1184 Application.Restore;
1185 actClearExecute(Sender);
1188 procedure TfrmSender.ChangeTaskIcon;
1194 if Sleeping then IcoNum := IconSleep else IcoNum := IconConnected;
1196 if Sleeping then IcoNum := IconSleepDisconnected
1197 else IcoNum := IconDisconnected;
1200 //
\83^
\83X
\83N
\83A
\83C
\83R
\83\93\82Ì
\8fó
\91Ô
\81i
\8e¸
\94s
\8fó
\91Ô
\8eg
\97p
\81j
1201 if Sleeping then IcoNum := IconSleepDisconnected
1202 else IcoNum := IconDisconnected;
1204 Ico := TIcon.Create;
1206 imgIcon.GetIcon(IcoNum, Ico);
1207 TaskTray.Icon := Ico;
1208 TaskTray.Registered := true;
1213 ; // 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
1214 //
\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
1215 //
\82»
\82Ì
\8fê
\8d\87\82Í
\83G
\83\89\81[
\82ð
\96³
\8e\8b\82·
\82é
1220 procedure TfrmSender.SetStatusText(const Value: String);
1222 FStatusText := Value;
1223 StatusBar.Panels[PanelStatus].Text := Value;
1227 procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
1230 if Length(Application.Hint) > 0 then
1232 StatusBar.Panels[PanelStatus].Text := GetLongHint(Application.Hint);
1233 Application.HintColor := clInfoBk;
1234 {
\91\97\90M
\83{
\83^
\83\93\8aÖ
\98A
1235 if (Application.Hint = SendButtonLongHint)
1236 and (FNowChannel <> '') then
1238 //
\91\97\90M
\83{
\83^
\83\93\82Ì
\8fê
\8d\87\82Í
\91¬
\8dU
\8fo
\82·
1239 Application.HintColor := clYellow;
1240 Application.ActivateHint(Mouse.CursorPos);
1243 if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
1245 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
1246 DoSurfacePreview(id, spHint);
1250 StatusBar.Panels[PanelStatus].Text := FStatusText;
1251 frmSurfacePreview.HideAway;
1255 procedure TfrmSender.ConstructMenu(Simple: boolean);
1257 BuildMenu(mnPopConst, Simple);
1258 BuildMenu(mnPopUpConst.Items, Simple);
1259 BuildMenu(ConstBarMenu.Items, Simple);
1260 //
\96\88\89ñ
\8f\89\8aú
\89»?
1261 if Pref.EConstBar then ConstMenuBar.Menu := nil;
1262 ConstMenuBar.AutoSize := false;
1263 ConstMenuBar.Width := 1000;
1264 ConstMenuBar.Menu := ConstBarMenu;
1265 ConstMenuBar.AutoSize := true;
1268 procedure TfrmSender.memScriptKeyDown(Sender: TObject; var Key: Word;
1269 Shift: TShiftState);
1271 Func: TReturnKeyFunction;
1273 if (Key = VK_RETURN) then begin
1274 if (ssShift in Shift) then
1275 Func := Pref.WhenShiftReturn
1276 else if (ssCtrl in Shift) then
1277 Func := Pref.WhenCtrlReturn
1279 Func := Pref.WhenReturn;
1282 with tbtnInsertConst do
1283 Pos := tbtnInsertConst.ClientToScreen(Point(0, Height));
1284 mnPopUpConst.Popup(Pos.X, Pos.Y);
1287 memScript.SelText := '\n';
1291 memScript.SelText := '\n'#13#10;
1294 memScript.SelText := #13#10
1300 procedure TfrmSender.mnShowToolBarClick(Sender: TObject);
1302 mnShowToolBar.Checked := not mnShowToolBar.Checked;
1303 Pref.ShowToolBar := mnShowToolBar.Checked;
1307 procedure TfrmSender.mnShowConstBarClick(Sender: TObject);
1309 mnShowConstBar.Checked := not mnShowConstBar.Checked;
1310 Pref.ShowConstBar := mnShowConstBar.Checked;
1314 procedure TfrmSender.UpdateLayout;
1316 with SakuraScriptFountain do begin
1317 TagColor.Color := Pref.MarkUpColor;
1318 TagErrorColor.Color := Pref.MarkErrorColor;
1319 Scope0Color.Color := Pref.TalkColorH;
1320 Scope1Color.Color := Pref.TalkColorU;
1321 SynchronizedColor.Color := Pref.TalkColorS;
1323 memScript.Ruler.Visible := Pref.ShowRuler;
1324 memScript.Ruler.Color := Pref.TextColor;
1325 memScript.Color := Pref.BgColor;
1327 ToolBar.Visible := Pref.ShowToolBar;
1328 ConstMenuBar.Visible := Pref.ShowConstBar;
1331 with tabChannel do begin
1332 TabPosition := Pref.TabPosition;
1333 case Pref.TabPosition of
1334 tpTop: Align := alTop;
1335 tpBottom: Align := alBottom;
1337 TabWidth := Pref.TabWidth;
1341 function TfrmSender.DoTrans(var Script: String;
1342 Options: TScriptTransOptions; out FoundURL: boolean): String;
1343 var UrlCancel, Mark: String;
1344 Url, UrlName: array[0..6] of String;
1345 i, j, u, UrlCount: integer;
1346 LastSurfaceH, LastSurfaceU: integer;
1347 UnyuTalking: boolean;
1348 QuickSection, Synchronize: boolean;
1349 Warnings: TStringList;
1354 UnyuTalking := false;
1355 QuickSection := false;
1356 Synchronize := false;
1357 SsParser.LeaveEscape := true;
1358 SsParser.EscapeInvalidMeta := false;
1359 SsParser.InputString := Script;
1361 Warnings := TStringList.Create;
1363 for i := 0 to SsParser.Count-1 do begin
1364 if SsParser[i] = '\t' then begin
1365 if not(toIgnoreTimeCritical in Options) then
1366 Script := Script + '\t';
1367 end else if SsParser[i] = '\e' then begin
1369 end else if (SsParser.Match(SsParser[i], '\URL%b') > 0) then begin
1370 if toConvertURL in Options then begin
1371 UrlCount := 0; //
\91O
\82ÌURL
\83^
\83O
\82Ì
\89e
\8b¿
\82ð
\96³
\8e\8b\81B
1372 for u := 7 downto 1 do begin
1373 if (SsParser.Match(SsParser[i],
1374 '\URL%b'+StringReplace(StringOfChar('-', u*2),
1375 '-', '%b', [rfReplaceAll]))) > 0 then begin
1376 for j := 1 to u do begin
1377 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
1378 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
1379 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
1380 if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
1383 if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
1384 if UrlCancel = '' then UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1386 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin //
\8aÈ
\88Õ
\94ÅURL
\95Ï
\8a·
1387 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
1388 Url[0] := SsParser.GetParam(SsParser[i], 1);
1389 UrlName[0] := '
\8ds
\82
\81@
\81@
\81@
\81@
\81@
\81@';
1390 UrlCancel := '
\8ds
\82©
\82È
\82¢
\81@
\81@
\81@
\81@';
1391 if Pos('http://', Url[0]) > 0 then begin
1393 if not QuickSection then
1394 Script := Script + '\_q' + Url[0] + '\_q'
1396 Script := Script + Url[0];
1399 end else Script := Script + SsParser[i];
1401 Mark := SsParser[i];
1402 if Mark = '\h' then begin
1403 UnyuTalking := false;
1404 if toHUTagTo01Tag in Options then Mark := '\0';
1405 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1406 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');
1407 end else if Mark = '\u' then begin
1408 UnyuTalking := true;
1409 if toHUTagTo01Tag in Options then Mark := '\1';
1410 if Synchronize and Pref.WarnScopeChangeInSynchronize then
1411 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');
1412 end else if Mark = '\_q' then begin
1413 QuickSection := not QuickSection;
1414 end else if Mark = '\_s' then begin
1415 Synchronize := not Synchronize;
1416 end else if SsParser.Match(Mark, '\s%b') > 0 then begin
1417 if UnyuTalking then begin
1418 LastSurfaceU := StrToIntDef(SsParser.GetParam(Mark, 1),
1421 LastSurfaceH := StrToIntDef(SsParser.GetParam(Mark, 1),
1424 end else if SsParser.Match(Mark, '\s%d') > 0 then begin
1425 if UnyuTalking then begin
1426 LastSurfaceU := StrToIntDef(Mark[3], LastSurfaceU);
1428 LastSurfaceH := StrToIntDef(Mark[3], LastSurfaceH);
1431 Script := Script + Mark;
1434 if UrlCount > 0 then begin
1436 Script := Script + '\h\n';
1437 if not (toNoChoice in Options) then begin
1438 for i := 0 to UrlCount-1 do begin
1439 Script := Script + Format('\q%d[%s][%s]',
1440 [i, SsParser.EscapeParam(Url[i]), UrlName[i]]);
1442 Script := Script + Format('\q%d[#cancel][%s]', [UrlCount, UrlCancel]);
1443 //Script := Script + '\z'; //
\8dÅ
\90Vphase
\82Å
\82Í
\8dí
\8f\9c
1445 Script := Script + '\h';
1446 for i := 0 to UrlCount-1 do begin
1447 Script := Script + Format('\n{%s}(%s)', [UrlName[i], Url[i]]);
1449 Script := Script + Format('\n{%s}', [UrlCancel]);
1453 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8dÅ
\8cã
\82É
\83E
\83F
\83C
\83g
\91}
\93ü
1454 if toWaitScriptEnd in Options then begin
1455 i := Pref.WaitScriptEnd;
1456 while i > 0 do begin
1458 Script := Script + '\w9';
1461 Script := Script + '\w' + IntToStr(i);
1467 Script := Script + '\e';
1468 RegExp.Subst('s/\r\n//gk', Script);
1470 //
\83^
\83O
\83`
\83F
\83b
\83N
\8aÖ
\98A
1471 for i := 0 to SsParser.Count-1 do begin
1472 if SsParser.MarkUpType[i] = mtTagErr then begin
1473 Result := '"' + SsParser[i] + '"'#13#10 +
1474 '
\82Í
\81ASSTP Bottle
\82Å
\94F
\82ß
\82ç
\82ê
\82È
\82¢
\82©
\81A
\94F
\8e¯
\82Å
\82«
\82È
\82¢
\83^
\83O
\82Å
\82·
\81B';
1478 if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
1479 Warnings.Add('
\83X
\83N
\83\8a\83v
\83g
\82ª\t
\82©
\82ç
\8en
\82Ü
\82Á
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1483 if (Warnings.Count > 0) and (toWarnCheck in Options) then begin
1484 if MessageDlg(Warnings.Text + #13#10 + '
\91\97\90M
\82µ
\82Ü
\82·
\82©?', mtWarning,
1485 mbOkCancel, 0) = mrCancel then
1486 Result := Warnings.Text;
1493 function TfrmSender.DoTrans(var Script: String;
1494 Options: TScriptTransOptions): String;
1497 Result := DoTrans(Script, Options, dum);
1500 procedure TfrmSender.mnGoToHPClick(Sender: TObject);
1502 OpenBrowser(Pref.HomePage);
1505 procedure TfrmSender.ShowHintLabel(const Mes: String; Col: TColor);
1507 lblMessage.Caption := Mes;
1508 lblMessage.Font.Color := Col;
1509 lblMessage.Visible := true;
1510 LabelTimer.Enabled := false;
1511 LabelTimer.Enabled := true;
1514 procedure TfrmSender.LabelTimerTimer(Sender: TObject);
1516 LabelTimer.Enabled := false;
1517 lblmessage.Visible := false;
1520 procedure TfrmSender.actCopyAllExecute(Sender: TObject);
1524 Str := memScript.Lines.Text;
1525 Clip := ClipBoard();
1526 Clip.SetTextBuf(PChar(Str));
1529 procedure TfrmSender.actCopyAllNoReturnExecute(Sender: TObject);
1533 Str := memScript.Lines.Text;
1534 RegExp.Subst('s/\r\n//gk', Str);
1535 Clip := ClipBoard();
1536 Clip.SetTextBuf(PChar(Str));
1540 procedure TfrmSender.Slpp20SlppEvent(Sender: TObject; EventType: TIdSlppEventType;
1541 const Param: String);
1542 var HeadValue: THeadValue;
1544 HeadValue := THeadValue.Create(Param);
1547 etScript, etForceBroadcast, etUnicast: begin
1548 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
1549 DispatchBottle(EventType, HeadValue);
1551 etMemberCount: begin
1552 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l'
1554 etChannelCount: begin
1556 ChannelList.Channel[HeadValue['Channel']].Members := StrToInt(HeadValue['Num']);
1561 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\92Ê
\90M
\8am
\97§
\81B');
1563 FBeginConnectFailCount := 0;
1564 //
\83`
\83\83\83\93\83l
\83\8b\8e©
\93®
\93o
\98^
1565 if not Connecting then
1566 PostCommand(['Command: getChannels']);
1567 SakuraSeeker.BeginDetect;
1569 etChannelList: begin
1570 UpdateJoinChannelList(HeadValue);
1571 //
\8dÅ
\8cã
\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\83`
\83\83\83\93\83l
\83\8b\82ð
\8bL
\98^
\82·
\82é
1572 if JoinChannelsBackup = nil then JoinChannelsBackup := TStringList.Create;
1573 JoinChannelsBackup.Assign(JoinChannels);
1575 etCloseChannel: begin
1576 with JoinChannels do
1577 if IndexOf(HeadValue['Channel']) >= 0 then
1578 Delete(IndexOf(HeadValue['Channel']));
1579 with tabChannel do begin
1580 if Tabs.IndexOf(HeadValue['Channel']) >= 0 then
1581 Tabs.Delete(Tabs.IndexOf(HeadValue['Channel']));
1582 if Tabs.Count > 0 then TabIndex := 0 else TabIndex := -1;
1583 tabChannelChange(self);
1585 ShowHintLabel(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½',
1587 frmLog.AddCurrentSystemLog('SYSTEM', HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1588 frmMessageBox.ShowMessage(HeadValue['Channel'] + '
\83`
\83\83\83\93\83l
\83\8b\82Í
\94p
\8e~
\82³
\82ê
\82Ü
\82µ
\82½');
1590 etForceBroadcastInformation: begin
1591 if HeadValue['Type'] = 'Vote' then begin
1592 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1593 end else if HeadValue['Type'] = 'Agree' then begin
1594 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0));
1604 procedure TfrmSender.BottleSstpResendCountChange(Sender: TObject);
1606 StatusBar.Panels[PanelCount].Text := IntToStr(FBottleSstp.CueCount) + '
\8c\8f';
1608 TaskTray.TipString := 'Yasagure Client (' +
1609 IntToStr(FBottleSstp.CueCount) + '
\8c\8f)';
1611 ; //
\83^
\83X
\83N
\83g
\83\8c\83C
\93o
\98^
\8e¸
\94s
\82ð
\96³
\8e\8b\82·
\82é
1613 actClearBottles.Enabled := (FBottleSstp.CueCount > 0);
1616 procedure TfrmSender.actSettingExecute(Sender: TObject);
1618 Application.CreateForm(TfrmSetting, frmSetting);
1628 BuildReplaceMenu(mnPresetReplaceRoot);
1631 frmLog.UpdateWindow;
1632 SetScriptAutoBackUp; //
\83X
\83N
\83\8a\83v
\83g
\8e©
\93®
\95Û
\91¶
\90Ý
\92è
\8dX
\90V
1633 UpdateChannelList; //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\8dÄ
\83\8d\81[
\83h
1636 procedure TfrmSender.memScriptKeyPress(Sender: TObject; var Key: Char);
1638 if (Key = #13) or (Key = #10) then Key := Char(0);
1642 procedure TfrmSender.Slpp20Disconnect(Sender: TObject);
1645 UpdateJoinChannelList(nil);
1646 frmLog.AddCurrentSystemLog('SYSTEM', '
\83T
\81[
\83o
\82©
\82ç
\90Ø
\92f
\82³
\82ê
\82Ü
\82µ
\82½');
1647 if not Application.Terminated then RetryBeginConnect;
1651 procedure TfrmSender.SetSleeping(const Value: boolean);
1654 FBottleSstp.ResendSleep := Value;
1658 procedure TfrmSender.actClearBottlesExecute(Sender: TObject);
1661 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]),
1662 mtWarning, mbOkCancel, 0);
1663 if Re = mrOk then begin
1665 frmLog.AllBottleOpened;
1666 frmLog.UpdateWindow;
1670 procedure TfrmSender.SakuraSeekerDetectResultChanged(Sender: TObject);
1672 UpdateIfGhostBox; //
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\82Ì
\92\86\90g
\82ð
\8f\91\82«
\8a·
\82¦
\82é
1676 procedure TfrmSender.UpdateChannelInfo(Dat: THeadValue);
1678 Ch: TChannelListItem;
1681 for i := 1 to Dat.IntData['Count'] do begin
1682 Ch := TChannelListItem.Create;
1683 Ch.Name := Dat[Format('CH%d_name', [i])];
1684 Ch.Ghost := Dat[Format('CH%d_ghost', [i])];
1685 Ch.Info := Dat[Format('CH%d_info', [i])];
1686 Ch.NoPost := Dat[Format('CH%d_nopost', [i])] = '1';
1687 Ch.Members := Dat.IntData[Format('CH%d_count', [i])];
1688 Ch.WarnPost:= Dat[Format('CH%d_warnpost', [i])] = '1';
1689 ChannelList.Add(Ch);
1695 procedure TfrmSender.mnGetNewIdClick(Sender: TObject);
1697 ShowHintLabel('LUID
\82Ì
\8eæ
\93¾
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
1698 // PostCommand(['Command: getNewId', 'Agent: ' + VersionString]);
1702 procedure TfrmSender.NoLuidError;
1705 ShowMessage('SSTP Bottle ID
\82Ì
\8eæ
\93¾
\82ª
\82Ü
\82¾
\8a®
\97¹
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10+
1706 '
\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+
1707 '
\82±
\82Ì
\91\80\8dì
\82ÍClient
\8f\89\89ñ
\8bN
\93®
\8e\9e\82É1
\89ñ
\82¾
\82¯
\95K
\97v
\82Å
\82·
\81B');
1711 procedure TfrmSender.tabChannelChange(Sender: TObject);
1714 if tabChannel.TabIndex >= 0 then begin
1715 FNowChannel := tabChannel.Tabs[tabChannel.TabIndex];
1716 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1721 tabChannel.Repaint; //
\82±
\82ê
\82ª
\82È
\82¢
\82Æ
\90F
\82ª
\95Ï
\82í
\82ç
\82È
\82¢
\82±
\82Æ
\82ª
\82 \82é
1722 ConstructMenu(true);
1726 procedure TfrmSender.actPrevChannelExecute(Sender: TObject);
1729 with tabChannel do begin
1730 if Tabs.Count = 0 then Exit;
1731 if TabIndex=0 then TabIndex := Tabs.Count-1
1732 else TabIndex := TabIndex-1;
1734 tabChannelChange(Self);
1738 procedure TfrmSender.actNextChannelExecute(Sender: TObject);
1741 with tabChannel do begin
1742 if Tabs.Count = 0 then Exit;
1743 if TabIndex=Tabs.Count-1 then TabIndex := 0
1744 else TabIndex := TabIndex+1;
1746 tabChannelChange(Self);
1751 procedure TfrmSender.UpdateJoinChannelList(Dat: THeadValue);
1755 nodat := Dat = nil; //nil
\82È
\82ç
\83`
\83\83\83\93\83l
\83\8b\91S
\89ð
\8f\9c
1756 if nodat then Dat := THeadValue.Create('');
1758 for i := 0 to Dat.Count-1 do
1759 if Dat.KeyAt[i] = 'Entry' then begin
1760 if RegExp.Match('m/^(.+?) \((\d+?)\)$/', Dat.ValueAt[i]) then
1761 JoinChannels.Add(RegExp[1]);
1763 with tabChannel do begin
1768 for i := 0 to JoinChannels.Count-1 do begin
1769 //
\8eó
\90M
\90ê
\97p
\83`
\83\83\83\93\83l
\83\8b\82Í
\95\
\8e¦
\82µ
\82È
\82¢
1770 if not ChannelList.Channel[JoinChannels[i]].NoPost then
1771 Tabs.Add(JoinChannels[i]);
1774 //
\8c³
\82©
\82ç
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\82Í
1775 //
\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)
1777 for i := 0 to Tabs.Count-1 do
1778 if Tabs[i] = FNowChannel then TabIndex := i;
1779 if Tabs.Count > 0 then begin
1780 FNowChannel := Tabs[TabIndex];
1781 actSend.Hint := Format('
\81u%s
\81v
\82É
\91\97\90M|%s', [FNowChannel, SendButtonLongHint]);
1784 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
1786 Visible := Tabs.Count > 0;
1787 if Tabs.Count > 1 then begin
1788 actNextChannel.Enabled := true;
1789 actPrevChannel.Enabled := true;
1791 actNextChannel.Enabled := false;
1792 actPrevChannel.Enabled := false;
1794 OnChange := tabChannelChange;
1796 if nodat then Dat.Free;
1797 if JoinChannels.Count = 0 then begin
1798 Self.Caption := FOriginalCaption + ' -
\83`
\83\83\83\93\83l
\83\8b\82É
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ';
1799 actSend.Enabled := false;
1801 Self.Caption := FOriginalCaption;
1802 actSend.Enabled := true;
1807 procedure TfrmSender.cbxTargetGhostDropDown(Sender: TObject);
1809 SakuraSeeker.BeginDetect;
1813 procedure TfrmSender.actShowLogExecute(Sender: TObject);
1816 if frmLog.WindowState = wsMinimized then frmLog.WindowState := wsNormal;
1819 procedure TfrmSender.actSleepExecute(Sender: TObject);
1821 if actSleep.Checked then begin
1822 actSleep.Checked := false;
1823 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\89ð
\8f\9c\82µ
\82Ü
\82µ
\82½');
1825 actSleep.Checked := true;
1826 ShowHintLabel('
\83X
\83\8a\81[
\83v
\82ð
\90Ý
\92è
\82µ
\82Ü
\82µ
\82½');
1828 Sleeping := actSleep.Checked;
1833 procedure TfrmSender.DispatchBottle(Dat: THeadValue; LogTime: TDateTime;
1834 Vote, Agree: integer);
1835 //procedure TfrmSender.DispatchBottle(EventType: TIdSlppEventType;
1836 // Dat: THeadValue);
1837 var Opt: TSstpSendOptions;
1838 Event: TBottleChainBottleEvent;
1839 Script, Sender, Ghost, Channel, ErrorMes: String;
1840 BreakFlag, NoDispatch: boolean;
1841 Sound, LogName: String;
1842 i, j, k, SkipCount: integer;
1843 Rule: TBottleChainRule;
1844 Action: TBottleChainAction;
1845 LogNameList: TStringList;
1847 ReplaceHash: THeadValue;
1850 if Pref.NoTranslate then Opt := Opt + [soNoTranslate];
1851 if Pref.NoDescript then Opt := Opt + [soNoDescript];
1852 Channel := Dat['Channel'];
1855 etScript: Sender := Channel;
1856 etForceBroadcast: Sender := '
\81y
\82¨
\92m
\82ç
\82¹
\81z';
1857 etUnicast: Sender := Dat['SenderUID'];
1860 Sender := Channel; //
\92Ê
\8fí
1862 //
\96Ú
\95W
\83S
\81[
\83X
\83g(
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\88È
\91O)
\8c\88\92è
1863 if Dat['IfGhost'] <> '' then begin
1864 Ghost := Dat['IfGhost'];
1866 if ChannelList.Channel[Channel] <> nil then
1867 Ghost := ChannelList.Channel[Channel].Ghost
1871 Dat['TargetGhost'] := Ghost;
1873 //
\83\81\83^
\95¶
\8e\9a\8f\80\94õ
1874 ReplaceHash := THeadValue.Create;
1875 ReplaceHash['%channel%'] := SafeFileName(Dat['Channel']);
1876 ReplaceHash['%ghost%'] := SafeFileName(Dat['IfGhost']);
1877 ReplaceHash['%date%'] := FormatDateTime('yy-mm-dd', Now());
1878 ReplaceHash['%year%'] := FormatDateTime('yyyy', Now());
1879 ReplaceHash['%yy%'] := FormatDateTime('yy', Now());
1880 ReplaceHash['%month%'] := FormatDateTime('mm', Now());
1881 ReplaceHash['%day%'] := FormatDateTime('dd', Now());
1882 ReplaceHash['%hour%'] := FormatDateTime('hh', Now());
1883 ReplaceHash['%minute%'] := FormatDateTime('nn', Now());
1885 Event := TBottleChainBottleEvent.Create;
1889 if EventType = etScript then Event.LogType := ltBottle
1890 else Event.LogType := ltSystemLog;
1892 Event.LogType := ltBottle; //
\92Ê
\8fí
1894 //
\83X
\83N
\83\8a\83v
\83g
\95Ï
\8a·
1895 Script := ScriptTransForSSTP(Dat['Script'], ErrorMes);
1896 //
\96â
\91è
\82Ì
\97L
\82é
\95r
\82É
\91Î
\82·
\82é
\93®
\8dì
1897 if (ErrorMes <> '') AND (NOT Pref.ErrScript) then
1899 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'+
1900 '
\94z
\91\97\82³
\82ê
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81@
\81c '+Dat['Script']);
1905 NoDispatch := false;
1907 LogNameList := TStringList.Create;
1910 for i := 0 to BottleChainRuleList.Count-1 do begin
1911 if SkipCount > 0 then begin
1915 Rule := BottleChainRuleList[i];
1916 if not Rule.Enabled then Continue;
1917 if not Rule.Check(Event) then Continue;
1918 for j := 0 to Rule.Actions.Count-1 do begin
1919 Action := (Rule.Actions[j] as TBottleChainAction);
1920 if Action is TBottleChainAbortRuleAction then
1922 if Action is TBottleChainSkipRuleAction then
1923 SkipCount := (Action as TBottleChainSkipRuleAction).SkipCount;
1924 if (Action is TBottleChainSoundAction) and (Sound = '') then
1926 Sound := (Action as TBottleChainSoundAction).SoundFile;
1927 Sound := StringReplaceEx(Sound, ReplaceHash);
1929 if Action is TBottleChainNoDispatchAction then
1931 if Action is TBottleChainLogAction then
1933 for k := 0 to (Action as TBottleChainLogAction).LogNames.Count-1 do begin
1934 LogName := (Action as TBottleChainLogAction).LogNames[k];
1935 LogName := StringReplaceEx(LogName, ReplaceHash);
1936 LogNameList.Add(LogName);
1939 if Action is TBottleChainOverrideGhostAction then
1941 Dat['TargetGhost'] := (Action as TBottleChainOverrideGhostAction).TargetGhost;
1943 if Action is TBottleChainQuitAction then
1944 Application.Terminate;
1945 if Action is TBottleChainSaveTextLogAction then
1946 AppendTextLog(StringReplaceEx((Action as TBottleChainSaveTextLogAction).FileName, ReplaceHash),
1947 Format('%s,%s,%s,%s', [Dat['Channel'], Dat['IfGhost'],
1948 FormatDateTime('yy/mm/dd hh:nn:ss', Now), Dat['Script']]));
1949 if Action is TBottleChainSaveXMLLogAction then
1950 AppendXMLLog(StringReplaceEx((Action as TBottleChainSaveXMLLogAction).FileName, ReplaceHash),
1952 if Action is TBottleChainSurfaceReplaceAction then
1953 Script := ReplaceSurface(Script, (Action as TBottleChainSurfaceReplaceAction).Params);
1955 if BreakFlag then Break;
1958 if Dat['Script'] <> '' then begin
1959 for i := 0 to LogNameList.Count-1 do
1960 frmLog.AddCurrentScriptLog(LogNameList[i], Dat['Script'], Sender, Dat['MID'], Dat['IfGhost'],
1961 LogTime, Vote, Agree);
1962 if NoDispatch or Pref.NotSSTP then begin
1963 frmLog.SetBottleState(Dat['MID'], lsOpened);
1965 Ghost := Dat['TargetGhost']; //
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82³
\82ê
\82Ä
\82¢
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
1966 CueItem := TLogItem.Create(ltBottle, Dat['MID'], Dat['Channel'],
1967 Script, Ghost, Now());
1969 FBottleSstp.Push(CueItem);
1977 if Dat['DialogMessage'] <> '' then begin
1979 frmMessageBox.ShowMessage(
1980 DateTimeToStr(Now) + #13#10 +
1981 'SSTP Bottle
\83T
\81[
\83o
\82©
\82ç
\82¨
\92m
\82ç
\82¹'#13#10+Dat['DialogMessage']);
1982 for i := 0 to LogNameList.Count-1 do
1983 frmLog.AddCurrentSystemLog(LogNameList[i], Dat['DialogMessage']);
1988 if (Sound <> '') then PlaySound(Sound);
1998 procedure TfrmSender.YenETrans;
1999 var St, Le, i: integer;
2002 if Pref.NotYenETrans then exit; // \e
\83`
\83F
\83b
\83N
\82µ
\82È
\82¢
2003 St := memScript.SelStart;
2004 Le := memScript.SelLength;
2005 Orig := GetScriptText;
2006 RegExp.Subst('s/(\r\n)+$//kg', Orig);
2008 with SsParser do begin
2009 LeaveEscape := true;
2010 EscapeInvalidMeta := false;
2011 InputString := Orig;
2013 for i := 0 to SsParser.Count-1 do begin
2014 if SsParser[i] <> '\e' then Text := Text + SsParser[i];
2017 Text := Text + '\e';
2019 if Orig <> Text then memScript.Lines.Text := Text;
2020 SsParser.InputString := Text;
2022 RegExp.Subst('s/\r\n//kg', Text);
2024 memScript.SelStart := St;
2025 memScript.SelLength := Le;
2029 procedure TfrmSender.PostCommand(const Command: array of String);
2030 var PostStr: TStringList;
2035 PostStr := TStringList.Create;
2036 for i := Low(Command) to High(Command) do begin
2037 PostStr.Add(Command[i]);
2039 PostCommand(PostStr);
2047 procedure TfrmSender.PostCommand(Command: TStrings);
2048 var PostStr: String;
2051 PostStr := Command.Text;
2052 PostStr := ParamsEncode(PostStr);
2054 FHttp := THTTPDownloadThread.Create(Pref.BottleServer, Pref.CgiName, PostStr);
2055 if Pref.UseHttpProxy then begin
2056 FHttp.ProxyServer := Pref.ProxyAddress;
2057 FHttp.ProxyPort := Pref.ProxyPort;
2059 FHttp.OnSuccess := HttpSuccess;
2060 FHttp.OnConnectionFailed := HttpFailure;
2061 FHttp.FreeOnTerminate := true; //
\8f\9f\8eè
\82É
\8e©
\95ª
\82ÅFree
\82µ
\82Ä
\82
\82¾
\82³
\82¢
2064 on EHeapException do begin
2065 Connecting := false;
2072 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
2073 //var Log: TLogItem;
2075 ShowHintLabel('
\93\8a\95[
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
2077 if frmLog.lvwLog.Selected = nil then Exit;
2078 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2079 if Log = nil then Exit;
2080 if Log.LogType <> ltBottle then Exit;
2082 'Command: voteMessage',
2084 'LUID: ' + Pref.LUID,
2091 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
2092 //var Log: TLogItem;
2094 ShowHintLabel('
\93¯
\88Ó
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
2096 if frmLog.lvwLog.Selected = nil then Exit;
2097 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
2098 if Log = nil then Exit;
2099 if Log.LogType <> ltBottle then Exit;
2101 'Command: voteMessage',
2103 'LUID: ' + Pref.LUID,
2110 function TfrmSender.GhostNameToSetName(const Ghost: String): String;
2112 if SakuraSeeker.ProcessByName[Ghost] <> nil then
2113 Result := SakuraSeeker.ProcessByName[Ghost].SetName
2118 procedure TfrmSender.tabChannelContextPopup(Sender: TObject;
2119 MousePos: TPoint; var Handled: Boolean);
2123 with tabChannel do begin
2124 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
2125 if Tag < 0 then Handled := true;
2132 procedure TfrmSender.PostSetChannel(Channels: TStrings);
2133 var PostStr: TStringList;
2136 PostStr := TStringList.Create;
2138 with PostStr do begin
2139 Add('Command: setChannels');
2140 Add('Agent: ' + VersionString);
2141 Add('LUID: ' + Pref.LUID);
2142 if Channels <> nil then
2143 for i := 0 to Channels.Count-1 do begin
2144 Add(Format('Ch%d: %s'#13#10, [i+1, Channels[i]]));
2147 PostCommand(PostStr);
2154 procedure TfrmSender.mnLeaveThisChannelClick(Sender: TObject);
2156 // Chs: TStringList;
2159 //
\8ew
\92è
\82µ
\82½
\83`
\83\83\83\93\83l
\83\8b\82©
\82ç
\94²
\82¯
\82é
2161 Ch := Tabs[Tag]; //
\94²
\82¯
\82½
\82¢
\83`
\83\83\83\93\83l
\83\8b\96¼
2162 Chs := TStringList.Create;
2164 //
\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ð
2165 //
\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é
2167 Chs.Assign(JoinChannels);
2168 while Chs.IndexOf(Ch) >= 0 do
2169 Chs.Delete(Chs.IndexOf(Ch));
2170 PostSetChannel(Chs);
2177 procedure TfrmSender.mnGotoVoteClick(Sender: TObject);
2179 OpenBrowser(Pref.VotePage);
2182 procedure TfrmSender.tabChannelMouseMove(Sender: TObject;
2183 Shift: TShiftState; X, Y: Integer);
2184 //var Index: integer;
2188 with tabChannel do begin
2189 Index := IndexOfTabAt(X, Y);
2191 Hint := Ch + ': ' + IntToStr(ChannelList.Channel[Ch].Members) + '
\90l';
2196 procedure TfrmSender.mnGoToHelpClick(Sender: TObject);
2198 OpenBrowser(Pref.HelpPage);
2201 procedure TfrmSender.tabChannelMouseDown(Sender: TObject;
2202 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2203 //var Index: integer;
2206 with tabChannel do begin
2207 Index := IndexOfTabAt(X, Y);
2208 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
2209 if Button = mbLeft then begin
2210 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
2212 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
2218 procedure TfrmSender.tabChannelDragOver(Sender, Source: TObject; X,
2219 Y: Integer; State: TDragState; var Accept: Boolean);
2220 //var TargetRect: TRect;
2221 // OldDest: integer;
2224 Accept := Source = tabChannel;
2225 if not Accept then Exit;
2226 with tabChannel do begin
2227 OldDest := FDragTabDest;
2228 FDragTabDest := IndexOfTabAt(X, Y);
2229 if FDragTabDest = -1 then begin
2230 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
2233 with Canvas do begin
2237 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
2238 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
2239 TargetRect := TabRect(OldDest);
2240 with Canvas do begin
2241 Brush.Style := bsClear;
2242 Rectangle(TargetRect.Left, TargetRect.Top,
2243 TargetRect.Right, TargetRect.Bottom);
2246 if (OldDest <> FDragTabDest) then begin
2247 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
2248 TargetRect := TabRect(FDragTabDest);
2249 with Canvas do begin
2250 Brush.Style := bsClear;
2251 Rectangle(TargetRect.Left, TargetRect.Top,
2252 TargetRect.Right, TargetRect.Bottom);
2259 procedure TfrmSender.tabChannelDragDrop(Sender, Source: TObject; X,
2261 //var DestIndex: integer;
2264 with tabChannel do begin
2265 DestIndex := IndexOfTabAt(X, Y);
2266 Tabs.Move(FDragTabIndex, DestIndex);
2271 procedure TfrmSender.tabChannelEndDrag(Sender, Target: TObject; X,
2275 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
2276 tabChannel.Tabs.BeginUpdate;
2277 tabChannel.Tabs.EndUpdate;
2281 procedure TfrmSender.cbxTargetGhostDrawItem(Control: TWinControl;
2282 Index: Integer; Rect: TRect; State: TOwnerDrawState);
2283 var AlignRight: boolean;
2286 //
\83S
\81[
\83X
\83g
\91I
\91ð
\83{
\83b
\83N
\83X
\82Ì
\83I
\81[
\83i
\81[
\83h
\83\8d\81[
2287 with cbxTargetGhost do begin
2288 AlignRight := false;
2289 if Pref.HideGhosts and not FTargetGhostExpand and
2290 (Index = Items.Count-1) and (Index > 0) then
2292 //
\81u
\82·
\82×
\82Ä
\95\
\8e¦
\81v
2293 Canvas.Font.Color := clWindowText;
2294 Canvas.Font.Style := [];
2296 end else if (Index > 0) then
2298 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\91I
\91ð
2299 if SakuraSeeker.ProcessByName[Items[Index]] = nil then
2300 Canvas.Font.Color := clRed //
\91¶
\8dÝ
\82µ
\82È
\82¢
\83S
\81[
\83X
\83g
2302 Canvas.Font.Color := clBlue; //
\91¶
\8dÝ
\82·
\82é
\83S
\81[
\83X
\83g
2303 Canvas.Font.Style := [fsBold];
2306 Canvas.Font.Color := clWindowText;
2307 Canvas.Font.Style := [];
2309 if odSelected in State then
2310 Canvas.Font.Color := clHighlightText;
2314 w := Canvas.TextWidth(cbxTargetGhost.Items[Index]);
2315 Canvas.TextRect(Rect, Rect.Right - w, Rect.Top,
2316 cbxTargetGhost.Items[Index]);
2318 Canvas.TextRect(Rect, Rect.Left, Rect.Top,
2319 cbxTargetGhost.Items[Index]);
2323 procedure TfrmSender.FormCloseQuery(Sender: TObject;
2324 var CanClose: Boolean);
2326 //
\83t
\83@
\83C
\83\8b\82Ì
\8dX
\90V
\83`
\83F
\83b
\83N
\81i
\83G
\83f
\83B
\83^
\95\94\81j
2327 if CheckFileSave(Self) = idCancel then
2332 //
\83\8d\83O
\81i
\83^
\83u
\81j
\93à
\97e
\82Ì
\95Ï
\8dX
\83`
\83F
\83b
\83N
2333 if frmLog.CheckLog(Self) = idCancel then
2338 if (not Pref.ConfirmOnExit) or FEndSession then
2340 if MessageDlg('Yasagure Client
\82ð
\8fI
\97¹
\82µ
\82Ü
\82·', mtConfirmation,
2341 mbOkCancel, 0) = mrCancel then
2345 procedure TfrmSender.UpdateIfGhostBox;
2349 HiddenCount: integer;
2351 cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
2352 Selected := cbxTargetGhost.Text;
2354 with cbxTargetGhost do begin
2357 Items.Add(ChannelDefault);
2358 for i := 0 to SakuraSeeker.Count-1 do begin
2359 //
\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é
2360 if Length(SakuraSeeker[i].Name) = 0 then Continue;
2361 if Pref.HideGhosts and not FTargetGhostExpand then
2362 if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
2367 if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
2368 cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
2370 cbxTargetGhost.ItemIndex := 0;
2371 if (Length(Selected) > 0) and (Selected <> ChannelDefault) then begin
2372 with cbxTargetGhost do begin
2373 for i := 1 to Items.Count-1 do begin
2374 if Items[i] = Selected then
2377 //
\83S
\81[
\83X
\83g
\82ª
\93Ë
\91R
\91¶
\8dÝ
\82µ
\82È
\82
\82È
\82Á
\82½
\8fê
\8d\87\91Î
\8dô
2378 if ItemIndex = 0 then begin
2379 Items.Add(Selected);
2380 ItemIndex := Items.Count - 1;
2384 if Pref.HideGhosts and not FTargetGhostExpand then
2385 Items.Add(Format('
\82·
\82×
\82Ä(%d)...', [HiddenCount]));
2391 procedure TfrmSender.HTTPFailure(Sender: TObject);
2395 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
2396 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½'#13#10 +
2397 (Sender as THTTPDownloadThread).LastErrorMessage);
2398 Connecting := false;
2402 procedure TfrmSender.actPrevGhostExecute(Sender: TObject);
2405 SakuraSeeker.BeginDetect;
2407 i := cbxTargetGhost.ItemIndex;
2411 i := cbxTargetGhost.Items.Count-1;
2412 if Pref.HideGhosts and not FTargetGhostExpand then
2415 cbxTargetGhost.ItemIndex := i;
2416 cbxTargetGhostChange(self);
2419 procedure TfrmSender.actNextGhostExecute(Sender: TObject);
2422 SakuraSeeker.BeginDetect;
2424 i := cbxTargetGhost.ItemIndex;
2426 if Pref.HideGhosts and not FTargetGhostExpand then
2428 if i > cbxTargetGhost.Items.Count-2 then i := 0;
2431 if i > cbxTargetGhost.Items.Count-1 then i := 0;
2433 cbxTargetGhost.ItemIndex := i;
2434 cbxTargetGhostChange(self);
2437 procedure TfrmSender.actResetGhostExecute(Sender: TObject);
2439 cbxTargetGhost.ItemIndex := 0; // (CH
\90\84\8f§)
\82É
\96ß
\82·
2440 FTargetGhostExpand := false;
2441 if Visible then memScript.SetFocus;
2442 cbxTargetGhostChange(self);
2446 procedure TfrmSender.timDisconnectCheckTimerTimer(Sender: TObject);
2448 if (IdSlpp20.LastReadTimeInterval > Pref.ReconnectWait * 60000) then begin
2450 frmLog.AddCurrentSystemLog('SYSTEM', 'SSTP Bottle
\83T
\81[
\83o
\82Æ
\82Ì
\90Ú
\91±
\82ª
\83^
\83C
\83\80\83A
\83E
\83g
\82µ
\82Ü
\82µ
\82½');
2451 if IdSlpp20.Connected then IdSlpp20.Disconnect;
2453 if not IdSlpp20.Connected then begin
2455 Slpp20Disconnect(self); //
\82È
\82º
\82©Disconnect
\83C
\83x
\83\93\83g
\82ª
\8bN
\82±
\82ç
\82¸
\82É
\90Ø
\92f
\82µ
\82½
\8fê
\8d\87
2457 //
\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
2458 //
\82½
\82¾
\82µ
\89ñ
\90\94\90§
\8cÀ
\82 \82è
2466 procedure TfrmSender.RetryBeginConnect;
2468 if FBeginConnectFailCount < 3 then begin
2469 //
\90Ø
\92f
\82³
\82ê
\82Ä
\82¢
\82ê
\82Î
\8dÄ
\90Ú
\91±
2470 FAutoAddAfterGetChannel := true;
2472 end else if FBeginConnectFailCount = 3 then begin
2473 frmLog.AddCurrentSystemLog('SYSTEM', '
\8dÄ
\90Ú
\91±
\8e©
\93®
\83\8a\83g
\83\89\83C
\82ð
\92\86\8e~
\82µ
\82Ü
\82·');
2474 frmMessageBox.ShowMessage(
2475 'SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
2476 '
\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+
2477 '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'
2479 Inc(FBeginConnectFailCount);
2484 procedure TfrmSender.actDownloadLogExecute(Sender: TObject);
2486 var BottleLog: TBottleLogList;
2488 Cond: TBottleLogDownloadCondition;
2490 function TimeStr(Mins: integer): String;
2491 var day, hour, min: integer;
2493 day := Mins div (60 * 24);
2494 hour := (Mins div 60) mod 24;
2497 if day > 0 then Result := Result + Format('%d
\93ú', [day]);
2498 if hour > 0 then Result := Result + Format('%d
\8e\9e\8aÔ', [hour]);
2499 if (min > 0) or (Result = '') then Result := Result + Format('%d
\95ª', [min]);
2503 ShowHintLabel('
\83\8d\83O
\82Ì
\83_
\83E
\83\93\83\8d\81[
\83h
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ', WarningColor);
2505 Application.CreateForm(TfrmLogDownload, frmLogDownload);
2507 if frmLogDownload.Execute then begin
2508 with frmLogDownload do begin
2509 if IsRange then begin
2510 if CompareDate(DateLo, DateHi) = 0 then
2511 Title := FormatDateTime('yy-mm-dd', DateLo)
2513 Title := FormatDateTime('yy-mm-dd', DateLo) + ' - ' + FormatdateTime('yy-mm-dd', DateHi);
2515 Title := Format('
\89ß
\8b\8e%s', [TimeStr(RecentCount)]);
2517 if Channel <> '' then Title := Title + '(' + Channel + ')';
2519 BottleLog := TBottleLogList.Create(Title);
2521 BottleLog.OnLoaded := frmLog.LogLoaded;
2522 BottleLog.OnLoadFailure := frmLog.LogLoadFailure;
2523 BottleLog.OnLoadWork := frmLog.LogLoadWork;
2524 with frmLogDownload do begin
2525 Cond.IsRange := IsRange;
2526 Cond.RecentCount := RecentCount;
2527 Cond.DateLo := DateLo;
2528 Cond.DateHi := DateHi;
2529 Cond.MinVote := MinVote;
2530 Cond.MinAgree := MinAgree;
2531 Cond.Channel := Channel;
2533 BottleLog.LoadFromWeb(Cond);
2535 FreeAndNil(BottleLog);
2537 if BottleLog <> nil then begin
2538 NewIndex := frmLog.BottleLogList.Add(BottleLog);
2540 frmLog.tabBottleLog.TabIndex := NewIndex;
2541 frmLog.UpdateWindow;
2545 frmLogDownload.Release;
2550 function TfrmSender.BuildMenuConditionCheck(const IfGhost,
2551 Ghost: String): boolean;
2558 Cond := Token(IfGhost, ',', i);
2559 if Cond <> '' then begin
2560 if Cond[1] = '!' then begin
2561 Cond := Copy(Cond, 2, High(integer));
2562 if Cond = Ghost then Result := false;
2564 if Cond <> Ghost then Result := false;
2571 procedure TfrmSender.BuildMenu(Root: TMenuItem; Simple: boolean);
2572 var i, j, k, count: integer;
2573 ConstData: TScriptConst;
2574 Menu1, Menu2: TMenuItem;
2577 // Simple = false
\82Ì
\8fê
\8d\87\82Í
\83\81\83j
\83\85\81[
\82ð
\8a®
\91S
\82É
\8dÄ
\8d\
\92z
\82·
\82é
\81B
2578 // 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
2579 if cbxTargetGhost.ItemIndex > 0 then Ghost := cbxTargetGhost.Text
2580 // else if FNowChannel <> '' then Ghost := ChannelList.Channel[FNowChannel].Ghost;
2584 //
\8aù
\91¶
\82Ì
\83\81\83j
\83\85\81[
\8dí
\8f\9c
2585 if Simple then begin
2586 // IfGhost
\8fð
\8c\8f\95t
\82«
\83\81\83j
\83\85\81[
\82Ì
\82Ý
\8dí
\8f\9c
2587 for i := Root.Count-1 downto 0 do begin
2588 if ScriptConstList.GetMenuByID(Root.Items[i].Tag).IfGhost <> '' then
2592 //
\91S
\95\94\8dí
\8f\9c
2596 for i := 0 to ScriptConstList.Count-1 do begin
2597 for j := 0 to ScriptConstList[i].Count-1 do begin
2598 //
\83S
\81[
\83X
\83g
\88á
\82¢
\82Ì
\8fê
\8d\87\82Í
\83X
\83L
\83b
\83v
2599 if not BuildMenuConditionCheck(ScriptConstList[i][j].IfGhost, Ghost) then Continue;
2601 // 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
2602 if Simple and (count < Root.Count) then
2603 if (Root.Items[count].Tag = ScriptConstList[i][j].ID) then begin
2607 Menu1 := TMenuItem.Create(Root);
2610 Caption := ScriptConstList[i][j].Caption;
2611 Hint := ScriptConstList[i][j].Caption;
2612 AutoHotkeys := maManual;
2613 Tag := ScriptConstList[i][j].ID;
2614 OnClick := mnConstGroupClick;
2617 if not Simple then begin
2620 if count < Root.Count-1 then
2621 Root.Insert(count, Menu1)
2626 Menu1.Enabled := ScriptConstList[i][j].Count > 0;
2627 for k := 0 to ScriptConstList[i][j].Count-1 do begin
2628 ConstData := ScriptConstList[i][j][k];
2629 Menu2 := TMenuItem.Create(Root);
2630 Menu2.Caption := ConstData.Caption;
2631 Menu2.Hint := ConstData.ConstText;
2632 // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
2633 // + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
2634 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\8eÀ
\8c»
\82Ì
\82½
\82ß
\8fã
\8dí
\8f\9c
2635 Menu2.ShortCut := ConstData.ShortCut;
2636 Menu2.OnClick := mnConstClick;
2637 Menu2.AutoHotkeys := maManual;
2638 Menu2.Tag := ConstData.ID;
2639 if (k mod 15 = 0) and (k > 0) then Menu2.Break := mbBarBreak;
2646 procedure TfrmSender.cbxTargetGhostChange(Sender: TObject);
2648 //
\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
2649 if Pref.HideGhosts and not FTargetGhostExpand then
2651 with cbxTargetGhost do
2653 //
\88ê
\94Ô
\89º
\82Ì
\83A
\83C
\83e
\83\80\82ª
\91I
\91ð
\82³
\82ê
\82½
\82Æ
\82«
\81B
2654 //
\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
2655 if (ItemIndex = Items.Count-1) and (ItemIndex > 0) then
2657 FTargetGhostExpand := true;
2660 DroppedDown := true;
2664 //
\92è
\8c^
\8bå
\83\81\83j
\83\85\81[
\82ð
\8dÄ
\8d\
\92z
2665 ConstructMenu(true);
2666 //
\83v
\83\8c\83r
\83\85\81[
\82ª
\82 \82é
\8fê
\8d\87\82Í
\83v
\83\8c\83r
\83\85\81[
2670 procedure TfrmSender.PlaySound(const FileName: String);
2672 if Pref.SilentWhenHidden and not Application.ShowMainForm then Exit;
2674 MediaPlayer.FileName := FileName;
2678 on E: EMCIDeviceError do begin
2679 ShowMessage('
\83T
\83E
\83\93\83h
\8dÄ
\90¶
\83G
\83\89\81[:'#13#10 + FileName + #13#10#13#10 + E.Message);
2684 procedure TfrmSender.actFMOExplorerExecute(Sender: TObject);
2687 if not Assigned(frmFMOExplorer) then
2688 Application.CreateForm(TfrmFMOExplorer, frmFMOExplorer);
2691 ShowMessage('FMO
\83G
\83N
\83X
\83v
\83\8d\81[
\83\89\82ð
\95\
\8e¦
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10#13#10 +
2694 frmFMOExplorer.Show;
2697 procedure TfrmSender.SaveChainRuleList;
2698 var Str: TStringList;
2700 Str := TStringList.Create;
2702 Str.Text := ComponentToString(BottleChainRuleList);
2703 Str.SaveToFile(ExtractFileDir(Application.ExeName)+'\rule.txt');
2709 procedure TfrmSender.BottleSstpResendEnd(Sender: TObject; MID: String);
2711 frmLog.SetBottleState(MID, lsOpened);
2714 procedure TfrmSender.BottleSstpResendTrying(Sender: TObject; MID: String);
2716 frmLog.SetBottleState(MID, lsPlaying);
2719 procedure TfrmSender.LogInsertCue(const TestAction: boolean);
2720 var InsertItem: TLogItem;
2721 i, errCount, Res: integer;
2722 Log: TBottleLogList;
2723 ErrorMes: String; //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83G
\83\89\81[
\82Ì
\93à
\97e
2725 if FBottleSstp.CueCount > 0 then begin
2726 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'+
2727 '
\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+
2728 '
\90V
\92\85\83\81\83b
\83Z
\81[
\83W
\82Í
\82»
\82Ì
\8cã
\82É
\8dÄ
\90¶
\82³
\82ê
\82Ü
\82·
\81B', [FBottleSstp.CueCount]),
2729 mtWarning, mbOkCancel, 0) = mrCancel then Exit;
2732 frmLog.AllBottleOpened;
2733 if frmLog.lvwLog.Selected = nil then Exit;
2734 Log := frmLog.SelectedBottleLog;
2735 if Log = nil then Exit;
2736 FBottleSSTP.OnResendCountChange := nil;
2738 for i := frmLog.lvwLog.Selected.Index downto 0 do begin
2739 if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
2740 InsertItem := TLogItem.Create(Log[i] as TLogItem);
2742 //
\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¢
2746 InsertItem.Script := ScriptTransForSSTP(InsertItem.Script, ErrorMes);
2748 if ErrorMes <> '' then
2750 Res := MessageDlg('
\83X
\83N
\83\8a\83v
\83g
\82É
\96â
\91è
\82ª
\82 \82é
\89Â
\94\
\90«
\82ª
\82 \82è
\82Ü
\82·
\81B' +
2751 '
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10 + ErrorMes, mtWarning,
2754 raise Exception.Create('Script Syntax Error')
2755 else if Res = mrCancel then
2759 frmLog.AllBottleOpened;
2763 //
\83A
\83N
\83V
\83\87\83\93\82ª
\97L
\8cø
\82Å
\82 \82ê
\82Î
\92Ê
\8fí
\8f\88\97\9d\8fÈ
\97ª
2765 //
\8c^
\95Ï
\8a·
\82Æ
\8eó
\90M
2766 BottleCnv(InsertItem)
2769 //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\91Î
\8dô
2770 if InsertItem.Ghost = '' then
2771 if ChannelList.Channel[InsertItem.Channel] <> nil then
2772 InsertItem.Ghost := ChannelList.Channel[InsertItem.Channel].Ghost;
2773 FBottleSSTP.Push(InsertItem);
2774 frmLog.SetBottleState(InsertItem.MID, lsUnopened);
2781 if errCount > 0 then
2782 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]));
2783 FBottleSSTP.OnResendCountChange := BottleSstpResendCountChange;
2784 BottleSstpResendCountChange(self);
2785 frmLog.lvwLog.Invalidate;
2788 procedure TfrmSender.actInsertCueExecute(Sender: TObject);
2790 LogInsertCue(false); //
\92Ê
\8fí
\82Ì
\98A
\91±
\8dÄ
\90¶
\82ð
\82·
\82é
2793 function TfrmSender.ScriptTransForSSTP(const Script: String;
2794 out Error: String): String;
2795 var TransOpt: TScriptTransOptions;
2797 if Pref.NoTransURL then
2798 TransOpt := [toConvertURL, toNoChoice, toWaitScriptEnd]
2800 TransOpt := [toConvertURL, toWaitScriptEnd];
2801 if Pref.IgnoreFrequentYenS then TransOpt := TransOpt + [toIgnoreFrequentYenS];
2802 if Pref.FixMessySurface then TransOpt := TransOpt + [toFixMessySurface];
2803 if Pref.HUTagTo01Tag then TransOpt := TransOpt + [toHUTagTo01Tag];
2805 Error := DoTrans(Result, TransOpt);
2808 procedure TfrmSender.FormResize(Sender: TObject);
2811 //
\83G
\83f
\83B
\83^
\81[
\95\94\95ª
\82Ì
\83\8f\81[
\83h
\83\89\83b
\83v
\95\9d\82ð
\92²
\90®
\82·
\82é
2812 if memScript.ColWidth <> 0 then
2816 w := Width - LeftMargin - ColWidth div 2;
2817 if ScrollBars in [ssVertical, ssBoth] then
2818 w := w - GetSystemMetrics(SM_CYVSCROLL);
2819 WrapOption.WrapByte := w div ColWidth;
2824 procedure TfrmSender.actCopyExecute(Sender: TObject);
2826 memScript.CopyToClipboard;
2829 procedure TfrmSender.actPasteExecute(Sender: TObject);
2831 memScript.PasteFromClipboard;
2834 procedure TfrmSender.actCutExecute(Sender: TObject);
2836 memScript.CutToClipboard;
2839 procedure TfrmSender.actSelectAllExecute(Sender: TObject);
2841 memScript.SelectAll;
2844 procedure TfrmSender.actUndoExecute(Sender: TObject);
2849 procedure TfrmSender.actRedoExecute(Sender: TObject);
2854 function TfrmSender.IsSurfaceTag(const Script: String;
2855 var ID: integer): boolean;
2858 if SsParser.Match(Script, '\s%d') = 3 then
2861 ID := Ord(Script[3]) - Ord('0')
2863 else if (Length(Script) > 0) and (SsParser.Match(Script, '\s[%D]') = Length(Script)) then
2866 ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
2870 procedure TfrmSender.memScriptMouseMove(Sender: TObject;
2871 Shift: TShiftState; X, Y: Integer);
2875 //
\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[
2876 if not Pref.SurfacePreviewOnScriptPoint then
2878 token := memScript.TokenStringFromPos(Point(X, Y));
2879 if IsSurfaceTag(token, id) then
2881 DoSurfacePreview(id, spEditor);
2884 frmSurfacePreview.HideAway;
2888 procedure TfrmSender.DoSurfacePreview(Surface: integer;
2889 const Kind: TSurfacePreviewType);
2894 if cbxTargetGhost.ItemIndex > 0 then
2895 ghost := cbxTargetGhost.Text
2898 {
\8eè
\93®
\82Ì
\82Í
\82¸
2899 else if FNowChannel <> '' then
2900 ghost := ChannelList.Channel[FNowChannel].Ghost;
2903 //
\93ñ
\8fd
\95\
\8e¦
\82Ì
\97}
\90§
2904 if (FVisiblePreviewGhost = Ghost) and (FVisiblePreviewSurface = Surface) and
2905 not (frmSurfacePreview.IsHidden) then
2912 Bmp := TBitmap.Create;
2914 if Spps.TryGetImage(ghost, Surface, Bmp) then
2918 CPos := GetSurfacePreviewPositionHint(Bmp.Width, Bmp.Height);
2920 CPos := GetSurfacePreviewPositionScriptPoint(Bmp.Width, Bmp.Height);
2922 CPos := Point(0, 0);
2924 frmSurfacePreview.ShowPreview(Bmp, CPos.X, CPos.Y);
2925 FVisiblePreviewGhost := Ghost;
2926 FVisiblePreviewSurface := Surface;
2928 frmSurfacePreview.HideAway;
2935 function TfrmSender.GetSurfacePreviewPositionHint(w, h: integer): TPoint;
2936 {var MousePoint: TPoint;
2939 //
\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é
2940 //
\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Å
2941 //
\88Ä
\8aO
\82â
\82â
\82±
\82µ
\82¢
2942 {GetCursorPos(MousePoint);
2943 OutputDebugString(PChar(IntToStr(FVisibleMenuItem.Count)));
2944 //if GetMenuItemRect(Self.Handle, FVisibleMenuItem.Items[0].Handle, 1, MenuRect) then ;
2945 Result := Point(MenuRect.Left-10, MenuRect.Top-10);}
2946 Result := GetSurfacePreviewPositionScriptPoint(w, h);
2949 function TfrmSender.GetSurfacePreviewPositionScriptPoint(w, h: integer): TPoint;
2950 var MousePoint: TPoint;
2952 GetCursorPos(MousePoint);
2953 case Pref.SurfacePreviewOnScriptPointPosition of
2954 spspMainWindowRight:
2955 Result := Point(Self.Left + Self.Width, MousePoint.Y);
2957 Result := Point(Self.Left - w, MousePoint.Y);
2961 procedure TfrmSender.mnConstGroupClick(Sender: TObject);
2963 if (Sender is TMenuItem) then
2964 FVisibleMenuItem := Sender as TMenuItem;
2967 procedure TfrmSender.actRecallScriptBufferExecute(Sender: TObject);
2969 if FScriptBuffer.Count = 0 then
2971 memScript.Lines.Assign(FScriptBuffer[0] as TStringList);
2973 ShowHintLabel('
\83X
\83N
\83\8a\83v
\83g
\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½');
2976 procedure TfrmSender.EditorPreview;
2977 var Ghost, Script: String;
2979 if frmEditorTalkShow <> nil then
2980 if frmEditorTalkShow.Visible then
2982 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
2984 if cbxTargetGhost.ItemIndex > 0 then
2985 Ghost := cbxTargetGhost.Text;
2986 {
\8eè
\93®
\82Å
\8ew
\92è
\82³
\82ê
\82é
2987 else if FNowChannel <> '' then
2988 Ghost := ChannelList.Channel[FNowChannel].Ghost;
2990 frmEditorTalkShow.TalkShowFrame.View(Script, Ghost);
2994 procedure TfrmSender.actEditorPreviewExecute(Sender: TObject);
2996 if frmEditorTalkShow <> nil then
2997 frmEditorTalkShow.Show
3000 Application.CreateForm(TfrmEditorTalkShow, frmEditorTalkShow);
3001 frmEditorTalkShow.Show;
3006 //
\83v
\83\89\83O
\83C
\83\93\83\8a\83Z
\83b
\83g
3007 procedure TfrmSender.actResetPluginsExecute(Sender: TObject);
3009 Spps.ClearImagePool;
3010 Spps.LoadFromDirectory(FSppDir);
3014 procedure TfrmSender.IdSLPP20Connect(Sender: TObject);
3016 ShowHintLabel('SSTP Bottle
\83T
\81[
\83o
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82µ
\82½');
3020 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
3021 //
\83T
\83C
\83Y
\89Â
\95Ï
\82Ì
\94z
\97ñ
\83p
\83\89\83\81\81[
\83^
\94Å
3022 function TfrmSender.TagReplace(Script: String; Before,
3023 After: array of String): String;
3024 var BeforeList, AfterList: TStringList;
3027 BeforeList := TStringList.Create;
3028 AfterList := TStringList.Create;
3030 for i := Low(Before) to High(Before) do
3031 BeforeList.Add(Before[i]);
3032 for i := Low(After) to High(After) do
3033 AfterList.Add(After[i]);
3034 Result := TagReplace(Script, BeforeList, AfterList);
3041 //
\83X
\83N
\83\8a\83v
\83g
\92\86\82Ì
\83^
\83O
\82ð
\92u
\8a·
\82·
\82é
3042 // StringReplace
\82Æ
\88á
\82Á
\82Ä
\90³
\8am
\82É
\83^
\83O
\82É
\83}
\83b
\83`
\82µ
\81A
3043 //
\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¢)
3044 function TfrmSender.TagReplace(Script: String; Before,
3045 After: TStrings): String;
3047 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3053 OldStr := InputString;
3054 OldLeaveEscape := LeaveEscape;
3055 OldEscapeInvalidMeta := EscapeInvalidMeta;
3056 LeaveEscape := true;
3057 EscapeInvalidMeta := false;
3058 InputString := Script;
3060 for i := 0 to SsParser.Count-1 do
3063 for j := 0 to Before.Count-1 do
3065 if (SsParser.MarkUpType[i] = mtTag) and (SsParser[i] = Before[j]) then
3068 Result := Result + After[j];
3072 Result := Result + SsParser[i];
3076 LeaveEscape := OldLeaveEscape;
3077 EscapeInvalidMeta := OldEscapeInvalidMeta;
3078 InputString := OldStr;
3082 // WndProc
\82ð
\83I
\81[
\83o
\81[
\83\89\83C
\83h
\82µ
\82Ä
\81AFWM_TaskBarCraeted
\82É
3083 //
\91Î
\89\9e\82·
\82é
3084 procedure TfrmSender.WndProc(var Message: TMessage);
3086 if (Message.Msg = FWM_TaskBarCreated) and (FWM_TaskBarCreated <> 0) then
3088 TaskTray.Registered := false; // TTaskTray
\82É
\83^
\83X
\83N
\83g
\83\8c\83C
\82ª
\8fÁ
\82¦
\82½
\82±
\82Æ
\82ð
3089 //
\8bC
\82Ã
\82©
\82¹
\82é
3097 procedure TfrmSender.actReplaceExecute(Sender: TObject);
3099 Form: TfrmStrReplaceDialog;
3101 Options: TReplaceFlags;
3103 Application.CreateForm(TfrmStrReplaceDialog, Form);
3105 if Form.Execute then
3109 Lines := memScript.Lines.Text;
3110 Options := [rfReplaceAll];
3112 Options := Options + [rfIgnoreCase];
3114 Lines := StringReplaceRegExp(Lines, BeforeStr, AfterStr, Options)
3116 Lines := StringReplace(Lines, BeforeStr, AfterStr, Options);
3118 if Lines <> memScript.Lines.Text then
3120 memScript.SelectAll;
3121 memScript.SelText := Lines;
3129 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
3132 if frmLog.lvwLog.Selected = nil then Exit;
3133 Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
3134 if Log = nil then Exit;
3135 CopyFromLogToEditor(Log);
3138 procedure TfrmSender.actSendToLogWindowExecute(Sender: TObject);
3139 var Ghost, Script: String;
3142 Script := StringReplace(GetScriptText, #13#10, '', [rfReplaceAll]);
3143 if cbxTargetGhost.ItemIndex > 0 then
3144 Ghost := cbxTargetGhost.Text
3147 frmLog.AddCurrentScriptLog('
\83N
\83\8a\83b
\83v', Script, ClipChannel, '', Ghost, Now(), 0, 0);
3151 procedure TfrmSender.memScriptDragOver(Sender, Source: TObject; X,
3152 Y: Integer; State: TDragState; var Accept: Boolean);
3154 //
\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é
3155 if Source is TBottleLogDragObject then
3156 Accept := (Source as TBottleLogDragObject).LogItem.LogType = ltBottle
3159 procedure TfrmSender.memScriptDragDrop(Sender, Source: TObject; X,
3161 var Src: TBottleLogDragObject;
3164 //
\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é
3165 if not (Source is TBottleLogDragObject) then
3167 if (Source as TBottleLogDragObject).LogItem.LogType <> ltBottle then
3169 Src := Source as TBottleLogDragObject;
3171 CopyFromLogToEditor(Log);
3174 procedure TfrmSender.CopyFromLogToEditor(Log: TLogItem);
3178 if Log.LogType <> ltBottle then Exit;
3179 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Ä)
3180 memScript.Lines.Clear;
3181 memScript.Lines.Add(Log.Script);
3182 SetFileName(Log.MID, false); //
\83^
\83C
\83g
\83\8b\82¾
\82¯
\95Ï
\8dX
3183 SetFileModified(false); //
\95Ï
\8dX
\96³
\82µ
\82É
3185 //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\91Î
\8dô
3187 if ChannelList.Channel[Log.Channel] <> nil then
3188 Ghost := ChannelList.Channel[Log.Channel].Ghost;
3191 //
\83S
\81[
\83X
\83g
\96¼
\82ð
\83{
\83b
\83N
\83X
\82É
\93ü
\82ê
\82é
3192 //
\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Å
3193 //
\96³
\97\9d\96î
\97\9d\83S
\81[
\83X
\83g
\96¼
\82ª
\83{
\83b
\83N
\83X
\82É
\93ü
\82é
3194 cbxTargetGhost.Items.Add(Ghost);
3195 cbxTargetGhost.ItemIndex := cbxTargetGhost.Items.Count-1;
3197 cbxTargetGhost.Invalidate;
3199 cbxTargetGhost.ItemIndex := 0; // 'CH
\90\84\8f§'
\82É
\82·
\82é
3203 procedure TfrmSender.actDeleteLogItemExecute(Sender: TObject);
3205 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\82Ì
\8cÂ
\95Ê
\83\8d\83O
\82ð
\8dí
\8f\9c\82·
\82é
3206 if frmLog.SelectedBottleLog = nil then
3208 if frmLog.lvwLog.Selected = nil then
3210 frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
3211 frmLog.UpdateWindow;
3212 frmLog.lvwLogChange(Self, nil, ctState);
3213 frmLog.SelectedBottleLog.LogModified := true; //
\95Ï
\8dX
\82³
\82ê
\82½
3216 procedure TfrmSender.ClearEditor;
3217 var TmpScript: String;
3219 DoSaveBuffer: boolean;
3220 SavedScript: TStringList;
3222 //
\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é
3223 //
\8e©
\93®
\83N
\83\8a\83b
\83v
\82ª
\97L
\8cø
\82Å
\82 \82ê
\82Î
\83X
\83L
\83b
\83v
\82·
\82é
3224 if (NOT Pref.NotCheckClear) AND (NOT Pref.AutoClip) then
3225 if CheckFileSave(Self) = idCancel then exit;
3226 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\83N
\83\8a\83A
3227 //
\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é
3228 DoSaveBuffer := false;
3229 if FScriptBuffer.Count = 0 then
3230 DoSaveBuffer := true
3231 else if (FScriptBuffer[0] as TStringList).Text <> GetScriptText then
3232 DoSaveBuffer := true;
3233 if (GetScriptText = Pref.DefaultScript) or (GetScriptText = '') then
3234 DoSaveBuffer := false;
3235 if DoSaveBuffer then
3237 SavedScript := TStringList.Create;
3238 SavedScript.Text := GetScriptText;
3239 FScriptBuffer.Insert(0, SavedScript);
3241 if FScriptBuffer.Count >= 4 then
3242 FScriptBuffer.Delete(FScriptBuffer.Count-1);
3243 actRecallScriptBuffer.Enabled := FScriptBuffer.Count > 0;
3245 TmpScript := Pref.DefaultScript;
3246 Position := Pos('|', TmpScript);
3247 if Position < 1 then Position := 1;
3248 TmpScript := StringReplace(TmpScript, '|', '', []);
3249 memScript.Lines.Text := TmpScript;
3250 Sendmessage(memScript.Handle, WM_VSCROLL, SB_LINEUP, 0);
3251 memScript.SelStart := Position-1;
3253 if Visible then memScript.SetFocus;
3254 // FScriptModified := false;
3255 FScriptBackModified := false; //
\8e©
\93®
\95Û
\91¶
\88ê
\8e\9e\92â
\8e~
3256 SetFileName(NewFileTitle, true); //
\83t
\83@
\83C
\83\8b\82ð
\90V
\8bK
\88µ
\82¢
\82É
\82·
\82é
3257 SetFileModified(false); //
3258 EditerStatusChange; //
\83X
\83e
\81[
\83^
\83X
\8dX
\90V
3261 procedure TfrmSender.AppendTextLog(const FileName, Line: String);
3265 //
\91\97\90M
\83\8d\83O
\95Û
\91¶
3267 ForceDirectories(ExtractFileDir(FileName));
3268 AssignFile(F, FileName);
3269 if FileExists(FileName) then
3278 frmLog.AddCurrentSystemLog('SYSTEM', '
\83e
\83L
\83X
\83g
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\81F'+E.Message);
3282 procedure TfrmSender.AppendXMLLog(const FileName: String; Args: THeadValue);
3287 Impl: TDomImplementation;
3288 Parser: TXmlToDomParser;
3291 try // Long try block to handle all kinds of exception in this method
3292 if not FileExists(FileName) then
3294 // Create empty XML log file
3295 Impl := TDomImplementation.create(nil);
3297 ForceDirectories(ExtractFileDir(FileName));
3298 Parser := TXmlToDomParser.create(nil);
3299 Parser.DOMImpl := Impl;
3302 DOM := Parser.fileToDom(ExtractFilePath(Application.ExeName)+'xbtl.dat');
3305 documentElement.setAttribute('saved',
3306 FormatDateTime('yy/mm/dd hh:nn:ss', Now));
3307 documentElement.setAttribute('generator', VersionString);
3308 documentElement.setAttribute('version', '1.0');
3310 //
\82±
\82ê
\82Í
\96¾
\8e¦
\93I
\82ÉFree
\82µ
\82È
\82
\82Ä
\82æ
\82¢
3311 F := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
3313 DOM.writeCodeAsShiftJIS(F);
3318 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3321 Parser.DOMImpl.freeDocument(DOM);
3328 F := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
3334 F.Seek(P, soFromEnd);
3336 if Buf = '</bottlelog>' then
3341 raise Exception.Create(FileName + ' is not a valid XML bottle log file')
3344 F.Seek(P, soFromEnd);
3345 Buf := Format('<message mid="%s">', [Args['MID']]);
3346 Buf := Buf + Format('<date>%s</date>', [FormatDateTime('yy/mm/dd hh:nn:ss', Now)]);
3347 Buf := Buf + Format('<channel>%s</channel>', [XMLEntity(Args['Channel'])]);
3348 Buf := Buf + Format('<script>%s</script>', [XMLEntity(Args['Script'])]);
3349 Buf := Buf + '<votes>0</votes><agrees>0</agrees>';
3350 Buf := Buf + Format('<ghost>%s</ghost>', [XMLEntity(Args['IfGhost'])]);
3351 Buf := Buf + '</message>';
3352 Buf := Buf + '</bottlelog>';
3353 F.Write(Buf[1], Length(Buf));
3360 frmLog.AddCurrentSystemLog('SYSTEM', 'XML
\83\8d\83O
\95Û
\91¶
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:'+E.Message);
3364 procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
3369 SelText := memScript.SelText;
3370 if SelText <> '' then
3372 StatusBar.Panels[PanelBytes].Text := Format('(%d
\83o
\83C
\83g)', [Length(SelText)]);
3379 function TfrmSender.ReplaceSurface(Script: String;
3380 Params: TCollection): String;
3382 Flag, OldLeaveEscape, OldEscapeInvalidMeta: boolean;
3383 OldStr, Tag: String;
3384 i, j, k, Cur: integer;
3385 Item: TSurfaceReplaceItem;
3386 Before: TSurfaceReplaceBeforeItem;
3392 OldStr := InputString;
3393 OldLeaveEscape := LeaveEscape;
3394 OldEscapeInvalidMeta := EscapeInvalidMeta;
3395 LeaveEscape := true;
3396 EscapeInvalidMeta := false;
3397 InputString := Script;
3399 for i := 0 to SsParser.Count-1 do
3401 if SsParser.MarkUpType[i] <> mtTag then
3403 Result := Result + SsParser.Str[i];
3406 Tag := SsParser.Str[i];
3407 if SsParser.Match(Tag, '\s%d') = 2 then
3408 Cur := Ord(Tag[3]) - Ord('0')
3409 else if SsParser.Match(Tag, '\s[%D]') > 0 then
3410 Cur := StrToInt(SsParser.GetParam(Tag, 1))
3413 Result := Result + Tag;
3417 for j := 0 to Params.Count-1 do
3419 Item := Params.Items[j] as TSurfaceReplaceItem;
3420 for k := 0 to Item.Before.Count-1 do
3422 Before := Item.Before.Items[k] as TSurfaceReplaceBeforeItem;
3423 if (Cur >= Before.FromNo) and (Cur <= Before.ToNo) then
3426 Result := Result + Format('\s[%d]', [Item.After]);
3434 Result := Result + Tag;
3438 LeaveEscape := OldLeaveEscape;
3439 EscapeInvalidMeta := OldEscapeInvalidMeta;
3440 InputString := OldStr;
3444 procedure TfrmSender.WMQueryEndSession(var msg: TWMQueryEndSession);
3446 // Windows
\82ª
\8fI
\97¹
\82µ
\82æ
\82¤
\82Æ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82ð
\8a´
\92m
\82·
\82é
3447 FEndSession := true;
3452 procedure TfrmSender.IdSLPP20ConnectFailed(Sender: TObject);
3455 if FBeginConnectFailCount = 0 then
3458 if Pref.UseHttpProxy then
3459 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 +
3460 '
\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 +
3461 '
\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')
3463 frmMessageBox.ShowMessage('SSTP Bottle
\83T
\81[
\83o
\82É
\90Ú
\91±
\82Å
\82«
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B'#13#10 +
3464 '
\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 +
3465 '
\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');
3467 ShowHintLabel('SSTP Bottle Server
\90Ú
\91±
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½', WarningColor);
3468 Inc(FBeginConnectFailCount);
3472 procedure TfrmSender.BuildReplaceMenu(Root: TMenuItem);
3475 Presets: TReplacePresetCollection;
3479 Presets := Pref.ReplacePresets.Presets;
3480 for i := 0 to Presets.Count-1 do
3482 NewItem := TMenuItem.Create(Root);
3485 Caption := Presets[i].Title;
3486 ShortCut := Presets[i].ShortCut;
3487 AutoHotkeys := maManual;
3488 Hint := Presets[i].Pairs.StringExpression;
3490 OnClick := mnPresetReplaceClick;
3494 Root.Enabled := Presets.Count > 0;
3497 procedure TfrmSender.mnPresetReplaceClick(Sender: TObject);
3499 Preset: TReplacePreset;
3502 //
\83v
\83\8a\83Z
\83b
\83g
\92u
\8a·
\82ð
\8eÀ
\8ds
3503 Preset := Pref.ReplacePresets.Presets[(Sender as TMenuItem).Tag];
3504 Lines := memScript.Lines.Text;
3505 New := Preset.Pairs.ExecuteReplace(Lines);
3506 if New <> Lines then
3508 memScript.SelectAll;
3509 memScript.SelText := New;
3511 if Preset.ConfirmAfterReplace then
3517 procedure TfrmSender.BottleCnv(Log: TLogItem);
3519 HeadValue: THeadValue;
3522 HeadValue := THeadValue.Create;
3523 HeadValue['MID'] := Log.MID;
3524 HeadValue['Channel'] := Log.Channel;
3525 // HeadValue['SEND'] := 'SSTP/1.4';
3526 // HeadValue['Sender'] := 'SSTP Bottle ' + Log.Channel;
3527 HeadValue['IfGhost'] := Log.Ghost;
3528 HeadValue['Script'] := Log.Script;
3529 // HeadValue['Charset'] := 'Shift_JIS';
3530 // HeadValue['DialogMessage'] := Log.Script;
3532 //
\83\81\83b
\83Z
\81[
\83W
\8eó
\90M
\8f\88\97\9d\82Ö
3533 DispatchBottle(HeadValue, Log.LogTime, Log.Votes, Log.Agrees);
3539 procedure TfrmSender.SetScriptAutoBackUp;
3541 //
\83o
\83b
\83N
\83A
\83b
\83v
\83^
\83C
\83}
\81[
\82Ö
\92l
\82Ì
\83Z
\83b
\83g
3542 frmSender.ScriptBackUp.Enabled := Pref.ScriptBackUp;
3543 frmSender.ScriptBackUp.Interval := Pref.ScriptBackUpTime * 60000;
3546 procedure TfrmSender.ScriptBackUpTimer(Sender: TObject);
3550 //
\83X
\83N
\83\8a\83v
\83g
\82Ì
\8e©
\93®
\83o
\83b
\83N
\83A
\83b
\83v
3551 if FScriptBackModified then
3553 Script := GetScriptText;
3554 AppendTextLog(ExtractFilePath(Application.ExeName) + AutoSaveFile,
3555 FormatDateTime('yy/mm/dd hh:nn:ss', Now) + #13#10 + Script);
3556 ShowHintLabel('
\83o
\83b
\83N
\83A
\83b
\83v
\8eÀ
\8ds');
3557 FScriptBackModified := False;
3561 procedure TfrmSender.UpdateChannelList;
3563 Ch: TChannelListItem;
3566 //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\92è
\8b`
3568 //
\83t
\83\89\83O
\82ð
\8c©
\82Ä
\94»
\92f
3569 if NOT Pref.GhostCh then exit;
3570 //if (Pref.GhostChList.Count mod 2) = 1 then Pref.GhostChList.Add('');
3572 while i < Pref.GhostChList.Count-1 do
3574 Ch := TChannelListItem.Create;
3575 Ch.Name := Pref.GhostChList.Strings[i];
3576 Ch.Ghost := Pref.GhostChList.Strings[i+1];
3580 Ch.WarnPost:= false;
3581 ChannelList.Add(Ch);
3586 procedure TfrmSender.UpdateJoinChannelList;
3588 UpdateChannelList; //
\83`
\83\83\83\93\83l
\83\8b\90Ý
\92è
3595 actSend.Hint := Format('
\91\97\90M|%s', [SendButtonLongHint]);
3596 actNextChannel.Enabled := false;
3597 actPrevChannel.Enabled := false;
3598 OnChange := tabChannelChange;
3602 procedure TfrmSender.PerformFileOpen(AFileName: string);
3604 //
\8eÀ
\8dÛ
\82É
\83t
\83@
\83C
\83\8b\82ð
\8aJ
\82
3605 if FileCheck(AFileName) = false then exit;
3606 Screen.Cursor := crHourGlass;
3608 memScript.Lines.LoadFromFile(AFileName);
3609 SetFileModified(false);
3613 ShowMessage('
\83G
\83\89\81[:'#13#10#13#10 + E.Message);
3614 AFileName := NewFileTitle; //
\8e¸
\94s
\82µ
\82½
\8e\9e\82Í
\83^
\83C
\83g
\83\8b\8f\89\8aú
\89»
\81B
3617 Screen.Cursor := crDefault;
3618 SetFileName(AFileName, true);
3623 procedure TfrmSender.PerformFileSave(const AFileName: string);
3625 //
\8eÀ
\8dÛ
\82É
\95Û
\91¶
\82·
\82é
3626 Screen.Cursor := crHourGlass;
3628 memScript.Lines.SaveToFile(AFileName);
3629 SetFileModified(false);
3632 ShowMessage('
\83G
\83\89\81[:'#13#10#13#10 + E.Message);
3634 Screen.Cursor := crDefault;
3637 procedure TfrmSender.actFileOpenExecute(Sender: TObject);
3640 if CheckFileSave(Self) = idCancel then exit;
3641 if OpenDialog.Execute then
3642 PerformFileOpen(OpenDialog.FileName);
3645 procedure TfrmSender.SetFileName(const FileName: String; const Value: boolean);
3647 //
\83^
\83C
\83g
\83\8b\95Ï
\8dX
\82Æ
\83t
\83@
\83C
\83\8b\83p
\83X
\83Z
\83b
\83g
3648 //
\82à
\82µ
\81A
\91æ
\93ñ
\88ø
\90\94\82ªfalse
\82È
\82ç
\83^
\83C
\83g
\83\8b\82¾
\82¯
\95Ï
\8dX
3649 if Value then FFileName := FileName;
3650 //else FSubFileName := ExtractFileName(FileName);
3651 Self.Caption := Format('%s - %s', [ExtractFileName(FileName), FOriginalCaption]);
3654 function TfrmSender.CheckFileSave(Sender: TObject): integer;
3658 //
\83t
\83@
\83C
\83\8b\82Ì
\95Ï
\8dX
\82ð
\8am
\94F
3659 // Result := idCancel
\82Å
\8fI
\97¹
\91j
\8e~
3660 if FFileModified then
3662 Res := MessageDlg(Format('
\83t
\83@
\83C
\83\8b %s
\82Í
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81B'#13#10#13#10 +
3663 '
\95Û
\91¶
\82µ
\82Ü
\82·
\82©
\81H', [FFileName]), mtConfirmation, mbYesNoCancel, 0);
3664 if Res = idYes then Res := FileSave(Self);
3670 function TfrmSender.FileSave(Sender: TObject): integer;
3675 if FFileName = NewFileTitle then
3676 Res := FileSaveAs(Sender) //
\83p
\83X
\96¼
\82ª
\8ew
\92è
\82³
\82ê
\82Ä
\82¢
\81¨
\90V
\8bK
3679 PerformFileSave(FFileName);
3685 function TfrmSender.FileSaveAs(Sender: TObject): integer;
3689 //
\96¼
\91O
\82ð
\95t
\82¯
\82Ä
\95Û
\91¶
3691 SaveDialog.FileName := ExtractFileName(FFileName);
3692 //SaveDialog.InitialDir := ExtractFileDir(Application.ExeName);
3693 if SaveDialog.Execute then
3695 if FileCheck(SaveDialog.FileName) = false then
3700 if FileExists(SaveDialog.FileName) then
3701 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',
3702 [SaveDialog.FileName]), mtConfirmation, mbYesNoCancel, 0);
3705 PerformFileSave(SaveDialog.FileName);
3706 SetFileName(SaveDialog.FileName, true);
3713 procedure TfrmSender.actFileSaveAsExecute(Sender: TObject);
3715 //
\96¼
\91O
\82ð
\95t
\82¯
\82Ä
\95Û
\91¶
\8cÄ
\82Ñ
\8fo
\82µ
3719 procedure TfrmSender.actFileSaveExecute(Sender: TObject);
3721 //
\8fã
\8f\91\82«
\95Û
\91¶
\8cÄ
\82Ñ
\8fo
\82µ
3725 procedure TfrmSender.SetFileModified(const Value: boolean);
3727 //
\83t
\83@
\83C
\83\8b\95Ï
\8dX
\83t
\83\89\83O
\82Æ
\95\
\8e¦
\95Ï
\8dX
3729 StatusBar.Panels[PanelConnecting].Text := '
\95Ï
\8dX'
3731 StatusBar.Panels[PanelConnecting].Text := '';
3732 FFileModified := Value;
3735 procedure TfrmSender.OpenBrowser(const Url: string);
3739 if Pref.BrowserExeName = '' then
3741 ShellExecute(Handle, 'open', PChar(Url), nil, nil, SW_SHOW);
3744 Command := Pref.BrowserExeName + ' ' + Url;
3745 WinExec(PChar(Command), SW_SHOW);
3749 function TfrmSender.FileCheck(const AFileName: string): boolean;
3753 //
\8e©
\93®
\95Û
\91¶
\82Å
\8ew
\92è
\82³
\82ê
\82Ä
\82¢
\82é
\83t
\83@
\83C
\83\8b\82Í
\93Ç
\8f\91\82«
\82µ
\82È
\82¢
\81B
3755 if (ExtractFilePath(Application.ExeName) + AutoSaveFile) = AFileName then
3758 ShowMessage('
\8e©
\93®
\95Û
\91¶
\91Î
\8fÛ
\83t
\83@
\83C
\83\8b\82Í
\93Ç
\8f\91\82«
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B');
3765 procedure TfrmSender.CopyDataMessage(var WMCopyData: TWMCopyData);
3768 HeadValue: THeadValue;
3771 if WMCopyData.CopyDataStruct.dwData = 1 then
3773 Param := PChar(WMCopyData.CopyDataStruct.lpData);
3774 HeadValue := THeadValue.Create(Param);
3776 if HeadValue['Script'] <> '' then
3777 DispatchBottle(HeadValue, Now(), 0, 0)
3778 else if HeadValue['Type'] = 'Vote' then
3779 frmLog.VoteLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0))
3780 else if HeadValue['Type'] = 'Agree' then
3781 frmLog.AgreeLog(HeadValue['MID'], StrToIntDef(HeadValue['Num'], 0))
3782 else if (HeadValue['Num'] <> '') AND (HeadValue['Channel'] = '') AND
3783 (HeadValue['Entry'] = '') then
3784 StatusBar.Panels[PanelMembers].Text := HeadValue['Num'] + '
\90l';