本文整理汇总了C#中PermissionMask.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PermissionMask.ToString方法的具体用法?C# PermissionMask.ToString怎么用?C# PermissionMask.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionMask
的用法示例。
在下文中一共展示了PermissionMask.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override string Execute(string[] args, UUID fromAgentID)
{
UUID rootID;
Primitive rootPrim;
List<Primitive> childPrims;
List<uint> localIDs = new List<uint>();
// Reset class-wide variables
PermsSent = false;
Objects.Clear();
Perms = PermissionMask.None;
PermCount = 0;
if (args.Length < 1 || args.Length > 4)
return "Usage prim-uuid [copy] [mod] [xfer]";
if (!UUID.TryParse(args[0], out rootID))
return "Usage prim-uuid [copy] [mod] [xfer]";
for (int i = 1; i < args.Length; i++)
{
switch (args[i].ToLower())
{
case "copy":
Perms |= PermissionMask.Copy;
break;
case "mod":
Perms |= PermissionMask.Modify;
break;
case "xfer":
Perms |= PermissionMask.Transfer;
break;
default:
return "Usage prim-uuid [copy] [mod] [xfer]";
}
}
Logger.DebugLog("Using PermissionMask: " + Perms.ToString(), Client);
// Find the requested prim
rootPrim = Client.Network.CurrentSim.ObjectsPrimitives.Find(delegate(Primitive prim) { return prim.ID == rootID; });
if (rootPrim == null)
return "Cannot find requested prim " + rootID.ToString();
else
Logger.DebugLog("Found requested prim " + rootPrim.ID.ToString(), Client);
if (rootPrim.ParentID != 0)
{
// This is not actually a root prim, find the root
if (!Client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(rootPrim.ParentID, out rootPrim))
return "Cannot find root prim for requested object";
else
Logger.DebugLog("Set root prim to " + rootPrim.ID.ToString(), Client);
}
// Find all of the child objects linked to this root
childPrims = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(delegate(Primitive prim) { return prim.ParentID == rootPrim.LocalID; });
// Build a dictionary of primitives for referencing later
Objects[rootPrim.ID] = rootPrim;
for (int i = 0; i < childPrims.Count; i++)
Objects[childPrims[i].ID] = childPrims[i];
// Build a list of all the localIDs to set permissions for
localIDs.Add(rootPrim.LocalID);
for (int i = 0; i < childPrims.Count; i++)
localIDs.Add(childPrims[i].LocalID);
// Go through each of the three main permissions and enable or disable them
#region Set Linkset Permissions
PermCount = 0;
if ((Perms & PermissionMask.Modify) == PermissionMask.Modify)
Client.Objects.SetPermissions(Client.Network.CurrentSim, localIDs, PermissionWho.NextOwner, PermissionMask.Modify, true);
else
Client.Objects.SetPermissions(Client.Network.CurrentSim, localIDs, PermissionWho.NextOwner, PermissionMask.Modify, false);
PermsSent = true;
if (!GotPermissionsEvent.WaitOne(1000 * 30, false))
return "Failed to set the modify bit, permissions in an unknown state";
PermCount = 0;
if ((Perms & PermissionMask.Copy) == PermissionMask.Copy)
Client.Objects.SetPermissions(Client.Network.CurrentSim, localIDs, PermissionWho.NextOwner, PermissionMask.Copy, true);
else
Client.Objects.SetPermissions(Client.Network.CurrentSim, localIDs, PermissionWho.NextOwner, PermissionMask.Copy, false);
PermsSent = true;
if (!GotPermissionsEvent.WaitOne(1000 * 30, false))
return "Failed to set the copy bit, permissions in an unknown state";
PermCount = 0;
if ((Perms & PermissionMask.Transfer) == PermissionMask.Transfer)
Client.Objects.SetPermissions(Client.Network.CurrentSim, localIDs, PermissionWho.NextOwner, PermissionMask.Transfer, true);
else
Client.Objects.SetPermissions(Client.Network.CurrentSim, localIDs, PermissionWho.NextOwner, PermissionMask.Transfer, false);
PermsSent = true;
if (!GotPermissionsEvent.WaitOne(1000 * 30, false))
return "Failed to set the transfer bit, permissions in an unknown state";
//.........这里部分代码省略.........