unit Settings;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzButton, ExtCtrls, RzPanel, ComCtrls, StdCtrls, RzTabs,inifiles,ShellAPI,StrUtils,
  Grids, ValEdit, ImgList,parseinf;

type
  TForm2 = class(TForm)
    RzPanel1: TRzPanel;
    RzButton1: TRzButton;
    RzButton2: TRzButton;
    RzPageControl1: TRzPageControl;
    TabSheet2: TRzTabSheet;
    TabSheet1: TRzTabSheet;
    RzPanel2: TRzPanel;
    DRPDIR: TLabeledEdit;
    RzPanel3: TRzPanel;
    Hwidcheck: TCheckBox;
    Label1: TLabel;
    DEVDBDIR: TLabeledEdit;
    IGNORELS: TMemo;
    Label2: TLabel;
    Restorepoint: TCheckBox;
    ImageList1: TImageList;
    OpenDialog1: TOpenDialog;
    OEM_install: TCheckBox;
    procedure RzButton2Click(Sender: TObject);
    procedure RzButton1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure XPdirChange(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;
  IsChanged:boolean;

implementation
uses unit1;

{$R *.dfm}

procedure TForm2.RzButton2Click(Sender: TObject);
var
  IninfileSET:Tinifile;
Ils:string;
i:integer;
begin



   if GB_Write_allowed then
   begin
   IninfileSET:=TIniFile.Create(GB_ini_path);

  IninfileSET.WriteString('Path','DRPDIR',DRPDIR.Text);
//  IninfileSET.WriteString('Path','XPDIR',XPDIR.Text);
//  IninfileSET.WriteString('Path','VISTADIR',Vista.Text);
//  IninfileSET.WriteString('Path','VISTA64DIR',Vista64.Text);
  IninfileSET.WriteString('Path','DEV_DB',DEVDBDIR.Text);

  IninfileSET.WriteBool('EXPERT','1hwid',Hwidcheck.Checked);
  IninfileSET.WriteBool('EXPERT','Restorepoint',Restorepoint.Checked);
  IninfileSET.WriteBool('EXPERT','OEM_install',OEM_install.Checked);


  Ils:=UpperCase(IGNORELS.Text);
  Ils:=AnsiReplaceStr(Ils,#13#10,',');
  IninfileSET.WriteString('window','IGNORELS',Ils);
  IninfileSET.Free;



  end;

if   IsChanged then
  if (MessageDlg('Настройки изменились.'#13'Нужен перезапуск программы'#13'Вы хотите перезапустить программу??',mtConfirmation,[mbYes, mbNo],0)=mrYes) then
    begin
    ShellExecute(0,PChar('open'),
               pchar(ParamStr(0)),
               Nil,Nil,SW_SHOW);
    Application.Terminate;

    end;


close;
end;

procedure TForm2.RzButton1Click(Sender: TObject);
begin
close;
end;

procedure TForm2.FormCreate(Sender: TObject);
var
  IninfileSET:Tinifile;
  item:TListItem;
  i:integer;
begin

IninfileSET:=TIniFile.Create(GB_ini_path);
DRPDIR.Text:=uppercase( IninfileSET.Readstring('Path','DRPDIR',''));
//XPDIR.Text:=uppercase(IninfileSET.Readstring('Path','XPDIR',''));
//Vista.Text:=uppercase(IninfileSET.Readstring('Path','VISTADIR',''));
//Vista64.Text:=uppercase(IninfileSET.Readstring('Path','VISTA64DIR',''));
DEVDBDIR.Text:=uppercase(IninfileSET.Readstring('Path','DEV_DB',''));

IGNORELS.Text:=UpperCase(IninfileSET.Readstring('window','IGNORELS',''));
IGNORELS.Text:=AnsiReplaceStr(IGNORELS.Text,',',#13#10);

Hwidcheck.Checked:=IninfileSET.ReadBool('EXPERT','1hwid',false);
Restorepoint.Checked:=IninfileSET.ReadBool('EXPERT','Restorepoint',false);
OEM_install.Checked:=IninfileSET.ReadBool('EXPERT','OEM_install',false);

IninfileSET.Free;




  IsChanged:=false;
end;

procedure TForm2.XPdirChange(Sender: TObject);
begin
  IsChanged:=true;
end;

end.
