Legend:
- Unmodified
- Added
- Removed
-
Main.pas
r2 r4 6 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 7 Dialogs, StdCtrls, Menus, ImgList, ComCtrls, XPMan, CoolTrayIcon, Registry, ShellApi, 8 WinSkinData, ExtCtrls, xmldom, XMLIntf, msxmldom, XMLDoc, 8 //WinSkinData, 9 ExtCtrls, xmldom, XMLIntf, msxmldom, XMLDoc, 9 10 IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, RichEdit, 10 11 IdRawBase, IdRawClient, IdIcmpClient, MPlayer; 12 13 const 14 ApplicationVersion = '3.3'; 15 ApplicationRevision = 5; 16 R = '\Software\maronsoft\Heroes of Fantasy client pack\'; 17 UpdateInfoFile = 'http://wow.zdechov.net/client/aktualizace.txt'; 18 DefaultRSSChannel = 'http://wow.zdechov.net/rss.php?category=articles'; 19 OldRSSChannel = 'http://wow.zdechov.net/rss.php'; 11 20 12 21 type … … 23 32 protected 24 33 procedure Execute; override; 25 end; 26 27 type 34 procedure Update; 35 end; 36 37 TServer = record 38 Name: string; 39 Address: string; 40 ExeFile: string; 41 Image: string; 42 Description: string; 43 OnlinePlayersAddress: string; 44 end; 45 28 46 TForm1 = class(TForm) 29 47 MainMenu1: TMainMenu; … … 56 74 Editovatoznaen2: TMenuItem; 57 75 Smazat1: TMenuItem; 58 SkinData1: TSkinData;59 76 ImageList16default: TImageList; 60 77 ImageList32default: TImageList; … … 165 182 procedure Importzwowstatusnet2Click(Sender: TObject); 166 183 procedure Zkoprovatfonty1Click(Sender: TObject); 184 procedure FormDestroy(Sender: TObject); 167 185 private 168 186 { Private declarations } … … 177 195 178 196 // veřejné proměné 179 Servers: array of record 180 Name: string; 181 Address: string; 182 ExeFile: string; 183 Image: string; 184 Description: string; 185 OnlinePlayersAddress: string; 186 end; 197 Servers: array of TServer; 187 198 188 199 //obecné procedury … … 217 228 end; 218 229 219 const220 ApplicationVersion = '3.2';221 ApplicationRevision = 5;222 R = '\Software\maronsoft\Heroes of Fantasy client pack\';223 UpdateInfoFile = 'http://wow.zdechov.net/client/aktualizace.txt';224 225 230 var 226 231 Form1: TForm1; … … 235 240 ShowDetails: Boolean = False; 236 241 // MakePing: boolean = True; 237 RSSAddress: string = 'http://wow.zdechov.net/rss.php';242 RSSAddress: string; 238 243 CopyFonts: Boolean = True; 239 244 … … 247 252 Desktop: TRect; 248 253 249 // veřejné přoměné 250 vlakno: TVlakno; 254 Vlakno: TVlakno; 251 255 252 256 implementation … … 361 365 procedure TForm1.FormCreate(Sender: TObject); 362 366 begin 363 //Načítání nastavení a vypsání 367 Vlakno := TVlakno.Create(True); 368 369 // Načítání nastavení a vypsání 364 370 LoadRegOptions; 365 371 LoadRegServers; … … 367 373 WriteServers; 368 374 369 // Akce na záhladě nastavení375 // Akce na záhladě nastavení 370 376 if StartMinimalize then 371 377 Application.ShowMainForm := False; 372 378 373 // ostatní379 // ostatní 374 380 Form1.Caption := Form1.Caption+' '+ApplicationVersion; 375 381 SystemParametersInfo(SPI_GETWORKAREA, 0, @Desktop, 0); 376 382 InitRichEditURLDetection(RichEdit1); 377 383 378 // zjištění aktualizace384 // zjištění aktualizace 379 385 if UpdateApplication then 380 386 if NeedUpdate then 381 387 ProcedureUpdateApplication; 388 end; 389 390 procedure TForm1.FormDestroy(Sender: TObject); 391 begin 392 Vlakno.WaitFor; 393 Vlakno.Free; 382 394 end; 383 395 … … 450 462 MyTextFile: TextFile; 451 463 begin 464 try 452 465 AssignFile(MyTextFile, ExtractFileDir(Servers[SeverIndex].ExeFile)+'\realmlist.wtf'); 453 466 Rewrite(MyTextFile); … … 466 479 if AfterWoWStartMinimalize then 467 480 Application.Minimize; 481 except 482 raise Exception.Create('Nepodařilo se spustit hru pro připojení k serveru ' + Servers[SeverIndex].Name + '.'); 483 end; 468 484 end; 469 485 … … 485 501 Form4.Edit3.Text := GetWoWExeFile; 486 502 BitMap := TBitmap.Create; 487 ImageList32default.GetBitmap(0,BitMap); 488 Form4.Image1.Picture.Graphic := BitMap; 503 ImageList32default.GetBitmap(0, BitMap); 504 Form4.Image1.Picture.Graphic.Assign(BitMap); 505 BitMap.Free; 489 506 end; 490 507 … … 530 547 if FileExists(Servers[i].Image) then begin 531 548 BitMap.LoadFromFile(Servers[i].Image); 532 ResizeBitmap(BitMap, BitMap2,32,32);533 ImageList32.Add(BitMap2, nil);534 ResizeBitmap(BitMap2,BitMap, 16,16);535 ImageList16.Add(BitMap, nil);549 ResizeBitmap(BitMap, BitMap2, 32, 32); 550 ImageList32.Add(BitMap2, nil); 551 ResizeBitmap(BitMap2,BitMap, 16, 16); 552 ImageList16.Add(BitMap, nil); 536 553 end; 537 554 end else begin //todo dodělat pro ikony 538 555 end; 539 556 end; 557 Bitmap.Free; 558 Bitmap2.Free; 540 559 end; 541 560 end; … … 558 577 if ImageFile = '1' then begin 559 578 BitMap := TBitmap.Create; 560 ImageList32default.GetBitmap(1,BitMap); 561 Form4.Image1.Picture.Graphic := BitMap; 579 ImageList32default.GetBitmap(1, BitMap); 580 Form4.Image1.Picture.Graphic.Assign(BitMap); 581 BitMap.Free; 562 582 end else begin 563 583 if FileExists(ImageFile) then begin … … 568 588 BitMap := TBitmap.Create; 569 589 Form1.ImageList32default.GetBitmap(0,BitMap); 570 Form4.Image1.Picture.Graphic := BitMap; 590 Form4.Image1.Picture.Graphic.Assign(Bitmap); 591 BitMap.Free; 571 592 end; 572 593 end; … … 654 675 ShowDetails := Reg.ReadBool('ShowDetails'); 655 676 if reg.ValueExists('RSSAddress') then RSSAddress := Reg.ReadString('RSSAddress'); 677 if RSSAddress = OldRSSChannel then RSSAddress := DefaultRSSChannel; // Přesměrování na novou adresu RSS 678 656 679 if reg.ValueExists('Ping') then Timer4.Enabled := Reg.ReadBool('Ping'); 657 680 end; … … 665 688 //skiny 666 689 if Reg.OpenKey(R+'CheckBox3', False) then begin 667 SkinData1.Active := Reg.ReadBool('Boolean');690 //SkinData1.Active := Reg.ReadBool('Boolean'); 668 691 end; 669 692 if Reg.OpenKey(R+'skiny', False) then begin 670 693 if reg.ValueExists('skiny') then begin 671 SkinData1.SkinFile := Reg.ReadString('Skiny');694 //SkinData1.SkinFile := Reg.ReadString('Skiny'); 672 695 end else 673 SkinData1.Active := False;696 //SkinData1.Active := False; 674 697 end; 675 698 … … 807 830 //skiny 808 831 if Reg.OpenKey(R+'CheckBox3', True) then begin 809 Reg.WriteBool('Boolean',SkinData1.Active);832 //Reg.WriteBool('Boolean',SkinData1.Active); 810 833 end; 811 834 if Reg.OpenKey(R+'skiny', True) then begin 812 Reg.WriteString('Skiny',SkinData1.SkinFile);835 //Reg.WriteString('Skiny',SkinData1.SkinFile); 813 836 end; 814 837 … … 1007 1030 begin 1008 1031 SetLength(Servers,length(Servers)+1); 1009 1010 Servers[length(Servers)-1].Name := 'Heroes of Fantasy'; 1011 Servers[length(Servers)-1].Address := 'wow.zdechov.net'; 1012 Servers[length(Servers)-1].OnlinePlayersAddress := 'http://wow.zdechov.net/stat/stat.xml'; 1013 Servers[length(Servers)-1].ExeFile := GetWoWExeFile; 1014 Servers[length(Servers)-1].Image := '1'; 1015 Servers[length(Servers)-1].Description := 'Heroes of Fantasy - Free server'+chr(13)+chr(10)+' 2x XP'+chr(13)+chr(10)+'web: http://wow.zdechov.net/'+chr(13)+chr(10)+'reamlist: wow.zdechov.net'; 1032 with Servers[length(Servers) - 1] do begin 1033 Name := 'Heroes of Fantasy'; 1034 Address := 'wow.zdechov.net'; 1035 OnlinePlayersAddress := 'http://wow.zdechov.net/stat/stat.xml'; 1036 ExeFile := GetWoWExeFile; 1037 Image := '1'; 1038 Description := 'Heroes of Fantasy - Free server'+chr(13)+chr(10)+' 2x XP'+chr(13)+chr(10)+'web: http://wow.zdechov.net/'+chr(13)+chr(10)+'realmlist: wow.zdechov.net'; 1039 end; 1016 1040 WriteImages; 1017 1041 WriteServers; … … 1099 1123 procedure TForm1.ShowWeb; 1100 1124 begin 1101 ShellExecute(Handle, 'open', PChar('http://wow.zdechov.net/ client/'), nil, nil, SW_SHOWNORMAL);1125 ShellExecute(Handle, 'open', PChar('http://wow.zdechov.net/?page=client/'), nil, nil, SW_SHOWNORMAL); 1102 1126 end; 1103 1127 … … 1496 1520 const AReplyStatus: TReplyStatus); 1497 1521 begin 1498 if AReplyStatus.MsRoundTripTime > IdIcmpClient1.ReceiveTimeoutthen begin1499 Label2.Caption := 'Of line';1522 if AReplyStatus.MsRoundTripTime > Cardinal(IdIcmpClient1.ReceiveTimeout) then begin 1523 Label2.Caption := 'Offline'; 1500 1524 Label2.Font.Color := clRed; 1501 1525 end else begin … … 1504 1528 Label2.Caption := 'Odezva: <1 ms' 1505 1529 else 1506 Label2.Caption := 'Odezva: '+IntToStr(AReplyStatus.MsRoundTripTime)+' ms'; 1507 end; 1508 end; 1509 1510 { TVlakno } 1511 1512 procedure TVlakno.Execute; 1513 begin 1514 if Form1.IdIcmpClient1.Host <> '' then begin 1515 try 1516 Form1.IdIcmpClient1.Ping; 1517 except 1518 Form1.Label2.Caption := 'Ofline'; 1519 Form1.Label2.Font.Color := clRed; 1520 end; 1521 end; 1530 Label2.Caption := 'Odezva: ' + IntToStr(AReplyStatus.MsRoundTripTime) + ' ms'; 1531 end; 1522 1532 end; 1523 1533 1524 1534 procedure TForm1.Timer4Timer(Sender: TObject); 1525 1535 begin 1526 // vlakno.Terminate;1527 1536 Timer4.Interval := 4000; 1528 Vlakno := TVlakno.Create(true);1529 vlakno.Resume;1530 // vlakno.Execute;1531 1537 Vlakno.Free; 1538 Vlakno := TVlakno.Create(True); 1539 Vlakno.Resume; 1540 Vlakno.WaitFor; 1532 1541 end; 1533 1542 … … 1639 1648 end; 1640 1649 1650 { TVlakno } 1651 1652 procedure TVlakno.Execute; 1653 begin 1654 if Form1.IdIcmpClient1.Host <> '' then 1655 try 1656 Form1.IdIcmpClient1.Ping; 1657 except 1658 Synchronize(Update); 1659 end; 1660 end; 1661 1662 procedure TVlakno.Update; 1663 begin 1664 Form1.Label2.Caption := 'Offline'; 1665 Form1.Label2.Font.Color := clRed; 1666 end; 1667 1641 1668 end.
Note:
See TracChangeset
for help on using the changeset viewer.