public static GetParamEnum ( List |
||
vParams | List |
|
iIndex | int | |
uDefault | uint | |
enumItems | KeePass.Ecas.EcasEnum | |
return | uint |
public static uint GetParamEnum(List<string> vParams, int iIndex,
uint uDefault, EcasEnum enumItems)
{
if(enumItems == null) { Debug.Assert(false); return uDefault; }
string str = GetParamString(vParams, iIndex, null);
if(string.IsNullOrEmpty(str)) { Debug.Assert(false); return uDefault; }
uint uID;
if(!uint.TryParse(str, out uID)) { Debug.Assert(false); return uDefault; }
// Make sure the enumeration contains the value
if(enumItems.GetItemString(uID, null) == null) { Debug.Assert(false); return uDefault; }
return uID;
}
private static bool IsMatchEnvironmentVar(EcasCondition c, EcasContext ctx) { string strName = EcasUtil.GetParamString(c.Parameters, 0, true); uint uCompareType = EcasUtil.GetParamEnum(c.Parameters, 1, EcasUtil.StdStringCompareEquals, EcasUtil.StdStringCompare); string strValue = EcasUtil.GetParamString(c.Parameters, 2, true); if (string.IsNullOrEmpty(strName) || (strValue == null)) { return(false); } try { string strVar = Environment.GetEnvironmentVariable(strName); if (strVar == null) { return(false); } return(EcasUtil.CompareStrings(strVar, strValue, uCompareType)); } catch (Exception) { Debug.Assert(false); } return(false); }