{ Private declarations } public { Public declarations } end;
var Form1: TForm1; value : string; ini:Tinifile;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.sButton1Click(Sender: TObject); begin
if sRadioButton1.Checked=true then begin smemo1.text:=IdEncoderMIME1.Encode(smemo1.Text) end else if sRadioButton2.Checked=true then smemo1.text:=IdDecoderMIME1.DecodeString(smemo1.Text);
end;
procedure TForm1.FormCreate(Sender: TObject); var ok: boolean; begin
if ini.ReadString('mail', 'pop', '0')='1' then begin sCheckBox3.Checked:=true;
end;
if sCheckBox3.Checked=true then begin sEdit3.Text:= ini.ReadString('mail','log','Логин'); sEdit4.Text:= ini.ReadString('mail','pass', 'Пароль'); end;
if ini.ReadString('dos','2', '0')='1' then sCheckBox4.Checked:=true;
if sCheckBox4.Checked=true then begin ok:=false; while ok=false do begin If InputBox('Внимание', 'Введите пароль!', '')=ini.ReadString('pass', 'code','Пароль') then ok:=true else begin If MessageDlg ('Пароль неправильный. Выйти?', mtConfirmation, [mbYes, mbNo] ,0) = mrYes then Close; showmessage('Пароль правильный');
end; end; end; sleep(150);
end;
procedure TForm1.sButton3Click(Sender: TObject); begin if sOpenDialog1.Execute=true then smemo1.Lines.LoadFromFile(sOpenDialog1.FileName); end;
procedure TForm1.sButton2Click(Sender: TObject); begin if sSaveDialog1.Execute=true then smemo1.Lines.SaveToFile(sSaveDialog1.FileName+'.txt'); end;
procedure TForm1.FormDestroy(Sender: TObject); begin ini.Free;
end;
procedure TForm1.N1Click(Sender: TObject); begin if sOpenDialog1.Execute=true then begin smemo1.Lines.LoadFromFile(sOpenDialog1.FileName); showmessage('Сохранено'); end; end;
procedure TForm1.N2Click(Sender: TObject); begin if sSaveDialog1.Execute=true then smemo1.Lines.SaveToFile(sSaveDialog1.FileName+'.txt'); end;
procedure TForm1.sButton4Click(Sender: TObject); begin ini.WriteString('pass','code',sEdit1.Text); showmessage('Пароль изменен'); end;
procedure TForm1.sButton5Click(Sender: TObject); begin if sRadioButton3.Checked=true then sSkinManager1.SkinName:='WMP11 (internal)';
if sRadioButton4.Checked=true then sSkinManager1.SkinName:='Deep (internal)';
if sRadioButton5.Checked=true then sSkinManager1.SkinName:='Vista (internal)';
if sRadioButton6.Checked=true then sSkinManager1.SkinName:='XPSilver (internal)';
if sRadioButton7.Checked=true then sSkinManager1.SkinName:='Aluminium (internal)';
if sRadioButton8.Checked=true then sSkinManager1.SkinName:='Cappuccino (internal)';
if sRadioButton9.Checked=true then sSkinManager1.SkinName:='Cold (internal)';
if sRadioButton10.Checked=true then sSkinManager1.SkinName:='Garnet (internal)';
if sRadioButton11.Checked=true then sSkinManager1.SkinName:='KaraKum (internal)';
if sRadioButton12.Checked=true then sSkinManager1.SkinName:='Nautilus (internal)';
if sRadioButton13.Checked=true then sSkinManager1.SkinName:='FalloutStyle (internal)'; ini.WriteString('style','tema', sSkinManager1.SkinName); showmessage('Тема изменина!');
end; procedure TForm1.Timer1Timer(Sender: TObject); var a:string; begin a:=timetostr(time); form1.Caption:='Кодим текст '+a; sLabel8.Caption:=inttostr(length(sMemo3.Text)); sLabel1.Caption:=inttostr(length(smemo2.Text));
end; procedure TForm1.sBitBtn1Click(Sender: TObject); var data:string; F : TextFile; S : String; begin if sCheckBox1.Checked=true then begin data:=datetostr(date); sRichEdit1.Lines.Add(data+' '+sMemo2.Text); sMemo2.Clear; end else begin sRichEdit1.Lines.Add(sMemo2.Text); sMemo2.Clear; end; end; procedure TForm1.sBitBtn2Click(Sender: TObject); var F : TextFile; S : String; begin AssignFile(F, getWin+'\text.txt'); Rewrite(F); S := sRichEdit1.Text; WriteLn(F,S); CloseFile(F); MessageDlg('Сохранено',mtInformation,[mbOk],0); end; function TForm1.getWin: string; var i:cardinal; d:array[0..MAX_PATH] of Char; begin try if getWindowsDirectory(d,i) >0 then result:= d; except result:= 'undifined'; end; end; procedure TForm1.sButton6Click(Sender: TObject); var F : TextFile; S : String;
begin AssignFile(F, getWin+'\text.txt'); Rewrite(F); S := ''; WriteLn(F,S); CloseFile(F); sRichEdit1.Lines.LoadFromFile(getWin+'\text.txt'); showmessage('Создано'); begin
end end; procedure TForm1.N3Click(Sender: TObject); begin sTabSheet2.PageControl.ActivePageIndex:=2; end;
procedure TForm1.sPageControl1Change(Sender: TObject); begin if sTabSheet3.PageControl.ActivePageIndex=1 then begin sRichEdit1.Lines.LoadFromFile(getWin+'\text.txt'); end; end; procedure TForm1.sBitBtn4Click(Sender: TObject); var att:Tidattachment; begin if idsmtp1.Connected then IdSMTP1.Send(IdMessage1); sleep(100); showMessage('Отправка завершена'); end;
procedure TForm1.sBitBtn3Click(Sender: TObject); begin if sOpenDialog2.Execute=true then begin sEdit7.Text:=sOpenDialog2.FileName; end end; procedure TForm1.sButton7Click(Sender: TObject); var att:Tidattachment; begin ini.WriteString('mail','log', sEdit3.Text); ini.WriteString('mail','pass', sEdit4.Text); IdSMTP1.Host:='smtp.'+sComboBox1.Text; IdSMTP1.Port:=25; IdSMTP1.Username:=sEdit3.Text; IdSMTP1.Password:=sEdit4.Text; IdMessage1.From.Text:=sEdit3.Text+'@'+sComboBox1.Text; IdMessage1.Body.Text:=sMemo3.Text; IdMessage1.Subject:=sEdit6.Text; IdMessage1.Recipients.EMailAddresses:=sEdit5.Text; IdMessage1.MessageParts.Clear; if sedit7.Text='' then begin idsmtp1.Connect(); if idsmtp1.Connected then showmessage('Подключился'); end else begin att:=TIdAttachment.Create(IdMessage1.MessageParts, sOpenDialog2.FileName); idsmtp1.Connect(); if idsmtp1.Connected then showmessage('Подключился'); end;
end; procedure TForm1.sCheckBox2Click(Sender: TObject); begin if sCheckBox2.Checked=true then sedit4.PasswordChar:=#0 else sedit4.PasswordChar:='*'; end; procedure TForm1.sButton8Click(Sender: TObject); begin Idsmtp1.Disconnect; showmessage('Отключился'); end; procedure TForm1.sCheckBox3Click(Sender: TObject); begin ini.WriteBool('mail','pop', sCheckBox3.Checked); end; procedure TForm1.sCheckBox4Click(Sender: TObject); begin ini.WriteBool('dos','2', sCheckBox4.Checked); end; end.