2
2
KeePass Password Safe - The Open-Source Password Manager
3
Copyright (C) 2003-2011 Dominik Reichl <dominik.reichl@t-online.de>
3
Copyright (C) 2003-2012 Dominik Reichl <dominik.reichl@t-online.de>
5
5
This program is free software; you can redistribute it and/or modify
6
6
it under the terms of the GNU General Public License as published by
100
100
FontUtil.AssignDefaultBold(m_rbStandardCharSet);
101
101
FontUtil.AssignDefaultBold(m_rbPattern);
102
102
FontUtil.AssignDefaultBold(m_rbCustom);
103
FontUtil.AssignDefaultMono(m_tbPreview, true);
104
105
m_ttMain.SetToolTip(m_btnProfileAdd, KPRes.GenProfileSaveDesc);
105
106
m_ttMain.SetToolTip(m_btnProfileRemove, KPRes.GenProfileRemoveDesc);
166
167
m_cmbProfiles.SelectedIndex = ((m_optInitial == null) ? 0 : 1);
168
PwGeneratorUtil.AddStandardProfilesIfNoneAvailable();
170
foreach(PwProfile ppw in Program.Config.PasswordGenerator.UserProfiles)
169
foreach(PwProfile ppw in PwGeneratorUtil.GetAllProfiles(true))
172
171
m_cmbProfiles.Items.Add(ppw.Name);
235
234
string strProfile = m_cmbProfiles.Text;
236
235
m_btnProfileRemove.Enabled = ((strProfile != CustomMeta) &&
237
(strProfile != DeriveFromPrevious) &&
238
(strProfile != AutoGeneratedMeta));
236
(strProfile != DeriveFromPrevious) && (strProfile != AutoGeneratedMeta) &&
237
!PwGeneratorUtil.IsBuiltInProfile(strProfile));
240
239
m_tabAdvanced.Text = ((m_cbExcludeLookAlike.Checked ||
241
240
m_cbNoRepeat.Checked || (m_tbExcludeChars.Text.Length > 0)) ?
372
371
SetGenerationOptions(Program.Config.PasswordGenerator.AutoGeneratedPasswordsProfile);
375
foreach(PwProfile pwgo in Program.Config.PasswordGenerator.UserProfiles)
374
foreach(PwProfile pwgo in PwGeneratorUtil.GetAllProfiles(false))
377
376
if(pwgo.Name == strProfile)
405
404
pwCurrent.Name = strProfile;
407
406
if(strProfile.Equals(CustomMeta) || strProfile.Equals(DeriveFromPrevious) ||
408
(strProfile.Length == 0))
407
(strProfile.Length == 0) || PwGeneratorUtil.IsBuiltInProfile(strProfile))
410
409
MessageService.ShowWarning(KPRes.FieldNameInvalid);
419
List<PwProfile> lUser = Program.Config.PasswordGenerator.UserProfiles;
420
421
bool bExists = false;
421
for(int i = 0; i < Program.Config.PasswordGenerator.UserProfiles.Count; ++i)
422
for(int i = 0; i < lUser.Count; ++i)
423
if(Program.Config.PasswordGenerator.UserProfiles[i].Name == strProfile)
424
if(lUser[i].Name.Equals(strProfile, StrUtil.CaseIgnoreCmp))
425
Program.Config.PasswordGenerator.UserProfiles[i] = pwCurrent;
426
m_cmbProfiles.SelectedIndex = m_cmbProfiles.FindString(strProfile);
426
lUser[i] = pwCurrent;
428
for(int j = 0; j < m_cmbProfiles.Items.Count; ++j)
430
if(m_cmbProfiles.Items[j].ToString().Equals(strProfile,
431
StrUtil.CaseIgnoreCmp))
433
m_bBlockUIUpdate = true;
434
m_cmbProfiles.Items[j] = strProfile; // Fix case
435
m_bBlockUIUpdate = false;
436
m_cmbProfiles.SelectedIndex = j;
433
Program.Config.PasswordGenerator.UserProfiles.Add(pwCurrent);
434
m_cmbProfiles.Items.Add(strProfile);
435
m_cmbProfiles.SelectedIndex = m_cmbProfiles.Items.Count - 1;
448
m_bBlockUIUpdate = true;
450
List<PwProfile> lAll = PwGeneratorUtil.GetAllProfiles(false);
451
for(int c = 0; c < lAll.Count; ++c)
452
m_cmbProfiles.Items.RemoveAt(m_cmbProfiles.Items.Count - 1);
454
lUser.Add(pwCurrent);
457
foreach(PwProfile pwAdd in PwGeneratorUtil.GetAllProfiles(true))
459
m_cmbProfiles.Items.Add(pwAdd.Name);
460
if(pwAdd.Name == strProfile)
461
iNewSel = m_cmbProfiles.Items.Count - 1;
464
m_bBlockUIUpdate = false;
465
m_cmbProfiles.SelectedIndex = iNewSel;
446
476
string strProfile = m_cmbProfiles.Text;
448
478
if((strProfile == CustomMeta) || (strProfile == DeriveFromPrevious) ||
449
(strProfile == AutoGeneratedMeta))
479
(strProfile == AutoGeneratedMeta) || PwGeneratorUtil.IsBuiltInProfile(strProfile))
452
482
m_cmbProfiles.SelectedIndex = 0;
457
487
m_cmbProfiles.Items.RemoveAt(i);
459
List<PwProfile> lProfiles = Program.Config.PasswordGenerator.UserProfiles;
460
for(int j = 0; j < lProfiles.Count; ++j)
489
List<PwProfile> lUser = Program.Config.PasswordGenerator.UserProfiles;
490
for(int j = 0; j < lUser.Count; ++j)
462
if(lProfiles[j].Name == strProfile)
492
if(lUser[j].Name == strProfile)
464
lProfiles.RemoveAt(j);
500
530
Application.DoEvents();
502
ProtectedString psNew = new ProtectedString(false);
503
PwGenerator.Generate(psNew, pwOpt, null, Program.PwGeneratorPool);
532
ProtectedString psNew;
533
PwGenerator.Generate(out psNew, pwOpt, null, Program.PwGeneratorPool);
504
534
sbList.AppendLine(psNew.ReadString());
505
535
m_pbPreview.Value = (int)((100 * i) / MaxPreviewPasswords);