本文整理汇总了C#中Group.AddMember方法的典型用法代码示例。如果您正苦于以下问题:C# Group.AddMember方法的具体用法?C# Group.AddMember怎么用?C# Group.AddMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group.AddMember方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMethod1
public void TestMethod1()
{
IExpenseReport visitor = new OverAllGroupExpenseVisitor();
Group group = new Group("myGroup");
Member member1 = new Member("pankaj", "sharma", "[email protected]");
Member member2 = new Member("pranav", "sharma", "[email protected]");
group.AddMember(member1);
group.AddMember(member2);
group.AddMember(new Member("ankush", "sharma", "[email protected]"));
group.AddExpense(new Expense("",100,member1));
group.AddExpense(new Expense("", 200, member2));
List<MemberwiseContribution> contributions = visitor.Generate(group);
}
示例2: OnTick
//.........这里部分代码省略.........
{
if (m_response == 0x01)
{
GameClient cln = WorldMgr.GetClientFromID(m_data1);
if (cln == null)
return;
GamePlayer groupLeader = cln.Player;
if (groupLeader == null)
return;
if (player.Group != null)
{
player.Out.SendMessage("You are still in a group.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!GameServer.ServerRules.IsAllowedToGroup(groupLeader, player, false))
{
return;
}
if (player.InCombatPvE)
{
player.Out.SendMessage("You can't join a group while in combat!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (groupLeader.Group != null)
{
if (groupLeader.Group.Leader != groupLeader) return;
if (groupLeader.Group.MemberCount >= ServerProperties.Properties.GROUP_MAX_MEMBER)
{
player.Out.SendMessage("The group is full.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
groupLeader.Group.AddMember(player);
GameEventMgr.Notify(GamePlayerEvent.AcceptGroup, player);
return;
}
var group = new Group(groupLeader);
GroupMgr.AddGroup(group, group);
group.AddMember(groupLeader);
group.AddMember(player);
GameEventMgr.Notify(GamePlayerEvent.AcceptGroup, player);
return;
}
break;
}
case eDialogCode.KeepClaim:
{
if (m_response == 0x01)
{
if (player.Guild == null)
{
player.Out.SendMessage("You have to be a member of a guild, before you can use any of the commands!",
eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
AbstractGameKeep keep = GameServer.KeepManager.GetKeepCloseToSpot(player.CurrentRegionID, player, WorldMgr.VISIBILITY_DISTANCE);
if (keep == null)
{
player.Out.SendMessage("You have to be near the keep to claim it.", eChatType.CT_System,
eChatLoc.CL_SystemWindow);
示例3: Group_Creation
public void Group_Creation()
{
string testGroupAName = "TestGroupA";
string testGroupAPath = RepositoryPath.Combine(Repository.Root.Path, testGroupAName);
if (Node.Exists(testGroupAPath))
Node.ForceDelete(testGroupAPath);
string testGroupBName = "TestGroupB";
string testGroupBPath = RepositoryPath.Combine(Repository.Root.Path, testGroupBName);
if (Node.Exists(testGroupBPath))
Node.ForceDelete(testGroupBPath);
string testGroupCName = "TestGroupC";
string testGroupCPath = RepositoryPath.Combine(Repository.Root.Path, testGroupCName);
if (Node.Exists(testGroupCPath))
Node.ForceDelete(testGroupCPath);
string testUserAName = "TestUserA";
string testUserAPath = RepositoryPath.Combine("/Root/IMS/BuiltIn/Portal", testUserAName);
if (Node.Exists(testUserAPath))
Node.ForceDelete(testUserAPath);
User testUserA = new User(Node.LoadNode("/Root/IMS/BuiltIn/Portal"));
testUserA.Name = testUserAName;
testUserA.Save();
AddPathToDelete(testGroupAPath);
AddPathToDelete(testGroupBPath);
AddPathToDelete(testGroupCPath);
AddPathToDelete(testUserAPath);
Group testGroupA = new Group(Repository.Root);
testGroupA.Name = testGroupAName;
testGroupA.AddMember(User.Administrator);
testGroupA.AddMember(User.Visitor);
testGroupA.Save();
Group testGroupB = new Group(Repository.Root);
testGroupB.Name = testGroupBName;
testGroupB.AddMember(User.Administrator);
testGroupB.AddMember(testGroupA);
testGroupB.Save();
Group testGroupC = new Group(Repository.Root);
testGroupC.Name = testGroupCName;
testGroupC.AddMember(testGroupB);
testGroupC.Save();
//testGroupA.AddMember(testGroupC);
//testGroupA.Save();
}
示例4: getContentParticle
void getContentParticle(Group group, ElementType parent)
{
Group childGroup;
Reference rf;
if (isChar('('))
{
childGroup = new Group();
group.AddMember(childGroup);
getGroup(childGroup, parent);
}
else
{
rf = getReference(group, parent, false);
getFrequency(rf);
}
}
示例5: getReference
Reference getReference(Group group, ElementType parent, bool mixed)
{
// XMLName name;
ElementType child;
Reference rf;
// Create an ElementType for the referenced child.
child = createElementType();
// Add the child to the parent and vice versa. If we are processing
// mixed content, then each child must be unique in the parent.
if ( mixed )
{
if (parent.HasChildElement(child.Name))
throwXMLMiddlewareException("The element type " + child.Name + " appeared more than once in the declaration of mixed content for the element type " + parent.Name + ".");
}
parent.AddChildElement(child);
child.AddParentElement(parent);
// Create a Reference for the child, add it to the group, and return it.
rf = new Reference(child);
group.AddMember(rf);
return rf;
}
示例6: OnCommand
public void OnCommand(GameClient client, string[] args)
{
if (client.Player.Group != null && client.Player.Group.Leader != client.Player)
{
client.Out.SendMessage("You are not the leader of your group.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (IsSpammingCommand(client.Player, "invite"))
return;
string targetName = string.Join(" ", args, 1, args.Length - 1);
GamePlayer target;
if (args.Length < 2)
{ // Inviting by target
if (client.Player.TargetObject == null || client.Player.TargetObject == client.Player)
{
client.Out.SendMessage("You have not selected a valid player as your target.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!(client.Player.TargetObject is GamePlayer))
{
client.Out.SendMessage("You have not selected a valid player as your target.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
target = (GamePlayer) client.Player.TargetObject;
if (!GameServer.ServerRules.IsAllowedToGroup(client.Player, target, false))
{
return;
}
}
else
{ // Inviting by name
GameClient targetClient = WorldMgr.GetClientByPlayerNameAndRealm(targetName, 0, true);
if (targetClient == null)
target = null;
else
target = targetClient.Player;
if (target == null || !GameServer.ServerRules.IsAllowedToGroup(client.Player, target, true))
{ // Invalid target or realm restriction
client.Out.SendMessage("No players online with that name.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (target == client.Player)
{
client.Out.SendMessage("You can't invite yourself.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
}
if (target.Group != null)
{
client.Out.SendMessage("The player is still in a group.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_PvP &&
target.IsStealthed)
{
client.Out.SendMessage("You can't find the player around here.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (client.Account.PrivLevel > target.Client.Account.PrivLevel)
{
// you have no choice!
if (client.Player.Group == null)
{
Group group = new Group(client.Player);
GroupMgr.AddGroup(group, group);
group.AddMember(client.Player);
group.AddMember(target);
}
else
{
client.Player.Group.AddMember(target);
}
client.Out.SendMessage("(GM) You have added " + target.Name + " to your group.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
target.Out.SendMessage("GM " + client.Player.Name + " has added you to " + client.Player.GetPronoun(1, false) + " group.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
else
{
client.Out.SendMessage("You have invited " + target.Name + " to join your group.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
target.Out.SendGroupInviteCommand(client.Player, client.Player.Name + " has invited you to join\n" + client.Player.GetPronoun(1, false) + " group. Do you wish to join?");
target.Out.SendMessage(client.Player.Name + " has invited you to join " + client.Player.GetPronoun(1, false) + " group.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
示例7: Permission_20_PermissionsViaIndirectGroupMembership
public void Permission_20_PermissionsViaIndirectGroupMembership()
{
// 20.
// create a brand new file
File file = CreateBrandNewFile(RepositoryPath.Combine(Repository.Root.Path, "GroupTest.doc"));
int idOfFile = file.Id;
// create a group
string testGroupAName = "TestGroupA";
string testGroupAPath = RepositoryPath.Combine(Repository.Root.Path, testGroupAName);
if (Node.Exists(testGroupAPath))
Node.ForceDelete(testGroupAPath);
Group testGroupA = new Group(Repository.Root);
testGroupA.Name = testGroupAName;
testGroupA.AddMember(Dincsi);
testGroupA.Save();
string testGroupBName = "TestGroupB";
string testGroupBPath = RepositoryPath.Combine(Repository.Root.Path, testGroupBName);
if (Node.Exists(testGroupBPath))
Node.ForceDelete(testGroupBPath);
Group testGroupB = new Group(Repository.Root);
testGroupB.Name = testGroupBName;
testGroupB.AddMember(User.Administrator);
testGroupB.AddMember(testGroupA);
testGroupB.Save();
// Deny Open for the group
file.Security.SetPermission(testGroupA, true, PermissionType.Open, PermissionValue.Deny);
// Sould be denied for the user who is a member of the group
Assert.IsTrue(file.Security.GetPermission((IUser)Dincsi, PermissionType.Open) == PermissionValue.Deny);
// Allow Open for the group
file.Security.SetPermission(testGroupA, true, PermissionType.Open, PermissionValue.Allow);
// Sould be allowed for the user who is a member of the group
Assert.IsTrue(file.Security.GetPermission((IUser)Dincsi, PermissionType.Open) == PermissionValue.Allow);
}