diff --git a/Firemonkey/Firemonkey Style Equalizer/uFMEqualizer.pas b/Firemonkey/Firemonkey Style Equalizer/uFMEqualizer.pas index 76aba46..2dc7b31 100644 --- a/Firemonkey/Firemonkey Style Equalizer/uFMEqualizer.pas +++ b/Firemonkey/Firemonkey Style Equalizer/uFMEqualizer.pas @@ -14,28 +14,28 @@ interface type TFMStyleLine=record - Index : Integer; - IsColor : Boolean; - Name : string; - Value : string; - Color : TAlphaColor; + Index: Integer; + IsColor: Boolean; + Name: string; + Value: string; + Color: TAlphaColor; end; TStyleEqualizer=class private - FCount : integer; - FLines : TList; - FMod : TList; - FResource : TStringList; + FCount: integer; + FLines: TList; + FMod: TList; + FResource: TStringList; FStyleBook: TStyleBook; FLayout: TLayout; - Context : TRttiContext; + Context: TRttiContext; procedure SetStyleBook(const Value: TStyleBook); procedure FillList; - function PropIsColor(const Name, Value : string):Boolean; + function PropIsColor(const Name, Value: string):Boolean; public - property StyleBook : TStyleBook read FStyleBook write SetStyleBook; - property Layout : TLayout read FLayout write FLayout; + property StyleBook: TStyleBook read FStyleBook write SetStyleBook; + property Layout: TLayout read FLayout write FLayout; procedure Refresh; procedure Restore; procedure ChangeHSL(dH, dS, dL: Single); @@ -76,9 +76,9 @@ function TStyleEqualizer.PropIsColor(const Name, Value: string): Boolean; procedure TStyleEqualizer.FillList; var - i : integer; - ALine : TFMStyleLine; - p : integer; + i: integer; + ALine: TFMStyleLine; + p: integer; begin FLines.Clear; FResource.Clear; @@ -129,9 +129,9 @@ procedure TStyleEqualizer.FillList; procedure TStyleEqualizer.Refresh; Var - i : Integer; - s : string; - Index : Integer; + i: Integer; + s: string; + Index: Integer; begin FStyleBook.Resource.BeginUpdate; try @@ -172,8 +172,8 @@ procedure TStyleEqualizer.SetStyleBook(const Value: TStyleBook); procedure TStyleEqualizer.ChangeRGB(dR, dG, dB: Byte); var - i : Integer; - v : TFMStyleLine; + i: Integer; + v: TFMStyleLine; begin for i := 0 to FLines.Count-1 do @@ -190,8 +190,8 @@ procedure TStyleEqualizer.ChangeRGB(dR, dG, dB: Byte); procedure TStyleEqualizer.ChangeHSL(dH, dS, dL: Single); var - i : Integer; - v : TFMStyleLine; + i: Integer; + v: TFMStyleLine; begin for i := 0 to FLines.Count-1 do if FLines[i].IsColor and (FLines[i].Color<>claNull) then diff --git a/Firemonkey/Firemonkey Style Equalizer/uFrmStyleEqualizer.pas b/Firemonkey/Firemonkey Style Equalizer/uFrmStyleEqualizer.pas index 570ce4a..e73ab91 100644 --- a/Firemonkey/Firemonkey Style Equalizer/uFrmStyleEqualizer.pas +++ b/Firemonkey/Firemonkey Style Equalizer/uFrmStyleEqualizer.pas @@ -57,17 +57,17 @@ TFrmStyleEqualizer = class(TForm) procedure Timer1Timer(Sender: TObject); procedure TrackBarRedChange(Sender: TObject); private - StyleEqualizer : TStyleEqualizer; + StyleEqualizer: TStyleEqualizer; FStyleBook: TStyleBook; - FApplied : Boolean; - FIdleMSec : DWord; + FApplied: Boolean; + FIdleMSec: DWord; procedure SetStyleBook(const Value: TStyleBook); - procedure GetCurrentHSLValues(var dh, ds, dl : single); - procedure GetCurrentRGBValues(var dr, dg, db : byte); + procedure GetCurrentHSLValues(var dh, ds, dl: single); + procedure GetCurrentRGBValues(var dr, dg, db: byte); procedure ApplyHSLChanges; procedure ApplyRGBChanges; public - property StyleBook : TStyleBook read FStyleBook write SetStyleBook; + property StyleBook: TStyleBook read FStyleBook write SetStyleBook; end; @@ -99,8 +99,8 @@ function MSecIdle: DWord; procedure TFrmStyleEqualizer.ApplyHSLChanges; var - dh, ds, dl : single; - s : TStopwatch; + dh, ds, dl: single; + s: TStopwatch; begin GetCurrentHSLValues(dh, ds, dl); s:=TStopwatch.Create; @@ -115,8 +115,8 @@ procedure TFrmStyleEqualizer.ApplyHSLChanges; procedure TFrmStyleEqualizer.ApplyRGBChanges; var - dr, dg, db : byte; - s : TStopwatch; + dr, dg, db: byte; + s: TStopwatch; begin GetCurrentRGBValues(dr, dg, db); if (dr>0) or (dg>0) or (db>0) then diff --git a/Firemonkey/Firemonkey Style Equalizer/uMain.pas b/Firemonkey/Firemonkey Style Equalizer/uMain.pas index 9ad6d7a..3cc4414 100644 --- a/Firemonkey/Firemonkey Style Equalizer/uMain.pas +++ b/Firemonkey/Firemonkey Style Equalizer/uMain.pas @@ -79,7 +79,7 @@ procedure TFrmMain.BtnLoadClick(Sender: TObject); procedure TFrmMain.BtnEQClick(Sender: TObject); var - Frm : TFrmStyleEqualizer; + Frm: TFrmStyleEqualizer; begin Frm:=TFrmStyleEqualizer.Create(Self); Frm.StyleBook:=StyleBook1; diff --git a/Google/Maps/Google Maps Basic Sample/fMain.pas b/Google/Maps/Google Maps Basic Sample/fMain.pas index 9720ed3..00e926d 100644 --- a/Google/Maps/Google Maps Basic Sample/fMain.pas +++ b/Google/Maps/Google Maps Basic Sample/fMain.pas @@ -141,7 +141,7 @@ implementation procedure TfrmMain.FormCreate(Sender: TObject); var - aStream : TMemoryStream; + aStream: TMemoryStream; begin WebBrowser1.Navigate('about:blank'); if Assigned(WebBrowser1.Document) then @@ -173,7 +173,7 @@ procedure TfrmMain.ButtonClearMarkersClick(Sender: TObject); procedure TfrmMain.ButtonGotoAddressClick(Sender: TObject); var - address : string; + address: string; begin address := MemoAddress.Lines.Text; address := StringReplace(StringReplace(Trim(address), #13, ' ', [rfReplaceAll]), #10, ' ', [rfReplaceAll]); diff --git a/Google/Maps/Google Maps ClickEvent/uMain.pas b/Google/Maps/Google Maps ClickEvent/uMain.pas index dc5ae42..a13343e 100644 --- a/Google/Maps/Google Maps ClickEvent/uMain.pas +++ b/Google/Maps/Google Maps ClickEvent/uMain.pas @@ -123,7 +123,7 @@ implementation procedure TFrmMain.FormCreate(Sender: TObject); var - aStream : TMemoryStream; + aStream: TMemoryStream; begin WebBrowser1.Navigate('about:blank'); if Assigned(WebBrowser1.Document) then @@ -144,16 +144,16 @@ procedure TFrmMain.FormCreate(Sender: TObject); procedure TFrmMain.WebBrowser1CommandStateChange(ASender: TObject; Command: Integer; Enable: WordBool); var - ADocument : IHTMLDocument2; - ABody : IHTMLElement2; - Lat : string; - Lng : string; + ADocument: IHTMLDocument2; + ABody: IHTMLElement2; + Lat: string; + Lng: string; - function GetIdValue(const Id : string):string; + function GetIdValue(const Id: string):string; var - Tag : IHTMLElement; - TagsList : IHTMLElementCollection; - Index : Integer; + Tag: IHTMLElement; + TagsList: IHTMLElementCollection; + Index: Integer; begin Result:=''; TagsList := ABody.getElementsByTagName('input'); @@ -188,7 +188,7 @@ procedure TFrmMain.WebBrowser1CommandStateChange(ASender: TObject; Command: Int procedure TFrmMain.AddLatLngToList(const Lat, Lng: string); var - Item : TListItem; + Item: TListItem; begin if (Lat<>'') and (Lng<>'') then begin diff --git a/Google/Maps/Google Maps Static/UnitMain.pas b/Google/Maps/Google Maps Static/UnitMain.pas index 60287b8..c972106 100644 --- a/Google/Maps/Google Maps Static/UnitMain.pas +++ b/Google/Maps/Google Maps Static/UnitMain.pas @@ -108,11 +108,11 @@ procedure TFormMain.FormCreate(Sender: TObject); procedure TFormMain.GetMapImage; var StreamData :TMemoryStream; - JPEGImage : TJPEGImage; + JPEGImage: TJPEGImage; begin EditURL.Text:=buildUrl; StreamData := TMemoryStream.Create; - JPEGImage := TJPEGImage.Create; + JPEGImage := TJPEGImage.Create; try try idhttp1.Get(EditURL.Text, StreamData); @@ -125,7 +125,7 @@ procedure TFormMain.GetMapImage; LY := (ImageMap.Height - ScrollBoxMap.ClientHeight) * -1; ImageMap.Picture.Assign(JPEGImage); - Except On E : Exception Do + Except On E: Exception Do MessageDlg('Exception: '+E.Message,mtError, [mbOK], 0); End; finally @@ -144,7 +144,7 @@ procedure TFormMain.IdHTTP10WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Integer); begin ProgressBar1.Position := 0; - ProgressBar1.Max := IdHTTP1.Response.ContentLength; + ProgressBar1.Max := IdHTTP1.Response.ContentLength; end; procedure TFormMain.IdHTTP10WorkEnd(ASender: TObject; AWorkMode: TWorkMode); diff --git a/Google/Maps/Google Maps Styles/fMain.pas b/Google/Maps/Google Maps Styles/fMain.pas index c906516..e0ca261 100644 --- a/Google/Maps/Google Maps Styles/fMain.pas +++ b/Google/Maps/Google Maps Styles/fMain.pas @@ -273,7 +273,7 @@ implementation procedure TfrmMain.FormCreate(Sender: TObject); var - aStream : TMemoryStream; + aStream: TMemoryStream; begin WebBrowser1.Navigate('about:blank'); if Assigned(WebBrowser1.Document) then @@ -298,7 +298,7 @@ procedure TfrmMain.ButtonGotoLocationClick(Sender: TObject); procedure TfrmMain.ButtonGotoAddressClick(Sender: TObject); var - address : string; + address: string; begin address := MemoAddress.Lines.Text; address := StringReplace(StringReplace(Trim(address), #13, ' ', [rfReplaceAll]), #10, ' ', [rfReplaceAll]); diff --git a/Google/QrCode/Main.pas b/Google/QrCode/Main.pas index 669f984..27cc2b1 100644 --- a/Google/QrCode/Main.pas +++ b/Google/QrCode/Main.pas @@ -41,17 +41,17 @@ implementation const UrlGoogleQrCode='http://chart.apis.google.com/chart?chs=%dx%d&cht=qr&chld=%s&chl=%s'; -QrImgCorrStr : array [TQrImage_ErrCorrLevel] of string=('L','M','Q','H'); +QrImgCorrStr: array [TQrImage_ErrCorrLevel] of string=('L','M','Q','H'); procedure WinInet_HttpGet(const Url: string;Stream:TStream); const BuffSize = 1024*1024; var - hInter : HINTERNET; + hInter: HINTERNET; UrlHandle: HINTERNET; BytesRead: DWORD; - Buffer : Pointer; + Buffer: Pointer; begin hInter := InternetOpen('', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if Assigned(hInter) then @@ -76,9 +76,9 @@ procedure WinInet_HttpGet(const Url: string;Stream:TStream); end end; -procedure GetQrCode(Width,Height:Word;Correction_Level:TQrImage_ErrCorrLevel;const Data:string;StreamImage : TMemoryStream); +procedure GetQrCode(Width,Height:Word;Correction_Level:TQrImage_ErrCorrLevel;const Data:string;StreamImage: TMemoryStream); Var - EncodedURL : string; + EncodedURL: string; begin EncodedURL:=Format(UrlGoogleQrCode,[Width,Height,QrImgCorrStr[Correction_Level],HTTPEncode(Data)]); WinInet_HttpGet(EncodedURL,StreamImage); @@ -87,8 +87,8 @@ procedure GetQrCode(Width,Height:Word;Correction_Level:TQrImage_ErrCorrLevel;con procedure TFrmMain.BtnGenerateClick(Sender: TObject); var -ImageStream : TMemoryStream; -PngImage : TPngImage; +ImageStream: TMemoryStream; +PngImage: TPngImage; begin Image1.Picture:=nil; ImageStream:=TMemoryStream.Create; diff --git a/Misc/SFX/Common.pas b/Misc/SFX/Common.pas index c766a05..33f843f 100644 --- a/Misc/SFX/Common.pas +++ b/Misc/SFX/Common.pas @@ -7,8 +7,8 @@ interface type TRecSFX= record - Size : Integer; - Name : Array [0..MAX_PATH] of AnsiChar; + Size: Integer; + Name: Array [0..MAX_PATH] of AnsiChar; end; implementation diff --git a/Misc/SFX/MainCreateSFX.pas b/Misc/SFX/MainCreateSFX.pas index fc16635..d1c7591 100644 --- a/Misc/SFX/MainCreateSFX.pas +++ b/Misc/SFX/MainCreateSFX.pas @@ -23,8 +23,8 @@ TFrmCreateSFX = class(TForm) procedure ButtonSelectClick(Sender: TObject); procedure FormCreate(Sender: TObject); private - FSrcFileName : string; - FSfxFileName : string; + FSrcFileName: string; + FSfxFileName: string; function CreateStub:Boolean; function GetCompressionLevel: TCompressionLevel; procedure CreateSFX; @@ -61,13 +61,13 @@ procedure TFrmCreateSFX.ButtonSelectClick(Sender: TObject); procedure TFrmCreateSFX.CreateSFX; var - SrcFileStream : TFileStream; + SrcFileStream: TFileStream; CompressedStream: TMemoryStream; - hDestRes : THANDLE; - Compressor : TCompressionStream; - RecSFX : TRecSFX; + hDestRes: THANDLE; + Compressor: TCompressionStream; + RecSFX: TRecSFX; begin - SrcFileStream := TFileStream.Create(FSrcFileName,fmOpenRead or fmShareDenyNone); + SrcFileStream := TFileStream.Create(FSrcFileName,fmOpenRead or fmShareDenyNone); ProgressBarSfx.Max := SrcFileStream.Size; try try @@ -118,7 +118,7 @@ procedure TFrmCreateSFX.CreateSFX; finally SrcFileStream.Free; end; - except on e : exception do + except on e: exception do Application.MessageBox(PAnsiChar(e.Message),'Error',MB_OK+MB_ICONERROR); end; end; @@ -153,7 +153,7 @@ procedure TFrmCreateSFX.FormCreate(Sender: TObject); function TFrmCreateSFX.GetCompressionLevel: TCompressionLevel; var - i : Integer; + i: Integer; begin Result:=clMax; for i:= 0 to ComponentCount - 1 do diff --git a/Misc/SFX/MainSFX.pas b/Misc/SFX/MainSFX.pas index 06b8e4b..4cfd3ad 100644 --- a/Misc/SFX/MainSFX.pas +++ b/Misc/SFX/MainSFX.pas @@ -45,8 +45,8 @@ function SelectFolderCallbackProc(hwnd: HWND; uMsg: UINT; lParam: LPARAM; lpData function SelectFolder(hwndOwner: HWND;const Caption: string; var InitFolder: string): Boolean; var ItemIDList: PItemIDList; - idlRoot : PItemIDList; - Path : PAnsiChar; + idlRoot: PItemIDList; + Path: PAnsiChar; BrowseInfo: TBrowseInfo; begin Result := False; @@ -55,13 +55,13 @@ function SelectFolder(hwndOwner: HWND;const Caption: string; var InitFolder: str with BrowseInfo do begin hwndOwner := GetActiveWindow; - pidlRoot := idlRoot; + pidlRoot := idlRoot; SHGetSpecialFolderLocation(hwndOwner, CSIDL_DRIVES, idlRoot); pszDisplayName := StrAlloc(MAX_PATH); lpszTitle := PAnsiChar(Caption); - lpfn := @SelectFolderCallbackProc; - lParam := LongInt(PAnsiChar(InitFolder)); - ulFlags := BIF_RETURNONLYFSDIRS OR BIF_USENEWUI; + lpfn := @SelectFolderCallbackProc; + lParam := LongInt(PAnsiChar(InitFolder)); + ulFlags := BIF_RETURNONLYFSDIRS OR BIF_USENEWUI; end; ItemIDList := SHBrowseForFolder(BrowseInfo); @@ -69,18 +69,18 @@ function SelectFolder(hwndOwner: HWND;const Caption: string; var InitFolder: str if SHGetPathFromIDList(ItemIDList, Path) then begin InitFolder := Path; - Result := True; + Result := True; end; end; procedure TFrmMain.Extract; var - DeCompressStream : TDeCompressionStream; - ResourceStream : TResourceStream; - DestFileStream : TFileStream; - FileNameDest : String; - RecSFX : TRecSFX; + DeCompressStream: TDeCompressionStream; + ResourceStream: TResourceStream; + DestFileStream: TFileStream; + FileNameDest: String; + RecSFX: TRecSFX; begin if FindResource(0, 'SFXDATA', RT_RCDATA)=0 then @@ -108,7 +108,7 @@ procedure TFrmMain.Extract; ResourceStream:= TResourceStream.Create(0,'SFXDATA',RT_RCDATA); try ProgressBarSfx.Max:=ResourceStream.Size; - FileNameDest := EditPath.Text+ChangeFileExt(ExtractFileName(ParamStr(0)),''); + FileNameDest := EditPath.Text+ChangeFileExt(ExtractFileName(ParamStr(0)),''); DestFileStream := TFileStream.Create(FileNameDest,fmCreate); try DeCompressStream:=TDeCompressionStream.Create(ResourceStream); @@ -124,7 +124,7 @@ procedure TFrmMain.Extract; finally ResourceStream.Free; end; - except on e : exception do + except on e: exception do Application.MessageBox(PAnsiChar(e.Message),'Error',MB_OK+MB_ICONERROR); end; end; diff --git a/Misc/SelectDelphiVersion/SelectDelphiVersion.pas b/Misc/SelectDelphiVersion/SelectDelphiVersion.pas index b6e1fc5..1a69b43 100644 --- a/Misc/SelectDelphiVersion/SelectDelphiVersion.pas +++ b/Misc/SelectDelphiVersion/SelectDelphiVersion.pas @@ -79,7 +79,7 @@ function RegKeyExists(const RegPath: string;const RootKey :HKEY): Boolean; Reg: TRegistry; begin try - Reg := TRegistry.Create; + Reg := TRegistry.Create; try Reg.RootKey := RootKey; Result := Reg.KeyExists(RegPath); @@ -131,10 +131,10 @@ procedure ExtractIconFileToImageList(ImageList: TImageList; const Filename: stri { TFrmSelDelphiVer } procedure TFrmSelDelphiVer.LoadInstalledVersions; Var - item : TListItem; - DelphiComp : TDelphiVersions; - FileName : string; - ImageIndex : Integer; + item: TListItem; + DelphiComp: TDelphiVersions; + FileName: string; + ImageIndex: Integer; begin for DelphiComp := Low(TDelphiVersions) to High(TDelphiVersions) do if RegKeyExists(DelphiRegPaths[DelphiComp],HKEY_CURRENT_USER) then diff --git a/Misc/SelectDelphiVersion/UnitTest.pas b/Misc/SelectDelphiVersion/UnitTest.pas index 33c88f5..e17aac2 100644 --- a/Misc/SelectDelphiVersion/UnitTest.pas +++ b/Misc/SelectDelphiVersion/UnitTest.pas @@ -29,9 +29,9 @@ implementation procedure TForm9.Button1Click(Sender: TObject); var - Frm : TFrmSelDelphiVer; - item : TListItem; - DelphiPath : string; + Frm: TFrmSelDelphiVer; + item: TListItem; + DelphiPath: string; begin Frm := TFrmSelDelphiVer.Create(Self); try diff --git a/Networking/NetworkList/NETWORKLIST_TLB.pas b/Networking/NetworkList/NETWORKLIST_TLB.pas index ecdc62f..3640eef 100644 --- a/Networking/NetworkList/NETWORKLIST_TLB.pas +++ b/Networking/NetworkList/NETWORKLIST_TLB.pas @@ -24,9 +24,9 @@ interface // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: -// Type Libraries : LIBID_xxxx -// CoClasses : CLASS_xxxx -// DISPInterfaces : DIID_xxxx +// Type Libraries: LIBID_xxxx +// CoClasses: CLASS_xxxx +// DISPInterfaces: DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const diff --git a/Networking/TcpGeoConnections/GoogleMapHelper.pas b/Networking/TcpGeoConnections/GoogleMapHelper.pas index c84f107..0b23d35 100644 --- a/Networking/TcpGeoConnections/GoogleMapHelper.pas +++ b/Networking/TcpGeoConnections/GoogleMapHelper.pas @@ -119,13 +119,13 @@ interface UrlGooleMapsImage_gray='http://labs.google.com/ridefinder/images/mm_20_gray.png'; UrlGooleMapsImage_brown='http://labs.google.com/ridefinder/images/mm_20_brown.png'; -function GetUrlGooleMapsImageLetter(Letter: Char) : string; +function GetUrlGooleMapsImageLetter(Letter: Char): string; implementation uses SysUtils; -function GetUrlGooleMapsImageLetter(Letter: Char) : string; +function GetUrlGooleMapsImageLetter(Letter: Char): string; begin Result:=Format(UrlGooleMapsImageLetter,[Letter]); diff --git a/Networking/TcpGeoConnections/IpHelperApi.pas b/Networking/TcpGeoConnections/IpHelperApi.pas index 3029e59..0cbd074 100644 --- a/Networking/TcpGeoConnections/IpHelperApi.pas +++ b/Networking/TcpGeoConnections/IpHelperApi.pas @@ -19,12 +19,12 @@ interface PMibTcpRowOwnerPid = ^TMibTcpRowOwnerPid; TMibTcpRowOwnerPid = packed record - dwState : DWORD; - dwLocalAddr : DWORD; - dwLocalPort : DWORD; + dwState: DWORD; + dwLocalAddr: DWORD; + dwLocalPort: DWORD; dwRemoteAddr: DWORD; dwRemotePort: DWORD; - dwOwningPid : DWORD; + dwOwningPid: DWORD; end; diff --git a/Networking/TcpGeoConnections/MainGeoTcpConn.pas b/Networking/TcpGeoConnections/MainGeoTcpConn.pas index f59f824..ff85508 100644 --- a/Networking/TcpGeoConnections/MainGeoTcpConn.pas +++ b/Networking/TcpGeoConnections/MainGeoTcpConn.pas @@ -30,10 +30,10 @@ TFrmMain = class(TForm) procedure ComboBoxTypesChange(Sender: TObject); procedure ButtonReloadClick(Sender: TObject); private - FCurrentMapType : TWebMapTypes; - FLocalIpAddresses : TStrings; + FCurrentMapType: TWebMapTypes; + FLocalIpAddresses: TStrings; FLocalComputerName: string; - FExtendedTcpTable : PMIB_TCPTABLE_OWNER_PID; + FExtendedTcpTable: PMIB_TCPTABLE_OWNER_PID; FExternalIpAddress: string; procedure GetMapListItem; procedure LoadTCPConnections; @@ -72,16 +72,16 @@ implementation type TResolveGeoLocation = class(TThread) private - FListItem : TListItem; - FGeoInfo : TGeoInfoClass; - FRemoteHostName : string; - FRemoteIP : string; - FServer : Cardinal; - FImageList : TImageList; + FListItem: TListItem; + FGeoInfo: TGeoInfoClass; + FRemoteHostName: string; + FRemoteIP: string; + FServer: Cardinal; + FImageList: TImageList; procedure SetData; protected procedure Execute; override; - constructor Create(Server : Cardinal;const RemoteIP:string;ImageList:TImageList;ListItem:TListItem); + constructor Create(Server: Cardinal;const RemoteIP:string;ImageList:TImageList;ListItem:TListItem); end; { @@ -101,7 +101,7 @@ procedure TFrmMain.ButtonReloadClick(Sender: TObject); procedure TFrmMain.ComboBoxMapsChange(Sender: TObject); var - i : Integer; + i: Integer; begin FCurrentMapType:=TWebMapTypes(ComboBoxMaps.ItemIndex); @@ -109,9 +109,9 @@ procedure TFrmMain.ComboBoxMapsChange(Sender: TObject); case FCurrentMapType of Google_Maps: for i:= Low(GoogleMapsTypes) to High(GoogleMapsTypes) do ComboBoxTypes.Items.Add(GoogleMapsTypes[i]); - Bing_Map : for i:= Low(BingMapsTypes) to High(BingMapsTypes) do + Bing_Map: for i:= Low(BingMapsTypes) to High(BingMapsTypes) do ComboBoxTypes.Items.Add(BingMapsTypes[i]); - Yahoo_Map : for i:= Low(YahooMapsTypes) to High(YahooMapsTypes) do + Yahoo_Map: for i:= Low(YahooMapsTypes) to High(YahooMapsTypes) do ComboBoxTypes.Items.Add(YahooMapsTypes[i]); end; @@ -131,8 +131,8 @@ procedure TFrmMain.ComboBoxTypesChange(Sender: TObject); procedure TFrmMain.FormCreate(Sender: TObject); var - libHandle : THandle; - MapType : TWebMapTypes; + libHandle: THandle; + MapType: TWebMapTypes; begin FLocalIpAddresses :=TStringList.Create; TIdStack.IncUsage; @@ -142,7 +142,7 @@ procedure TFrmMain.FormCreate(Sender: TObject); TIdStack.DecUsage; end; FLocalComputerName:=GetLocalComputerName; - libHandle := LoadLibrary(iphlpapi); + libHandle := LoadLibrary(iphlpapi); GetExtendedTcpTable := GetProcAddress(libHandle, 'GetExtendedTcpTable'); for MapType:=Low(TWebMapTypes) to High(TWebMapTypes) do @@ -179,14 +179,14 @@ function GetPIDName(hSnapShot: THandle; PID: DWORD): string; procedure TFrmMain.GetMapListItem(); var - HTMLWindow2 : IHTMLWindow2; - MemoryStream : TMemoryStream; - Item : TListItem; - Lat : AnsiString; - Lng : AnsiString; - Title : AnsiString; - MapType : string; - MapStr : AnsiString; + HTMLWindow2: IHTMLWindow2; + MemoryStream: TMemoryStream; + Item: TListItem; + Lat: AnsiString; + Lng: AnsiString; + Title: AnsiString; + MapType: string; + MapStr: AnsiString; //sorry , but tha html pages contains a lot of % (porcent) chars function ReplaceTag(const PageStr,Tag,NewValue:string):AnsiString; @@ -216,10 +216,10 @@ function ReplaceTag(const PageStr,Tag,NewValue:string):AnsiString; MemoryStream := TMemoryStream.Create; try case FCurrentMapType of - Google_Maps : MapStr:=GoogleMapsPage; - Yahoo_Map : MapStr:=YahooMapsPage; - Bing_Map : MapStr:=BingsMapsPage; - Open_Streetmap : MapStr:=OpenStreetMapsPage; + Google_Maps: MapStr:=GoogleMapsPage; + Yahoo_Map: MapStr:=YahooMapsPage; + Bing_Map: MapStr:=BingsMapsPage; + Open_Streetmap: MapStr:=OpenStreetMapsPage; end; MapStr:=ReplaceTag(MapStr,'[Lat]',Lat); @@ -240,31 +240,31 @@ function ReplaceTag(const PageStr,Tag,NewValue:string):AnsiString; { procedure TFrmMain.GetMapListItem(Item: TListItem); var - StreamData : TMemoryStream; - JPEGImage : TJPEGImage; - UrlImage : string; - lHTTP : TIdHTTP; - Server : Cardinal; - IsLocal : Boolean; + StreamData: TMemoryStream; + JPEGImage: TJPEGImage; + UrlImage: string; + lHTTP: TIdHTTP; + Server: Cardinal; + IsLocal: Boolean; begin if Item.SubItems.Count=0) or (Server=0) or (Server=16777343); + UrlImage := BuildUrlStaticMapUrl(Item.SubItems[COLUMN_Latitude],Item.SubItems[COLUMN_Longitude],'hybrid','jpg',FCurrentZoom,400,400,True); + Server := Cardinal(Item.SubItems.Objects[COLUMN_RemoteServer]); + IsLocal := (FLocalIpAddresses.IndexOf(Item.SubItems[COLUMN_RemoteIP])>=0) or (Server=0) or (Server=16777343); if Assigned(Item.Data) then begin - JPEGImage := TJPEGImage(Item.Data); + JPEGImage := TJPEGImage(Item.Data); ImageMap.Picture.Assign(JPEGImage); end else begin StreamData := TMemoryStream.Create; - JPEGImage := TJPEGImage.Create; - lHTTP := TIdHTTP.Create(nil); + JPEGImage := TJPEGImage.Create; + lHTTP := TIdHTTP.Create(nil); lHTTP.Request.UserAgent:='Mozilla/3.0'; try try @@ -273,7 +273,7 @@ procedure TFrmMain.GetMapListItem(Item: TListItem); JPEGImage.LoadFromStream(StreamData); ImageMap.Picture.Assign(JPEGImage); //Item.Data:=JPEGImage; - except on E : Exception Do + except on E: Exception Do MessageDlg('Exception: '+E.Message,mtError, [mbOK], 0); end; finally @@ -292,16 +292,16 @@ procedure TFrmMain.ListViewIPaddressClick(Sender: TObject); procedure TFrmMain.LoadTCPConnections; var - Server : Cardinal; - Error : DWORD; - TableSize : DWORD; - Snapshot : THandle; - i : integer; - ListItem : TListItem; - IpAddress : in_addr; - FCurrentPid : Cardinal; - IsLocal : Boolean; - RemoteIp : string; + Server: Cardinal; + Error: DWORD; + TableSize: DWORD; + Snapshot: THandle; + i: integer; + ListItem: TListItem; + IpAddress: in_addr; + FCurrentPid: Cardinal; + IsLocal: Boolean; + RemoteIp: string; begin ListViewIPaddress.Items.BeginUpdate; try @@ -320,9 +320,9 @@ procedure TFrmMain.LoadTCPConnections; if (FExtendedTcpTable.Table[i].dwOwningPid<>0) and (FExtendedTcpTable.Table[i].dwOwningPid<>FCurrentPid) and (FExtendedTcpTable.Table[i].dwRemoteAddr<>0) then begin IpAddress.s_addr := FExtendedTcpTable.Table[i].dwRemoteAddr; - RemoteIp := string(inet_ntoa(IpAddress)); - Server := FExtendedTcpTable.Table[i].dwRemoteAddr; - IsLocal := (FLocalIpAddresses.IndexOf(RemoteIp)>=0) or (Server=0) or (Server=16777343);// or IpAddressIsLAN(RemoteIp); + RemoteIp := string(inet_ntoa(IpAddress)); + Server := FExtendedTcpTable.Table[i].dwRemoteAddr; + IsLocal := (FLocalIpAddresses.IndexOf(RemoteIp)>=0) or (Server=0) or (Server=16777343);// or IpAddressIsLAN(RemoteIp); if CheckBoxRemote.Checked and IsLocal then Continue; if FExtendedTcpTable.Table[i].dwRemoteAddr = 0 then @@ -364,7 +364,7 @@ procedure TFrmMain.LoadTCPConnections; for i:= 0 to ListViewIPaddress.Items.Count-1 do begin Server:=Cardinal(ListViewIPaddress.Items.Item[i].SubItems.Objects[COLUMN_RemoteServer]); - IsLocal := (FLocalIpAddresses.IndexOf(ListViewIPaddress.Items.Item[i].SubItems[COLUMN_RemoteIP])>=0) or (Server=0) or (Server=16777343); + IsLocal := (FLocalIpAddresses.IndexOf(ListViewIPaddress.Items.Item[i].SubItems[COLUMN_RemoteIP])>=0) or (Server=0) or (Server=16777343); if not IsLocal then TResolveGeoLocation.Create(Server,ListViewIPaddress.Items.Item[i].SubItems[COLUMN_RemoteIP],ImageList1,ListViewIPaddress.Items.Item[i]); end; @@ -396,7 +396,7 @@ procedure TResolveGeoLocation.Execute; procedure TResolveGeoLocation.SetData; var - Bitmap : TBitmap; + Bitmap: TBitmap; begin FListItem.SubItems[COLUMN_RemoteServer]:=FRemoteHostName; FListItem.SubItems[COLUMN_Country] :=FGeoInfo.GeoInfo.CountryName; diff --git a/Networking/TcpGeoConnections/MapsHelper.pas b/Networking/TcpGeoConnections/MapsHelper.pas index 9389fe1..cfaf676 100644 --- a/Networking/TcpGeoConnections/MapsHelper.pas +++ b/Networking/TcpGeoConnections/MapsHelper.pas @@ -5,15 +5,15 @@ interface type TWebMapTypes=(Google_Maps,Yahoo_Map,Bing_Map,Open_Streetmap); const - WebMapNames : Array[TWebMapTypes] of string =('Google Maps','Yahoo Maps','Bing Maps','OpenStreetMaps'); + WebMapNames: Array[TWebMapTypes] of string =('Google Maps','Yahoo Maps','Bing Maps','OpenStreetMaps'); - GoogleMapsTypes : Array[0..3] of string =( + GoogleMapsTypes: Array[0..3] of string =( 'HYBRID', 'ROADMAP', 'SATELLITE', 'TERRAIN'); - BingMapsTypes : Array[0..4] of string =( + BingMapsTypes: Array[0..4] of string =( 'Hybrid', 'Road', 'Aerial', @@ -21,7 +21,7 @@ interface 'Birdseye' ); - YahooMapsTypes : Array[0..2] of string =( + YahooMapsTypes: Array[0..2] of string =( 'HYB', 'SAT', 'REG' diff --git a/Networking/TcpGeoConnections/NetHelperFuncs.pas b/Networking/TcpGeoConnections/NetHelperFuncs.pas index da6afa5..fa6e340 100644 --- a/Networking/TcpGeoConnections/NetHelperFuncs.pas +++ b/Networking/TcpGeoConnections/NetHelperFuncs.pas @@ -13,71 +13,71 @@ interface type PGeoInfo = ^TGeoInfo; TGeoInfo = record - Status : string; - CountryCode : string; - CountryName : string; - RegionCode : string; - City : string; - ZipPostalCode : string; - Latitude : Double; - Longitude : Double; - TimezoneName : string; - Gmtoffset : string; - Isdst : string; - FlagImage : TPngImage; + Status: string; + CountryCode: string; + CountryName: string; + RegionCode: string; + City: string; + ZipPostalCode: string; + Latitude: Double; + Longitude: Double; + TimezoneName: string; + Gmtoffset: string; + Isdst: string; + FlagImage: TPngImage; function LatitudeToString:string; function LongitudeToString:string; end; TGeoInfoClass = class private - FIpAddress : string; - FGeoInfo : TGeoInfo; + FIpAddress: string; + FGeoInfo: TGeoInfo; public - property GeoInfo : TGeoInfo read FGeoInfo; - constructor Create(IpAddress : string); overload; + property GeoInfo: TGeoInfo read FGeoInfo; + constructor Create(IpAddress: string); overload; Destructor Destroy; override; end; - ProcTraceCallBack = procedure(const ServerName,ServerIp:string;GeoInfo : TGeoInfo) of object; + ProcTraceCallBack = procedure(const ServerName,ServerIp:string;GeoInfo: TGeoInfo) of object; ProcTraceLogCallBack = procedure(const Msg:string) of object; TGeoTraceThread = class(TThread) private - DestAddr : in_addr; - TraceHandle : THandle; - FDestAddress : string; - FLogString : string; - FIcmpTimeOut : Word; - FMaxHops : Word; - FResolveHostName : boolean; - FServerCallBack : string; - FServerIpCallBack : string; - FCallBack : ProcTraceCallBack; - FLogCallBack : ProcTraceLogCallBack; - FIncludeGeoInfo : boolean; - FGeoInfo : TGeoInfo; + DestAddr: in_addr; + TraceHandle: THandle; + FDestAddress: string; + FLogString: string; + FIcmpTimeOut: Word; + FMaxHops: Word; + FResolveHostName: boolean; + FServerCallBack: string; + FServerIpCallBack: string; + FCallBack: ProcTraceCallBack; + FLogCallBack: ProcTraceLogCallBack; + FIncludeGeoInfo: boolean; + FGeoInfo: TGeoInfo; function Trace(const Ttl: Byte): Longint; procedure Log; procedure IntCallBack; public procedure Execute; override; - property MaxHops : Word read FMaxHops write FMaxHops default 30; - property DestAddress : string read FDestAddress write FDestAddress; - property IcmpTimeOut : Word read FIcmpTimeOut write FIcmpTimeOut default 5000; - property ResolveHostName : boolean read FResolveHostName write FResolveHostName default True; - property IncludeGeoInfo : boolean read FIncludeGeoInfo write FIncludeGeoInfo default True; - property CallBack : ProcTraceCallBack read FCallBack write FCallBack; - property MsgCallBack : ProcTraceLogCallBack read FLogCallBack write FLogCallBack; + property MaxHops: Word read FMaxHops write FMaxHops default 30; + property DestAddress: string read FDestAddress write FDestAddress; + property IcmpTimeOut: Word read FIcmpTimeOut write FIcmpTimeOut default 5000; + property ResolveHostName: boolean read FResolveHostName write FResolveHostName default True; + property IncludeGeoInfo: boolean read FIncludeGeoInfo write FIncludeGeoInfo default True; + property CallBack: ProcTraceCallBack read FCallBack write FCallBack; + property MsgCallBack: ProcTraceLogCallBack read FLogCallBack write FLogCallBack; end; -function GetLocalComputerName : String; +function GetLocalComputerName: String; function GetRemoteHostName(Addr:DWORD): string; overload; function GetRemoteHostName(const Addr: string): string; overload; function GetExternalIP: string; -procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); -//function IpAddressIsLAN(IpAddress:string) : Boolean; +procedure GetGeoInfo(const IpAddress: string;var GeoInfo :TGeoInfo); +//function IpAddressIsLAN(IpAddress:string): Boolean; implementation @@ -101,9 +101,9 @@ implementation PIP_option_information = ^TIPOptionInformation; TIPOptionInformation = packed record - Ttl : Byte; - Tos : Byte; - Flags : Byte; + Ttl: Byte; + Tos: Byte; + Flags: Byte; OptionsSize: Byte; OptionsData: Pointer; end; @@ -111,18 +111,18 @@ implementation PIcmpEchoReply= ^TIcmpEchoReply; TIcmpEchoReply = packed record - Address : Longint; - Status : Longint; - RoundTripTime : Longint; - DataSize : Word; - Reserved : Word; - Data : Pointer; - Options : TIPOptionInformation; + Address: Longint; + Status: Longint; + RoundTripTime: Longint; + DataSize: Word; + Reserved: Word; + Data: Pointer; + Options: TIPOptionInformation; end; function IcmpCreateFile: THandle; stdcall; external 'ICMP.DLL' name 'IcmpCreateFile'; function IcmpCloseHandle(IcmpHandle: THandle): BOOL; stdcall; external 'ICMP.DLL' name 'IcmpCloseHandle'; -function IcmpSendEcho(IcmpHandle : THandle; DestinationAddress: Longint; RequestData: Pointer; RequestSize: Word; RequestOptions: PIP_option_information; ReplyBuffer: Pointer; ReplySize, Timeout: DWORD): DWORD; stdcall; external 'ICMP.DLL' name 'IcmpSendEcho'; +function IcmpSendEcho(IcmpHandle: THandle; DestinationAddress: Longint; RequestData: Pointer; RequestSize: Word; RequestOptions: PIP_option_information; ReplyBuffer: Pointer; ReplySize, Timeout: DWORD): DWORD; stdcall; external 'ICMP.DLL' name 'IcmpSendEcho'; procedure WinInet_HttpGet(const Url: string;Stream:TStream);overload; @@ -132,7 +132,7 @@ procedure WinInet_HttpGet(const Url: string;Stream:TStream);overload; hInter: HINTERNET; UrlHandle: HINTERNET; BytesRead: dWord; - Buffer : Pointer; + Buffer: Pointer; begin hInter := InternetOpen('Mozilla/3.0', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if Assigned(hInter) then @@ -159,7 +159,7 @@ procedure WinInet_HttpGet(const Url: string;Stream:TStream);overload; function WinInet_HttpGet(const Url: string): string;overload; Var - StringStream : TStringStream; + StringStream: TStringStream; begin Result:=''; StringStream:=TStringStream.Create; @@ -177,16 +177,16 @@ function WinInet_HttpGet(const Url: string): string;overload; -procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); +procedure GetGeoInfo(const IpAddress: string;var GeoInfo :TGeoInfo); var - XMLDoc : OleVariant; - ANode : OleVariant; + XMLDoc: OleVariant; + ANode: OleVariant; FormatSettings: TFormatSettings; - d : Double; - Success : HResult; - UrlImage : string; - XmlContent : string; - StreamData : TMemoryStream; + d: Double; + Success: HResult; + UrlImage: string; + XmlContent: string; + StreamData: TMemoryStream; begin GeoInfo.FlagImage:=nil; Success := CoInitializeEx(nil, COINIT_MULTITHREADED); @@ -243,8 +243,8 @@ procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); if GeoInfo.CountryCode<>'' then begin - GeoInfo.FlagImage := TPngImage.Create; - StreamData := TMemoryStream.Create; + GeoInfo.FlagImage := TPngImage.Create; + StreamData := TMemoryStream.Create; try UrlImage:=Format(UrlFlags,[LowerCase(GeoInfo.CountryCode)]); WinInet_HttpGet(UrlImage,StreamData); @@ -265,23 +265,23 @@ procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); end; { -procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); +procedure GetGeoInfo(const IpAddress: string;var GeoInfo :TGeoInfo); var - lHTTP : TIdHTTP; - lStream : TStringStream; - XMLDoc : OleVariant; - ANode : OleVariant; + lHTTP: TIdHTTP; + lStream: TStringStream; + XMLDoc: OleVariant; + ANode: OleVariant; FormatSettings: TFormatSettings; - d : Double; - Success : HResult; - StreamData : TMemoryStream; - UrlImage : string; + d: Double; + Success: HResult; + StreamData: TMemoryStream; + UrlImage: string; - XmlContent : string; + XmlContent: string; begin GeoInfo.FlagImage:=nil; - lHTTP := TIdHTTP.Create(nil); + lHTTP := TIdHTTP.Create(nil); //lHTTP.ReadTimeout:=20000; lStream := TStringStream.Create(''); Success := CoInitializeEx(nil, COINIT_MULTITHREADED); @@ -340,9 +340,9 @@ procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); if GeoInfo.CountryCode<>'' then begin - StreamData := TMemoryStream.Create; - GeoInfo.FlagImage := TPngImage.Create; - lHTTP := TIdHTTP.Create(nil); + StreamData := TMemoryStream.Create; + GeoInfo.FlagImage := TPngImage.Create; + lHTTP := TIdHTTP.Create(nil); try UrlImage:=Format(UrlFlags,[LowerCase(GeoInfo.CountryCode)]); try @@ -350,7 +350,7 @@ procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); StreamData.Seek(0,soFromBeginning); GeoInfo.FlagImage.LoadFromStream(StreamData);//load the image in a Stream except - on E : EIdHTTPProtocolException do + on E: EIdHTTPProtocolException do if E.ErrorCode=404 then ; end; finally @@ -361,10 +361,10 @@ procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); end; } -function GetLocalComputerName : String; +function GetLocalComputerName: String; var Buffer: array[0..255] of Char; - Size : DWORD; + Size: DWORD; begin size := 256; if GetComputerName(Buffer, Size) then @@ -384,9 +384,9 @@ function GetRemoteHostName(Addr:DWORD): string; overload; end; { -function IpAddressIsLAN(IpAddress:string) : Boolean; +function IpAddressIsLAN(IpAddress:string): Boolean; Var - IpInt : Cardinal; + IpInt: Cardinal; begin //10.0.0.0 - 10.255.255.255 //172.16.0.0 - 172.31.255.255 @@ -414,10 +414,10 @@ function GetExternalIP: string; { function GetExternalIP: string; var - lHTTP : TIdHTTP; + lHTTP: TIdHTTP; lStream: TStringStream; begin - lHTTP := TIdHTTP.Create(nil); + lHTTP := TIdHTTP.Create(nil); lStream := TStringStream.Create(Result); try try @@ -473,20 +473,20 @@ procedure TGeoTraceThread.Execute; const MaxPings = 3; var - HostName : String; - HostReply : Boolean; - HostIP : LongInt; - HostEnt : PHostEnt; - WSAData : TWSAData; - WsaErr : DWORD; - OldTick : DWORD; - PingTime : DWORD; - TraceResp : Longint; - Index : Word; + HostName: String; + HostReply: Boolean; + HostIP: LongInt; + HostEnt: PHostEnt; + WSAData: TWSAData; + WsaErr: DWORD; + OldTick: DWORD; + PingTime: DWORD; + TraceResp: Longint; + Index: Word; FCurrentTTL: Word; - sValue : string; + sValue: string; FGeoInfoStr: string; - IpAddress : in_addr; + IpAddress: in_addr; begin WsaErr := WSAStartup($101, WSAData); @@ -506,7 +506,7 @@ procedure TGeoTraceThread.Execute; Exit; end; - DestAddr := PInAddr(in_addr(HostEnt.h_addr_list^))^; + DestAddr := PInAddr(in_addr(HostEnt.h_addr_list^))^; TraceHandle := IcmpCreateFile; if TraceHandle = INVALID_HANDLE_VALUE then @@ -527,8 +527,8 @@ procedure TGeoTraceThread.Execute; Synchronize(Log); end; - TraceResp := 0; - FCurrentTTL := 0; + TraceResp := 0; + FCurrentTTL := 0; while (TraceResp <> DestAddr.S_addr) and (FCurrentTTL < FMaxHops) do begin @@ -537,7 +537,7 @@ procedure TGeoTraceThread.Execute; sValue:=''; for Index := 0 to MaxPings-1 do begin - OldTick := GetTickCount; + OldTick := GetTickCount; TraceResp := Trace(FCurrentTTL); if TraceResp = -1 then @@ -552,7 +552,7 @@ procedure TGeoTraceThread.Execute; FLogString := Format(' <%d ms', [1]); HostReply := True; - HostIP := TraceResp; + HostIP := TraceResp; end; if Index = 0 then @@ -579,8 +579,8 @@ procedure TGeoTraceThread.Execute; FServerIpCallBack:=sValue; if FResolveHostName then begin - HostName := GetRemoteHostName(HostIP); - FServerCallBack := HostName; + HostName := GetRemoteHostName(HostIP); + FServerCallBack := HostName; if HostName <> '' then FLogString := FLogString + HostName + ' [' + sValue + '] '+FGeoInfoStr else @@ -616,14 +616,14 @@ procedure TGeoTraceThread.Execute; function TGeoTraceThread.Trace(const Ttl: Byte): Longint; var IPOptionInfo: TIPOptionInformation; - IcmpEcho : PIcmpEchoReply; - IcpmErr : Integer; + IcmpEcho: PIcmpEchoReply; + IcpmErr: Integer; begin GetMem(IcmpEcho, SizeOf(TIcmpEchoReply)); try - IPOptionInfo.Ttl := Ttl; - IPOptionInfo.Tos := 0; - IPOptionInfo.Flags := 0; + IPOptionInfo.Ttl := Ttl; + IPOptionInfo.Tos := 0; + IPOptionInfo.Flags := 0; IPOptionInfo.OptionsSize := 0; IPOptionInfo.OptionsData := nil; diff --git a/Networking/Traceroute/MainDemoGeoInfoTrace.pas b/Networking/Traceroute/MainDemoGeoInfoTrace.pas index 23f0296..555a625 100644 --- a/Networking/Traceroute/MainDemoGeoInfoTrace.pas +++ b/Networking/Traceroute/MainDemoGeoInfoTrace.pas @@ -37,7 +37,7 @@ procedure TFrmMainTrace.BrnTraceClick(Sender: TObject); procedure TFrmMainTrace.TraceAddress; var - Trace : TGeoTraceThread; + Trace: TGeoTraceThread; begin if Trim(EditAddress.Text)='' then Exit; Trace:=TGeoTraceThread.Create(True); diff --git a/Networking/Traceroute/NetHelperFuncs.pas b/Networking/Traceroute/NetHelperFuncs.pas index 6cf841f..372d8cd 100644 --- a/Networking/Traceroute/NetHelperFuncs.pas +++ b/Networking/Traceroute/NetHelperFuncs.pas @@ -12,17 +12,17 @@ interface type TGeoInfo = record - Status : string; - CountryCode : string; - CountryName : string; - RegionCode : string; - City : string; - ZipPostalCode : string; - Latitude : double; - Longitude : double; - TimezoneName : string; - Gmtoffset : string; - Isdst : string; + Status: string; + CountryCode: string; + CountryName: string; + RegionCode: string; + City: string; + ZipPostalCode: string; + Latitude: double; + Longitude: double; + TimezoneName: string; + Gmtoffset: string; + Isdst: string; function LatitudeToString:string; function LongitudeToString:string; end; @@ -31,39 +31,39 @@ TGeoInfo = record ProcTraceLogCallBack = procedure(const Msg:string) of object; TGeoTraceThread = class(TThread) private - DestAddr : in_addr; - TraceHandle : THandle; - FDestAddress : string; - FLogString : string; - FIcmpTimeOut : Word; - FMaxHops : Word; - FResolveHostName : boolean; - FServerCallBack : string; - FServerIpCallBack : string; - FCallBack : ProcTraceCallBack; - FLogCallBack : ProcTraceLogCallBack; - FIncludeGeoInfo : boolean; - FGeoInfo : TGeoInfo; + DestAddr: in_addr; + TraceHandle: THandle; + FDestAddress: string; + FLogString: string; + FIcmpTimeOut: Word; + FMaxHops: Word; + FResolveHostName: boolean; + FServerCallBack: string; + FServerIpCallBack: string; + FCallBack: ProcTraceCallBack; + FLogCallBack: ProcTraceLogCallBack; + FIncludeGeoInfo: boolean; + FGeoInfo: TGeoInfo; function Trace(const Ttl: Byte): Longint; procedure Log; procedure IntCallBack; public procedure Execute; override; - property MaxHops : Word read FMaxHops write FMaxHops default 30; - property DestAddress : string read FDestAddress write FDestAddress; - property IcmpTimeOut : Word read FIcmpTimeOut write FIcmpTimeOut default 5000; - property ResolveHostName : boolean read FResolveHostName write FResolveHostName default True; - property IncludeGeoInfo : boolean read FIncludeGeoInfo write FIncludeGeoInfo default True; - property CallBack : ProcTraceCallBack read FCallBack write FCallBack; - property MsgCallBack : ProcTraceLogCallBack read FLogCallBack write FLogCallBack; + property MaxHops: Word read FMaxHops write FMaxHops default 30; + property DestAddress: string read FDestAddress write FDestAddress; + property IcmpTimeOut: Word read FIcmpTimeOut write FIcmpTimeOut default 5000; + property ResolveHostName: boolean read FResolveHostName write FResolveHostName default True; + property IncludeGeoInfo: boolean read FIncludeGeoInfo write FIncludeGeoInfo default True; + property CallBack: ProcTraceCallBack read FCallBack write FCallBack; + property MsgCallBack: ProcTraceLogCallBack read FLogCallBack write FLogCallBack; end; -function GetLocalComputerName : String; +function GetLocalComputerName: String; function GetRemoteHostName(Addr:DWORD): string; overload; function GetRemoteHostName(const Addr: string): string; overload; function GetExternalIP: string; -procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); +procedure GetGeoInfo(const IpAddress: string;var GeoInfo :TGeoInfo); implementation @@ -83,9 +83,9 @@ implementation PIP_option_information = ^TIPOptionInformation; TIPOptionInformation = packed record - Ttl : Byte; - Tos : Byte; - Flags : Byte; + Ttl: Byte; + Tos: Byte; + Flags: Byte; OptionsSize: Byte; OptionsData: Pointer; end; @@ -93,18 +93,18 @@ implementation PIcmpEchoReply= ^TIcmpEchoReply; TIcmpEchoReply = packed record - Address : Longint; - Status : Longint; - RoundTripTime : Longint; - DataSize : Word; - Reserved : Word; - Data : Pointer; - Options : TIPOptionInformation; + Address: Longint; + Status: Longint; + RoundTripTime: Longint; + DataSize: Word; + Reserved: Word; + Data: Pointer; + Options: TIPOptionInformation; end; function IcmpCreateFile: THandle; stdcall; external 'ICMP.DLL' name 'IcmpCreateFile'; function IcmpCloseHandle(IcmpHandle: THandle): BOOL; stdcall; external 'ICMP.DLL' name 'IcmpCloseHandle'; -function IcmpSendEcho(IcmpHandle : THandle; DestinationAddress: Longint; RequestData: Pointer; RequestSize: Word; RequestOptions: PIP_option_information; ReplyBuffer: Pointer; ReplySize, Timeout: DWORD): DWORD; stdcall; external 'ICMP.DLL' name 'IcmpSendEcho'; +function IcmpSendEcho(IcmpHandle: THandle; DestinationAddress: Longint; RequestData: Pointer; RequestSize: Word; RequestOptions: PIP_option_information; ReplyBuffer: Pointer; ReplySize, Timeout: DWORD): DWORD; stdcall; external 'ICMP.DLL' name 'IcmpSendEcho'; { TGeoInfo } @@ -125,17 +125,17 @@ function TGeoInfo.LongitudeToString: string; result:=FloatToStr(Longitude,FormatSettings); end; -procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); +procedure GetGeoInfo(const IpAddress: string;var GeoInfo :TGeoInfo); var - lHTTP : TIdHTTP; - lStream : TStringStream; - XMLDoc : OleVariant; - ANode : OleVariant; + lHTTP: TIdHTTP; + lStream: TStringStream; + XMLDoc: OleVariant; + ANode: OleVariant; FormatSettings: TFormatSettings; - d : Double; - Success : HResult; + d: Double; + Success: HResult; begin - lHTTP := TIdHTTP.Create(nil); + lHTTP := TIdHTTP.Create(nil); lStream := TStringStream.Create(''); Success := CoInitializeEx(nil, COINIT_MULTITHREADED); try @@ -190,10 +190,10 @@ procedure GetGeoInfo(const IpAddress : string;var GeoInfo :TGeoInfo); end; end; -function GetLocalComputerName : String; +function GetLocalComputerName: String; var Buffer: array[0..255] of Char; - Size : DWORD; + Size: DWORD; begin size := 256; if GetComputerName(Buffer, Size) then @@ -221,10 +221,10 @@ function GetRemoteHostName(const Addr: string): string; overload; function GetExternalIP: string; var - lHTTP : TIdHTTP; + lHTTP: TIdHTTP; lStream: TStringStream; begin - lHTTP := TIdHTTP.Create(nil); + lHTTP := TIdHTTP.Create(nil); lStream := TStringStream.Create(Result); try try @@ -247,20 +247,20 @@ procedure TGeoTraceThread.Execute; const MaxPings = 3; var - HostName : String; - HostReply : Boolean; - HostIP : LongInt; - HostEnt : PHostEnt; - WSAData : TWSAData; - WsaErr : DWORD; - OldTick : DWORD; - PingTime : DWORD; - TraceResp : Longint; - Index : Word; + HostName: String; + HostReply: Boolean; + HostIP: LongInt; + HostEnt: PHostEnt; + WSAData: TWSAData; + WsaErr: DWORD; + OldTick: DWORD; + PingTime: DWORD; + TraceResp: Longint; + Index: Word; FCurrentTTL: Word; - sValue : string; + sValue: string; FGeoInfoStr: string; - IpAddress : in_addr; + IpAddress: in_addr; begin WsaErr := WSAStartup($101, WSAData); @@ -280,7 +280,7 @@ procedure TGeoTraceThread.Execute; Exit; end; - DestAddr := PInAddr(in_addr(HostEnt.h_addr_list^))^; + DestAddr := PInAddr(in_addr(HostEnt.h_addr_list^))^; TraceHandle := IcmpCreateFile; if TraceHandle = INVALID_HANDLE_VALUE then @@ -301,8 +301,8 @@ procedure TGeoTraceThread.Execute; Synchronize(Log); end; - TraceResp := 0; - FCurrentTTL := 0; + TraceResp := 0; + FCurrentTTL := 0; while (TraceResp <> DestAddr.S_addr) and (FCurrentTTL < FMaxHops) do begin @@ -311,7 +311,7 @@ procedure TGeoTraceThread.Execute; sValue:=''; for Index := 0 to MaxPings-1 do begin - OldTick := GetTickCount; + OldTick := GetTickCount; TraceResp := Trace(FCurrentTTL); if TraceResp = -1 then @@ -326,7 +326,7 @@ procedure TGeoTraceThread.Execute; FLogString := Format(' <%d ms', [1]); HostReply := True; - HostIP := TraceResp; + HostIP := TraceResp; end; if Index = 0 then @@ -353,8 +353,8 @@ procedure TGeoTraceThread.Execute; FServerIpCallBack:=sValue; if FResolveHostName then begin - HostName := GetRemoteHostName(HostIP); - FServerCallBack := HostName; + HostName := GetRemoteHostName(HostIP); + FServerCallBack := HostName; if HostName <> '' then FLogString := FLogString + HostName + ' [' + sValue + '] '+FGeoInfoStr else @@ -390,14 +390,14 @@ procedure TGeoTraceThread.Execute; function TGeoTraceThread.Trace(const Ttl: Byte): Longint; var IPOptionInfo: TIPOptionInformation; - IcmpEcho : PIcmpEchoReply; - IcpmErr : Integer; + IcmpEcho: PIcmpEchoReply; + IcpmErr: Integer; begin GetMem(IcmpEcho, SizeOf(TIcmpEchoReply)); try - IPOptionInfo.Ttl := Ttl; - IPOptionInfo.Tos := 0; - IPOptionInfo.Flags := 0; + IPOptionInfo.Ttl := Ttl; + IPOptionInfo.Tos := 0; + IPOptionInfo.Flags := 0; IPOptionInfo.OptionsSize := 0; IPOptionInfo.OptionsData := nil; diff --git a/OSX/List OSX Processes/uMain.pas b/OSX/List OSX Processes/uMain.pas index 628cc86..90c9f7a 100644 --- a/OSX/List OSX Processes/uMain.pas +++ b/OSX/List OSX Processes/uMain.pas @@ -57,17 +57,17 @@ implementation //Added functions(properties) //Indicates the URL to the application's executable. - function executableURL : NSURL; cdecl;//@property (readonly) NSURL *executableURL; + function executableURL: NSURL; cdecl;//@property (readonly) NSURL *executableURL; //Indicates the name of the application. This is dependent on the current localization of the referenced app, and is suitable for presentation to the user. - function localizedName : NSString; cdecl;//@property (readonly) NSString *localizedName; + function localizedName: NSString; cdecl;//@property (readonly) NSString *localizedName; //Indicates the URL to the application's bundle, or nil if the application does not have a bundle. - function bundleURL : NSURL; cdecl;//@property (readonly) NSURL *bundleURL; + function bundleURL: NSURL; cdecl;//@property (readonly) NSURL *bundleURL; //Indicates the CFBundleIdentifier of the application, or nil if the application does not have an Info.plist. - function bundleIdentifier : NSString; cdecl;//@property (readonly) NSString *bundleIdentifier; + function bundleIdentifier: NSString; cdecl;//@property (readonly) NSString *bundleIdentifier; //Indicates the date when the application was launched. This property is not available for all applications. Specifically, it is not available for applications that were launched without going through LaunchServices. */ - function launchDate : NSDate;cdecl;//@property (readonly) NSDate *launchDate; + function launchDate: NSDate;cdecl;//@property (readonly) NSDate *launchDate; //Returns the icon of the application. - function icon : NSImage;cdecl;//@property (readonly) NSImage *icon; + function icon: NSImage;cdecl;//@property (readonly) NSImage *icon; end; TNSRunningApplicationEx = class(TOCGenericImport) end; @@ -78,11 +78,11 @@ TNSRunningApplicationEx = class(TOCGenericImportnil) then @@ -124,7 +124,7 @@ function TryValidateObject(AClass : TObject; ValidationResult : TStrings = nil): if not ValidationAttribute(LAttr).Validate(LProp.GetValue(AClass)) then begin Result:=false; - sMessage := Format('Failed validation %s on property %s.%s (Hint : %s)', [LAttr.ClassName, AClass.ClassName, LProp.Name, ValidationAttribute(LAttr).CustomMessage]); + sMessage := Format('Failed validation %s on property %s.%s (Hint: %s)', [LAttr.ClassName, AClass.ClassName, LProp.Name, ValidationAttribute(LAttr).CustomMessage]); //store the message in the stringlist if ValidationResult<>nil then ValidationResult.Add(sMessage); @@ -135,13 +135,13 @@ function TryValidateObject(AClass : TObject; ValidationResult : TStrings = nil): end; end; -function TryTransformObject(AClass : TObject; ADirection : TAttributeTransDirection) : boolean; +function TryTransformObject(AClass: TObject; ADirection: TAttributeTransDirection): boolean; var - LContext : TRttiContext; - LType : TRttiType; - LAttr : TCustomAttribute; - LProp : TRttiProperty; - OValue : TValue; + LContext: TRttiContext; + LType: TRttiType; + LAttr: TCustomAttribute; + LProp: TRttiProperty; + OValue: TValue; begin Result:=True; LType:=LContext.GetType(AClass.ClassInfo); @@ -249,7 +249,7 @@ constructor ValidTypesAttribute.Create(const TypeKinds: TTypeKinds); function ValidTypesAttribute.GetCustomMessage: string; var - LKind : TTypeKind; + LKind: TTypeKind; begin Result:=''; if FtypeKinds<>[] then @@ -288,10 +288,10 @@ function TransformAttribute.RunTransform(AValue: TValue; out OutValue: TValue; function EncryptedAttribute.RunTransform(AValue: TValue; out OutValue: TValue; ADirection: TAttributeTransDirection): Boolean; var - Cypher : TPC1Cypher; - I : Integer; - Data : TArray; - LStream : TMemoryStream; + Cypher: TPC1Cypher; + I: Integer; + Data: TArray; + LStream: TMemoryStream; begin //encrypt if ADirection= tdForward then diff --git a/RTTI/Getting the getter and setter of a property using RTTI/uRttiHelper.pas b/RTTI/Getting the getter and setter of a property using RTTI/uRttiHelper.pas index 5fa79f1..76fe463 100644 --- a/RTTI/Getting the getter and setter of a property using RTTI/uRttiHelper.pas +++ b/RTTI/Getting the getter and setter of a property using RTTI/uRttiHelper.pas @@ -9,13 +9,13 @@ interface type TRttiPropertyHelper = class helper for TRttiProperty private - function GetSetterField : TRttiField; - function GetGetterField : TRttiField; + function GetSetterField: TRttiField; + function GetGetterField: TRttiField; public - property SetterField : TRttiField read GetSetterField; - property GetterField : TRttiField read GetGetterField; - function SetterMethod (Instance : TObject) : TRttiMethod; - function GetterMethod (Instance : TObject) : TRttiMethod; + property SetterField: TRttiField read GetSetterField; + property GetterField: TRttiField read GetGetterField; + function SetterMethod (Instance: TObject): TRttiMethod; + function GetterMethod (Instance: TObject): TRttiMethod; end; @@ -43,12 +43,12 @@ function GetCodePointer(Instance: TObject; P: Pointer): Pointer; inline; end; -function GetPropGetterMethod(Instance: TObject; AProp : TRttiProperty) : TRttiMethod; +function GetPropGetterMethod(Instance: TObject; AProp: TRttiProperty): TRttiMethod; var - LPropInfo : PPropInfo; + LPropInfo: PPropInfo; LMethod: TRttiMethod; - LCodeAddress : Pointer; - LType : TRttiType; + LCodeAddress: Pointer; + LType: TRttiType; LocalContext: TRttiContext; begin Result:=nil; @@ -73,12 +73,12 @@ function GetPropGetterMethod(Instance: TObject; AProp : TRttiProperty) : TRttiMe end; end; -function GetPropSetterMethod(Instance: TObject; AProp : TRttiProperty) : TRttiMethod; +function GetPropSetterMethod(Instance: TObject; AProp: TRttiProperty): TRttiMethod; var - LPropInfo : PPropInfo; + LPropInfo: PPropInfo; LMethod: TRttiMethod; - LCodeAddress : Pointer; - LType : TRttiType; + LCodeAddress: Pointer; + LType: TRttiType; LocalContext: TRttiContext; begin Result:=nil; @@ -102,11 +102,11 @@ function GetPropSetterMethod(Instance: TObject; AProp : TRttiProperty) : TRttiMe end; end; -function GetPropGetterField(AProp : TRttiProperty) : TRttiField; +function GetPropGetterField(AProp: TRttiProperty): TRttiField; var - LPropInfo : PPropInfo; + LPropInfo: PPropInfo; LField: TRttiField; - LOffset : Integer; + LOffset: Integer; begin Result:=nil; //Is a readable property? @@ -128,11 +128,11 @@ function GetPropGetterField(AProp : TRttiProperty) : TRttiField; end; end; -function GetPropSetterField(AProp : TRttiProperty) : TRttiField; +function GetPropSetterField(AProp: TRttiProperty): TRttiField; var - LPropInfo : PPropInfo; + LPropInfo: PPropInfo; LField: TRttiField; - LOffset : Integer; + LOffset: Integer; begin Result:=nil; //Is a writable property? diff --git a/RTTI/Rtti Explorer Lite/MainRttiExpl.pas b/RTTI/Rtti Explorer Lite/MainRttiExpl.pas index 2515034..5b4243e 100644 --- a/RTTI/Rtti Explorer Lite/MainRttiExpl.pas +++ b/RTTI/Rtti Explorer Lite/MainRttiExpl.pas @@ -38,7 +38,7 @@ TFrmRTTIExplLite = class(TForm) procedure FormDestroy(Sender: TObject); private { Private declarations } - ctx : TRttiContext; + ctx: TRttiContext; procedure LoadTree; procedure LoadClasses; function FindTextTv(Text:string;Tv:TTreeView):TTreeNode; @@ -65,7 +65,7 @@ implementation procedure ShowRttiLiteExplorer; var - Frm : TFrmRTTIExplLite; + Frm: TFrmRTTIExplLite; begin Frm:= TFrmRTTIExplLite.Create(nil); try @@ -132,7 +132,7 @@ procedure TFrmRTTIExplLite.BtnFillClick(Sender: TObject); procedure TFrmRTTIExplLite.BtnSearchClick(Sender: TObject); Var - Node : TTreeNode; + Node: TTreeNode; begin if Trim(EditSearch.Text)='' then exit; @@ -164,7 +164,7 @@ procedure TFrmRTTIExplLite.BtnSearchClick(Sender: TObject); function TFrmRTTIExplLite.FindTextTv(Text: string;Tv:TTreeView): TTreeNode; var - Node : TTreeNode; + Node: TTreeNode; begin Result:=nil; Tv.Items.BeginUpdate; @@ -209,8 +209,8 @@ procedure TFrmRTTIExplLite.LoadClasses; function FindTRttiType(lType:TRttiType):TTreeNode; var - i : integer; - Node : TTreeNode; + i: integer; + Node: TTreeNode; begin Result:=nil; if not Assigned(lType) then exit; @@ -229,9 +229,9 @@ procedure TFrmRTTIExplLite.LoadClasses; function FindFirstTRttiTypeOrphan:TTreeNode; var - i : integer; - Node : TTreeNode; - lType : TRttiType; + i: integer; + Node: TTreeNode; + lType: TRttiType; begin Result:=nil; for i:=0 to TreeViewClasses.Items.Count-1 do @@ -250,10 +250,10 @@ procedure TFrmRTTIExplLite.LoadClasses; end; var - TypeList : TArray; - lType : TRttiType; - PNode : TTreeNode; - Node : TTreeNode; + TypeList: TArray; + lType: TRttiType; + PNode: TTreeNode; + Node: TTreeNode; begin TreeViewClasses.Items.BeginUpdate; try @@ -293,20 +293,20 @@ procedure TFrmRTTIExplLite.LoadTree; end; var - lType : TRttiType; - lMethod : TRttiMethod; + lType: TRttiType; + lMethod: TRttiMethod; lProperty: TRttiProperty; - lField : TRttiField; + lField: TRttiField; - PNode : TTreeNode; - Node : TTreeNode; + PNode: TTreeNode; + Node: TTreeNode; - TypeList : TArray; - Units : TStrings; - UnitName : string; + TypeList: TArray; + Units: TStrings; + UnitName: string; - Package : TRttiPackage; - PackageN : TTreeNode; + Package: TRttiPackage; + PackageN: TTreeNode; begin TreeViewRtti.Items.BeginUpdate; TreeViewRtti.Items.Clear; @@ -354,15 +354,15 @@ procedure TFrmRTTIExplLite.LoadTree; procedure TFrmRTTIExplLite.TreeViewRttiChange(Sender: TObject; Node: TTreeNode); Var - aNode : TTreeNode; - lTyp : TRttiType; - lType : TRttiType; - lMethod : TRttiMethod; + aNode: TTreeNode; + lTyp: TRttiType; + lType: TRttiType; + lMethod: TRttiMethod; lProperty: TRttiProperty; - lProp : TRttiProperty; - lField : TRttiField; + lProp: TRttiProperty; + lField: TRttiField; - Item : TListItem; + Item: TListItem; begin aNode:=TreeViewRtti.Selected; if aNode<>nil then @@ -473,156 +473,148 @@ procedure TFrmRTTIExplLite.TreeViewRttiCustomDrawItem(Sender: TCustomTreeView; var FontColor: TColor; BackColor: TColor; - lType : TRttiType; - //lMethod : TRttiMethod; + lType: TRttiType; + //lMethod: TRttiMethod; //lProperty: TRttiProperty; - //lField : TRttiField; + //lField: TRttiField; begin - FontColor := Sender.Canvas.Font.Color; + FontColor := Sender.Canvas.Font.Color; Sender.Canvas.Font.Color := clNavy; Sender.Canvas.Font.Color := FontColor; - BackColor := clWindow; - FontColor := clWindowText; - - case Node.Level of - Package_Level : - Begin - FontColor := clBlack; - Sender.Canvas.Font.Style := [fsBold]; - end; - - Unit_Level : - Begin - FontColor := clRed; - end; - - Type_Level : - Begin - lType:=Node.Data; - - if lType<>nil then - case lType.TypeKind of - tkClass : Begin - FontColor := clGreen; - Sender.Canvas.Font.Style := [fsBold] - End; - - else FontColor := clBlue; - - end; - end; - - Field_Level : - begin - if Node.Data=nil then exit; + BackColor := clWindow; + FontColor := clWindowText; - if TRttiObject(Node.Data).ClassNameIs('TRttiInstanceMethodEx') then - begin - //lMethod:=Node.Data; - FontColor := clGray; - end - else - if TRttiObject(Node.Data).ClassNameIs('TRttiInstancePropertyEx') then - begin - //lProperty:=Node.Data; - FontColor := clNavy; - end; - end; + case Node.Level of + Package_Level : + begin + FontColor := clBlack; + Sender.Canvas.Font.Style := [fsBold]; end; - - - if (Node.Selected) then + + Unit_Level : + begin + FontColor := clRed; + end; + + Type_Level : + begin + lType := Node.Data; + if lType<>nil then + case lType.TypeKind of + tkClass: + begin + FontColor := clGreen; + Sender.Canvas.Font.Style := [fsBold] + End; + else FontColor := clBlue; + end; + end; + Field_Level : begin - BackColor := clHighlight; - FontColor := clWindow; + if Node.Data = nil then exit; + + if TRttiObject(Node.Data).ClassNameIs('TRttiInstanceMethodEx') then + begin + //lMethod:=Node.Data; + FontColor := clGray; + end + else + if TRttiObject(Node.Data).ClassNameIs('TRttiInstancePropertyEx') then + begin + //lProperty:=Node.Data; + FontColor := clNavy; + end; end; + end; - Sender.Canvas.Brush.Color := BackColor; - Sender.Canvas.Font.Color := FontColor; - DefaultDraw := True; + if (Node.Selected) then + begin + BackColor := clHighlight; + FontColor := clWindow; + end; + + Sender.Canvas.Brush.Color := BackColor; + Sender.Canvas.Font.Color := FontColor; + DefaultDraw := True; end; procedure TFrmRTTIExplLite.TreeViewRttiDblClick(Sender: TObject); - function FindRttyType(lType:TRttiType):TTreeNode; - var - i : integer; - begin - Result:=nil; - for i:=0 to TreeViewRtti.Items.Count-1 do - if TreeViewRtti.Items[i].Level=Type_Level then - begin - Result:=TreeViewRtti.Items[i]; - if Assigned(Result.Data) then - if lType.QualifiedName=TRttiType(Result.Data).QualifiedName then - break; - end; - - end; + function FindRttyType(lType:TRttiType):TTreeNode; + var + i: integer; + begin + Result := nil; + for i:= 0 to TreeViewRtti.Items.Count-1 do + if TreeViewRtti.Items[i].Level=Type_Level then + begin + Result := TreeViewRtti.Items[i]; + if Assigned(Result.Data) then + if lType.QualifiedName = TRttiType(Result.Data).QualifiedName then + break; + end; + end; Var - Node : TTreeNode; - lType : TRttiType; - lMethod : TRttiMethod; + Node: TTreeNode; + lType: TRttiType; + lMethod: TRttiMethod; lProperty: TRttiProperty; - lField : TRttiField; + lField: TRttiField; begin - Node:=TreeViewRtti.Selected; - case Node.Level of - Field_Level : - begin - - if TRttiObject(Node.Data).ClassNameIs('TRttiInstanceFieldEx') then - begin - lField :=Node.Data; - lType :=ctx.FindType(lField.FieldType.QualifiedName); - if Assigned(lType) then - begin - Node:=FindRttyType(lType); - if Node<>nil then - begin - Node.MakeVisible; - TreeViewRtti.Selected:=Node; - end; - end; - end - else - if TRttiObject(Node.Data).ClassNameIs('TRttiInstancePropertyEx') then - begin - lProperty :=Node.Data; - lType :=ctx.FindType(lProperty.PropertyType.QualifiedName); - if Assigned(lType) then - begin - Node:=FindRttyType(lType); - if Node<>nil then - begin - Node.MakeVisible; - TreeViewRtti.Selected:=Node; - end; - end; - end - else - if TRttiObject(Node.Data).ClassNameIs('TRttiInstanceMethodEx') then - begin - lMethod :=Node.Data; - if lMethod.HasExtendedInfo and (lMethod.MethodKind in [mkFunction,mkClassFunction]) then - begin - lType :=ctx.FindType(lMethod.ReturnType.QualifiedName); - if Assigned(lType) then - begin - Node:=FindRttyType(lType); - if Node<>nil then - begin - Node.MakeVisible; - TreeViewRtti.Selected:=Node; - end; - end; - end; - end; - - - end; + Node:=TreeViewRtti.Selected; + case Node.Level of + Field_Level : + begin + if TRttiObject(Node.Data).ClassNameIs('TRttiInstanceFieldEx') then + begin + lField := Node.Data; + lType := ctx.FindType(lField.FieldType.QualifiedName); + if Assigned(lType) then + begin + Node := FindRttyType(lType); + if Node <> nil then + begin + Node.MakeVisible; + TreeViewRtti.Selected := Node; + end; + end; + end + else + if TRttiObject(Node.Data).ClassNameIs('TRttiInstancePropertyEx') then + begin + lProperty := Node.Data; + lType := ctx.FindType(lProperty.PropertyType.QualifiedName); + if Assigned(lType) then + begin + Node := FindRttyType(lType); + if Node<>nil then + begin + Node.MakeVisible; + TreeViewRtti.Selected:=Node; + end; + end; + end + else + if TRttiObject(Node.Data).ClassNameIs('TRttiInstanceMethodEx') then + begin + lMethod := Node.Data; + if lMethod.HasExtendedInfo and (lMethod.MethodKind in [mkFunction,mkClassFunction]) then + begin + lType := ctx.FindType(lMethod.ReturnType.QualifiedName); + if Assigned(lType) then + begin + Node := FindRttyType(lType); + if Node <> nil then + begin + Node.MakeVisible; + TreeViewRtti.Selected:=Node; + end; + end; + end; end; + end; + end; end; end. diff --git a/System/BIOS/SMBIOS/uSMBIOS.pas b/System/BIOS/SMBIOS/uSMBIOS.pas index 9a3f520..82d519b 100644 --- a/System/BIOS/SMBIOS/uSMBIOS.pas +++ b/System/BIOS/SMBIOS/uSMBIOS.pas @@ -1,5 +1,5 @@ -//Author Rodrigo Ruz V. -//2011-08-01 +// Author Rodrigo Ruz V. +// 2011-08-01 unit uSMBIOS; @@ -51,7 +51,7 @@ interface ReleaseDate: Byte; BiosRomSize: Byte; Characteristics: Int64; - ExtensionBytes : array [0..1] of Byte; + ExtensionBytes: array [0..1] of Byte; end; TSysInfo = packed record @@ -124,7 +124,7 @@ interface TSMBiosTableEntry = record Header: TSmBiosTableHeader; - Index : Integer; + Index: Integer; end; TSMBios = class @@ -166,25 +166,25 @@ TSMBios = class property Buffer: PByteArray read FBuffer; property DataString: AnsiString read FDataString; property DmiRevision: Integer read FDmiRevision; - property SmbiosMajorVersion : Integer read FSmbiosMajorVersion; - property SmbiosMinorVersion : Integer read FSmbiosMinorVersion; - property SMBiosTablesList : TList read FSMBiosTablesList; + property SmbiosMajorVersion: Integer read FSmbiosMajorVersion; + property SmbiosMinorVersion: Integer read FSmbiosMinorVersion; + property SMBiosTablesList: TList read FSMBiosTablesList; property BiosInfo: TBiosInfo read FBiosInfo Write FBiosInfo; property BiosInfoIndex: Integer read FBiosInfoIndex Write FBiosInfoIndex; - property HasBiosInfo : Boolean read GetHasBiosInfo; + property HasBiosInfo: Boolean read GetHasBiosInfo; property SysInfo: TSysInfo read FSysInfo Write FSysInfo; property SysInfoIndex: Integer read FSysInfoIndex Write FSysInfoIndex; - property HasSysInfo : Boolean read GetHasSysInfo; + property HasSysInfo: Boolean read GetHasSysInfo; property BaseBoardInfo: TBaseBoardInfo read FBaseBoardInfo write FBaseBoardInfo; property BaseBoardInfoIndex: Integer read FBaseBoardInfoIndex Write FBaseBoardInfoIndex; - property HasBaseBoardInfo : Boolean read GetHasBaseBoardInfo; + property HasBaseBoardInfo: Boolean read GetHasBaseBoardInfo; property EnclosureInfo: TEnclosureInfo read FEnclosureInfo write FEnclosureInfo; property EnclosureInfoIndex: Integer read FEnclosureInfoIndex Write FEnclosureInfoIndex; - property HasEnclosureInfo : Boolean read GetHasEnclosureInfo; + property HasEnclosureInfo: Boolean read GetHasEnclosureInfo; property ProcessorInfo: TProcessorInfo read FProcessorInfo write FProcessorInfo; property ProcessorInfoIndex: Integer read FProcessorInfoIndex Write FProcessorInfoIndex; - property HasProcessorInfo : Boolean read GetHasProcessorInfo; + property HasProcessorInfo: Boolean read GetHasProcessorInfo; end; implementation @@ -242,10 +242,10 @@ function TSMBios.GetHasSysInfo: Boolean; function TSMBios.SearchSMBiosTable(TableType: SMBiosTables): integer; Var - Index : integer; - Header : TSmBiosTableHeader; + Index: integer; + Header: TSmBiosTableHeader; begin - Index := 0; + Index := 0; repeat Move(Buffer[Index], Header, SizeOf(Header)); @@ -296,7 +296,7 @@ function TSMBios.GetSMBiosString(Entry, Index: integer): AnsiString; function TSMBios.GetSMBiosTableIndex(TableType: SMBiosTables): integer; Var - Entry : TSMBiosTableEntry; + Entry: TSMBiosTableEntry; begin Result:=-1; for Entry in FSMBiosTablesList do @@ -309,12 +309,12 @@ function TSMBios.GetSMBiosTableIndex(TableType: SMBiosTables): integer; function TSMBios.GetSMBiosTablesList: TList; Var - Index : integer; + Index: integer; Header: TSmBiosTableHeader; - Entry : TSMBiosTableEntry; + Entry: TSMBiosTableEntry; begin - Result := TList.Create; - Index := 0; + Result := TList.Create; + Index := 0; repeat Move(Buffer[Index], Header, SizeOf(Header)); Entry.Header:=Header; diff --git a/VCL/VCL Styles/VCL Styles Hooks/uMain.pas b/VCL/VCL Styles/VCL Styles Hooks/uMain.pas index 634e363..ee63cb0 100644 --- a/VCL/VCL Styles/VCL Styles Hooks/uMain.pas +++ b/VCL/VCL Styles/VCL Styles Hooks/uMain.pas @@ -44,9 +44,9 @@ procedure TFrmMain.FormCreate(Sender: TObject); procedure TFrmMain.ListStyleHooks; var - RttiType : TRttiType; - Item : TListItem; - List : TStyleHookList; + RttiType: TRttiType; + Item: TListItem; + List: TStyleHookList; StyleClass: TStyleHookClass; begin for RttiType in TRttiContext.Create.GetTypes do diff --git a/VCL/VCL Styles/VCL Styles Hooks/uVCLStyleUtils.pas b/VCL/VCL Styles/VCL Styles Hooks/uVCLStyleUtils.pas index fa1b7e2..9499aae 100644 --- a/VCL/VCL Styles/VCL Styles Hooks/uVCLStyleUtils.pas +++ b/VCL/VCL Styles/VCL Styles Hooks/uVCLStyleUtils.pas @@ -13,8 +13,8 @@ interface Procedure ApplyEmptyVCLStyleHook(ControlClass :TClass); Procedure RemoveEmptyVCLStyleHook(ControlClass :TClass); -function IsStyleHookRegistered(ControlClass: TClass; StyleHookClass: TStyleHookClass) : Boolean; -function GetRegisteredStylesHooks(ControlClass: TClass) : TStyleHookList; +function IsStyleHookRegistered(ControlClass: TClass; StyleHookClass: TStyleHookClass): Boolean; +function GetRegisteredStylesHooks(ControlClass: TClass): TStyleHookList; implementation @@ -25,7 +25,7 @@ implementation TStyleHookDictionary = TDictionary; TCustomStyleEngineHelper = Class Helper for TCustomStyleEngine public - class function GetRegisteredStyleHooks : TStyleHookDictionary; + class function GetRegisteredStyleHooks: TStyleHookDictionary; end; @@ -34,9 +34,9 @@ class function TCustomStyleEngineHelper.GetRegisteredStyleHooks: TStyleHookDicti Result:= Self.FRegisteredStyleHooks; end; -function IsStyleHookRegistered(ControlClass: TClass; StyleHookClass: TStyleHookClass) : Boolean; +function IsStyleHookRegistered(ControlClass: TClass; StyleHookClass: TStyleHookClass): Boolean; var - List : TStyleHookList; + List: TStyleHookList; begin Result:=False; if TCustomStyleEngine.GetRegisteredStyleHooks.ContainsKey(ControlClass) then @@ -46,7 +46,7 @@ function IsStyleHookRegistered(ControlClass: TClass; StyleHookClass: TStyleHook end; end; -function GetRegisteredStylesHooks(ControlClass: TClass) : TStyleHookList; +function GetRegisteredStylesHooks(ControlClass: TClass): TStyleHookList; begin Result:=nil; if TCustomStyleEngine.GetRegisteredStyleHooks.ContainsKey(ControlClass) then diff --git a/VCL/VCL Styles/VCL Styles Listview Ownerdraw/main.pas b/VCL/VCL Styles/VCL Styles Listview Ownerdraw/main.pas index 668baf1..0974fdc 100644 --- a/VCL/VCL Styles/VCL Styles Listview Ownerdraw/main.pas +++ b/VCL/VCL Styles/VCL Styles Listview Ownerdraw/main.pas @@ -25,7 +25,7 @@ TFrmMain = class(TForm) procedure LvSampleDataDrawItem(Sender: TCustomListView; Item: TListItem; Rect: TRect; State: TOwnerDrawState); private - FColumns : TDictionary; + FColumns: TDictionary; procedure AddColumns(); procedure AddItems(); public @@ -45,16 +45,16 @@ implementation procedure TFrmMain.AddColumns; - Procedure AddColumn(const AColumnName : String; AWidth : Integer; AColumnType : TColumnType); + Procedure AddColumn(const AColumnName: String; AWidth: Integer; AColumnType: TColumnType); begin FColumns.Add(AColumnName, LvSampleData.Columns.Add()); FColumns[AColumnName].Caption := AColumnName; - FColumns[AColumnName].Width := AWidth; - FColumns[AColumnName].Tag := Integer(AColumnType); + FColumns[AColumnName].Width := AWidth; + FColumns[AColumnName].Tag := Integer(AColumnType); end; begin - FColumns := TDictionary.Create(); + FColumns := TDictionary.Create(); AddColumn('Text', 150, ctText); AddColumn('Porc', 100, ctProgress); AddColumn('Text2', 150, ctText); @@ -65,8 +65,8 @@ procedure TFrmMain.AddItems; const MaxItems = 100; var - LItem : TListItem; - i : Integer; + LItem: TListItem; + i: Integer; begin Randomize; LvSampleData.Items.BeginUpdate; @@ -112,16 +112,16 @@ procedure TFrmMain.LvSampleDataDrawItem(Sender: TCustomListView; Item: TListItem ListView_Padding = 5; var LRect, LRect2: TRect; - i, p : Integer; + i, p: Integer; LText: string; LSize: TSize; LDetails: TThemedElementDetails; - LTextFormat : TTextFormatFlags; - LColor : TColor; - LStyleService : TCustomStyleServices; - LColummnType : TColumnType; + LTextFormat: TTextFormatFlags; + LColor: TColor; + LStyleService: TCustomStyleServices; + LColummnType: TColumnType; begin - LStyleService := StyleServices; + LStyleService := StyleServices; if not LStyleService.Enabled then exit; Sender.Canvas.Brush.Style := bsSolid; @@ -133,7 +133,7 @@ procedure TFrmMain.LvSampleDataDrawItem(Sender: TCustomListView; Item: TListItem for i := 0 to TListView(Sender).Columns.Count - 1 do begin LColummnType := TColumnType(TListView(Sender).Columns[i].Tag); - LRect.Right := LRect.Left + Sender.Column[i].Width; + LRect.Right := LRect.Left + Sender.Column[i].Width; LText := ''; if i = 0 then @@ -171,10 +171,10 @@ procedure TFrmMain.LvSampleDataDrawItem(Sender: TCustomListView; Item: TListItem LSize.cx := GetSystemMetrics(SM_CXMENUCHECK); LSize.cy := GetSystemMetrics(SM_CYMENUCHECK); - LRect2.Top := Rect.Top + (Rect.Bottom - Rect.Top - LSize.cy) div 2; + LRect2.Top := Rect.Top + (Rect.Bottom - Rect.Top - LSize.cy) div 2; LRect2.Bottom := LRect2.Top + LSize.cy; - LRect2.Left := LRect.Left + ((LRect.Width - LSize.cx) div 2); - LRect2.Right := LRect2.Left + LSize.cx; + LRect2.Left := LRect.Left + ((LRect.Width - LSize.cx) div 2); + LRect2.Right := LRect2.Left + LSize.cx; if (LText = '1') then begin @@ -202,7 +202,7 @@ procedure TFrmMain.LvSampleDataDrawItem(Sender: TCustomListView; Item: TListItem LStyleService.DrawElement(Sender.Canvas.Handle, LDetails, LRect); end; - LRect2 := ResizeRect(LRect, 2, 2, 2, 2); + LRect2 := ResizeRect(LRect, 2, 2, 2, 2); LDetails := LStyleService.GetElementDetails(tpBar); LStyleService.DrawElement(Sender.Canvas.Handle, LDetails, LRect2); diff --git a/VCL/VCL Styles/VCL Styles Owner Draw Sample/Main.pas b/VCL/VCL Styles/VCL Styles Owner Draw Sample/Main.pas index 714fd0b..69f80c0 100644 --- a/VCL/VCL Styles/VCL Styles Owner Draw Sample/Main.pas +++ b/VCL/VCL Styles/VCL Styles Owner Draw Sample/Main.pas @@ -21,7 +21,7 @@ TFrmMain = class(TForm) private { Private declarations } - Procedure SetOwnerDraw(Value : Boolean); + Procedure SetOwnerDraw(Value: Boolean); public { Public declarations } end; @@ -45,8 +45,8 @@ procedure TFrmMain.CheckBox1Click(Sender: TObject); procedure TFrmMain.FormCreate(Sender: TObject); var - i : integer; - Item : TListItem; + i: integer; + Item: TListItem; begin SetOwnerDraw(CheckBox1.Checked); for i:=0 to 99 do @@ -65,9 +65,9 @@ procedure TFrmMain.FormCreate(Sender: TObject); procedure TFrmMain.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); Var - LListBox : TListBox; - LStyles : TCustomStyleServices; - LDetails : TThemedElementDetails; + LListBox: TListBox; + LStyles: TCustomStyleServices; + LDetails: TThemedElementDetails; begin LListBox :=TListBox(Control); LStyles :=StyleServices; @@ -92,15 +92,15 @@ procedure TFrmMain.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: procedure TFrmMain.ListView1DrawItem(Sender: TCustomListView; Item: TListItem; Rect: TRect; State: TOwnerDrawState); var - r : TRect; - rc : TRect; - ColIdx : Integer; - s : string; - LDetails : TThemedElementDetails; - LStyles : TCustomStyleServices; - BoxSize : TSize; - Spacing : Integer; - LColor : TColor; + r: TRect; + rc: TRect; + ColIdx: Integer; + s: string; + LDetails: TThemedElementDetails; + LStyles: TCustomStyleServices; + BoxSize: TSize; + Spacing: Integer; + LColor: TColor; begin Spacing:=4; LStyles:=StyleServices; @@ -108,7 +108,7 @@ procedure TFrmMain.ListView1DrawItem(Sender: TCustomListView; Item: TListItem; LColor := LStyles.GetSystemColor(clWindowText); Sender.Canvas.Brush.Color := LStyles.GetStyleColor(scListView); - Sender.Canvas.Font.Color := LColor; + Sender.Canvas.Font.Color := LColor; Sender.Canvas.FillRect(Rect); r := Rect; @@ -157,10 +157,10 @@ procedure TFrmMain.ListView1DrawItem(Sender: TCustomListView; Item: TListItem; if (ColIdx=0) and TListView(Sender).Checkboxes then begin rc := Rect; - rc.Top := Rect.Top + (Rect.Bottom - Rect.Top - BoxSize.cy) div 2; + rc.Top := Rect.Top + (Rect.Bottom - Rect.Top - BoxSize.cy) div 2; rc.Bottom := rc.Top + BoxSize.cy; - rc.Left := rc.Left + Spacing; - rc.Right := rc.Left + BoxSize.cx; + rc.Left := rc.Left + Spacing; + rc.Right := rc.Left + BoxSize.cx; if Item.Checked then LDetails := StyleServices.GetElementDetails(tbCheckBoxUncheckedNormal) diff --git a/WMI/WMI File Explorer/uMain.pas b/WMI/WMI File Explorer/uMain.pas index 37a7855..07e2aa4 100644 --- a/WMI/WMI File Explorer/uMain.pas +++ b/WMI/WMI File Explorer/uMain.pas @@ -35,22 +35,22 @@ TFrmMain = class(TForm) procedure EditUserExit(Sender: TObject); procedure EditPasswordExit(Sender: TObject); private - Dt : OleVariant; - FSWbemLocator : OLEVariant; - FWMIService : OLEVariant; - FExtensions : TStringList; + Dt: OleVariant; + FSWbemLocator: OLEVariant; + FWMIService: OLEVariant; + FExtensions: TStringList; FComputer: string; FUser: string; FPassword: string; - function ConnectWMI : boolean; + function ConnectWMI: boolean; procedure UpdateFolderTreeItem(Node:TTreeNode); procedure UpdateFileTreeItem(Node:TTreeNode); - function VarDateToDateTime(const V : OleVariant): TDateTime; - function GetNodeFullPath(Node:TTreeNode) : string; - function GetImageIndexExt(const Ext : string) : Integer; - property Computer : string read FComputer; - property User : string read FUser; - property Password : string read FPassword; + function VarDateToDateTime(const V: OleVariant): TDateTime; + function GetNodeFullPath(Node:TTreeNode): string; + function GetImageIndexExt(const Ext: string): Integer; + property Computer: string read FComputer; + property User: string read FUser; + property Password: string read FPassword; public { Public declarations } end; @@ -122,11 +122,11 @@ procedure TFrmMain.BtnConnectClick(Sender: TObject); end; end; -function TFrmMain.ConnectWMI : Boolean; +function TFrmMain.ConnectWMI: Boolean; begin Result:=False; try - FWMIService := FSWbemLocator.ConnectServer(Computer, 'root\CIMV2', User, Password); + FWMIService := FSWbemLocator.ConnectServer(Computer, 'root\CIMV2', User, Password); Result:=True; except on E:EOleException do @@ -169,8 +169,8 @@ procedure TFrmMain.FormDestroy(Sender: TObject); function TFrmMain.GetImageIndexExt(const Ext: string): Integer; var - Icon : TIcon; - FileInfo : SHFILEINFO; + Icon: TIcon; + FileInfo: SHFILEINFO; begin ZeroMemory(@FileInfo, SizeOf(FileInfo)); Result:=FExtensions.IndexOf(Ext); @@ -211,22 +211,22 @@ procedure TFrmMain.TreeViewFoldersChange(Sender: TObject; Node: TTreeNode); UpdateFileTreeItem(Node); except on E: Exception do - ShowMessage(Format('Message : %s : Trace %s',[E.Message, E.StackTrace])); + ShowMessage(Format('Message: %s: Trace %s',[E.Message, E.StackTrace])); end; end; procedure TFrmMain.UpdateFileTreeItem(Node: TTreeNode); Var FWbemObjectSet: OLEVariant; - FWbemObject : OLEVariant; - oEnum : IEnumvariant; - iValue : LongWord; - sValue : String; - Path : String; - Drive : String; - WmiPath : String; - Item : TListItem; - Wql : String; + FWbemObject: OLEVariant; + oEnum: IEnumvariant; + iValue: LongWord; + sValue: String; + Path: String; + Drive: String; + WmiPath: String; + Item: TListItem; + Wql: String; begin Path :=GetNodeFullPath(Node); Drive :=ExtractFileDrive(Path); @@ -240,7 +240,7 @@ procedure TFrmMain.UpdateFileTreeItem(Node: TTreeNode); Wql:=Format('SELECT Name,FileSize,CreationDate,FileType FROM CIM_DataFile Where Drive="%s" AND Path="%s"',[Drive,WmiPath]); MemoLog.Lines.Add(Wql); FWbemObjectSet:= FWMIService.ExecQuery(Wql,'WQL',wbemFlagForwardOnly); - oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; + oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; while oEnum.Next(1, FWbemObject, iValue) = 0 do begin sValue:=FWbemObject.Name; @@ -261,17 +261,17 @@ procedure TFrmMain.UpdateFileTreeItem(Node: TTreeNode); procedure TFrmMain.UpdateFolderTreeItem(Node: TTreeNode); Var - lNode : TTreeNode; + lNode: TTreeNode; FWbemObjectSet: OLEVariant; - FWbemObject : OLEVariant; - oEnum : IEnumvariant; - iValue : LongWord; + FWbemObject: OLEVariant; + oEnum: IEnumvariant; + iValue: LongWord; - sValue : string; - Path : string; - Drive : string; - WmiPath : string; - Wql : string; + sValue: string; + Path: string; + Drive: string; + WmiPath: string; + Wql: string; begin if Node=nil then begin @@ -279,7 +279,7 @@ procedure TFrmMain.UpdateFolderTreeItem(Node: TTreeNode); TreeViewFolders.Items.Clear; try FWbemObjectSet:= FWMIService.ExecQuery('SELECT Name FROM Win32_LogicalDisk','WQL',wbemFlagForwardOnly); - oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; + oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; while oEnum.Next(1, FWbemObject, iValue) = 0 do begin sValue:=Trim(FWbemObject.Name); @@ -305,7 +305,7 @@ procedure TFrmMain.UpdateFolderTreeItem(Node: TTreeNode); Wql :=Format('SELECT Name FROM CIM_Directory Where Drive="%s" AND Path="%s"',[Drive,WmiPath]); MemoLog.Lines.Add(Wql); FWbemObjectSet:= FWMIService.ExecQuery(Wql,'WQL',wbemFlagForwardOnly); - oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; + oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; while oEnum.Next(1, FWbemObject, iValue) = 0 do begin sValue:=Trim(FWbemObject.Name); diff --git a/WMI/WMI File Explorer/uStackTrace.pas b/WMI/WMI File Explorer/uStackTrace.pas index b38bc22..0162a06 100644 --- a/WMI/WMI File Explorer/uStackTrace.pas +++ b/WMI/WMI File Explorer/uStackTrace.pas @@ -14,11 +14,11 @@ function GetExceptionStackInfoProc(P: PExceptionRecord):Pointer; function GetStackInfoStringProc(Info: Pointer): string; var - StackInfoList : TJclStackInfoList; - List : TStringList; + StackInfoList: TJclStackInfoList; + List: TStringList; begin if Info = nil then Exit; - List := TStringList.Create; + List := TStringList.Create; try StackInfoList := TJclStackInfoList(Info); StackInfoList.AddToStrings(List); @@ -37,16 +37,16 @@ initialization if JclStartExceptionTracking then begin Exception.GetExceptionStackInfoProc := GetExceptionStackInfoProc; - Exception.GetStackInfoStringProc := GetStackInfoStringProc; - Exception.CleanUpStackInfoProc := CleanUpStackInfoProc; + Exception.GetStackInfoStringProc := GetStackInfoStringProc; + Exception.CleanUpStackInfoProc := CleanUpStackInfoProc; end; finalization if JclExceptionTrackingActive then begin Exception.GetExceptionStackInfoProc := nil; - Exception.GetStackInfoStringProc := nil; - Exception.CleanUpStackInfoProc := nil; + Exception.GetStackInfoStringProc := nil; + Exception.CleanUpStackInfoProc := nil; JclStopExceptionTracking; end; end. diff --git a/Winapi/COM/Preview Handlers/PreviewHandler Host/uHostPreview.pas b/Winapi/COM/Preview Handlers/PreviewHandler Host/uHostPreview.pas index 5c8cc3b..7775b77 100644 --- a/Winapi/COM/Preview Handlers/PreviewHandler Host/uHostPreview.pas +++ b/Winapi/COM/Preview Handlers/PreviewHandler Host/uHostPreview.pas @@ -31,11 +31,11 @@ interface type THostPreviewHandler = class(TCustomControl) private - FFileStream : TFileStream; - FPreviewGUIDStr : string; + FFileStream: TFileStream; + FPreviewGUIDStr: string; FFileName: string; FLoaded :Boolean; - FPreviewHandler : IPreviewHandler; + FPreviewHandler: IPreviewHandler; procedure SetFileName(const Value: string); procedure LoadPreviewHandler; procedure WMSize(var Message: TWMSize); message WM_SIZE; @@ -178,13 +178,13 @@ procedure THostPreviewHandler.LoadPreviewHandler; const GUID_ISHELLITEM = '{43826d1e-e718-42ee-bc55-a1e261c37bfe}'; var - prc : TRect; - LPreviewGUID : TGUID; - LInitializeWithFile : IInitializeWithFile; - LInitializeWithStream : IInitializeWithStream; - LInitializeWithItem : IInitializeWithItem; - LIStream : IStream; - LShellItem : IShellItem; + prc: TRect; + LPreviewGUID: TGUID; + LInitializeWithFile: IInitializeWithFile; + LInitializeWithStream: IInitializeWithStream; + LInitializeWithItem: IInitializeWithItem; + LIStream: IStream; + LShellItem: IShellItem; begin FLoaded:=False; @@ -235,7 +235,7 @@ procedure THostPreviewHandler.SetFileName(const Value: string); procedure THostPreviewHandler.WMSize(var Message: TWMSize); var - prc : TRect; + prc: TRect; begin inherited; if FPreviewHandler<>nil then diff --git a/Winapi/COM/Preview Handlers/PreviewHandler Host/uMain.pas b/Winapi/COM/Preview Handlers/PreviewHandler Host/uMain.pas index 429a59b..4a03ee8 100644 --- a/Winapi/COM/Preview Handlers/PreviewHandler Host/uMain.pas +++ b/Winapi/COM/Preview Handlers/PreviewHandler Host/uMain.pas @@ -19,7 +19,7 @@ TFrmMain = class(TForm) private { Private declarations } FPreview: THostPreviewHandler; - procedure LoadPreview(const FileName : string); + procedure LoadPreview(const FileName: string); public { Public declarations } end; @@ -58,7 +58,7 @@ procedure TFrmMain.LoadPreview(const FileName: string); FPreview.Width := Panel1.ClientWidth; FPreview.Height := Panel1.ClientHeight; FPreview.Parent := Panel1; - FPreview.Align := alClient; + FPreview.Align := alClient; //FPreview.FileName:='C:\Users\Dexter\Desktop\RAD Studio Projects\XE2\delphi-preview-handler\main.pas'; //FPreview.FileName:='C:\Users\Dexter\Desktop\RAD Studio Projects\2010\SMBIOS Delphi\Docs\DSP0119.pdf'; //FPreview.FileName:='C:\Users\Dexter\Desktop\seleccion\RePLE.msg'; diff --git a/Winapi/COM/Preview Handlers/PreviewHandler Host_Without_TShellListView/uMain.pas b/Winapi/COM/Preview Handlers/PreviewHandler Host_Without_TShellListView/uMain.pas index 4a636fc..7db5780 100644 --- a/Winapi/COM/Preview Handlers/PreviewHandler Host_Without_TShellListView/uMain.pas +++ b/Winapi/COM/Preview Handlers/PreviewHandler Host_Without_TShellListView/uMain.pas @@ -20,7 +20,7 @@ TFrmMain = class(TForm) private { Private declarations } FPreview: THostPreviewHandler; - procedure LoadPreview(const FileName : string); + procedure LoadPreview(const FileName: string); public { Public declarations } end; @@ -69,7 +69,7 @@ procedure TFrmMain.LoadPreview(const FileName: string); FPreview.Width := Panel1.ClientWidth; FPreview.Height := Panel1.ClientHeight; FPreview.Parent := Panel1; - FPreview.Align := alClient; + FPreview.Align := alClient; //FPreview.FileName:='C:\Users\Dexter\Desktop\RAD Studio Projects\XE2\delphi-preview-handler\main.pas'; //FPreview.FileName:='C:\Users\Dexter\Desktop\RAD Studio Projects\2010\SMBIOS Delphi\Docs\DSP0119.pdf'; //FPreview.FileName:='C:\Users\Dexter\Desktop\seleccion\RePLE.msg'; diff --git a/Winapi/DWM/AeroColorizer/Main.pas b/Winapi/DWM/AeroColorizer/Main.pas index 4d484a2..977c156 100644 --- a/Winapi/DWM/AeroColorizer/Main.pas +++ b/Winapi/DWM/AeroColorizer/Main.pas @@ -38,13 +38,13 @@ implementation type tagCOLORIZATIONPARAMS = record - clrColor : COLORREF; //ColorizationColor - clrAftGlow : COLORREF; //ColorizationAfterglow - nIntensity : UINT; //ColorizationColorBalance -> 0-100 - clrAftGlowBal : UINT; //ColorizationAfterglowBalance - clrBlurBal : UINT; //ColorizationBlurBalance - clrGlassReflInt : UINT; //ColorizationGlassReflectionIntensity - fOpaque : BOOL; + clrColor: COLORREF; //ColorizationColor + clrAftGlow: COLORREF; //ColorizationAfterglow + nIntensity: UINT; //ColorizationColorBalance -> 0-100 + clrAftGlowBal: UINT; //ColorizationAfterglowBalance + clrBlurBal: UINT; //ColorizationBlurBalance + clrGlassReflInt: UINT; //ColorizationGlassReflectionIntensity + fOpaque: BOOL; end; @@ -54,21 +54,21 @@ tagCOLORIZATIONPARAMS = record TDwmGetColorizationParameters = procedure(out parameters :TColorizationParams); stdcall; TDwmSetColorizationParameters = procedure(parameters :PColorizationParams;unknown:BOOL); stdcall; - TDwmIsCompositionEnabled = function(out pfEnabled : BOOL): HRESULT; stdcall; + TDwmIsCompositionEnabled = function(out pfEnabled: BOOL): HRESULT; stdcall; var - DwmGetColorizationParameters : TDwmGetColorizationParameters; - DwmSetColorizationParameters : TDwmSetColorizationParameters; - DwmIsCompositionEnabled : TDwmIsCompositionEnabled; + DwmGetColorizationParameters: TDwmGetColorizationParameters; + DwmSetColorizationParameters: TDwmSetColorizationParameters; + DwmIsCompositionEnabled: TDwmIsCompositionEnabled; - hdwmapi : Cardinal; - OldHandle : THandle; + hdwmapi: Cardinal; + OldHandle: THandle; {$R *.dfm} function IsAeroEnabled: Boolean; var - pfEnabled : BOOL; + pfEnabled: BOOL; begin Result:=False; if Assigned(DwmIsCompositionEnabled) and (DwmIsCompositionEnabled(pfEnabled)=S_OK) then @@ -77,7 +77,7 @@ function IsAeroEnabled: Boolean; Procedure SetCompositionColor(AColor:TColor;Log:TStrings); var - Params : TColorizationParams; + Params: TColorizationParams; begin if IsAeroEnabled then if (Assigned(DwmGetColorizationParameters)) and (Assigned(DwmSetColorizationParameters)) then @@ -96,7 +96,7 @@ function IsAeroEnabled: Boolean; end; end; -procedure IconToBitMap(AIcon:TIcon; var Bitmap : TBitmap); +procedure IconToBitMap(AIcon:TIcon; var Bitmap: TBitmap); begin Bitmap.PixelFormat:=pf24bit; Bitmap.Width := AIcon.Width; @@ -104,16 +104,16 @@ procedure IconToBitMap(AIcon:TIcon; var Bitmap : TBitmap); Bitmap.Canvas.Draw(0, 0, AIcon); end; -function GetMostUsedColor(Bitmap : TBitmap) : TColor; +function GetMostUsedColor(Bitmap: TBitmap): TColor; type pRGBTripleArray = ^TRGBTripleArray; TRGBTripleArray = array[0..1023] of TRGBTriple; var - i, j : integer; - BmpRow : pRGBTripleArray; - Colors : TDictionary; - Count : Integer; - AColor : TColor; + i, j: integer; + BmpRow: pRGBTripleArray; + Colors: TDictionary; + Count: Integer; + AColor: TColor; begin Result := clBlack; Colors := TDictionary.Create; @@ -140,7 +140,7 @@ function GetMostUsedColor(Bitmap : TBitmap) : TColor; end; end; -function GetWindowIcon(hWnd: HWND) : HICON; +function GetWindowIcon(hWnd: HWND): HICON; begin Result:=GetClassLong(hWnd, GCL_HICONSM); if Result=0 then @@ -156,7 +156,7 @@ function GetWindowIcon(hWnd: HWND) : HICON; procedure TFrmMain.GetClassInfo(hWnd: HWND); var lpClassName: PWideChar; - nMaxCount : Integer; + nMaxCount: Integer; begin nMaxCount:=1024; GetMem(lpClassName,nMaxCount); @@ -172,15 +172,15 @@ procedure TFrmMain.GetClassInfo(hWnd: HWND); procedure TFrmMain.SetColorFromIcon(hWnd:HWND); var - hIHandle : HICON; - oImg : TPicture; - AColor : TColor; - Bitmap : TBitmap; + hIHandle: HICON; + oImg: TPicture; + AColor: TColor; + Bitmap: TBitmap; begin hIHandle := GetWindowIcon(hWnd); if hIHandle=0 then exit; GetClassInfo(hWnd); - oImg := TPicture.Create(); + oImg := TPicture.Create(); Bitmap := TBitmap.Create; try oImg.Icon.Handle := hIHandle; @@ -211,7 +211,7 @@ procedure TFrmMain.FormCreate(Sender: TObject); procedure TFrmMain.Timer1Timer(Sender: TObject); var - NewHandle : HWND; + NewHandle: HWND; begin NewHandle:=GetForegroundWindow; if (NewHandle<>OldHandle) and (NewHandle<>Handle) then @@ -227,7 +227,7 @@ initialization hdwmapi := LoadLibrary('dwmapi.dll'); if (hdwmapi <> 0) then begin - @DwmIsCompositionEnabled := GetProcAddress(hdwmapi, 'DwmIsCompositionEnabled'); + @DwmIsCompositionEnabled := GetProcAddress(hdwmapi, 'DwmIsCompositionEnabled'); @DwmGetColorizationParameters := GetProcAddress(hdwmapi, LPCSTR(127)); @DwmSetColorizationParameters := GetProcAddress(hdwmapi, LPCSTR(131)); end; diff --git a/Winapi/WlanAPI/nduWlanAPI.pas b/Winapi/WlanAPI/nduWlanAPI.pas index fd16c85..9cc4a82 100644 --- a/Winapi/WlanAPI/nduWlanAPI.pas +++ b/Winapi/WlanAPI/nduWlanAPI.pas @@ -462,7 +462,7 @@ Tndu_WLAN_ASSOCIATION_ATTRIBUTES = record Pndu_WLAN_SECURITY_ATTRIBUTES = ^Tndu_WLAN_SECURITY_ATTRIBUTES; Tndu_WLAN_SECURITY_ATTRIBUTES = record bSecurityEnabled: Bool; - bOneXEnabled : Bool; + bOneXEnabled: Bool; dot11AuthAlgorithm: Tndu_DOT11_AUTH_ALGORITHM; dot11CipherAlgorithm: Tndu_DOT11_CIPHER_ALGORITHM; end;