本文整理汇总了C#中OpenSim.Framework.EstateBan类的典型用法代码示例。如果您正苦于以下问题:C# EstateBan类的具体用法?C# EstateBan怎么用?C# EstateBan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EstateBan类属于OpenSim.Framework命名空间,在下文中一共展示了EstateBan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendBannedUserList
public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
{
throw new System.NotImplementedException();
}
示例2: EstateSettings
public EstateSettings(Dictionary<string, object> map)
{
foreach (KeyValuePair<string, object> kvp in map)
{
PropertyInfo p = this.GetType().GetProperty(kvp.Key, BindingFlags.Public | BindingFlags.Instance);
if (p == null)
continue;
// EstateBans is a complex type, let's treat it as special
if (p.Name == "EstateBans")
continue;
if (p.PropertyType.IsArray)
{
string[] elements = ((string)map[p.Name]).Split(new char[] { ',' });
UUID[] uuids = new UUID[elements.Length];
int i = 0;
foreach (string e in elements)
uuids[i++] = new UUID(e);
p.SetValue(this, uuids, null);
}
else
{
object value = p.GetValue(this, null);
if (value is String)
p.SetValue(this, map[p.Name], null);
else if (value is UInt32)
p.SetValue(this, UInt32.Parse((string)map[p.Name]), null);
else if (value is Boolean)
p.SetValue(this, Boolean.Parse((string)map[p.Name]), null);
else if (value is UUID)
p.SetValue(this, UUID.Parse((string)map[p.Name]), null);
}
}
// EstateBans are special
if (map.ContainsKey("EstateBans"))
{
var banData = ((Dictionary<string, object>)map["EstateBans"]).Values;
EstateBan[] bans = new EstateBan[banData.Count];
int b = 0;
foreach (Dictionary<string, object> ban in banData)
bans[b++] = new EstateBan(ban);
PropertyInfo bansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance);
bansProperty.SetValue(this, bans, null);
}
}
示例3: llManageEstateAccess
public LSL_Integer llManageEstateAccess(int action, string avatar)
{
m_host.AddScriptLPS(1);
EstateSettings estate = World.RegionInfo.EstateSettings;
bool isAccount = false;
bool isGroup = false;
if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID))
return 0;
UUID id = new UUID();
if (!UUID.TryParse(avatar, out id))
return 0;
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, id);
isAccount = account != null ? true : false;
if (!isAccount)
{
IGroupsModule groups = World.RequestModuleInterface<IGroupsModule>();
if (groups != null)
{
GroupRecord group = groups.GetGroupRecord(id);
isGroup = group != null ? true : false;
if (!isGroup)
return 0;
}
else
return 0;
}
switch (action)
{
case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_ADD:
if (!isAccount) return 0;
if (estate.HasAccess(id)) return 1;
if (estate.IsBanned(id))
estate.RemoveBan(id);
estate.AddEstateUser(id);
break;
case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_REMOVE:
if (!isAccount || !estate.HasAccess(id)) return 0;
estate.RemoveEstateUser(id);
break;
case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_ADD:
if (!isGroup) return 0;
if (estate.GroupAccess(id)) return 1;
estate.AddEstateGroup(id);
break;
case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_REMOVE:
if (!isGroup || !estate.GroupAccess(id)) return 0;
estate.RemoveEstateGroup(id);
break;
case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_ADD:
if (!isAccount) return 0;
if (estate.IsBanned(id)) return 1;
EstateBan ban = new EstateBan();
ban.EstateID = estate.EstateID;
ban.BannedUserID = id;
estate.AddBan(ban);
break;
case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_REMOVE:
if (!isAccount || !estate.IsBanned(id)) return 0;
estate.RemoveBan(id);
break;
default: return 0;
}
return 1;
}
示例4: SendBannedUserList
public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
{
}
示例5: EstateBanUser
public EstateResult EstateBanUser(UUID AgentId, bool isBan)
{
if (AgentId == UUID.Zero)
return EstateResult.InvalidReq; // not found
if (AgentId == m_scene.RegionInfo.EstateSettings.EstateOwner)
return EstateResult.InvalidReq; // never process EO
if (m_scene.IsEstateOwnerPartner(AgentId))
return EstateResult.InvalidReq; // never process EO
if (AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID)
return EstateResult.InvalidReq; // never process owner
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false;
for (int i = 0; i < banlistcheck.Length; i++)
{
if (AgentId == banlistcheck[i].BannedUserID)
{
alreadyInList = true;
break;
}
}
if (!isBan)
{ // This is an unban.
if (!alreadyInList)
return EstateResult.AlreadySet;
m_scene.RegionInfo.EstateSettings.RemoveBan(AgentId);
SaveEstateDataAndUpdateRegions((uint)EstateSettings.EstateSaveOptions.EstateSaveBans);
return EstateResult.Success;
}
// This is a ban.
// A user cannot be in both the banned and access lists.
// if they are being banned, remove them from access.
EstateAllowUser(AgentId, false);
if (alreadyInList)
return EstateResult.AlreadySet;
EstateBan item = new EstateBan();
item.BannedUserID = AgentId;
item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID;
item.BannedHostAddress = "0.0.0.0";
item.BannedHostIPMask = "0.0.0.0";
m_scene.RegionInfo.EstateSettings.AddBan(item);
SaveEstateDataAndUpdateRegions((uint)EstateSettings.EstateSaveOptions.EstateSaveBans);
// Banned, now shoo them away.
ScenePresence sp = m_scene.GetScenePresence(AgentId);
if (sp != null)
{
if (!sp.IsChildAgent)
{
UserProfileData UserProfile = m_scene.CommsManager.UserService.GetUserProfile(AgentId);
if ((UserProfile != null) && (UserProfile.HomeRegionID == m_scene.RegionInfo.RegionID))
{
// Can't send them to their home region, already there and now banned.
sp.ControllingClient.Kick("You have been banned from your Home location. You must login directly to a different region.");
System.Threading.Thread.Sleep(1000);
sp.Scene.IncomingCloseAgent(AgentId);
}
else
{
sp.ControllingClient.SendTeleportLocationStart();
m_scene.TeleportClientHome(AgentId, sp.ControllingClient);
}
}
}
return EstateResult.Success;
}
示例6: handleEstateAccessDeltaRequest
//.........这里部分代码省略.........
{
if ((estateAccessType & 1) != 0) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.RemoveEstateGroup(user);
estateSettings.Save();
}
}
}
Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
Scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 64) != 0) // Ban add
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
{
EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false;
for (int i = 0; i < banlistcheck.Length; i++)
{
if (user == banlistcheck[i].BannedUserID)
{
alreadyInList = true;
break;
}
}
if (!alreadyInList)
{
if ((estateAccessType & 1) != 0) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
EstateBan bitem = new EstateBan();
bitem.BannedUserID = user;
bitem.EstateID = (uint)estateID;
bitem.BannedHostAddress = "0.0.0.0";
bitem.BannedHostIPMask = "0.0.0.0";
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
示例7: AddToRegionBanlist
/// <summary>
/// Add en entry into region banlist
/// </summary>
/// <param name="item"></param>
public void AddToRegionBanlist(EstateBan item)
{
}
示例8: RemoveFromRegionBanlist
/// <summary>
/// remove an entry from the region banlist
/// </summary>
/// <param name="item"></param>
public void RemoveFromRegionBanlist(EstateBan item)
{
}
示例9: GetEstateRegions
public List<UUID> GetEstateRegions(uint estateID)
{
using (MySqlConnection conn = GetConnection())
{
using (MySqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "select RegionID from estate_map where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", estateID);
IDataReader r = cmd.ExecuteReader();
List<UUID> regions = new List<UUID>();
while (r.Read())
{
EstateBan eb = new EstateBan();
UUID uuid = new UUID();
UUID.TryParse(r["RegionID"].ToString(), out uuid);
regions.Add(uuid);
}
r.Close();
return regions;
}
}
}
示例10: FromOSD
public void FromOSD(OSD v)
{
OSDMap values = (OSDMap) v;
EstateID = (uint) values["EstateID"].AsInteger();
EstateName = values["EstateName"].AsString();
AbuseEmailToEstateOwner = values["AbuseEmailToEstateOwner"].AsInteger() == 1;
DenyAnonymous = values["DenyAnonymous"].AsInteger() == 1;
ResetHomeOnTeleport = values["ResetHomeOnTeleport"].AsInteger() == 1;
FixedSun = values["FixedSun"].AsInteger() == 1;
DenyTransacted = values["DenyTransacted"].AsInteger() == 1;
BlockDwell = values["BlockDwell"].AsInteger() == 1;
DenyIdentified = values["DenyIdentified"].AsInteger() == 1;
AllowVoice = values["AllowVoice"].AsInteger() == 1;
UseGlobalTime = values["UseGlobalTime"].AsInteger() == 1;
PricePerMeter = values["PricePerMeter"].AsInteger();
TaxFree = values["TaxFree"].AsInteger() == 1;
AllowDirectTeleport = values["AllowDirectTeleport"].AsInteger() == 1;
RedirectGridX = values["RedirectGridX"].AsInteger();
RedirectGridY = values["RedirectGridY"].AsInteger();
ParentEstateID = (uint) values["ParentEstateID"].AsInteger();
SunPosition = values["SunPosition"].AsReal();
EstateSkipScripts = values["EstateSkipScripts"].AsInteger() == 1;
BillableFactor = (float) values["BillableFactor"].AsReal();
PublicAccess = values["PublicAccess"].AsInteger() == 1;
AbuseEmail = values["AbuseEmail"].AsString();
EstateOwner = values["EstateOwner"].AsUUID();
AllowLandmark = values["AllowLandmark"].AsInteger() == 1;
AllowParcelChanges = values["AllowParcelChanges"].AsInteger() == 1;
AllowSetHome = values["AllowSetHome"].AsInteger() == 1;
DenyMinors = values["DenyMinors"].AsInteger() == 1;
//We always try to pull this in if it exists
if (values.ContainsKey("EstatePass"))
EstatePass = values["EstatePass"].AsString();
OSDMap Managers = values["EstateManagers"] as OSDMap;
#if (!ISWIN)
List<UUID> list = new List<UUID>();
foreach (OSD id in Managers.Values)
list.Add(id.AsUUID());
EstateManagers = list.ToArray();
#else
EstateManagers = Managers.Values.Select(ID => ID.AsUUID()).ToArray();
#endif
OSDMap Ban = values["EstateBans"] as OSDMap;
List<EstateBan> NewBan = new List<EstateBan>();
foreach (OSD BannedUser in Ban.Values)
{
EstateBan ban = new EstateBan();
ban.FromOSD(BannedUser);
NewBan.Add(ban);
}
EstateBans = NewBan.ToArray();
OSDMap Access = values["EstateAccess"] as OSDMap;
#if (!ISWIN)
List<UUID> list1 = new List<UUID>();
foreach (OSD uuid in Access.Values)
list1.Add(uuid.AsUUID());
EstateAccess = list1.ToArray();
#else
EstateAccess = Access.Values.Select(UUID => UUID.AsUUID()).ToArray();
#endif
OSDMap Groups = values["EstateGroups"] as OSDMap;
#if (!ISWIN)
List<UUID> list2 = new List<UUID>();
foreach (OSD uuid in Groups.Values)
list2.Add(uuid.AsUUID());
EstateGroups = list2.ToArray();
#else
EstateGroups = Groups.Values.Select(UUID => UUID.AsUUID()).ToArray();
#endif
}
示例11: handleEstateAccessDeltaRequest
//.........这里部分代码省略.........
foreach (EstateSettings estate in estateIDs)
{
if (estate.EstateID != m_scene.RegionInfo.EstateSettings.EstateID)
{
estate.RemoveEstateGroup (user);
estate.Save ();
}
}
}
m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
if ((estateAccessType & (int)AccessDeltaRequest.MoreToCome) == 0) //1024 means more than one is being sent
{
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
}
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & (int)AccessDeltaRequest.AddBannedUser) != 0) // Ban add
{
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
{
IEstateConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IEstateConnector> ();
if ((estateAccessType & 1) != 0 && connector != null) // All estates
{
List<EstateSettings> estateIDs = connector.GetEstates (remote_client.AgentId);
foreach (EstateSettings estate in estateIDs)
{
if (estate.EstateID != m_scene.RegionInfo.EstateSettings.EstateID)
{
EstateBan[] innerbanlistcheck = estate.EstateBans;
bool inneralreadyInList = false;
for (int i = 0; i < innerbanlistcheck.Length; i++)
{
if (user == innerbanlistcheck[i].BannedUserID)
{
inneralreadyInList = true;
break;
}
}
if (!inneralreadyInList)
{
EstateBan item = new EstateBan ();
item.BannedUserID = user;
item.EstateID = estate.EstateID;
IScenePresence SP = m_scene.GetScenePresence (user);
item.BannedHostAddress = (SP != null) ? ((System.Net.IPEndPoint)SP.ControllingClient.GetClientEP ()).Address.ToString () : "0.0.0.0";
item.BannedHostIPMask = (SP != null) ? ((System.Net.IPEndPoint)SP.ControllingClient.GetClientEP ()).Address.ToString () : "0.0.0.0";
item.BannedHostNameMask = (SP != null) ? ((System.Net.IPEndPoint)SP.ControllingClient.GetClientEP ()).Address.ToString () : "0.0.0.0";
estate.AddBan (item);
estate.Save ();
}
}
}
}
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false;
示例12: handleEstateAccessDeltaRequest
private void handleEstateAccessDeltaRequest(IClientAPI remote_client, UUID invoice, int estateAccessType, UUID user)
{
// EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
if (user == m_scene.RegionInfo.EstateSettings.EstateOwner)
return; // never process EO
if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID)
return; // never process owner
switch (estateAccessType)
{
case 64:
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
{
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false;
for (int i = 0; i < banlistcheck.Length; i++)
{
if (user == banlistcheck[i].BannedUserID)
{
alreadyInList = true;
break;
}
}
if (!alreadyInList)
{
EstateBan item = new EstateBan();
item.BannedUserID = user;
item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID;
item.BannedHostAddress = "0.0.0.0";
item.BannedHostIPMask = "0.0.0.0";
m_scene.RegionInfo.EstateSettings.AddBan(item);
m_scene.RegionInfo.EstateSettings.Save();
ScenePresence s = m_scene.GetScenePresence(user);
if (s != null)
{
if (!s.IsChildAgent)
{
s.ControllingClient.SendTeleportLocationStart();
m_scene.TeleportClientHome(user, s.ControllingClient);
}
}
}
else
{
remote_client.SendAlertMessage("User is already on the region ban list");
}
//m_scene.RegionInfo.regionBanlist.Add(Manager(user);
remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
break;
case 128:
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
{
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false;
EstateBan listitem = null;
for (int i = 0; i < banlistcheck.Length; i++)
{
if (user == banlistcheck[i].BannedUserID)
{
alreadyInList = true;
listitem = banlistcheck[i];
break;
}
}
if (alreadyInList && listitem != null)
{
m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
m_scene.RegionInfo.EstateSettings.Save();
}
else
{
remote_client.SendAlertMessage("User is not on the region ban list");
}
//m_scene.RegionInfo.regionBanlist.Add(Manager(user);
remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
break;
case 256:
//.........这里部分代码省略.........
示例13: T022_EstateSettingsBanList
public void T022_EstateSettingsBanList()
{
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
EstateBan estateBan1 = new EstateBan();
estateBan1.BannedUserID = DataTestUtil.UUID_MIN;
EstateBan estateBan2 = new EstateBan();
estateBan2.BannedUserID = DataTestUtil.UUID_MAX;
originalSettings.EstateBans = new EstateBan[] { estateBan1, estateBan2 };
// Saving settings.
db.StoreEstateSettings(originalSettings);
// Loading settings to another instance variable.
EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
Assert.AreEqual(2, loadedSettings.EstateBans.Length);
Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID);
Assert.AreEqual(DataTestUtil.UUID_MAX, loadedSettings.EstateBans[1].BannedUserID);
}
示例14: AddBan
public void AddBan(EstateBan ban)
{
if (ban == null)
return;
if (!IsBanned(ban.BannedUserID))
l_EstateBans.Add(ban);
}
示例15: LoadBanList
private void LoadBanList(EstateSettings es)
{
es.ClearBans();
List<string> query = null;
try
{
query = GD.Query(new string[] { "ID", "`Key`" }, new object[] { es.EstateID, "EstateBans" }, "estates", "Value");
}
catch
{
}
if (query == null || query.Count == 0)
return; //Couldn't find it, return then.
OSDMap estateInfo = (OSDMap)OSDParser.DeserializeLLSDXml(query[0]);
foreach (OSD map in estateInfo.Values)
{
OSDMap estateBan = (OSDMap)map;
EstateBan eb = new EstateBan();
eb.BannedUserID = estateBan["BannedUserID"].AsUUID();
eb.BannedHostAddress = estateBan["BannedHostAddress"].AsString();
eb.BannedHostIPMask = estateBan["BannedHostIPMask"].AsString();
es.AddBan(eb);
}
}