• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PermissionMask类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PermissionMask的典型用法代码示例。如果您正苦于以下问题:C# PermissionMask类的具体用法?C# PermissionMask怎么用?C# PermissionMask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PermissionMask类属于命名空间,在下文中一共展示了PermissionMask类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Permissions

 public Permissions(uint baseMask, uint everyoneMask, uint groupMask, uint nextOwnerMask, uint ownerMask)
 {
     BaseMask = (PermissionMask)baseMask;
     EveryoneMask = (PermissionMask)everyoneMask;
     GroupMask = (PermissionMask)groupMask;
     NextOwnerMask = (PermissionMask)nextOwnerMask;
     OwnerMask = (PermissionMask)ownerMask;
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:8,代码来源:Permissions.cs


示例2: PermMaskString

 /// <summary>
 /// Returns a 3-character summary of the PermissionMask
 /// CMT if the mask allows copy, mod and transfer
 /// -MT if it disallows copy
 /// --T if it only allows transfer
 /// --- if it disallows everything
 /// </summary>
 /// <param name="mask"></param>
 /// <returns></returns>
 private static string PermMaskString(PermissionMask mask) {
     string str = "";
     if (((uint)mask | (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy)
         str += "C";
     else
         str += "-";
     if (((uint)mask | (uint)PermissionMask.Modify) == (uint)PermissionMask.Modify)
         str += "M";
     else
         str += "-";
     if (((uint)mask | (uint)PermissionMask.Transfer) == (uint)PermissionMask.Transfer)
         str += "T";
     else
         str += "-";
     return str;
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:25,代码来源:ListContentsCommand.cs


示例3: RequestCreateItem

        public void RequestCreateItem(LLUUID parentFolder, string name, string description, AssetType type, 
            InventoryType invType, WearableType wearableType, PermissionMask nextOwnerMask, 
            ItemCreatedCallback callback)
        {
            CreateInventoryItemPacket create = new CreateInventoryItemPacket();
            create.AgentData.AgentID = _Client.Self.AgentID;
            create.AgentData.SessionID = _Client.Self.SessionID;

            create.InventoryBlock.CallbackID = RegisterItemCreatedCallback(callback);
            create.InventoryBlock.FolderID = parentFolder;
            create.InventoryBlock.TransactionID = LLUUID.Random();
            create.InventoryBlock.NextOwnerMask = (uint)nextOwnerMask;
            create.InventoryBlock.Type = (sbyte)type;
            create.InventoryBlock.InvType = (sbyte)invType;
            create.InventoryBlock.WearableType = (byte)wearableType;
            create.InventoryBlock.Name = Helpers.StringToField(name);
            create.InventoryBlock.Description = Helpers.StringToField(description);

            _Client.Network.SendPacket(create);
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:20,代码来源:InventoryManager.cs


示例4: HasPermissions

 public static bool HasPermissions(PermissionMask perms, PermissionMask checkPerms)
 {
     return (perms & checkPerms) == checkPerms;
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:4,代码来源:Permissions.cs


示例5: SetPermissions

        /// <summary>
        /// Set the permissions on multiple objects
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the objects reside</param>
        /// <param name="localIDs">An array which contains the IDs of the objects to set the permissions on</param>
        /// <param name="who">The new Who mask to set</param>
        /// <param name="permissions">The new Permissions mark to set</param>
        /// <param name="set">TODO: What does this do?</param>
        public void SetPermissions(Simulator simulator, List<uint> localIDs, PermissionWho who,
            PermissionMask permissions, bool set)
        {
            ObjectPermissionsPacket packet = new ObjectPermissionsPacket();

            packet.AgentData.AgentID = Client.Self.AgentID;
            packet.AgentData.SessionID = Client.Self.SessionID;

            // Override can only be used by gods
            packet.HeaderData.Override = false;

            packet.ObjectData = new ObjectPermissionsPacket.ObjectDataBlock[localIDs.Count];

            for (int i = 0; i < localIDs.Count; i++)
            {
                packet.ObjectData[i] = new ObjectPermissionsPacket.ObjectDataBlock();

                packet.ObjectData[i].ObjectLocalID = localIDs[i];
                packet.ObjectData[i].Field = (byte)who;
                packet.ObjectData[i].Mask = (uint)permissions;
                packet.ObjectData[i].Set = Convert.ToByte(set);
            }

            Client.Network.SendPacket(packet, simulator);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:33,代码来源:ObjectManager.cs


示例6: Deserialize

 /// <summary>
 /// Deserialize the message
 /// </summary>
 /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
 public void Deserialize(OSDMap map)
 {
     FolderID = map["folder_id"].AsUUID();
     AssetType = Utils.StringToAssetType(map["asset_type"].AsString());
     InventoryType = Utils.StringToInventoryType(map["inventory_type"].AsString());
     Name = map["name"].AsString();
     Description = map["description"].AsString();
     EveryoneMask = (PermissionMask)map["everyone_mask"].AsInteger();
     GroupMask = (PermissionMask)map["group_mask"].AsInteger();
     NextOwnerMask = (PermissionMask)map["next_owner_mask"].AsInteger();
 }
开发者ID:justincc,项目名称:libopenmetaverse,代码行数:15,代码来源:LindenMessages.cs


示例7: 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";
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:ChangePermsCommand.cs


示例8: RequestCreateItem

        /// <summary>
        /// Creates a wearable inventory item referencing an asset upload. 
        /// Second Life v1.9 uses this method to create wearable inventory items.
        /// </summary>
        /// <param name="parentFolder"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="type"></param>
        /// <param name="wearableType"></param>
        /// <param name="invType"></param>
        /// <param name="nextOwnerMask"></param>
        /// <param name="callback"></param>
        /// <param name="assetTransactionID">Proper use is to upload the inventory's asset first, then provide the Asset's TransactionID here.</param>
        public void RequestCreateItem(UUID parentFolder, string name, string description, AssetType type, UUID assetTransactionID,
            InventoryType invType, WearableType wearableType, PermissionMask nextOwnerMask, ItemCreatedCallback callback)
        {
            CreateInventoryItemPacket create = new CreateInventoryItemPacket();
            create.AgentData.AgentID = _Agents.AgentID;
            create.AgentData.SessionID = _Agents.SessionID;

            create.InventoryBlock.CallbackID = RegisterItemCreatedCallback(callback);
            create.InventoryBlock.FolderID = parentFolder;
            create.InventoryBlock.TransactionID = assetTransactionID;
            create.InventoryBlock.NextOwnerMask = (uint)nextOwnerMask;
            create.InventoryBlock.Type = (sbyte)type;
            create.InventoryBlock.InvType = (sbyte)invType;
            create.InventoryBlock.WearableType = (byte)wearableType;
            create.InventoryBlock.Name = Utils.StringToBytes(name);
            create.InventoryBlock.Description = Utils.StringToBytes(description);

            _Network.SendPacket(create);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:32,代码来源:InventoryManager.cs


示例9: SetPerms

        private void SetPerms(Simulator CurrentSim, List<uint> localIDs, PermissionWho who, PermissionMask Perms,
                              bool tf)
        {
            try
            {
                if (!skipPerms)
                {
                    PermCount = 0;

                    if ((Perms & PermissionMask.Modify) == PermissionMask.Modify)
                        Client.Objects.SetPermissions(CurrentSim, localIDs, who, PermissionMask.Modify,
                                                      tf);
                    PermsSent = true;

                    //  if (!GotPermissionsEvent.WaitOne(1000 * 30, false))
                    //     return Failure("failed to set the modify bit, permissions in an unknown state";

                    PermCount = 0;
                    if ((Perms & PermissionMask.Copy) == PermissionMask.Copy)
                        Client.Objects.SetPermissions(CurrentSim, localIDs, who, PermissionMask.Copy,
                                                      tf);

                    PermsSent = true;

                    //  if (!GotPermissionsEvent.WaitOne(1000 * 30, false))
                    //   return Failure("failed to set the copy bit, permissions in an unknown state";

                    PermCount = 0;
                    if ((Perms & PermissionMask.Transfer) == PermissionMask.Transfer)
                        Client.Objects.SetPermissions(CurrentSim, localIDs, who, PermissionMask.Transfer,
                                                      tf);

                    PermsSent = true;

                    PermCount = 0;
                    if ((Perms & PermissionMask.Move) == PermissionMask.Move)
                        Client.Objects.SetPermissions(CurrentSim, localIDs, who, PermissionMask.Transfer,
                                                      tf);

                    PermsSent = true;
                }
                /*
                else
                {
                    Client.Objects.SetPermissions(CurrentSim, localIDs, PermissionWho.Owner, PermissionMask.All, true);
                    Client.Objects.SetPermissions(CurrentSim, localIDs, PermissionWho.Group, PermissionMask.Modify, true);
                    Client.Objects.SetPermissions(CurrentSim, localIDs, PermissionWho.Group, PermissionMask.All, true);
                }
                //  if (!GotPermissionsEvent.WaitOne(1000 * 30, false))
                //    return Failure("failed to set the transfer bit, permissions in an unknown state";
                */
            }
            catch (Exception e)
            {
                DLRConsole.DebugWriteLine("ERROR {0}", e);
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:57,代码来源:DeedObjectsCommand.cs


示例10: Reperm

 private static Enum Reperm(PermissionMask mask, ImportSettings settings)
 {
     if (settings.Contains("sameperms")) return mask;
     if (settings.Contains("+xfer+copy")) return mask | PermissionMask.Copy | PermissionMask.Transfer;
     return PermissionMask.All;
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:6,代码来源:OarFile.cs


示例11: HasPermission

 public static bool HasPermission(this PermissionMask mask, PermissionMask permission)
 {
     return (mask & permission) == permission;
 }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:4,代码来源:LLPermissions.cs



注:本文中的PermissionMask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PermissionSet类代码示例发布时间:2022-05-24
下一篇:
C# PermissionInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap