forked from fireout/keepasssequencer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeneratorPlugin.cs
executable file
·54 lines (43 loc) · 1.39 KB
/
GeneratorPlugin.cs
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
using KeePass.Plugins;
namespace Sequencer
{
public class SequencerExt : Plugin
{
private IPluginHost m_host = null;
private Sequencer m_gen = null;
private string updateUrl = null;
public override string UpdateUrl
{
get
{
return updateUrl ?? (updateUrl = GetUpdateUrl());
}
}
private string GetUpdateUrl()
{
Configuration.PasswordSequenceConfigurationFactory factory = new Configuration.PasswordSequenceConfigurationFactory();
if (factory.SequencerConfiguration.AppSettings.Settings["version-file-url"] != null)
{
return factory.SequencerConfiguration.AppSettings.Settings["version-file-url"].Value;
}
return base.UpdateUrl;
}
public override bool Initialize(IPluginHost host)
{
if (host == null) return false;
m_host = host;
m_gen = new Sequencer();
m_host.PwGeneratorPool.Add(m_gen);
return true;
}
public override void Terminate()
{
if (m_host != null)
{
m_host.PwGeneratorPool.Remove(m_gen.Uuid);
m_gen = null;
m_host = null;
}
}
}
}