-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSAPLogonOpt.cs
128 lines (99 loc) · 4.23 KB
/
SAPLogonOpt.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
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
119
120
121
122
123
124
125
126
127
128
/*
Copyright (C) 2016 Marko Graf
*/
using System;
using KeePass.App.Configuration;
namespace KeeSAPLogon
{
public class SAPLogonOpt : IDisposable
{
private const string flagDisSystemID = KeeSAPLogonExt.PlugInName + "_" + "DisSystemID";
private const string flagDisClient = KeeSAPLogonExt.PlugInName + "_" + "DisClient";
private const string flagDisLanguage = KeeSAPLogonExt.PlugInName + "_" + "DisLanguage";
private const string flagDisTx = KeeSAPLogonExt.PlugInName + "_" + "DisTx";
private const string flagDefaultLng = KeeSAPLogonExt.PlugInName + "_" + "DefaultLng";
private const string flagDefaultTx = KeeSAPLogonExt.PlugInName + "_" + "DefaultTx";
private const string flagSAPGUIPath = KeeSAPLogonExt.PlugInName + "_" + "SAPGUIPath";
private readonly AceCustomConfig m_config = null;
private bool m_autoDetected = false;
//---------------------------------------------------------------------------------------------------
// Class Constructors
//---------------------------------------------------------------------------------------------------
public SAPLogonOpt(AceCustomConfig config)
{
m_config = config;
}
//---------------------------------------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------------------------------------
public bool AutoDetected
{
get { return m_autoDetected; }
}
//---------------------------------------------------------------------------------------------------
// Public Methods
//---------------------------------------------------------------------------------------------------
public bool DisSystemID
{
get { return m_config.GetBool(flagDisSystemID, true); }
set { m_config.SetBool(flagDisSystemID, value); }
}
public bool DisClient
{
get { return m_config.GetBool(flagDisClient, true); }
set { m_config.SetBool(flagDisClient, value); }
}
public bool DisLanguage
{
get { return m_config.GetBool(flagDisLanguage, false); }
set { m_config.SetBool(flagDisLanguage, value); }
}
public bool DisTx
{
get { return m_config.GetBool(flagDisTx, false); }
set { m_config.SetBool(flagDisTx, value); }
}
public string DefaultLng
{
get { return m_config.GetString(flagDefaultLng, ""); }
set { m_config.SetString(flagDefaultLng, value); }
}
public string DefaultTx
{
get { return m_config.GetString(flagDefaultTx, ""); }
set { m_config.SetString(flagDefaultTx, value); }
}
public string SAPGUIPath
{
get
{
//Try at first KeePass config
string tmp = m_config.GetString(flagSAPGUIPath, "");
if (SAPLogonHandler.ValidateSAPGUIPath(tmp))
{
m_autoDetected = false;
return tmp;
}
//Try auto detection
tmp = SAPLogonHandler.DetectSAPGUIPath();
if (SAPLogonHandler.ValidateSAPGUIPath(tmp))
{
m_autoDetected = true;
return tmp;
}
//Get indirectly the default value
m_autoDetected = false;
return (m_config.GetString(flagSAPGUIPath, ""));
}
set { m_config.SetString(flagSAPGUIPath, value); }
}
//---------------------------------------------------------------------------------------------------
// Interface Implementation: IDisposable
//---------------------------------------------------------------------------------------------------
#region IDisposable implementation
public void Dispose()
{
}
#endregion
}
}