本文整理汇总了C#中ThreatLevel类的典型用法代码示例。如果您正苦于以下问题:C# ThreatLevel类的具体用法?C# ThreatLevel怎么用?C# ThreatLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThreatLevel类属于命名空间,在下文中一共展示了ThreatLevel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:shangcheng,项目名称:Aurora,代码行数:33,代码来源:ScriptProtectionModule.cs
示例2: FindThreatLevelForFunction
public static ThreatLevel FindThreatLevelForFunction(string function, ThreatLevel requestedLevel)
{
if (PermittedFunctions.ContainsKey(function))
{
return PermittedFunctions[function];
}
return requestedLevel;
}
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:8,代码来源:GridRegistrationService.cs
示例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);
}
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:6,代码来源:ScriptProtectionModule.cs
示例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;
}
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:25,代码来源:ScriptProtectionModule.cs
示例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()));
}
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:6,代码来源:GridRegistrationService.cs
示例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;
}
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:29,代码来源:GridRegistrationService.cs
示例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);
}
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:12,代码来源:OSSL_Api.cs
示例8: CheckThreatLevel
public void CheckThreatLevel(ThreatLevel level, string function, ISceneChildEntity m_host, string API)
{
GetDefinition(level).CheckThreatLevel (function, m_host, API);
}
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:4,代码来源:ScriptProtectionModule.cs
示例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;
}
}
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:43,代码来源:OSSL_Api.cs
示例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;
}
}
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:14,代码来源:InterWorldCommunications.cs
示例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;
}
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:22,代码来源:GridRegistrationService.cs
示例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);
}
}
}
}
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:40,代码来源:ScriptProtectionModule.cs
示例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);
}
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:37,代码来源:ScriptProtectionModule.cs
示例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);
}
}
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:9,代码来源:OSSL_Api.cs
示例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;
}
}
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:45,代码来源:OSSL_Api.cs
示例16: Core_VerifyPass
public bool Core_VerifyPass(ThreatLevel threat)
{
return GuiUtils.VerifyPassphrase(Core, ThreatLevel.Medium);
}
开发者ID:RoelofSol,项目名称:DeOps,代码行数:4,代码来源:AppContext.cs
示例17: VerifyPassphrase
public static bool VerifyPassphrase(OpCore core, ThreatLevel threat)
{
//crit revise
if (threat != ThreatLevel.High)
return true;
bool trying = true;
while (trying)
{
GetTextDialog form = new GetTextDialog(core, core.User.GetTitle(), "Enter Passphrase", "");
form.StartPosition = FormStartPosition.CenterScreen;
form.ResultBox.UseSystemPasswordChar = true;
if (form.ShowDialog() != DialogResult.OK)
return false;
byte[] key = Utilities.GetPasswordKey(form.ResultBox.Text, core.User.PasswordSalt);
if (Utilities.MemCompare(core.User.PasswordKey, key))
return true;
MessageBox.Show("Wrong passphrase", "DeOps");
}
return false;
}
开发者ID:RoelofSol,项目名称:DeOps,代码行数:28,代码来源:GuiUtils.cs
示例18: CheckThreatLevel
public void CheckThreatLevel(ThreatLevel level, string function)
{
if (!m_OSFunctionsEnabled)
OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
if (!m_FunctionPerms.ContainsKey(function))
{
string perm = m_ScriptEngine.Config.GetString("Allow_" + function, "");
if (perm == "")
{
m_FunctionPerms[function] = null; // a null value is default
}
else
{
bool allowed;
if (bool.TryParse(perm, out allowed))
{
// Boolean given
if (allowed)
{
m_FunctionPerms[function] = new List<UUID>();
m_FunctionPerms[function].Add(UUID.Zero);
}
else
m_FunctionPerms[function] = new List<UUID>(); // Empty list = none
}
else
{
m_FunctionPerms[function] = new List<UUID>();
string[] ids = perm.Split(new char[] {','});
foreach (string id in ids)
{
string current = id.Trim();
UUID uuid;
if (UUID.TryParse(current, out uuid))
{
if (uuid != UUID.Zero)
m_FunctionPerms[function].Add(uuid);
}
}
}
}
}
// If the list is null, then the value was true / undefined
// Threat level governs permissions in this case
//
// If the list is non-null, then it is a list of UUIDs allowed
// to use that particular function. False causes an empty
// list and therefore means "no one"
//
// To allow use by anyone, the list contains UUID.Zero
//
if (m_FunctionPerms[function] == null) // No list = true
{
if (level > m_MaxThreatLevel)
OSSLError(
String.Format(
"{0} permission denied. Allowed threat level is {1} but function threat level is {2}.",
function, m_MaxThreatLevel, level));
}
else
{
if (!m_FunctionPerms[function].Contains(UUID.Zero))
{
if (!m_FunctionPerms[function].Contains(m_host.OwnerID))
OSSLError(
String.Format("{0} permission denied. Prim owner is not in the list of users allowed to execute this function.",
function));
}
}
}
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:75,代码来源:OSSL_Api.cs
示例19: CheckThreatLevel
public void CheckThreatLevel(ThreatLevel level, string function, ISceneChildEntity m_host, string API)
{
List<UUID> FunctionPerms = new List<UUID>();
if (!m_FunctionPerms.TryGetValue(function, out FunctionPerms))
{
string perm = m_config.GetString("Allow_" + function, "");
if (perm == "")
{
FunctionPerms = null;// a null value is default
}
else
{
bool allowed;
if (bool.TryParse(perm, out allowed))
{
// Boolean given
if (allowed)
{
FunctionPerms = new List<UUID>();
FunctionPerms.Add(UUID.Zero);
}
else
FunctionPerms = new List<UUID>(); // Empty list = none
}
else
{
FunctionPerms = new List<UUID>();
string[] ids = perm.Split(new char[] {','});
foreach (string id in ids)
{
string current = id.Trim();
UUID uuid;
if (UUID.TryParse(current, out uuid))
{
if (uuid != UUID.Zero)
FunctionPerms.Add(uuid);
}
}
}
m_FunctionPerms[function] = FunctionPerms;
}
}
// If the list is null, then the value was true / undefined
// Threat level governs permissions in this case
//
// If the list is non-null, then it is a list of UUIDs allowed
// to use that particular function. False causes an empty
// list and therefore means "no one"
//
// To allow use by anyone, the list contains UUID.Zero
//
if (FunctionPerms == null) // No list = true
{
if (level > m_MaxThreatLevel)
Error("Runtime Error: ",
String.Format(
"{0} permission denied. Allowed threat level is {1} but function threat level is {2}.",
function, m_MaxThreatLevel, level));
}
else
{
if (!FunctionPerms.Contains(UUID.Zero))
{
if (!FunctionPerms.Contains(m_host.OwnerID))
Error("Runtime Error: ",
String.Format("{0} permission denied. Prim owner is not in the list of users allowed to execute this function.",
function));
}
}
}
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:74,代码来源:ScriptProtectionModule.cs
示例20: CheckThreatLevel
public void CheckThreatLevel(ThreatLevel level, string function)
{
if (!m_OSFunctionsEnabled)
OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
if (!m_FunctionPerms.ContainsKey(function))
{
FunctionPerms perms = new FunctionPerms();
m_FunctionPerms[function] = perms;
string ownerPerm = m_ScriptEngine.Config.GetString("Allow_" + function, "");
string creatorPerm = m_ScriptEngine.Config.GetString("Creators_" + function, "");
if (ownerPerm == "" && creatorPerm == "")
{
// Default behavior
perms.AllowedOwners = null;
perms.AllowedCreators = null;
}
else
{
bool allowed;
if (bool.TryParse(ownerPerm, out allowed))
{
// Boolean given
if (allowed)
{
// Allow globally
perms.AllowedOwners.Add(UUID.Zero);
}
}
else
{
string[] ids = ownerPerm.Split(new char[] {','});
foreach (string id in ids)
{
string current = id.Trim();
UUID uuid;
if (UUID.TryParse(current, out uuid))
{
if (uuid != UUID.Zero)
perms.AllowedOwners.Add(uuid);
}
}
ids = creatorPerm.Split(new char[] {','});
foreach (string id in ids)
{
string current = id.Trim();
UUID uuid;
if (UUID.TryParse(current, out uuid))
{
if (uuid != UUID.Zero)
perms.AllowedCreators.Add(uuid);
}
}
}
}
}
// If the list is null, then the value was true / undefined
// Threat level governs permissions in this case
//
// If the list is non-null, then it is a list of UUIDs allowed
// to use that particular function. False causes an empty
// list and therefore means "no one"
//
// To allow use by anyone, the list contains UUID.Zero
//
if (m_FunctionPerms[function].AllowedOwners == null)
{
// Allow / disallow by threat level
if (level > m_MaxThreatLevel)
OSSLError(
String.Format(
"{0} permission denied. Allowed threat level is {1} but function threat level is {2}.",
function, m_MaxThreatLevel, level));
}
else
{
if (!m_FunctionPerms[function].AllowedOwners.Contains(UUID.Zero))
{
// Not anyone. Do detailed checks
if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID))
{
// prim owner is in the list of allowed owners
return;
}
TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID);
if (ti == null)
{
OSSLError(
String.Format("{0} permission error. Can't find script in prim inventory.",
function));
}
if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID))
OSSLError(
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:101,代码来源:OSSL_Api.cs
注:本文中的ThreatLevel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论