📄 ymlite.dpr
字号:
program YmLite;
uses
Windows,
Forms,
Dialogs,
classes,
Sysutils,
FileCtrl,
StdCtrls,
YchatU1 in 'YchatU1.pas' {Form1},
YchatU2 in 'YchatU2.pas' {Form2},
YchatU3 in 'YchatU3.pas' {Form3},
YchatU5 in 'YchatU5.pas' {Form5},
YchatU6 in 'YchatU6.pas' {Form6},
YchatU7 in 'YchatU7.pas' {Form7},
YchatU8 in 'YchatU8.pas' {Form8},
YchatU9 in 'YchatU9.pas' {Form9},
YchatU10 in 'YchatU10.pas' {Form10},
YchatU11 in 'YchatU11.pas' {Form11},
YchatU14 in 'YchatU14.pas' {Form14},
YchatU18 in 'YchatU18.pas' {Form18},
YchatU20 in 'YchatU20.pas' {Form20},
YchatU22 in 'YchatU22.pas' {Form22},
YchatU23 in 'YchatU23.pas' {Form23},
YchatU25 in 'YchatU25.pas' {Form25},
YchatU27 in 'YchatU27.pas' {Form27},
YchatU28 in 'YchatU28.pas' {Form28},
YchatU4 in 'YchatU4.pas' {Form4},
Unit1 in 'Unit1.pas',
YchatU24 in 'YchatU24.pas' {Form24},
YchatU34 in 'YchatU34.pas' {Form29},
YchatU30 in 'YchatU30.pas' {Form30},
YchatU35 in 'YchatU35.pas' {Form31},
YchatU36 in 'YchatU36.pas' {Form32},
YchatU38 in 'YchatU38.pas' {Form34},
YchatU39 in 'YchatU39.pas' {Form35},
YchatU40 in 'YchatU40.pas' {Form36},
YchatU41 in 'YchatU41.pas' {Form37},
YchatU42 in 'YchatU42.pas' {Form38},
YchatU44 in 'YchatU44.pas' {Form40},
YchatU48 in 'YchatU48.pas' {Form44},
YchatU49 in 'YchatU49.pas' {Form45},
YchatU50 in 'YchatU50.pas' {Form46},
YchatU55 in 'YchatU55.pas' {Form51},
YchatU57 in 'YchatU57.pas' {Form53},
ychatu17 in 'ychatu17.pas' {Form17},
progressloader in 'progressloader.pas' {Form43},
filedownloader in 'filedownloader.pas' {Form39},
identlib in 'identlib.pas' {Form47},
coverter in 'coverter.pas' {FConverter},
captchawindow in 'captchawindow.pas' {FormCaptcha},
cmdwin in 'cmdwin.pas' {CmdsBox};
{$R *.res}
{$R Girlyfilter.res}
{$R ymico.res}
{$R Alertava.res}
{$R Alertava2.res}
{$R BotStrings.Res}
{$R sheep.res}
Const
ValidURLChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$-_@.&+-!*"''(),;/#?:';
Function GetFileSize(FileN: String): Integer;
Var
S: TFileStream;
Begin
If FileExists(FileN) Then
Begin
S := TFileStream.Create(FileN, fmOpenRead or fmShareDenyNone);
Result:=S.Size;
S.Free;
End
else
Result:=0;
End;
Function URLDecode(Value : String) : String;
Const HexChars = '0123456789ABCDEF';
Var I : Integer;
Ch,H1,H2 : Char;
Begin
Result := '';
I := 1;
While I <= Length(Value) Do
Begin
Ch := Value[I];
Case Ch Of
'%' : Begin
H1 := Value[I+1];
H2 := Value[I+2];
Inc(I, 2);
Result := Result + Chr(((Pos(H1, HexChars) - 1) * 16) + (Pos(H2, HexChars) - 1));
End;
'+' : Result := Result + ' ';
'&' : Result := Result + #13+#10;
Else Result := Result + Ch;
End;
Inc(I);
End;
End;
Function ShortFileName(Const FileName: String): String;
Var
aTmp: Array[0..255] Of Char;
Begin
If GetShortPathName(PChar (FileName), aTmp, Sizeof (aTmp) - 1) = 0 Then
Begin
Result:= FileName;
End
Else
Begin
Result:= StrPas (aTmp);
End;
End;
function CopyFileWithFileStream(sourcefilename,targetfilename: String): boolean;
Var
S: TFileStream;
T: TMemoryStream;
bReturn: Boolean;
Begin
bReturn:=False;
try
S := TFileStream.Create( sourcefilename, fmOpenRead or fmShareDenyNone);
except
Result :=False;
Exit;
end;
try
T := TMemoryStream.Create();
T.CopyFrom(S, 0); //This raise an exception
S.free;
T.SaveToFile(targetfilename);
T.free;
except
Result :=False;
Exit;
end;
Result:=bReturn;
End;
Function IsFileSame(S,S2: String): Boolean;
Begin
Result:=False;
IF GetFileSize(S)=GetFileSize(s2) Then
Result:=True;
End;
Var
Tmp: TStringList;
TheStream : TResourceStream;
SI: TStartupInfo;
PI: TProcessInformation;
Wnd: Hwnd;
Param: String;
Pid: Thandle;
begin
// MemChk;
Path:=ExtractFilePath(Application.ExeName);
Param:=ParamStr(1);
If Copy(Param,1,7)='/update' then
Begin
Sleep(4000);
Wnd:=FindWindow(Pchar('Y!mLite'),Nil);
If Wnd<>0 Then
Begin
// ShowMessage('Upgra OK To Continue!');
GetWindowThreadProcessID(Wnd,@Pid);
WaitForSingleObject(Pid,4500);
// ShowMessage('Finished Waiting!');
Sleep(30);
DeleteFile(Path+'ymlite.exe');
Sleep(30);
CopyFileWithFileStream(Path+'ymlitenew.exe',Path+'ymlite.exe');
Sleep(30);
WinExec(Pchar(path+'ymlite.exe'),sw_normal);
End
else
Begin
// ShowMessage('Upgrading Press OK To Continue!');
Sleep(30);
DeleteFile(Path+'ymlite.exe');
Sleep(30);
CopyFileWithFileStream(Path+'ymlitenew.exe',Path+'ymlite.exe');
Sleep(30);
WinExec(Pchar(path+'ymlite.exe'),sw_normal);
End;
Exit;
End;
// Exit;
{ If FileExists(Path+'\dictionary.txt')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'dict', RT_RCDATA);
TheStream.SaveToFile(Path+'\dictionary.txt');
TheStream.Free;
End;}
IF FileExists(Path+'ymliteico.ico')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'ymicon', RT_RCDATA);
TheStream.SaveToFile(Path+'ymliteico.ico');
TheStream.Free;
End;
IF FileExists(Path+'sheep.jpg')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'sheepimg', RT_RCDATA);
TheStream.SaveToFile(Path+'sheep.jpg');
TheStream.Free;
End;
IF FileExists(Path+'botstrings.txt')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'botstrings', RT_RCDATA);
TheStream.SaveToFile(Path+'botstrings.txt');
TheStream.Free;
End;
{ IF FileExists(Path+'ImageOLE.dll')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'ImageOLE', RT_RCDATA);
TheStream.SaveToFile(Path+'ImageOLE.dll');
TheStream.Free;
Path:=ShortFileName(Path);
CreateProcess(Nil,Pchar('regsvr32 /s '+Path+'ImageOLE.dll'),Nil,Nil,False,Normal_Priority_Class,Nil,Nil,SI,PI);
WaitForSingleObject(pi.hProcess,INFINITE);
CloseHandle(Pi.hProcess);
CloseHandle(PI.Hthread);
End;}
If FileEXists(Path+'girlyfilter.ypf')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'girlyfilter', RT_RCDATA);
TheStream.SaveToFile(Path+'girlyfilter.ypf');
TheStream.Free;
End;
{ If FileExists(Path+'CrashLog.txt')=True Then
Begin
DeleteFile(Path+'voice\yacscom.dll');
RemoveDir(Path+'Voice');
End;}
{ IF (DirectoryExists(Path+'voice')=False) Then
Begin
//Path:=Path+'voice';
CreateDir(Path+'voice');
TheStream := TResourceStream.Create(hInstance, 'yacscom', RT_RCDATA);
TheStream.SaveToFile(Path+'voice\yacscom.dll');
TheStream.Free;
Path:=ShortFileName(Path);
CreateProcess(Nil,Pchar('regsvr32 /s '+Path+'voice\yacscom.dll'),Nil,Nil,False,Normal_Priority_Class,Nil,Nil,SI,PI);
WaitForSingleObject(pi.hProcess,INFINITE);
CloseHandle(Pi.hProcess);
CloseHandle(PI.Hthread);
//ShowMesage('YacsCom.Dll Registered!');
End;}
Path:=ExtractFilePath(Application.ExeName);
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm10, Form10);
Application.CreateForm(TForm43, Form43);
Application.CreateForm(TFormCaptcha, FormCaptcha);
Application.CreateForm(TForm46, Form46);
Form43.Visible:=True;
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TForm3, Form3);
Application.CreateForm(TForm5, Form5);
Application.CreateForm(TForm6, Form6);
Application.CreateForm(TForm7, Form7);
Application.CreateForm(TForm8, Form8);
Application.CreateForm(TForm9, Form9);
Form43.ProgressBar1.Position:=40;
Application.CreateForm(TForm11, Form11);
Application.CreateForm(TForm14, Form14);
Application.CreateForm(TForm18, Form18);
Application.CreateForm(TForm22, Form22);
Application.CreateForm(TForm25, Form25);
Application.CreateForm(TForm27, Form27);
Application.CreateForm(TForm28, Form28);
Application.CreateForm(TForm4, Form4);
Application.CreateForm(TForm24, Form24);
Form43.ProgressBar1.Position:=70;
Application.CreateForm(TForm31, Form31);
Application.CreateForm(TForm32, Form32);
Application.CreateForm(TForm35, Form35);
Application.CreateForm(TForm37, Form37);
Application.CreateForm(TForm44, Form44);
Application.CreateForm(TForm45, Form45);
Application.CreateForm(TForm46, Form46);
Application.CreateForm(TForm40, Form40);
Application.CreateForm(TForm51, Form51);
Application.CreateForm(TForm53, Form53);
Application.CreateForm(TForm20, Form20);
Try
Form1.LoadLayOut;
Form1.LoadLoginData;
Form43.ProgressBar1.Position:=90;
Form1.spSkinExPanel2.RollState:=True;
Form1.spSkinExPanel3.RollState:=False;
Form1.SpSkinExPanel1.Visible:=True;
Form1.SpSkinExPanel3.Visible:=True;
Form1.spSkinExPanel4.RollState:=True;
Except
ShowMessage('LoadLayOut/LoadLoginData Issue');
End;
// Form1.spSkinExPanel5.RollState:=True;
PmCounter:=0;
Try
Form1.ListBox1.Font.Size:=Form10.SpinEdit10.Value;
If FileExists(Path+'RtfImages\smileyref.txt')=False Then
Begin
Createdir(Path+'rtfimages');
Form36.Memo1.Lines.SaveToFile(Path+'RtfImages\smileyref.txt');
Form1.extractSmileyList;
End;
If FileExists(Path+'urls.txt')=True Then
Form5.ListBox1.Items.LoadFromFile(Path+'Urls.txt');
If FileExists(Path+'emotes.txt')=True Then
Form18.ListBox1.Items.LoadFromFile(Path+'emotes.txt');
Except
ShowMessage('RTF Images/Emotes/Urls/Font Loader Issue');
End;
If FileEXists(Path+'rtfimages\alertava.bmp')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'alertava', RT_RCDATA);
TheStream.SaveToFile(Path+'rtfimages\alertava.bmp');
TheStream.Free;
End;
If FileEXists(Path+'rtfimages\handright.gif')=False Then
Begin
TheStream := TResourceStream.Create(hInstance, 'alertaniava', RT_RCDATA);
TheStream.SaveToFile(Path+'rtfimages\handright.gif');
TheStream.Free;
End;
If FileExists(Path+'hotkeys.txt')=True Then
Begin
Tmp:=TStringList.Create;
Tmp.LoadFromFile(Path+'HotKeys.txt');
Form20.Edit1.Text:=Tmp[0];
Form20.Edit2.Text:=Tmp[1];
Form20.Edit3.Text:=Tmp[2];
Form20.Edit4.Text:=Tmp[3];
Tmp.Free;
End;
Form1.Button1.Width:=Form1.Panel6.Width;
Form1.Button1.Height:=Form1.Panel6.Height;
Form1.StartSound('please_login.wav',False,False);
If FileExists(Path+'serverroomlist.txt')=True Then
Form8.ServComboBox.Items.LoadFromFile(Path+'serverroomlist.txt');
Form8.ServComboBox.Sorted:=True;
{ If Form8.ComboBox1.Items[0]<>'' Then
Form8.ComboBox1.Text:=Form8.ComboBox1.Items[0];}
Form1.Timer1.Interval:=(1000*60)*7;
Form1.Timer1.Enabled:=True;
Form1.Timer3.Enabled:=True;
// If Form1.SoundEXSpellChecker1.Checked=True Then
// Form1.Richedit2.AddictSpell:=Form1.AddictSpell31;
FOrm1.Visible:=True;
{ For N:=1 to 64 Do
Begin
SendMessage(Form1.Richedit1.Handle,EM_SETZOOM,N,64);
Form1.Delay(10);
application.ProcessMessages;
End;}
Form1.richedit1.Paragraph.Alignment:=taCenter;
Form1.Richedit1.Lines.Add('');
Form1.richedit1.Paragraph.Alignment:=taLeftJustify;
Form1.Richedit1.Lines.Add('');
Form1.Richedit1.SelAttributes.Color:=$000000;
Form1.ScrollToEnd(Form1.Richedit1);
Form1.richedit1.Paragraph.Alignment:=taLeftJustify;
SendMessage(Form1.Richedit1.Handle,EM_SETZOOM,EMZoom,64);
Form43.Close;
Application.ProcessMessages;
// Form1.CreateSkin(Form2);
If Form2.CheckBox2.Checked=False Then
Form2.Show;
If Form2.CheckBox2.Checked=True Then
Begin
//autologin
LoggedInPassword:=Form2.Edit1.Text;
If Form2.RadioButton1.Checked=True Then
Form1.ConnectToYahooYMSG(LoggedInName,RoomName, LoggedInPassword);
If Form2.RadioButton4.Checked=True Then
Form1.ConnectToSPRT(LoggedInName,RoomName, LoggedInPassword, Cookie);
End;
Form43.ProgressBar1.Position:=100;
Form1.Panel10.Caption:='Now Rendering Smileys';
Form1.DrawSmileys;
Form1.CreateButtons;
NowRunning:=True;
If ProgButtons[1]<>Nil Then
Begin
// Form1.SpSkinScrollPanel2.ButtonHeight:=ProgButtons[1].Height+1;
Form1.SpSkinPanel2.Height:=ProgButtons[1].Height+1;
end;
If Form53.checkbox1.Checked=True Then
Form53.Button1.Click;
Form1.ReleaseMemory;
Application.Run;
If Gupdate=True Then
Form1.ShellEXecute(0,'Open',Pchar(Path+'ymlitenew.exe'),Pchar('/update'),Nil,sw_show);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -