diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 96374c4..0000000 --- a/.gitignore +++ /dev/null @@ -1,43 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/2k Maps Readme & License b/2k Maps Readme & License deleted file mode 100644 index 56a40f7..0000000 --- a/2k Maps Readme & License +++ /dev/null @@ -1,12 +0,0 @@ -** These maps are released to the public domain ** - -These are new maps for TurboRisk, in a size of 1850x900. This size was selected because TurboRisk doesn't allow resizing or maximizing the window, so margins were left to easily place the window and still fit in 2k resolution (1920x1080). Different Windows themes could give different results. - -There are three maps: -* Simplified: eliptical projection, simplified; based on PD work by Tom-b and found on Wikicommons. -* Realistic Mercator: mercator projection, following frontiers where available, or divisions from the standard map when not. -* Simplified Mercator: mercator projection, and simplified in large irregular polygons. - -Thanks to Nathan for the colours, borrowed from his modification of the standard map. - -TurboRisk was made by Mario Ferrari - https://www.marioferrari.org/freeware/turborisk/turborisk.html \ No newline at end of file diff --git a/About.dfm b/About.dfm deleted file mode 100644 index d32ad02..0000000 Binary files a/About.dfm and /dev/null differ diff --git a/About.pas b/About.pas deleted file mode 100644 index 62462d7..0000000 --- a/About.pas +++ /dev/null @@ -1,66 +0,0 @@ -unit About; - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, ExtCtrls; - -type - TfAbout = class(TForm) - Label2: TLabel; - Label4: TLabel; - Label5: TLabel; - lblVersion: TLabel; - Label6: TLabel; - Image1: TImage; - txtCredits: TMemo; - procedure FormShow(Sender: TObject); - private - { Private declarations } - public - { Public declarations } - end; - -var - fAbout: TfAbout; - -implementation - -{$R *.DFM} - -uses Globals; - -procedure TfAbout.FormShow(Sender: TObject); -begin - lblVersion.Caption := 'Version ' + sG_AppVers; - with txtCredits.Lines do begin - Clear; - Add( - 'Many thanks to Steve Stancliff for his WinRisk program, which I liked ' + 'and used so much, and which inspired TurboRisk.'); - Add(''); - Add('I want to thank all the many people who gave a contribution ' + - 'to make TurboRisk a better program.'); - Add(''); - Add('A very special thanks to the following people for their invaluable help:'); - Add(''); - Add('Paul R. Brown'); - Add('Julio Couce'); - Add('Anthony Covey-Crump'); - Add('Bobo Frogg'); - Add('Alexander Gogava'); - Add('Heitor Mansel'); - Add('Martin Nehrdich'); - Add('Eric Platel'); - Add('Timothy Purkess'); - Add('Rafal Smotrzyk'); - Add('Chrystian Wurmser'); - Add(''); - Add('Nathan Scarbrough deserves a special mention, because of his enormous' - + ' contribution to the development and testing of version 2.'); - Add(''); - Add('Thanks to RemObjects for their free Pascal Script interpreter.'); - end; -end; - -end. diff --git a/Attack.dfm b/Attack.dfm deleted file mode 100644 index 1f7f307..0000000 Binary files a/Attack.dfm and /dev/null differ diff --git a/Attack.pas b/Attack.pas deleted file mode 100644 index 924b8f1..0000000 --- a/Attack.pas +++ /dev/null @@ -1,224 +0,0 @@ -unit Attack; - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, Buttons, ExtCtrls; - -type - TfAttack = class(TForm) - panFromTerr: TPanel; - Label1: TLabel; - Label2: TLabel; - Label3: TLabel; - Label4: TLabel; - Label5: TLabel; - Label6: TLabel; - panFromArmies: TPanel; - panFromPlayer: TPanel; - panFromColor: TPanel; - panToTerr: TPanel; - panToArmies: TPanel; - panToPlayer: TPanel; - panToColor: TPanel; - cmdAttack: TBitBtn; - cmdRetreat: TBitBtn; - cmdDoOrDie: TBitBtn; - chkAutoMoveAll: TCheckBox; - cmdAttackUntil1: TBitBtn; - cboUntil1: TComboBox; - lblUntil1: TLabel; - cmdAttackUntil2: TBitBtn; - lblUntil2: TLabel; - cboUntil2: TComboBox; - procedure FormShow(Sender: TObject); - procedure cmdAttackClick(Sender: TObject); - procedure cmdDoOrDieClick(Sender: TObject); - procedure cmdAttackUntil1Click(Sender: TObject); - procedure cmdAttackUntil2Click(Sender: TObject); - procedure cboUntilKeyPress(Sender: TObject; var Key: Char); - procedure FormKeyPress(Sender: TObject; var Key: Char); - private - procedure UpdateDisplay; - public - iTf, iTt: integer; // Territori Da e A attacco - end; - -var - fAttack: TfAttack; - -implementation - -{$R *.DFM} - -uses Globals, Main, Territ, Stats; - -procedure TfAttack.FormShow(Sender: TObject); -begin - // size and controls depend on preferences - if bPrefExpertAttack then begin - cmdAttackUntil1.Visible := true; - cmdAttackUntil2.Visible := true; - lblUntil1.Visible := true; - lblUntil2.Visible := true; - cboUntil1.Visible := true; - cboUntil2.Visible := true; - Height := 254; - end - else begin - cmdAttackUntil1.Visible := false; - cmdAttackUntil2.Visible := false; - lblUntil1.Visible := false; - lblUntil2.Visible := false; - cboUntil1.Visible := false; - cboUntil2.Visible := false; - Height := 186; - end; - // dynamic window position - if arTerritory[iTf].Coord.X > fMain.Width div 2 then - Left := fMain.Left + 18 - else - Left := fMain.Left + 338; - if arTerritory[iTf].Coord.Y > fMain.Height div 2 then - Top := fMain.Top + 70 - else - Top := fMain.Top + 290; - // inizializzazione controlli - panFromTerr.Caption := arTerritory[iTf].Name; - panFromPlayer.Caption := arPlayer[iTurn].Name; - panFromColor.Color := arPlayer[iTurn].Color; - panToTerr.Caption := arTerritory[iTt].Name; - panToPlayer.Caption := arPlayer[arTerritory[iTt].Owner].Name; - panToColor.Color := arPlayer[arTerritory[iTt].Owner].Color; - UpdateDisplay; -end; - -procedure TfAttack.FormKeyPress(Sender: TObject; var Key: Char); -begin - case Key of - 'A','a': - cmdAttackClick(Sender); - 'D','d': - cmdDoOrDieClick(Sender); - 'R','r': - ModalResult := mrCancel; - 'M','m': - cmdAttackUntil1Click(Sender); - 'E','e': - cmdAttackUntil2Click(Sender); - end; -end; - -procedure TfAttack.UpdateDisplay; -begin - panFromArmies.Caption := IntToStr(arTerritory[iTf].Army); - panToArmies.Caption := IntToStr(arTerritory[iTt].Army); - cmdAttack.Enabled := (arTerritory[iTf].Army > 1); - cmdDoOrDie.Enabled := cmdAttack.Enabled; -end; - -procedure TfAttack.cboUntilKeyPress(Sender: TObject; var Key: Char); -begin - if not(Key in ['0' .. '9', #08]) then - Key := #0; -end; - -procedure TfAttack.cmdAttackClick(Sender: TObject); -begin - if PerformAttack(iTf, iTt) then begin - if chkAutoMoveAll.Checked then begin - inc(arTerritory[iTt].Army, arTerritory[iTf].Army - 1); - arTerritory[iTf].Army := 1; - DisplayTerritory(iTf); - DisplayTerritory(iTt); - UpdateStats; - end; - ModalResult := mrOK; - end - else begin - UpdateDisplay; - end; -end; - -procedure TfAttack.cmdDoOrDieClick(Sender: TObject); -var - bConquista: boolean; -begin - repeat - bConquista := PerformAttack(iTf, iTt); - UpdateDisplay; - Application.ProcessMessages; - until bConquista or (arTerritory[iTf].Army < 2); - if bConquista then begin - if chkAutoMoveAll.Checked then begin - inc(arTerritory[iTt].Army, arTerritory[iTf].Army - 1); - arTerritory[iTf].Army := 1; - DisplayTerritory(iTf); - DisplayTerritory(iTt); - UpdateStats; - end; - ModalResult := mrOK; - end - else begin - ModalResult := mrCancel; - end; -end; - -procedure TfAttack.cmdAttackUntil1Click(Sender: TObject); -var - bConquista: boolean; - iTarget: integer; -begin - bConquista := false; - iTarget := StrToIntDef(cboUntil1.Text, 0); - while not bConquista and (arTerritory[iTf].Army >= 2) and - (arTerritory[iTf].Army > iTarget) do begin - bConquista := PerformAttack(iTf, iTt); - UpdateDisplay; - Application.ProcessMessages; - end; - if bConquista then begin - if chkAutoMoveAll.Checked then begin - inc(arTerritory[iTt].Army, arTerritory[iTf].Army - 1); - arTerritory[iTf].Army := 1; - DisplayTerritory(iTf); - DisplayTerritory(iTt); - UpdateStats; - end; - ModalResult := mrOK; - end - else begin - ModalResult := mrCancel; - end; -end; - -procedure TfAttack.cmdAttackUntil2Click(Sender: TObject); -var - bConquista: boolean; - iTarget: integer; -begin - bConquista := false; - iTarget := StrToIntDef(cboUntil2.Text, 0); - while not bConquista and (arTerritory[iTf].Army >= 2) and - (arTerritory[iTt].Army > iTarget) do begin - bConquista := PerformAttack(iTf, iTt); - UpdateDisplay; - Application.ProcessMessages; - end; - if bConquista then begin - if chkAutoMoveAll.Checked then begin - inc(arTerritory[iTt].Army, arTerritory[iTf].Army - 1); - arTerritory[iTf].Army := 1; - DisplayTerritory(iTf); - DisplayTerritory(iTt); - UpdateStats; - end; - ModalResult := mrOK; - end - else begin - ModalResult := mrCancel; - end; -end; - -end. diff --git a/Cards.dfm b/Cards.dfm deleted file mode 100644 index a8b23c0..0000000 Binary files a/Cards.dfm and /dev/null differ diff --git a/Cards.pas b/Cards.pas deleted file mode 100644 index aa15859..0000000 --- a/Cards.pas +++ /dev/null @@ -1,237 +0,0 @@ -unit Cards; - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - ExtCtrls, StdCtrls, Buttons, checklst; - -type - TfCards = class(TForm) - lstCards: TCheckListBox; - cmdTrade: TBitBtn; - cmdHold: TBitBtn; - panArmies: TPanel; - procedure FormShow(Sender: TObject); - procedure lstCardsClickCheck(Sender: TObject); - procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); - procedure cmdTradeClick(Sender: TObject); - private - { Private declarations } - bReady: boolean; - iPBenefit, - iPInf, iPCav, iPArt, iPJok: integer; - function PreparaForm: boolean; - public - { Public declarations } - end; - -var - fCards: TfCards; - -// Assegna una nuova carta al giocatore di turno -procedure PescaCarta; - -// Verifica la validità e il valore di una combinazione di carte -function TestCombinazione(iInf, iCav, iArt, iJok: integer): integer; - -// Valuta la migliore combinazione per il giocatore di turno -function CercaCombinazioneMigliore(var iInf, iCav, iArt, iJok: integer): boolean; - -implementation - -{$R *.DFM} - -uses Globals, Stats; - -procedure TfCards.FormShow(Sender: TObject); -begin - PreparaForm; - UpdateGridPos; -end; - -procedure TfCards.lstCardsClickCheck(Sender: TObject); -var - i: integer; -begin - if not bReady then exit; - iPInf:=0; iPCav:=0; iPArt:=0; iPJok:=0; - with arPlayer[iTurn], lstCards do begin - for i:=0 to Items.Count-1 do begin - if Checked[i] then begin - if Items[i]='Infantry' then inc(iPInf) - else if Items[i]='Cavalry' then inc(iPCav) - else if Items[i]='Artillery' then inc(iPArt) - else if Items[i]='Joker' then inc(iPJok); - end; - end; - iPBenefit := TestCombinazione(iPInf, iPCav, iPArt, iPJok); - if iPBenefit<=0 then begin - cmdTrade.Enabled := false; - panArmies.Caption := ''; - end else begin - cmdTrade.Enabled := true; - panArmies.Caption := IntToStr(iPBenefit)+' armies'; - end; - end; -end; - -procedure TfCards.FormCloseQuery(Sender: TObject; var CanClose: Boolean); -begin - CanClose := cmdHold.Enabled or (ModalResult = mrOK); -end; - -procedure TfCards.cmdTradeClick(Sender: TObject); -begin - with arPlayer[iTurn] do begin - if iPBenefit > 0 then begin - inc(NewArmy,iPBenefit); - dec(Cards[caInf],iPInf); dec(Cards[caCav],iPCav); - dec(Cards[caArt],iPArt); dec(Cards[caJok],iPJok); - inc(NScambi); - UpdateStats; - end; - // se non ci sono altre combinazioni e sono in gestione semiautom.-> esco - if not PreparaForm and (CardsHandling=chSmart) then - ModalResult := mrOK; - end; -end; - -function TfCards.PreparaForm: boolean; -var - i, - iInf, iCav, iArt, iJok: integer; -begin - bReady := false; - with arPlayer[iTurn], lstCards do begin - // ricerca combinazione da proporre di default - Result := CercaCombinazioneMigliore(iInf, iCav, iArt, iJok); - // caricamento lista carte - Items.Clear; - for i:=1 to Cards[caInf] do begin - Items.Add('Infantry'); - if iInf>0 then begin - Checked[Items.Count-1] := true; - dec(iInf); - end; - end; - for i:=1 to Cards[caCav] do begin - Items.Add('Cavalry'); - if iCav>0 then begin - Checked[Items.Count-1] := true; - dec(iCav); - end; - end; - for i:=1 to Cards[caArt] do begin - Items.Add('Artillery'); - if iArt>0 then begin - Checked[Items.Count-1] := true; - dec(iArt); - end; - end; - for i:=1 to Cards[caJok] do begin - Items.Add('Joker'); - if iJok>0 then begin - Checked[Items.Count-1] := true; - dec(iJok); - end; - end; - cmdHold.Enabled := (Items.Count<=RMaxHeldCards); - bReady := true; - lstCardsClickCheck(self); - end; -end; - -// Assegna una nuova carta al giocatore di turno -procedure PescaCarta; -begin - with arPlayer[iTurn] do begin - case Random(44)+1 of - 1..14: inc(Cards[caInf]); - 15..28: inc(Cards[caArt]); - 29..42: inc(Cards[caCav]); - 43..44: inc(Cards[caJok]); - end; - end; -end; - -// Verifica la validità e il valore di una combinazione di carte -function TestCombinazione(iInf, iCav, iArt, iJok: integer): integer; -begin - Result := -1; // combinazione non possibile - if iInf+iCav+iArt+iJok<>3 then exit; - - with arPlayer[iTurn] do begin - // test se combinazione possibile - if (iInf>Cards[caInf]) or (iCav>Cards[caCav]) - or (iArt>Cards[caArt]) or (iJok>Cards[caJok]) then exit; - // valore combinazione - if ((iInf=1) and (iCav=1) and (iArt=1)) - or ((iInf=1) and (iCav=1) and (iJok=1)) - or ((iInf=1) and (iJok=1) and (iArt=1)) - or ((iJok=1) and (iCav=1) and (iArt=1)) - or ((iInf=1) and (iJok=2)) - or ((iCav=1) and (iJok=2)) - or ((iArt=1) and (iJok=2)) - or (iJok=3) then begin - Result := RSetValue[csDif]; - end else - if (iInf=3) - or ((iInf=2) and (iJok=1)) then begin - Result := RSetValue[csInf]; - end else - if (iCav=3) - or ((iCav=2) and (iJok=1)) then begin - Result := RSetValue[csCav]; - end else - if (iArt=3) - or ((iArt=2) and (iJok=1)) then begin - Result := RSetValue[csArt]; - end else begin - Result := 0; - end; - if (Result > 0) and (RCardsValueType = cvProgressive) then begin - if NScambi<8 then - Result := RTradeValue[NScambi+1] - else - Result := RTradeValue[8] + (NScambi-7) * RValueInc; - end; - end; -end; - -// Valuta la migliore combinazione per il giocatore di turno -function CercaCombinazioneMigliore(var iInf, iCav, iArt, iJok: integer): boolean; -var - iMaxBenefit: integer; - procedure Valuta(iInf2, iCav2, iArt2, iJok2: integer); - var - iBenefit: integer; - begin - iBenefit := TestCombinazione(iInf2, iCav2, iArt2, iJok2); - if iBenefit>iMaxBenefit then begin - iInf := iInf2; iCav := iCav2; - iArt := iArt2; iJok := iJok2; - iMaxBenefit := iBenefit; - end; - end; -begin - iInf:=0; iCav:=0; iArt:=0; iJok:=0; - iMaxBenefit := 0; - Valuta(1,1,1,0); - Valuta(1,1,0,1); - Valuta(1,0,1,1); - Valuta(0,1,1,1); - Valuta(1,0,0,2); - Valuta(0,1,0,2); - Valuta(0,0,1,2); - Valuta(0,0,0,3); - Valuta(3,0,0,0); - Valuta(0,3,0,0); - Valuta(0,0,3,0); - Valuta(2,0,0,1); - Valuta(0,2,0,1); - Valuta(0,0,2,1); - Result := (iMaxBenefit>0); -end; - -end. diff --git a/CheckUpd.dfm b/CheckUpd.dfm deleted file mode 100644 index 548df47..0000000 --- a/CheckUpd.dfm +++ /dev/null @@ -1,237 +0,0 @@ -object fCheckUpd: TfCheckUpd - Left = 534 - Top = 275 - HelpContext = 510 - Caption = 'Update manager' - ClientHeight = 638 - ClientWidth = 617 - Color = clBtnFace - Constraints.MinHeight = 500 - Constraints.MinWidth = 400 - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = False - Position = poScreenCenter - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object Splitter1: TSplitter - Left = 0 - Top = 209 - Width = 617 - Height = 5 - Cursor = crVSplit - Align = alTop - end - object panNews: TPanel - Left = 0 - Top = 0 - Width = 617 - Height = 209 - Align = alTop - BevelOuter = bvLowered - TabOrder = 0 - ExplicitLeft = 8 - ExplicitTop = 8 - ExplicitWidth = 516 - DesignSize = ( - 617 - 209) - object Label2: TLabel - Left = 8 - Top = 17 - Width = 32 - Height = 13 - Caption = 'News' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [fsBold] - ParentFont = False - end - object Label3: TLabel - Left = 412 - Top = 17 - Width = 83 - Height = 13 - Anchors = [akTop, akRight] - Caption = 'Show news since' - ExplicitLeft = 395 - end - object Panel1: TPanel - Left = 8 - Top = 36 - Width = 601 - Height = 165 - Anchors = [akLeft, akTop, akRight, akBottom] - BevelOuter = bvLowered - Ctl3D = True - ParentCtl3D = False - TabOrder = 0 - object wbrNews: TWebBrowser - Left = 1 - Top = 1 - Width = 599 - Height = 163 - Align = alClient - TabOrder = 0 - ExplicitWidth = 300 - ExplicitHeight = 64 - ControlData = { - 4C000000E93D0000D91000000000000000000000000000000000000000000000 - 000000004C000000000000000000000001000000E0D057007335CF11AE690800 - 2B2E126208000000000000004C0000000114020000000000C000000000000046 - 8000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000100000000000000000000000000000000000000} - end - end - object txtLastDate: TDateTimePicker - Left = 507 - Top = 9 - Width = 101 - Height = 21 - Anchors = [akTop, akRight] - Date = 40428.500000000000000000 - Time = 40428.500000000000000000 - TabOrder = 1 - OnChange = txtLastDateChange - ExplicitLeft = 490 - end - end - object panFiles: TPanel - Left = 0 - Top = 214 - Width = 617 - Height = 424 - Align = alClient - BevelOuter = bvLowered - TabOrder = 1 - ExplicitLeft = 97 - ExplicitTop = 226 - ExplicitWidth = 503 - ExplicitHeight = 258 - DesignSize = ( - 617 - 424) - object Label1: TLabel - Left = 8 - Top = 6 - Width = 27 - Height = 13 - Caption = 'Files' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [fsBold] - ParentFont = False - end - object lstUpdates: TListView - Left = 9 - Top = 25 - Width = 599 - Height = 337 - Anchors = [akLeft, akTop, akRight, akBottom] - Checkboxes = True - Columns = < - item - Caption = 'Type' - end - item - Caption = 'File name' - Width = 150 - end - item - Caption = 'Status' - Width = 100 - end - item - Caption = 'Comments' - Width = 220 - end> - TabOrder = 0 - ViewStyle = vsReport - ExplicitHeight = 293 - end - object panStatus: TPanel - Left = 9 - Top = 393 - Width = 436 - Height = 27 - Alignment = taLeftJustify - Anchors = [akLeft, akRight, akBottom] - BevelOuter = bvLowered - BorderWidth = 5 - TabOrder = 2 - Visible = False - ExplicitTop = 390 - end - object prbProgress: TProgressBar - Left = 8 - Top = 368 - Width = 600 - Height = 26 - Anchors = [akLeft, akRight, akBottom] - TabOrder = 3 - Visible = False - ExplicitTop = 365 - end - object prbDownload: TProgressBar - Left = 451 - Top = 393 - Width = 157 - Height = 26 - Anchors = [akRight, akBottom] - TabOrder = 4 - Visible = False - ExplicitTop = 390 - end - object cmdCancel: TBitBtn - Left = 513 - Top = 375 - Width = 96 - Height = 36 - Anchors = [akRight, akBottom] - Cancel = True - Caption = 'Close' - DoubleBuffered = True - ModalResult = 2 - ParentDoubleBuffered = False - TabOrder = 5 - ExplicitTop = 355 - end - object cmdUpdate: TBitBtn - Left = 8 - Top = 375 - Width = 156 - Height = 36 - Anchors = [akLeft, akBottom] - Caption = 'Install/Update selected files' - DoubleBuffered = True - ParentDoubleBuffered = False - TabOrder = 1 - OnClick = cmdUpdateClick - ExplicitTop = 372 - end - end - object idHTTP: TIdHTTP - OnWork = idHTTPWork - OnWorkBegin = idHTTPWorkBegin - OnWorkEnd = idHTTPWorkEnd - AllowCookies = True - ProxyParams.BasicAuthentication = False - ProxyParams.ProxyPort = 0 - Request.ContentLength = -1 - Request.ContentType = 'text/html' - Request.Accept = 'text/html, */*' - Request.BasicAuthentication = False - Request.UserAgent = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; it;' - HTTPOptions = [hoForceEncodeParams] - Left = 49 - Top = 438 - end -end diff --git a/CheckUpd.pas b/CheckUpd.pas deleted file mode 100644 index 58ef4f6..0000000 --- a/CheckUpd.pas +++ /dev/null @@ -1,444 +0,0 @@ -unit CheckUpd; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, - IdFTP, StdCtrls, IdHTTP, Buttons, CheckLst, ComCtrls, ExtCtrls, OleCtrls, - SHDocVw; - -type - TUpdNews = record - sText: string; - dDate: TDateTime; - end; - - TUpdFile = record - sType, sName, sSiteName, sPath, sSitePath, sRemark, sLocDate, - sSiteDate: string; - end; - - TfCheckUpd = class(TForm) - IdHTTP: TIdHTTP; - panNews: TPanel; - Panel1: TPanel; - wbrNews: TWebBrowser; - Label2: TLabel; - Label3: TLabel; - txtLastDate: TDateTimePicker; - Splitter1: TSplitter; - panFiles: TPanel; - lstUpdates: TListView; - Label1: TLabel; - cmdUpdate: TBitBtn; - panStatus: TPanel; - prbProgress: TProgressBar; - prbDownload: TProgressBar; - cmdCancel: TBitBtn; - procedure FormShow(Sender: TObject); - procedure cmdUpdateClick(Sender: TObject); - procedure idHTTPWorkBegin(ASender: TObject; AWorkMode: TWorkMode; - AWorkCountMax: Int64); - procedure idHTTPWork(ASender: TObject; AWorkMode: TWorkMode; - AWorkCount: Int64); - procedure idHTTPWorkEnd(ASender: TObject; AWorkMode: TWorkMode); - procedure txtLastDateChange(Sender: TObject); - private - sNewsHead, sNewsFoot: string; // news HTML header and footer - arNews: array of TUpdNews; - arFiles: array of TUpdFile; - public - function CheckUpdates(bSilent: boolean): boolean; - end; - -var - fCheckUpd: TfCheckUpd; - -implementation - -{$R *.dfm} - -uses ActiveX, DateUtils, StrUtils, IniFiles, StdPas, Globals; - -procedure WBLoadHTML(WebBrowser: TWebBrowser; HTMLCode: string); -var - sl: TStringList; - ms: TMemoryStream; -begin - WebBrowser.Navigate('about:blank'); - while WebBrowser.ReadyState < READYSTATE_INTERACTIVE do - Application.ProcessMessages; - - if Assigned(WebBrowser.Document) then begin - sl := TStringList.Create; - try - ms := TMemoryStream.Create; - try - sl.Text := HTMLCode; - sl.SaveToStream(ms); - ms.Seek(0, 0); (WebBrowser.Document as IPersistStreamInit) - .Load(TStreamAdapter.Create(ms)); - finally - ms.Free; - end; - finally - sl.Free; - end; - end; -end; - -function TfCheckUpd.CheckUpdates(bSilent: boolean): boolean; -const - SEPARATOR = ';'; -var - sVersInfo, sNews, sTmp, sTmp2: string; - lstFiles, lstNews: TStringList; - rFileDesc: TSearchRec; - i, j: integer; - bIgnore, bNews, bHead: boolean; -begin - Result := false; - try - Screen.Cursor := crHourGlass; - Application.ProcessMessages; - SetLength(arNews, 0); - SetLength(arFiles, 0); - // load news and version info file from website - try - sVersInfo := IdHTTP.Get( - 'http://www.marioferrari.org/freeware/turborisk/version_info.csv'); - sNews := IdHTTP.Get( - 'http://www.marioferrari.org/freeware/turborisk/news.htm'); - except - on e: Exception do begin - if not bSilent then begin - MessageDlg('Could not connect to TurboRisk website: ' + e.Message, - mtError, [mbOk], 0); - end; - exit; - end; - end; - // create temporary lists - lstFiles := TStringList.Create; - lstNews := TStringList.Create; - try - // copy news and version info into lists - lstFiles.Text := sVersInfo; - lstNews.Text := sNews; - // news: populate array - sNewsHead := ''; - sNewsFoot := ''; - bHead := true; - bNews := false; - bIgnore := false; - j := -1; - SetLength(arNews, 0); - for i := 0 to lstNews.Count - 1 do begin - sTmp := lstNews[i]; - // begin:ignore - if not bIgnore and SameText(copy(sTmp, 1, 17), '