本文整理汇总了C#中ThreatLevel类的典型用法代码示例。如果您正苦于以下问题:C# ThreatLevel类的具体用法?C# ThreatLevel怎么用?C# ThreatLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThreatLevel类属于命名空间,在下文中一共展示了ThreatLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetThreatLevel
public ThreatLevel GetThreatLevel()
{
if(m_MaxThreatLevel != 0)
return m_MaxThreatLevel;
string risk = m_config.GetString("FunctionThreatLevel", "VeryLow");
switch (risk)
{
case "None":
m_MaxThreatLevel = ThreatLevel.None;
break;
case "VeryLow":
m_MaxThreatLevel = ThreatLevel.VeryLow;
break;
case "Low":
m_MaxThreatLevel = ThreatLevel.Low;
break;
case "Moderate":
m_MaxThreatLevel = ThreatLevel.Moderate;
break;
case "High":
m_MaxThreatLevel = ThreatLevel.High;
break;
case "VeryHigh":
m_MaxThreatLevel = ThreatLevel.VeryHigh;
break;
case "Severe":
m_MaxThreatLevel = ThreatLevel.Severe;
break;
default:
break;
}
return m_MaxThreatLevel;
}
示例2: FindThreatLevelForFunction
public static ThreatLevel FindThreatLevelForFunction(string function, ThreatLevel requestedLevel)
{
if (PermittedFunctions.ContainsKey(function))
{
return PermittedFunctions[function];
}
return requestedLevel;
}
示例3: CheckThreatLevel
public bool CheckThreatLevel(ThreatLevel level, string function, ISceneChildEntity m_host, string API,
UUID itemID)
{
GetDefinition(level).CheckThreatLevel(function, m_host, API);
return CheckFunctionLimits(function, m_host, API, itemID);
}
示例4: GetDefinition
public ThreatLevelDefinition GetDefinition(ThreatLevel level)
{
switch (level)
{
case ThreatLevel.None:
return m_threatLevelNone;
case ThreatLevel.Nuisance:
return m_threatLevelNuisance;
case ThreatLevel.VeryLow:
return m_threatLevelVeryLow;
case ThreatLevel.Low:
return m_threatLevelLow;
case ThreatLevel.Moderate:
return m_threatLevelModerate;
case ThreatLevel.High:
return m_threatLevelHigh;
case ThreatLevel.VeryHigh:
return m_threatLevelVeryHigh;
case ThreatLevel.Severe:
return m_threatLevelSevere;
case ThreatLevel.NoAccess:
return m_threatLevelNoAccess;
}
return null;
}
示例5: ReadConfiguration
protected void ReadConfiguration(IConfig config)
{
PermissionSet.ReadFunctions(config);
m_timeBeforeTimeout = config.GetFloat("DefaultTimeout", m_timeBeforeTimeout);
m_defaultRegionThreatLevel = (ThreatLevel)Enum.Parse(typeof(ThreatLevel), config.GetString("DefaultRegionThreatLevel", m_defaultRegionThreatLevel.ToString()));
}
示例6: CheckThreatLevel
public bool CheckThreatLevel(string SessionID, string function, ThreatLevel defaultThreatLevel)
{
if (!m_useRegistrationService)
return true;
GridRegistrationURLs urls = m_genericsConnector.GetGeneric<GridRegistrationURLs>(UUID.Zero,
"GridRegistrationUrls", SessionID);
if (urls != null)
{
//Past time for it to expire
if (m_useSessionTime && urls.Expiration < DateTime.UtcNow)
{
MainConsole.Instance.Warn ("[GridRegService]: URLs expired for " + SessionID);
RemoveUrlsForClient(SessionID);
return false;
}
//First find the threat level that this setting has to have do be able to run
ThreatLevel functionThreatLevel = PermissionSet.FindThreatLevelForFunction(function, defaultThreatLevel);
//Now find the permission for that threat level
//else, check it against the threat level that the region has
ThreatLevel regionThreatLevel = FindRegionThreatLevel (SessionID);
//Return whether the region threat level is higher than the function threat level
if(!(functionThreatLevel <= regionThreatLevel))
MainConsole.Instance.Warn ("[GridRegService]: checkThreatLevel (" + function + ") failed for " + SessionID + ", fperm " + functionThreatLevel + ", rperm " + regionThreatLevel + "!");
return functionThreatLevel <= regionThreatLevel;
}
MainConsole.Instance.Warn ("[GridRegService]: Could not find URLs for checkThreatLevel for " + SessionID + "!");
return false;
}
示例7: CheckThreatLevel
// Returns of the function is allowed. Throws a script exception if not allowed.
public void CheckThreatLevel(ThreatLevel level, string function)
{
if (!m_OSFunctionsEnabled)
OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
string reasonWhyNot = CheckThreatLevelTest(level, function);
if (!String.IsNullOrEmpty(reasonWhyNot))
{
OSSLError(reasonWhyNot);
}
}
示例8: CheckThreatLevel
public void CheckThreatLevel(ThreatLevel level, string function, ISceneChildEntity m_host, string API)
{
GetDefinition(level).CheckThreatLevel (function, m_host, API);
}
示例9: Initialize
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
{
m_ScriptEngine = ScriptEngine;
m_host = host;
m_localID = localID;
m_itemID = itemID;
if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
m_OSFunctionsEnabled = true;
m_ScriptDelayFactor =
m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
m_ScriptDistanceFactor =
m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
string risk = m_ScriptEngine.Config.GetString("OSFunctionThreatLevel", "VeryLow");
switch (risk)
{
case "None":
m_MaxThreatLevel = ThreatLevel.None;
break;
case "VeryLow":
m_MaxThreatLevel = ThreatLevel.VeryLow;
break;
case "Low":
m_MaxThreatLevel = ThreatLevel.Low;
break;
case "Moderate":
m_MaxThreatLevel = ThreatLevel.Moderate;
break;
case "High":
m_MaxThreatLevel = ThreatLevel.High;
break;
case "VeryHigh":
m_MaxThreatLevel = ThreatLevel.VeryHigh;
break;
case "Severe":
m_MaxThreatLevel = ThreatLevel.Severe;
break;
default:
break;
}
}
示例10: Initialize
public void Initialize(IConfigSource source, IRegistryCore registry)
{
m_source = source;
m_config = source.Configs["AuroraInterWorldConnectors"];
if (m_config != null)
{
m_Enabled = m_config.GetBoolean("Enabled", false);
m_allowUntrustedConnections = m_config.GetBoolean("AllowUntrustedConnections", m_allowUntrustedConnections);
m_untrustedConnectionsDefaultTrust = (ThreatLevel)Enum.Parse(typeof(ThreatLevel), m_config.GetString("UntrustedConnectionsDefaultTrust", m_untrustedConnectionsDefaultTrust.ToString()));
registry.RegisterModuleInterface<InterWorldCommunications>(this);
registry.StackModuleInterface<ICommunicationService> (this);
m_registry = registry;
}
}
示例11: CheckThreatLevel
public bool CheckThreatLevel(string SessionID, ulong RegionHandle, string function, ThreatLevel defaultThreatLevel)
{
GridRegistrationURLs urls = m_genericsConnector.GetGeneric<GridRegistrationURLs>(UUID.Zero,
"GridRegistrationUrls", RegionHandle.ToString(), new GridRegistrationURLs());
if (urls != null)
{
//Past time for it to expire
if (urls.Expiration < DateTime.Now)
{
RemoveUrlsForClient(SessionID, RegionHandle);
return false;
}
//First find the threat level that this setting has to have do be able to run
ThreatLevel functionThreatLevel = PermissionSet.FindThreatLevelForFunction(function, defaultThreatLevel);
//Now find the permission for that threat level
//else, check it against the threat level that the region has
ThreatLevel regionThreatLevel = FindRegionThreatLevel(RegionHandle);
//Return whether the region threat level is higher than the function threat level
return functionThreatLevel <= regionThreatLevel;
}
return false;
}
示例12: ThreatLevelDefinition
public ThreatLevelDefinition(ThreatLevel threatLevel, UserSet userSet, ScriptProtectionModule module)
{
m_threatLevel = threatLevel;
m_userSet = userSet;
m_scriptProtectionModule = module;
m_allowGroupPermissions = m_scriptProtectionModule.m_config.GetBoolean(
"AllowGroupThreatPermissionCheck", m_allowGroupPermissions);
string perm = m_scriptProtectionModule.m_config.GetString("Allow_" + m_threatLevel.ToString(), "");
if (perm != "")
{
string[] ids = perm.Split(',');
foreach (string current in ids.Select(id => id.Trim()))
{
UUID uuid;
if (UUID.TryParse(current, out uuid))
{
if (uuid != UUID.Zero)
m_allowedUsers.Add(uuid);
}
}
}
perm = m_scriptProtectionModule.m_config.GetString("Allow_All", "");
if (perm != "")
{
string[] ids = perm.Split(',');
foreach (string current in ids.Select(id => id.Trim()))
{
UUID uuid;
if (UUID.TryParse(current, out uuid))
{
if (uuid != UUID.Zero)
m_allowedUsers.Add(uuid);
}
}
}
}
示例13: GetThreatLevel
public ThreatLevelDefinition GetThreatLevel()
{
if (m_MaxThreatLevel != 0)
return GetDefinition(m_MaxThreatLevel);
string risk = m_config.GetString("FunctionThreatLevel", "VeryLow");
switch (risk)
{
case "NoAccess":
m_MaxThreatLevel = ThreatLevel.NoAccess;
break;
case "None":
m_MaxThreatLevel = ThreatLevel.None;
break;
case "Nuisance":
m_MaxThreatLevel = ThreatLevel.Nuisance;
break;
case "VeryLow":
m_MaxThreatLevel = ThreatLevel.VeryLow;
break;
case "Low":
m_MaxThreatLevel = ThreatLevel.Low;
break;
case "Moderate":
m_MaxThreatLevel = ThreatLevel.Moderate;
break;
case "High":
m_MaxThreatLevel = ThreatLevel.High;
break;
case "VeryHigh":
m_MaxThreatLevel = ThreatLevel.VeryHigh;
break;
case "Severe":
m_MaxThreatLevel = ThreatLevel.Severe;
break;
}
return GetDefinition(m_MaxThreatLevel);
}
示例14: CheckThreatLevel
// Returns of the function is allowed. Throws a script exception if not allowed.
public void CheckThreatLevel(ThreatLevel level, string function)
{
string reasonWhyNot = CheckThreatLevelTest(level, function);
if (!String.IsNullOrEmpty(reasonWhyNot))
{
OSSLError(reasonWhyNot);
}
}
示例15: Initialize
public void Initialize(
IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
{
m_ScriptEngine = scriptEngine;
m_host = host;
m_item = item;
m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
m_ScriptDelayFactor =
m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
m_ScriptDistanceFactor =
m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
string risk = m_ScriptEngine.Config.GetString("OSFunctionThreatLevel", "VeryLow");
switch (risk)
{
case "NoAccess":
m_MaxThreatLevel = ThreatLevel.NoAccess;
break;
case "None":
m_MaxThreatLevel = ThreatLevel.None;
break;
case "VeryLow":
m_MaxThreatLevel = ThreatLevel.VeryLow;
break;
case "Low":
m_MaxThreatLevel = ThreatLevel.Low;
break;
case "Moderate":
m_MaxThreatLevel = ThreatLevel.Moderate;
break;
case "High":
m_MaxThreatLevel = ThreatLevel.High;
break;
case "VeryHigh":
m_MaxThreatLevel = ThreatLevel.VeryHigh;
break;
case "Severe":
m_MaxThreatLevel = ThreatLevel.Severe;
break;
default:
break;
}
}