/// <summary> /// Converts Input properties and SMO internal filtering to LDAP query filters /// </summary> /// <param name="inputProp">Dictionary of Input properties</param> /// <param name="smoFilterXml">Filter of the method</param> /// <param name="identityType">Group or User</param> /// <param name="changeContainsToStartsWith">IF needed to change Contains to Starts With operator for better performance</param> /// <returns>LDAP query filter</returns> public static string GetLdapQueryString(Dictionary<string, string> inputProp, string smoFilterXml, IdentityType identityType, bool changeContainsToStartsWith) { StringBuilder searchFilter = new StringBuilder(); searchFilter.Append("(&"); // Identity type switch (identityType) { case IdentityType.Group: searchFilter.Append("(objectcategory=group)(objectclass=group)"); break; case IdentityType.User: searchFilter.Append("(objectcategory=person)(objectclass=user)"); break; case IdentityType.Role: throw new ArgumentException("Identity type role is not supported for this filtering."); } //Parameters foreach (KeyValuePair<string,string> item in inputProp) { if (!String.IsNullOrEmpty(item.Value)) { FilterItem filterItem = ConvertSmoToLdapFilter(item.Key, item.Value); searchFilter.AppendFormat(Constants.StringFormats.LdapCompareFormat.Equal, filterItem.Prop, filterItem.Value); } } searchFilter.Append(ConvertXMLFilterToLdapFilter(smoFilterXml, changeContainsToStartsWith)); searchFilter.Append(")"); return searchFilter.ToString(); }
/// <summary> /// Create a new unique identifier from a list of tags. /// </summary> /// <param name="type"> /// The type of object that the identifier is for. /// </param> /// <param name="tags"> /// A list of Tag objects and nulls, where null specifies the delimiter /// between agent tags in the case of a multiagent. /// </param> public UniqueIdentifier(IdentityType type, Tag[] tags) { this.type = type; int totalSize = tags.Sum(x => (x==null) ? 0 : x.Data.Count) + tags.Length - 1; this.genome = new Resource[totalSize]; int i = 0; bool isFirst = true; foreach (var tag in tags) { // Pad with a null for every new tag after the first if (isFirst) { isFirst = false; } else { this.genome[i++] = null; } if (tag != null) { Array.Copy(tag.Data.ToArray(), 0, this.genome, i, tag.Data.Count); i += tag.Data.Count; } } }
public ChangePasswordController() { _domainDisplayName = ConfigurationManager.AppSettings["domainDisplayName"]; _contextType = (ContextType)Enum.Parse(typeof(ContextType), ConfigurationManager.AppSettings["contextType"], true); _domain = ConfigurationManager.AppSettings["domain"]; _container = ConfigurationManager.AppSettings["container"]; _identityType = (IdentityType)Enum.Parse(typeof(IdentityType), ConfigurationManager.AppSettings["identityType"], true); }
public static new UserPrincipalFull FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { return (UserPrincipalFull) FindByIdentityWithType(context, typeof (UserPrincipalFull), identityType, identityValue); }
public static Identity AcquireIdentity(string name, IdentityType type) { Identity id = new Identity(m_nextIncrementalValue, name, type); m_identities.Add(id); ++m_nextIncrementalValue; return id; }
public MXLogger(string loggerName, bool forceIdentity, string logglyKey = null) { DefLogger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(), loggerName); if (forceIdentity == false) { ForceIdentity = false; Identity = "NA"; IdentityType = IdentityType.None; } LogglyKey = logglyKey; _HostIP = GetHostIP(); }
public static new UserPrincipalEx FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { return((UserPrincipalEx)FindByIdentityWithType(context, typeof(UserPrincipalEx), identityType, identityValue)); }
public AuthenticationAttribute() { this.identityType = IdentityType.All; }
// Implement the overloaded search method FindByIdentity. public static new ActiveDirectoryUserPrincipal FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { return((ActiveDirectoryUserPrincipal)FindByIdentityWithType(context, typeof(ActiveDirectoryUserPrincipal), identityType, identityValue)); }
IDPacket(string name, IdentityType type, string address) { this.Name = name; this.Type = type; this.Address = address; this.ArrayType = IdentityType.Unknown; this.TypeDimensions = new int[0]; }
public Identity(string identityNo, IdentityType identityType) { this.IdentityNo = identityNo; this.IdentityType = identityType; }
private void Log(Level level, string identity, IdentityType identityType, string message, Exception exception, LogMedium logMedium = LogMedium.log4net, object logData = null) { PushToLog4Net(level, identity, identityType, message, exception, logData); }
/*public bool TryGetStructure(string name, out StructureType structure) { return current_scope.Structures.TryGetValue (name, out structure); }*/ public bool TryGetStructureChildIdentityType(StructureFrame scope, string name, ref IdentityType itype) { if (scope.Primitives.Numbers.ContainsKey (name)) { itype = IdentityType.Number; return true; } else if (scope.Primitives.Text.ContainsKey (name)) { itype = IdentityType.Text; return true; } else if (scope.Primitives.Booleans.ContainsKey (name)) { itype = IdentityType.Boolean; return true; } else if (scope.Functions.ContainsKey (name)) { itype = IdentityType.Function; return true; } else if (scope.Generics.ContainsKey (name)) { itype = IdentityType.Structure; return true; } else { return false; } }
protected virtual IEnumerable <string> BuildTokenUri(string baseUri, IAzureAccount account, IdentityType identityType, string resourceId) { var builder = new UriBuilder(baseUri) { Query = BuildTokenQuery(account, identityType, resourceId) }; yield return(builder.Uri.ToString()); if (identityType == IdentityType.ClientId) { builder = new UriBuilder(baseUri) { Query = BuildTokenQuery(account, IdentityType.ObjectId, resourceId) }; yield return(builder.Uri.ToString()); } }
public static UserPrincipal GetUser(IdentityType identityType, string identityValue) { var res = UserPrincipal.FindByIdentity(GetPrincipalContext(), identityType, identityValue); return(res); }
public Identity(uint id, string name, IdentityType type) { m_id = id; m_name = name; m_type = type; }
public QueryMessageCounts(string ownerName, IdentityType ownerType, MessageTypeFlag type, MessageState state) : base(ownerName, ownerType, type, state) { }
public IdentityCreated(IdentityType identityType, Guid identityId) : base(identityId) { IdentityType = identityType; }
public IAccessIdentity GetAccessIdentity(int id, IdentityType type) { return(Groups.GetById(id)); }
public ADPrincipalResolveException(IdentityType identityType, string value, Exception innerException) : base(String.Format("Cannot resolve identity \"{0}\"", value), innerException) { this.IdentityType = identityType; }
// Implement the overloaded search method FindByIdentity. public static new GenericDirectoryObject FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { return (GenericDirectoryObject) FindByIdentityWithType(context, typeof (GenericDirectoryObject), identityType, identityValue); }
public void Info(string identity, IdentityType identityType, string Message, LogMedium logMedium = LogMedium.log4net) { Log(Level.Info, identity, identityType, Message, null, logMedium); }
public void CreateParsePrimitive(string name, IdentityType type) { Debug ("Adding var name: " + name + " type: " + type + " in " + current_scope.Name + " scope level " + Scope_Stack.Count); switch (type) { case IdentityType.Number: if(!current_scope.Primitives.Numbers.ContainsKey(name)) current_scope.Primitives.Numbers.Add(name,0); break; case IdentityType.Boolean: if(!current_scope.Primitives.Numbers.ContainsKey(name)) current_scope.Primitives.Booleans.Add (name, false); break; case IdentityType.Text: if(!current_scope.Primitives.Numbers.ContainsKey(name)) current_scope.Primitives.Text.Add (name, ""); break; default: Console.WriteLine ("Not a primitive type"); break; } }
public UniqueIdentifier(IdentityType type, Resource[] genome) { this.type = type; this.genome = genome; }
/// <summary> /// Initializes a new instance of the <see cref="Identity"/> class, using /// an existing Identity for some parameters. /// </summary> /// <param name="name">The name.</param> /// <param name="originatingIdentity">The originating identity.</param> /// <param name="identityType">Type of the identity.</param> public Identity(string name, Identity originatingIdentity, IdentityType identityType = IdentityType.User) : this(name, originatingIdentity?.PostID, identityType, originatingIdentity?.ForumAdapter, 0) { }
public bool IsPrimitive(IdentityType i) { return i == IdentityType.Boolean || i == IdentityType.Number || i == IdentityType.Text; }
public string CreateDefinition(IMetadata sourceMetadata, IMetadata targetMetadata, IComparerContext context, bool onlyName = false, bool onlyDefinition = false) { var builder = new StringBuilder(); if (!onlyDefinition) { builder.Append(FieldName.AsSqlIndentifier()); } if (!onlyDefinition && !onlyName) { builder.Append(" "); } if (!onlyName) { var dataType = SqlHelper.GetDataType(this, sourceMetadata.MetadataCharacterSets.CharacterSetsById, sourceMetadata.MetadataDatabase.Database.CharacterSet.CharacterSetId); if (Field.ComputedSource != null) { builder.Append("COMPUTED BY "); if (context.EmptyBodiesEnabled) { builder.Append($"({CreateShimFieldContent(dataType)})"); } else { builder.Append(Field.ComputedSource); } } else { builder.Append(dataType); if (IdentityType != null) { builder.Append($" GENERATED {IdentityType.ToDescription()} AS IDENTITY"); if (Generator.InitialValue != 1 && Generator.GeneratorIncrement != 1) { builder.Append($" (START WITH {Generator.InitialValue} INCREMENT BY {Generator.GeneratorIncrement})"); } else if (Generator.InitialValue != 1 && Generator.GeneratorIncrement == 1) { builder.Append($" (START WITH {Generator.InitialValue})"); } else if (Generator.InitialValue == 1 && Generator.GeneratorIncrement != 1) { builder.Append($" (INCREMENT BY {Generator.GeneratorIncrement})"); } } var defaultClause = SqlHelper.HandleDefault(this); if (defaultClause != null) { builder.Append(" "); builder.Append(defaultClause); } var notNullClause = SqlHelper.HandleNullable(this); if (notNullClause != null) { builder.Append(" "); builder.Append(notNullClause); } var collateClause = SqlHelper.HandleCollate(this, sourceMetadata.MetadataCollations.CollationsByKey); if (collateClause != null) { builder.Append(" "); builder.Append(collateClause); } } } return(builder.ToString()); }
/// <summary> /// Converts Input properties and SMO internal filtering to LDAP query filters /// </summary> /// <param name="inputProp">Dictionary of Input properties</param> /// <param name="smoFilterXml">Filter of the method</param> /// <param name="identityType">Group or User</param> /// <param name="changeContainsToStartsWith">IF needed to change Contains to Starts With operator for better performance</param> /// <returns>LDAP query filter</returns> public static string GetLdapQueryString(Dictionary <string, string> inputProp, string smoFilterXml, IdentityType identityType, bool changeContainsToStartsWith) { StringBuilder searchFilter = new StringBuilder(); searchFilter.Append("(&"); // Identity type switch (identityType) { case IdentityType.Group: searchFilter.Append("(objectcategory=group)(objectclass=group)"); break; case IdentityType.User: searchFilter.Append("(objectcategory=person)(objectclass=user)"); break; case IdentityType.Role: throw new ArgumentException(Resources.IdentityTypeRoleIsNotSupported); } //Parameters foreach (KeyValuePair <string, string> item in inputProp) { if (!String.IsNullOrEmpty(item.Value)) { FilterItem filterItem = ConvertSmoToLdapFilter(item.Key, item.Value); searchFilter.AppendFormat(Constants.StringFormats.LdapCompareFormat.Equal, filterItem.Prop, filterItem.Value); } } searchFilter.Append(ConvertXMLFilterToLdapFilter(smoFilterXml, changeContainsToStartsWith)); searchFilter.Append(")"); return(searchFilter.ToString()); }
public static IDPacket CreateReturnPacket(IdentityType Type) { return new IDPacket (RETURN_NAME, Type, ""); }
public IdentityMessage(IdentityType idType, string idTypeValue) { IdType = idType; IdTypeValue = idTypeValue; }
/// <summary> /// The get user. /// </summary> public static UserPrincipal GetUser(string identity, IdentityType identityType) { PrincipalContext principalContext = GetPrincipalContext; return(UserPrincipal.FindByIdentity(principalContext, identityType, identity)); }
public void ResetToType(IdentityType type) { CancelImport(); IdentityType = type; }
/// <summary> /// Constructs the resource /// </summary> private JToken GetResource(string resourceId, string apiVersion) { var resource = this.GetExistingResource(resourceId, apiVersion).Result.ToResource <PolicyAssignmentProperties>(); // get incoming object properties if present JObject inputMetadata = null; if (this.InputObject != null) { var newProperties = this.InputObject.Properties.ToJToken(); inputMetadata = newProperties["metadata"] as JObject; } var parameterMetadata = this.Metadata != null?this.GetObjectFromParameter(this.Metadata, nameof(this.Metadata)) : null; PolicyAssignmentEnforcementMode?inputMode = null; if (Enum.TryParse(this.InputObject?.Properties?.EnforcementMode?.ToString(), true, out PolicyAssignmentEnforcementMode tempMode1)) { inputMode = tempMode1; } // Grab the non-compliance messages from the parameter or input object or existing resource var nonComplianceMessages = this.NonComplianceMessage?.Where(message => message != null).SelectArray(message => message.ToModel()); if (nonComplianceMessages == null && this.InputObject?.Properties.NonComplianceMessages != null) { nonComplianceMessages = this.InputObject.Properties.NonComplianceMessages.Where(message => message != null).SelectArray(message => message.ToModel()); } else if (nonComplianceMessages == null) { nonComplianceMessages = resource.Properties.NonComplianceMessages; } if (this.AssignIdentity != null && this.AssignIdentity.IsPresent) { this.IdentityType = ManagedIdentityType.SystemAssigned; } ResourceIdentity identityObject = this.IdentityType != null ? (this.IdentityType == ManagedIdentityType.UserAssigned ? new ResourceIdentity { Type = IdentityType.ToString(), UserAssignedIdentities = new Dictionary <string, UserAssignedIdentityResource> { { this.IdentityId, new UserAssignedIdentityResource { } } } } : new ResourceIdentity { Type = IdentityType.ToString() } ) : null; var policyAssignmentObject = new PolicyAssignment { Name = this.Name ?? this.InputObject?.Name ?? resource.Name, Identity = identityObject, Location = this.Location ?? this.InputObject?.Location ?? resource.Location, Properties = new PolicyAssignmentProperties { DisplayName = this.DisplayName ?? this.InputObject?.Properties?.DisplayName ?? resource.Properties.DisplayName, Description = this.Description ?? this.InputObject?.Properties?.Description ?? resource.Properties.Description, Scope = resource.Properties.Scope, NotScopes = this.NotScope ?? this.InputObject?.Properties?.NotScopes ?? resource.Properties.NotScopes, PolicyDefinitionId = resource.Properties.PolicyDefinitionId, Metadata = parameterMetadata ?? inputMetadata ?? resource.Properties.Metadata, EnforcementMode = this.EnforcementMode ?? inputMode ?? resource.Properties.EnforcementMode, NonComplianceMessages = nonComplianceMessages, Parameters = this.GetParameters(this.PolicyParameter, this.PolicyParameterObject) ?? this.InputObject?.Properties?.Parameters?.ToResourcePropertiesBody() as JObject ?? resource.Properties.Parameters } }; return(policyAssignmentObject.ToJToken()); }
public CreateIdentityVM(IdentityType type) { IdentityType = type; }
public AuthenticationAttribute(IdentityType identityType) { this.identityType = identityType; }
private static UserPrincipal GetUser(IdentityType identityType, string identityValue) { var res = UserPrincipal.FindByIdentity(GetPrincipalContext(), identityType, identityValue); return res; }
public static new GroupPrincipal FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { return((GroupPrincipal)FindByIdentityWithType(context, typeof(GroupPrincipal), identityType, identityValue)); }
public void ResolveIdentity(IdentityType iType) { string fqn = GetStringProperty(Constants.SOProperties.Identity.FQN, true); bool resolveContainers = GetBoolProperty(Constants.SOProperties.Identity.ResolveContainers); bool resolveMembers = GetBoolProperty(Constants.SOProperties.Identity.ResolveMembers); var fqnName = new FQName(fqn); base.ServiceBroker.IdentityService.ResolveIdentity(fqnName, iType, IdentityResolveOptions.Identity); if (resolveMembers) { base.ServiceBroker.IdentityService.ResolveIdentity(fqnName, iType, IdentitySection.Members); } if (resolveContainers) { base.ServiceBroker.IdentityService.ResolveIdentity(fqnName, iType, IdentitySection.Containers); } }
public static IDPacket CreateIDPacket(YSStateModule state, string name, IdentityType type) { ScopeFrame[] scope_stack = state.Scope_Stack.ToArray (); string path = "/"; for (int i = scope_stack.Length - 1; i >= 0; i--) { if (scope_stack [i].Type == ScopeFrame.FrameTypes.Structure) path += "s:"; else if (scope_stack [i].Type == ScopeFrame.FrameTypes.Function) path += "f:"; else if (scope_stack [i].Type == ScopeFrame.FrameTypes.Loop) path += "l:"; else path += "u:"; path += scope_stack [i].Name + "/"; } state.Debug ("Created IDPacket with path: " + path.Trim() + " name: " + name); return new IDPacket (name, type, path.Trim()); }
public void Fatal(string identity, IdentityType identityType, string Message, Exception exception, LogMedium logMedium = LogMedium.log4net) { Log(Level.Fatal, identity, identityType, Message, exception, logMedium); }
public static string ToFriendlyString(this IdentityType identityType) { return(Enum.GetName(typeof(IdentityType), identityType)?.ToLower()); }
public static IDPacket CreateSystemPacket(string TempPacketName, IdentityType Type) { return new IDPacket (TempPacketName + (SYSTEM_SEED++), Type, ""); }
private static GroupPrincipal GetGroup(IdentityType identityType, string identityValue) { return GroupPrincipal.FindByIdentity(GetPrincipalContext(), identityType, identityValue); }
/// <summary> /// </summary> /// <param name="message"> /// </param> /// <param name="client"> /// </param> protected override void Read(CharacterActionMessage message, IZoneClient client) { LogUtil.Debug(DebugInfoDetail.NetworkMessages, "Reading CharacterActionMessage"); // var actionNum = (int)characterAction.Action; // int unknown1 = message.Unknown1; // int args1 = message.Parameter1; // int nanoId = message.Parameter2; // short unknown2 = message.Unknown2; IdentityType targetIdentityType = message.Target.Type; switch (message.Action) { case CharacterActionType.CastNano: // Cast nano // CastNanoSpell // TODO: This has to be delayed (Casting attack speed) and needs to move to some other part // TODO: Check nanoskill requirements // TODO: Lower current nano points/check if enough nano points client.Controller.CastNano(message.Parameter2, message.Target); break; /* this is here to prevent server crash that is caused by search action if server doesn't reply if something is found or not */ case CharacterActionType.Search: // If action == search /* Msg 110:136744723 = "No hidden objects found." */ // TODO: SEARCH!! FeedbackMessageHandler.Default.Send(client.Controller.Character, 110, 136744723); break; case CharacterActionType.InfoRequest: // If action == Info Request IInstancedEntity tPlayer = client.Controller.Character.Playfield.FindByIdentity(message.Target); // TODO: Think of a new method to distinguish players from mobs (NPCFamily for example) var tChar = tPlayer as Character; if (tChar != null) { // Is it a Character object? (player and npcs) CharacterInfoPacketMessageHandler.Default.Send(client.Controller.Character, tChar); } else { // TODO: NPC's /* * var npc = * (NonPlayerCharacterClass) * FindDynel.FindDynelById(packet.Target); * if (npc != null) * { * var infoPacket = new PacketWriter(); * * Start packet header * infoPacket.PushByte(0xDF); * infoPacket.PushByte(0xDF); * infoPacket.PushShort(10); * infoPacket.PushShort(1); * infoPacket.PushShort(0); * infoPacket.PushInt(3086); sender (server ID) * infoPacket.PushInt(client.Character.Id.Instance); receiver * infoPacket.PushInt(0x4D38242E); packet ID * infoPacket.PushIdentity(npc.Id); affected identity * infoPacket.PushByte(0); ? * * End packet header * infoPacket.PushByte(0x50); npc's just have 0x50 * infoPacket.PushByte(1); esi_001? * infoPacket.PushByte((byte)npc.Stats.Profession.Value); Profession * infoPacket.PushByte((byte)npc.Stats.Level.Value); Level * infoPacket.PushByte((byte)npc.Stats.TitleLevel.Value); Titlelevel * infoPacket.PushByte((byte)npc.Stats.VisualProfession.Value); Visual Profession * * infoPacket.PushShort(0); no idea for npc's * infoPacket.PushUInt(npc.Stats.Health.Value); Current Health (Health) * infoPacket.PushUInt(npc.Stats.Life.Value); Max Health (Life) * infoPacket.PushInt(0); BreedHostility? * infoPacket.PushUInt(0); org ID * infoPacket.PushShort(0); * infoPacket.PushShort(0); * infoPacket.PushShort(0); * infoPacket.PushShort(0); * infoPacket.PushInt(0x499602d2); * infoPacket.PushInt(0x499602d2); * infoPacket.PushInt(0x499602d2); * var infoPacketA = infoPacket.Finish(); * client.SendCompressed(infoPacketA); * }*/ } break; case CharacterActionType.Logout: // If action == Logout // Start 30 second logout timer if client is not a GM (statid 215) if (client.Controller.Character.Stats[StatIds.gmlevel].Value == 0) { client.Controller.Character.StartLogoutTimer(); } else { // If client is a GM, disconnect without timer client.Controller.Character.StartLogoutTimer(1000); } break; case CharacterActionType.StopLogout: // If action == Stop Logout // Stop current logout timer and send stop logout packet client.Controller.Character.StopLogoutTimer(); client.Controller.Character.UpdateMoveType((byte)client.Controller.Character.PreviousMoveMode); client.Controller.Character.Playfield.Announce(message); break; case CharacterActionType.StandUp: { // If action == Stand client.Controller.Character.UpdateMoveType(37); client.Controller.Character.Playfield.Announce(message); if (client.Controller.Character.InLogoutTimerPeriod()) { this.Send(client.Controller.Character, this.StopLogout(client.Controller.Character), true); client.Controller.Character.StopLogoutTimer(); } // Send stand up packet, and cancel timer/send stop logout packet if timer is enabled // ((ZoneClient)client).StandCancelLogout(); } break; case CharacterActionType.TeamKickMember: { // Kick Team Member } break; case CharacterActionType.LeaveTeam: { // Leave Team /* * var team = new TeamClass(); * team.LeaveTeam(client); */ } break; case CharacterActionType.TransferLeader: { // Transfer Team Leadership } break; case CharacterActionType.TeamRequestInvite: { // Team Join Request // Send Team Invite Request To Target Player /* * var team = new TeamClass(); * team.SendTeamRequest(client, packet.Target); */ } break; case CharacterActionType.TeamRequestReply: { /* * Request Reply * Check if positive or negative response * * if positive * var team = new TeamClass(); * var teamID = TeamClass.GenerateNewTeamId(client, packet.Target); * * Destination Client 0 = Sender, 1 = Reciever * * Reciever Packets * /////////////////// * * CharAction 15 * team.TeamRequestReply(client, packet.Target); * * CharAction 23 * team.TeamRequestReplyCharacterAction23(client, packet.Target); * * TeamMember Packet * team.TeamReplyPacketTeamMember(1, client, packet.Target, "Member1"); * * TeamMemberInfo Packet * team.TeamReplyPacketTeamMemberInfo(1, client, packet.Target); * * TeamMember Packet * team.TeamReplyPacketTeamMember(1, client, packet.Target, "Member2"); * * Sender Packets * ///////////////// * * TeamMember Packet * team.TeamReplyPacketTeamMember(0, client, packet.Target, "Member1"); * * TeamMemberInfo Packet * team.TeamReplyPacketTeamMemberInfo(0, client, packet.Target); * * TeamMember Packet * team.TeamReplyPacketTeamMember(0, client, packet.Target, "Member2"); */ } break; case CharacterActionType.DeleteItem: // Remove/Delete item ItemDao.Instance.Delete( new { containertype = (int)targetIdentityType, containerinstance = client.Controller.Character.Identity.Instance, Id = message.Target.Instance }); client.Controller.Character.BaseInventory.RemoveItem( (int)targetIdentityType, message.Target.Instance); this.AcknowledgeDelete(client.Controller.Character, message); break; case CharacterActionType.Split: // Split? IItem it = client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType][message.Target.Instance ]; it.MultipleCount -= message.Parameter2; Item newItem = new Item(it.Quality, it.LowID, it.HighID); newItem.MultipleCount = message.Parameter2; client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType].Add( client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType].FindFreeSlot(), newItem); client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType].Write(); // Does it need to Acknowledge? Need to check that - Algorithman break; case CharacterActionType.AcceptTeamRequest: client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType][message.Target.Instance] .MultipleCount += client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType][message.Parameter2] .MultipleCount; client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType].Remove(message.Parameter2); client.Controller.Character.BaseInventory.Pages[(int)targetIdentityType].Write(); this.Acknowledge(client.Controller.Character, message); break; // ################################################################################### // Spandexpants: This is all i have done so far as to make sneak turn on and off, // currently i cannot find a missing packet or link which tells the server the player // has stopped sneaking, hidden packet or something, will come back to later. // ################################################################################### // Sneak Packet Received case CharacterActionType.StartSneak: // TODO: IF SNEAKING IS ALLOWED RUN THIS CODE. // TODO: Insert perception checks on receiving characters/mobs and then dont send to playfield // Send Action 162 : Enable Sneak this.Send(client.Controller.Character, this.Sneak(client.Controller.Character), true); // End of Enable sneak // TODO: IF SNEAKING IS NOT ALLOWED SEND REJECTION PACKET break; case CharacterActionType.UseItemOnItem: { Identity item1 = message.Target; var item2 = new Identity { Type = (IdentityType)message.Parameter1, Instance = message.Parameter2 }; client.Controller.Character.TradeSkillSource = new TradeSkillInfo( 0, (int)item1.Type, item1.Instance); client.Controller.Character.TradeSkillTarget = new TradeSkillInfo( 1, (int)item2.Type, item2.Instance); TradeSkillReceiver.TradeSkillBuildPressed(client, 300); break; } case CharacterActionType.ChangeVisualFlag: { client.Controller.Character.Stats[StatIds.visualflags].Value = message.Parameter2; ChatTextMessageHandler.Default.Send( client.Controller.Character, "Setting Visual Flag to " + message.Parameter2); AppearanceUpdateMessageHandler.Default.Send(client.Controller.Character); } break; case CharacterActionType.TradeskillSourceChanged: TradeSkillReceiver.TradeSkillSourceChanged(client, message.Parameter1, message.Parameter2); break; case CharacterActionType.TradeskillTargetChanged: TradeSkillReceiver.TradeSkillTargetChanged(client, message.Parameter1, message.Parameter2); break; case CharacterActionType.TradeskillBuildPressed: TradeSkillReceiver.TradeSkillBuildPressed(client, message.Target.Instance); break; default: { // unkown client.Controller.Character.Playfield.Announce(message); } break; } }
public IdentityIndex(IElasticConfiguration configuration) : base(configuration, "identity") { AddType(Identity = new IdentityType(this)); }
public MarkMessagesCommand(MessageTypeFlag type, MessageState action, int?id = null) : this(null, IdentityType.User, type, action, id) { this._ownerName = UserName; this._ownerType = IdentityType.User; }
public void Verbose(string identity, IdentityType identityType, string Message, LogMedium logMedium = LogMedium.log4net) { Log(Level.Verbose, identity, identityType, Message, null, logMedium); }
public DeleteMessagesCommand(MessageTypeFlag type, int?id = null) : this(null, IdentityType.User, type, id) { this._ownerName = UserName; this._ownerType = IdentityType.User; }
//private void PushToLoggly(Level level, string identity, IdentityType identityType, string message, Exception exception, object logData = null) //{ // StackFrame StacFrame = new StackFrame(3); // MethodBase CallingMethod = StacFrame.GetMethod(); // string AssemblyMethodName = CallingMethod.Name; // string AssemblyName = CallingMethod.DeclaringType.Name; // string AssemblyFullName = CallingMethod.DeclaringType.FullName; // JObject UserData = logData == null ? new JObject() : JObject.Parse(JsonConvert.SerializeObject(logData)); // UserData["Level"] = level.ToString(); // UserData["EventTime"] = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss:ffff"); // UserData["IdentityType"] = identityType.ToString(); // UserData["Identity"] = identity; // UserData["Assembly"] = AssemblyFullName; // UserData["Method"] = AssemblyMethodName; // if (!string.IsNullOrWhiteSpace(message)) // { // UserData["Message"] = message; // } // if (exception != null) // { // UserData["ExceptionType"] = exception.GetType().ToString(); // UserData["ExceptionMessage"] = exception.Message; // UserData["ExceptionStackTrace"] = exception.StackTrace; // } // JSONPost(JsonConvert.SerializeObject(UserData), LogglyURL + LogglyKey); //} private void PushToLog4Net(Level level, string identity, IdentityType identityType, string message, Exception exception, object logData = null) { string JSONString = ""; try { JSONString = logData != null ? "; JSONData=" + JsonConvert.SerializeObject(logData) : ""; } catch (Exception excp) { } MDC.Set("Identity", identity); MDC.Set("IdentityType", identityType.ToString()); MDC.Set("IPAddress", _HostIP); DefLogger.Log(typeof(MXLogger), level, message + JSONString, exception); MDC.Remove("Identity"); MDC.Remove("IdentityType"); MDC.Remove("IPAddress"); }
public static new ADUser FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { return((ADUser)FindByIdentityWithType(context, typeof(ADUser), identityType, identityValue)); }
public void SetIdentity(string identity, IdentityType identityType) { Identity = identity; IdentityType = identityType; }
/// <summary> /// </summary> /// <param name="item"> /// </param> protected void Trade(IdentityType container, int slotNumber) { IItem temp = this.GetCharacter().BaseInventory.Pages[(int)container][slotNumber]; // TODO: Remove item from Character's inventory and check against script reqs LogUtil.Debug( DebugInfoDetail.KnuBot, string.Format("KnuBut Trade item in container {0} slot {1}", container.ToString(), slotNumber)); }
// Implement the overloaded search method FindByIdentity public static new SouPerson FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { SouPerson result = (SouPerson) FindByIdentityWithType(context, typeof(SouPerson), identityType, identityValue); return result; }
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="IdentityType" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => IdentityType.CreateFrom(sourceValue);
public static GroupPrincipal FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) { return (GroupPrincipal)Principal.FindByIdentityWithType(context, typeof(GroupPrincipal), identityType, identityValue); }
protected static Principal FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType identityType, string identityValue) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (identityValue == null) { throw new ArgumentNullException(nameof(identityValue)); } if ((identityType < IdentityType.SamAccountName) || (identityType > IdentityType.Guid)) { throw new InvalidEnumArgumentException(nameof(identityType), (int)identityType, typeof(IdentityType)); } return(FindByIdentityWithTypeHelper(context, principalType, identityType, identityValue, DateTime.UtcNow)); }
protected override IEnumerable <string> BuildTokenUri(string baseUri, IAzureAccount account, IdentityType identityType, string resourceId) { StringBuilder query = new StringBuilder($"{baseUri}?resource={resourceId}&api-version=2017-09-01"); if (identityType == IdentityType.ClientId || identityType == IdentityType.ObjectId) { query.Append($"&clientid={Uri.EscapeDataString(account.Id)}"); } yield return(query.ToString()); }
/// <summary> /// The is user member of group. /// </summary> public static bool IsUserMemberOfGroup(GroupPrincipal groupPrincipal, string identity, IdentityType identityType) { UserPrincipal userPrincipal = GetUser(identity, identityType); if (userPrincipal == null) { return(false); } return(userPrincipal.IsMemberOf(groupPrincipal)); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="identityType"></param> /// <param name="identityValue"></param> public void Add(IPrincipalContext context, IdentityType identityType, string identityValue) { this.principalCollection.Add(context.PrincipalContextInstance, identityType, identityValue); }
public IDPacket(IDPacket copy) { Name = copy.Name; Type = copy.Type; Address = copy.Address; ArrayType = copy.ArrayType; TypeDimensions = copy.TypeDimensions; }