1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, JvDirectories, JvComponent,unit2, ComCtrls, Grids,
ValEdit;
const
nbenum=10;
displaytypeenum:array[0..nbenum-1] of string=
('All servers',
'NT/2000 workstations or servers',
'Windows 95 or later',
'Servers running Windows for Workgroups',
'Servers running Unix',
'LAN Manager workstations',
'LAN Manager servers',
'NT/2000 servers not domain controller',
'Servers maintained by the browser',
'Primary Domain (ignore version info)');
typeenum:array[0..nbenum-1] of cardinal=
(SV_TYPE_ALL,
SV_TYPE_NT,
SV_TYPE_WINDOWS,
SV_TYPE_WFW,
SV_TYPE_SERVER_UNIX,
SV_TYPE_WORKSTATION,
SV_TYPE_SERVER,
SV_TYPE_SERVER_NT,
SV_TYPE_LOCAL_LIST_ONLY,
SV_TYPE_DOMAIN_ENUM);
type
TForm1 = class(TForm)
Button1: TButton;
ComboBox1: TComboBox;
Label1: TLabel;
Edit1: TEdit;
Label3: TLabel;
JvDirectories1: TJvDirectories;
ValueListEditor1: TValueListEditor;
Label2: TLabel;
ValueListEditor2: TValueListEditor;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
uses strutils;
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
var i:integer;
begin
for i:=0 to nbenum-1 do ComboBox1.Items.Add(displaytypeenum[i]);
ComboBox1.ItemIndex:=0;
end;
function conv(S:string):string;
var i:integer;
begin
result:='';
for i:=1 to length(S) do
if S[i]<>'"' then
begin
if S[i]=';' then result:=result+'='
else result:=result+s[i];
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var chemin:string;
asl,asl2:TStringList;
i:integer;
begin
chemin:=jvdirectories1.Desktop+'liste.csv';
asl:=TStringList.Create;
asl2:=TStringList.Create;
if FileExists(chemin) then asl.LoadFromFile(chemin);
GetServers(typeenum[ComboBox1.ItemIndex],edit1.Text,asl2);
ValueListEditor1.Strings.Clear;
ValueListEditor2.Strings.Clear;
if asl2.count>0 then
for i:=0 to asl2.Count-1 do
begin
if asl.IndexOf(asl2.Strings[i])=-1 then
begin
asl.Add(asl2.Strings[i]);
ValueListEditor2.Strings.Add(conv(asl2.Strings[i]))
end;
end;
asl.Sort;
if ComboBox1.ItemIndex=0 then
begin
ValueListEditor1.Strings.Text:=conv(asl.Text);
asl.SaveToFile(chemin);
end
else ValueListEditor1.Strings.text:=conv(asl2.Text);
label1.Caption:=IntToStr(ValueListEditor1.Strings.Count);
label2.Caption:=IntToStr(ValueListEditor2.Strings.Count);
asl.Free;
asl2.Free;
end;
end. |
Partager