本文整理汇总了C#中OpenMetaverse.Permissions类的典型用法代码示例。如果您正苦于以下问题:C# Permissions类的具体用法?C# Permissions怎么用?C# Permissions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Permissions类属于OpenMetaverse命名空间,在下文中一共展示了Permissions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Equals
public bool Equals(Permissions other)
{
return this == other;
}
示例2: RequestCreateItemFromAsset
/// <summary>
/// Create an inventory item and upload asset data
/// </summary>
/// <param name="data">Asset data</param>
/// <param name="name">Inventory item name</param>
/// <param name="description">Inventory item description</param>
/// <param name="assetType">Asset type</param>
/// <param name="invType">Inventory type</param>
/// <param name="folderID">Put newly created inventory in this folder</param>
/// <param name="callback">Delegate that will receive feedback on success or failure</param>
public void RequestCreateItemFromAsset(byte[] data, string name, string description, AssetType assetType,
InventoryType invType, UUID folderID, ItemCreatedFromAssetCallback callback)
{
Permissions permissions = new Permissions();
permissions.EveryoneMask = PermissionMask.None;
permissions.GroupMask = PermissionMask.None;
permissions.NextOwnerMask = PermissionMask.All;
RequestCreateItemFromAsset(data, name, description, assetType, invType, folderID, permissions, callback);
}
示例3: Attach
/// <summary>
/// Attach an item to our agent specifying attachment details
/// </summary>
/// <param name="itemID">The <seealso cref="OpenMetaverse.UUID"/> of the item to attach</param>
/// <param name="ownerID">The <seealso cref="OpenMetaverse.UUID"/> attachments owner</param>
/// <param name="name">The name of the attachment</param>
/// <param name="description">The description of the attahment</param>
/// <param name="perms">The <seealso cref="OpenMetaverse.Permissions"/> to apply when attached</param>
/// <param name="itemFlags">The <seealso cref="OpenMetaverse.InventoryItemFlags"/> of the attachment</param>
/// <param name="attachPoint">The <seealso cref="OpenMetaverse.AttachmentPoint"/> on the agent
/// <param name="replace">If true replace existing attachment on this attachment point, otherwise add to it (multi-attachments)</param>
/// to attach the item to</param>
public void Attach(UUID itemID, UUID ownerID, string name, string description,
Permissions perms, uint itemFlags, AttachmentPoint attachPoint, bool replace)
{
// TODO: At some point it might be beneficial to have AppearanceManager track what we
// are currently wearing for attachments to make enumeration and detachment easier
RezSingleAttachmentFromInvPacket attach = new RezSingleAttachmentFromInvPacket();
attach.AgentData.AgentID = Client.Self.AgentID;
attach.AgentData.SessionID = Client.Self.SessionID;
attach.ObjectData.AttachmentPt = replace ? (byte)attachPoint : (byte)(ATTACHMENT_ADD | (byte)attachPoint);
attach.ObjectData.Description = Utils.StringToBytes(description);
attach.ObjectData.EveryoneMask = (uint)perms.EveryoneMask;
attach.ObjectData.GroupMask = (uint)perms.GroupMask;
attach.ObjectData.ItemFlags = itemFlags;
attach.ObjectData.ItemID = itemID;
attach.ObjectData.Name = Utils.StringToBytes(name);
attach.ObjectData.NextOwnerMask = (uint)perms.NextOwnerMask;
attach.ObjectData.OwnerID = ownerID;
Client.Network.SendPacket(attach);
}
示例4: FromOSD
public static Permissions FromOSD(OSD llsd)
{
Permissions permissions = new Permissions();
OSDMap map = llsd as OSDMap;
if (map != null)
{
permissions.BaseMask = (PermissionMask)map["base_mask"].AsUInteger();
permissions.EveryoneMask = (PermissionMask)map["everyone_mask"].AsUInteger();
permissions.GroupMask = (PermissionMask)map["group_mask"].AsUInteger();
permissions.NextOwnerMask = (PermissionMask)map["next_owner_mask"].AsUInteger();
permissions.OwnerMask = (PermissionMask)map["owner_mask"].AsUInteger();
}
return permissions;
}
示例5: btnUpload_Click
private void btnUpload_Click(object sender, EventArgs e)
{
bool tmp = chkTemp.Checked;
txtStatus.AppendText("Uploading...");
btnLoad.Enabled = false;
btnUpload.Enabled = false;
AssetID = InventoryID = UUID.Zero;
TextureName = Path.GetFileNameWithoutExtension(FileName);
if (tmp) TextureName += " (temp)";
TextureDescription = string.Format("Uploaded with Radegast on {0}", DateTime.Now.ToLongDateString());
Permissions perms = new Permissions();
perms.EveryoneMask = PermissionMask.All;
perms.NextOwnerMask = PermissionMask.All;
if (!tmp)
{
client.Settings.CAPS_TIMEOUT = 180 * 1000;
client.Inventory.RequestCreateItemFromAsset(UploadData, TextureName, TextureDescription, AssetType.Texture, InventoryType.Texture,
client.Inventory.FindFolderForType(AssetType.Texture), perms, UploadHandler);
}
else
{
TransactionID = UUID.Random();
client.Assets.RequestUpload(out AssetID, AssetType.Texture, UploadData, true, TransactionID);
}
}
示例6: Decode
public override bool Decode()
{
int version = -1;
Permissions = new Permissions();
string data = Utils.BytesToString(AssetData);
data = data.Replace("\r", String.Empty);
string[] lines = data.Split('\n');
for (int stri = 0; stri < lines.Length; stri++)
{
if (stri == 0)
{
string versionstring = lines[stri];
version = Int32.Parse(versionstring.Split(' ')[2]);
if (version != 22 && version != 18)
return false;
}
else if (stri == 1)
{
Name = lines[stri];
}
else if (stri == 2)
{
Description = lines[stri];
}
else
{
string line = lines[stri].Trim();
string[] fields = line.Split('\t');
if (fields.Length == 1)
{
fields = line.Split(' ');
if (fields[0] == "parameters")
{
int count = Int32.Parse(fields[1]) + stri;
for (; stri < count; )
{
stri++;
line = lines[stri].Trim();
fields = line.Split(' ');
int id = Int32.Parse(fields[0]);
if (fields[1] == ",")
fields[1] = "0";
else
fields[1] = fields[1].Replace(',', '.');
float weight = float.Parse(fields[1], System.Globalization.NumberStyles.Float,
Utils.EnUsCulture.NumberFormat);
Params[id] = weight;
}
}
else if (fields[0] == "textures")
{
int count = Int32.Parse(fields[1]) + stri;
for (; stri < count; )
{
stri++;
line = lines[stri].Trim();
fields = line.Split(' ');
AppearanceManager.TextureIndex id = (AppearanceManager.TextureIndex)Int32.Parse(fields[0]);
UUID texture = new UUID(fields[1]);
Textures[id] = texture;
}
}
else if (fields[0] == "type")
{
WearableType = (WearableType)Int32.Parse(fields[1]);
}
}
else if (fields.Length == 2)
{
switch (fields[0])
{
case "creator_mask":
// Deprecated, apply this as the base mask
Permissions.BaseMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "base_mask":
Permissions.BaseMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "owner_mask":
Permissions.OwnerMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "group_mask":
Permissions.GroupMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "everyone_mask":
Permissions.EveryoneMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "next_owner_mask":
Permissions.NextOwnerMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "creator_id":
Creator = new UUID(fields[1]);
//.........这里部分代码省略.........
示例7: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
//opensim drew this line because of clients might be hardcoded to only support 255? or was this trying to copy linden?
try
{
//Client.Objects.OnObjectProperties += callback;
int argsUsed;
Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim;
UUID groupID = UUID.Zero;
Simulator CurrentSim = CurSim;
Permissions AddPerms = new Permissions();
Permissions SubPerms = new Permissions();
bool doTaskInv = false;
List<Primitive> TaskPrims = new List<Primitive>();
List<uint> localIDs = new List<uint>();
// Reset class-wide variables
PermsSent = false;
Objects.Clear();
PermCount = 0;
bool oneAtATime = false;
if (args.Length < 3)
return ShowUsage();
if (!UUIDTryParse(args, 0, out groupID, out argsUsed))
return ShowUsage();
args.AdvanceArgs(argsUsed);
List<SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed);
if (IsEmpty(PS)) return Failure("Cannot find objects from " + args.str);
PermissionWho who = 0;
bool deed = false;
for (int i = argsUsed; i < args.Length; i++)
{
bool add = true;
bool setPerms = false;
string arg = args[i];
int whoint = (int) who;
PermissionMask Perms = PermsAdd[whoint];
if (arg.StartsWith("+"))
{
arg = arg.Substring(1);
}
else if (arg.StartsWith("-"))
{
arg = arg.Substring(1);
add = false;
Perms = PermsSub[whoint];
}
switch (arg.ToLower())
{
// change owner referall
case "who":
who = 0;
break;
case "o":
who |= PermissionWho.Owner;
break;
case "g":
who |= PermissionWho.Group;
break;
case "e":
who |= PermissionWho.Everyone;
break;
case "n":
who |= PermissionWho.NextOwner;
break;
case "a":
who = PermissionWho.All;
break;
// change perms for owner
case "copy":
Perms |= PermissionMask.Copy;
setPerms = true;
break;
case "mod":
Perms |= PermissionMask.Modify;
setPerms = true;
break;
case "xfer":
Perms |= PermissionMask.Transfer;
setPerms = true;
break;
case "all":
Perms |= PermissionMask.All;
setPerms = true;
break;
case "dmg":
Perms |= PermissionMask.Damage;
setPerms = true;
//.........这里部分代码省略.........
示例8: ItemData
public ItemData(UUID uuid, InventoryType type)
{
UUID = uuid;
InventoryType = type;
ParentUUID = UUID.Zero;
Name = String.Empty;
OwnerID = UUID.Zero;
AssetUUID = UUID.Zero;
Permissions = new Permissions();
AssetType = AssetType.Unknown;
CreatorID = UUID.Zero;
Description = String.Empty;
GroupID = UUID.Zero;
GroupOwned = false;
SalePrice = 0;
SaleType = SaleType.Not;
Flags = 0;
CreationDate = DateTime.Now;
}
示例9: Decode
/// <summary>
/// Decode the raw asset data including the Linden Text properties
/// </summary>
/// <returns>true if the AssetData was successfully decoded</returns>
public override bool Decode()
{
string data = Utils.BytesToString(AssetData);
EmbeddedItems = new List<InventoryItem>();
BodyText = string.Empty;
try
{
string[] lines = data.Split('\n');
int i = 0;
Match m;
// Version
if (!(m = Regex.Match(lines[i++], @"Linden text version\s+(\d+)")).Success)
throw new Exception("could not determine version");
int notecardVersion = int.Parse(m.Groups[1].Value);
if (notecardVersion < 1 || notecardVersion > 2)
throw new Exception("unsuported version");
if (!(m = Regex.Match(lines[i++], @"\s*{$")).Success)
throw new Exception("wrong format");
// Embedded items header
if (!(m = Regex.Match(lines[i++], @"LLEmbeddedItems version\s+(\d+)")).Success)
throw new Exception("could not determine embedded items version version");
if (m.Groups[1].Value != "1")
throw new Exception("unsuported embedded item version");
if (!(m = Regex.Match(lines[i++], @"\s*{$")).Success)
throw new Exception("wrong format");
// Item count
if (!(m = Regex.Match(lines[i++], @"count\s+(\d+)")).Success)
throw new Exception("wrong format");
int count = int.Parse(m.Groups[1].Value);
// Decode individual items
for (int n = 0; n < count; n++)
{
if (!(m = Regex.Match(lines[i++], @"\s*{$")).Success)
throw new Exception("wrong format");
// Index
if (!(m = Regex.Match(lines[i++], @"ext char index\s+(\d+)")).Success)
throw new Exception("missing ext char index");
//warning CS0219: The variable `index' is assigned but its value is never used
//int index = int.Parse(m.Groups[1].Value);
// Inventory item
if (!(m = Regex.Match(lines[i++], @"inv_item\s+0")).Success)
throw new Exception("missing inv item");
// Item itself
UUID uuid = UUID.Zero;
UUID creatorID = UUID.Zero;
UUID ownerID = UUID.Zero;
UUID lastOwnerID = UUID.Zero;
UUID groupID = UUID.Zero;
Permissions permissions = Permissions.NoPermissions;
int salePrice = 0;
SaleType saleType = SaleType.Not;
UUID parentUUID = UUID.Zero;
UUID assetUUID = UUID.Zero;
AssetType assetType = AssetType.Unknown;
InventoryType inventoryType = InventoryType.Unknown;
uint flags = 0;
string name = string.Empty;
string description = string.Empty;
DateTime creationDate = Utils.Epoch;
while (true)
{
if (!(m = Regex.Match(lines[i++], @"([^\s]+)(\s+)?(.*)?")).Success)
throw new Exception("wrong format");
string key = m.Groups[1].Value;
string val = m.Groups[3].Value;
if (key == "{")
continue;
if (key == "}")
break;
else if (key == "permissions")
{
uint baseMask = 0;
uint ownerMask = 0;
uint groupMask = 0;
uint everyoneMask = 0;
uint nextOwnerMask = 0;
while (true)
{
if (!(m = Regex.Match(lines[i++], @"([^\s]+)(\s+)?([^\s]+)?")).Success)
throw new Exception("wrong format");
string pkey = m.Groups[1].Value;
string pval = m.Groups[3].Value;
if (pkey == "{")
continue;
if (pkey == "}")
//.........这里部分代码省略.........
示例10: IsFullPerm
public static bool IsFullPerm(Permissions Permissions)
{
if (
((Permissions.OwnerMask & PermissionMask.Modify) != 0) &&
((Permissions.OwnerMask & PermissionMask.Copy) != 0) &&
((Permissions.OwnerMask & PermissionMask.Transfer) != 0)
)
{
return true;
}
else
{
return false;
}
}
示例11: UploadImage
private bool UploadImage()
{
SendToID = UUID.Zero;
string sendTo = String.Empty;
if(ccFirstName!=String.Empty) sendTo = ccFirstName + " " + ccLastName;
if (sendTo.Length > 0)
{
AutoResetEvent lookupEvent = new AutoResetEvent(false);
UUID thisQueryID = UUID.Zero;
bool lookupSuccess = false;
EventHandler<DirPeopleReplyEventArgs> callback =
delegate(object s, DirPeopleReplyEventArgs ep)
{
if (ep.QueryID == thisQueryID)
{
if (ep.MatchedPeople.Count > 0)
{
SendToID = ep.MatchedPeople[0].AgentID;
lookupSuccess = true;
}
lookupEvent.Set();
}
};
Client.Directory.DirPeopleReply += callback;
thisQueryID = Client.Directory.StartPeopleSearch(sendTo, 0);
bool eventSuccess = lookupEvent.WaitOne(10 * 1000, false);
Client.Directory.DirPeopleReply -= callback;
if (eventSuccess && lookupSuccess)
{
Console.WriteLine("Will send uploaded image to avatar {0} with UUID {1}", sendTo, SendToID.ToString());
}
else
{
Console.WriteLine("Could not find avatar {0}. Upload Cancelled.", sendTo);
return false;
}
}
if (UploadData != null)
{
string name = System.IO.Path.GetFileNameWithoutExtension(FileName);
Permissions perms = new Permissions();
perms.EveryoneMask = PermissionMask.All;
perms.NextOwnerMask = PermissionMask.All;
Console.WriteLine("Starting uploading of image to Asset Server with name '{0}'", name);
Client.Inventory.RequestCreateItemFromAsset(UploadData, name, "Uploaded with GridImageUploadCmd", AssetType.Texture,
InventoryType.Texture, Client.Inventory.FindFolderForType(AssetType.Texture), perms, ItemCreatedFromAssetCallback);
return true;
}
return false;
}
示例12: FromOSD
public static Permissions FromOSD(OSD llsd)
{
Permissions permissions = new Permissions();
OSDMap map = (OSDMap)llsd;
byte[] bytes = map["BaseMask"].AsBinary();
permissions.BaseMask = (PermissionMask)Utils.BytesToUInt(bytes);
bytes = map["EveryoneMask"].AsBinary();
permissions.EveryoneMask = (PermissionMask)Utils.BytesToUInt(bytes);
bytes = map["GroupMask"].AsBinary();
permissions.GroupMask = (PermissionMask)Utils.BytesToUInt(bytes);
bytes = map["NextOwnerMask"].AsBinary();
permissions.NextOwnerMask = (PermissionMask)Utils.BytesToUInt(bytes);
bytes = map["OwnerMask"].AsBinary();
permissions.OwnerMask = (PermissionMask)Utils.BytesToUInt(bytes);
return permissions;
}
示例13: cmdUpload_Click
private void cmdUpload_Click(object sender, EventArgs e)
{
SendToID = UUID.Zero;
string sendTo = txtSendtoName.Text.Trim();
if (sendTo.Length > 0)
{
AutoResetEvent lookupEvent = new AutoResetEvent(false);
UUID thisQueryID = UUID.Zero;
bool lookupSuccess = false;
EventHandler<DirPeopleReplyEventArgs> callback =
delegate(object s, DirPeopleReplyEventArgs ep)
{
if (ep.QueryID == thisQueryID)
{
if (ep.MatchedPeople.Count > 0)
{
SendToID = ep.MatchedPeople[0].AgentID;
lookupSuccess = true;
}
lookupEvent.Set();
}
};
Client.Directory.DirPeopleReply += callback;
thisQueryID = Client.Directory.StartPeopleSearch(sendTo, 0);
bool eventSuccess = lookupEvent.WaitOne(10 * 1000, false);
Client.Directory.DirPeopleReply -= callback;
if (eventSuccess && lookupSuccess)
{
Logger.Log("Will send uploaded image to avatar " + SendToID.ToString(), Helpers.LogLevel.Info, Client);
}
else
{
MessageBox.Show("Could not find avatar \"" + sendTo + "\", upload cancelled");
return;
}
}
if (UploadData != null)
{
prgUpload.Value = 0;
cmdLoad.Enabled = false;
cmdSave.Enabled = false;
cmdUpload.Enabled = false;
grpLogin.Enabled = false;
string name = System.IO.Path.GetFileNameWithoutExtension(FileName);
Permissions perms = new Permissions();
perms.EveryoneMask = PermissionMask.All;
perms.NextOwnerMask = PermissionMask.All;
Client.Inventory.RequestCreateItemFromAsset(UploadData, name, "Uploaded with SL Image Upload", AssetType.Texture,
InventoryType.Texture, Client.Inventory.FindFolderForType(AssetType.Texture), perms,
delegate(bool success, string status, UUID itemID, UUID assetID)
{
if (this.InvokeRequired)
BeginInvoke(new MethodInvoker(EnableControls));
else
EnableControls();
if (success)
{
AssetID = assetID;
UpdateAssetID();
// Fix the permissions on the new upload since they are fscked by default
InventoryItem item = (InventoryItem)Client.Inventory.Store[itemID];
Transferred = UploadData.Length;
BeginInvoke((MethodInvoker)delegate() { SetProgress(); });
}
else
{
MessageBox.Show("Asset upload failed: " + status);
}
}
);
}
}
示例14: InventoryItem
/// <summary>
///
/// </summary>
/// <returns></returns>
public InventoryItem(SerializationInfo info, StreamingContext ctxt)
: base(info, ctxt)
{
AssetUUID = (UUID)info.GetValue("AssetUUID", typeof(UUID));
Permissions = (Permissions)info.GetValue("Permissions", typeof(Permissions));
AssetType = (AssetType)info.GetValue("AssetType", typeof(AssetType));
InventoryType = (InventoryType)info.GetValue("InventoryType", typeof(InventoryType));
CreatorID = (UUID)info.GetValue("CreatorID", typeof(UUID));
Description = (string)info.GetValue("Description", typeof(string));
GroupID = (UUID)info.GetValue("GroupID", typeof(UUID));
GroupOwned = (bool)info.GetValue("GroupOwned", typeof(bool));
SalePrice = (int)info.GetValue("SalePrice", typeof(int));
SaleType = (SaleType)info.GetValue("SaleType", typeof(SaleType));
Flags = (uint)info.GetValue("Flags", typeof(uint));
CreationDate = (DateTime)info.GetValue("CreationDate", typeof(DateTime));
LastOwnerID = (UUID)info.GetValue("LastOwnerID", typeof(UUID));
}
示例15: btnUpload_Click
private void btnUpload_Click(object sender, EventArgs e)
{
txtStatus.AppendText("Uploading...");
btnLoad.Enabled = false;
btnUpload.Enabled = false;
AssetID = InventoryID = UUID.Zero;
string name = Path.GetFileNameWithoutExtension(FileName);
string desc = string.Format("Uploaded with Radegast on {0}", DateTime.Now.ToLongDateString());
Permissions perms = new Permissions();
perms.EveryoneMask = PermissionMask.All;
perms.NextOwnerMask = PermissionMask.All;
client.Inventory.RequestCreateItemFromAsset(UploadData, name, desc, AssetType.Texture, InventoryType.Texture,
client.Inventory.FindFolderForType(AssetType.Texture), perms, UploadHandler);
}