public static void RepairItem(IRealmClient client, NPC armorer, EntityId itemId, bool useGuildFunds) { var curChar = client.ActiveCharacter; uint totalCost = 0; if (itemId.Low != 0) { // Repairing an individual item. var item = GetItemByEntityId(curChar, itemId); if (item == null) return; if (!ArmorerCheatChecks(curChar, armorer, item)) return; totalCost += RepairItem(curChar, armorer, item, useGuildFunds); } else { // Case Repair all if (!ArmorerCheatChecks(curChar, armorer)) return; totalCost += RepairAllItems(curChar, armorer, useGuildFunds); } if (useGuildFunds) { /**************************** * TODO: record the funds usage in the guild log ****************************/ } }
public EventDescriptor(CommandId commandId, EntityId id, IEvent eventData, int entityVersion) { CommandId = commandId; EventData = eventData; Version = entityVersion; EntityId = id; }
public NpcEntity(EntityId id, EntityId ownerId, Entity owner,NpcInfo info) : base(id) { OwnerId = ownerId; Owner = owner; Info = info; }
private void CheckIfEventsAreUpdated(EntityId entityId, int expectedEntityVersion) { try { if (!EqualsNewEntityVersion(expectedEntityVersion)) { if (!DoesLatestEventVersionMatchVersion(entityId, expectedEntityVersion)) { ThrowConcurrencyException(entityId, expectedEntityVersion, CurrentEntityVersion(entityId)); } } } catch (NoEventsWereFoundException e) { Log.Error("Throwing a NoEventsWereFoundException on saving events for entityId '{0}' expected entity version '{1}'!", entityId, expectedEntityVersion); throw e; } catch (ConcurrencyException e) { Log.Error("Throwing a ConcurrencyException on saving events for entityId '{0}', expected entity version '{1}' and current entity version '{2}'!", e.EntityId, e.ExpectedEntityVersion, e.CurrentEntityVersion); throw e; } catch (Exception e) { Log.Error("Throwing a unknown exception on saving events for entityId '{0}' expected entityVersion '{1}'!", entityId, expectedEntityVersion); throw e; } }
public ApplyingEventWithUnexpectedVersionException(EntityId entityId, int currentVersion, int eventVersion) : base() { EntityId = entityId; CurrentVersion = currentVersion; EventVersion = eventVersion; }
private static Node ToNode(this INode node, EntityId id) { if (node is IUriNode) { return Node.ForUri(((IUriNode)node).Uri); } if (node is IBlankNode) { return Node.ForBlank(((IBlankNode)node).InternalID, id, node.GraphUri); } var literal = (ILiteralNode)node; if (literal.DataType != null) { return Node.ForLiteral(literal.Value, literal.DataType); } if (literal.Language != null) { return Node.ForLiteral(literal.Value, literal.Language); } return Node.ForLiteral(literal.Value); }
public Data(EntityId readerId, EntityId writerId, long seqNum, ParameterList inlineQosParams, DataEncapsulation dEnc) : base(SubMessageKind.DATA) { this.readerId = readerId; this.writerId = writerId; this.writerSN = new SequenceNumber(seqNum); if (inlineQosParams != null && inlineQosParams.Count > 0) { Header.FlagsValue |= 0x2; this.inlineQosParams = inlineQosParams; } if (dEnc.ContainsData()) { Header.FlagsValue |= Flags.DataFlag; // dataFlag } else { Header.FlagsValue |= Flags.KeyFlag; // keyFlag } this.dataEncapsulation = dEnc; }
public CasterInfo(WorldObject caster) { CasterId = caster.EntityId; Level = caster.CasterLevel; m_caster = caster; //Faction = caster.Faction; //ObjectType = caster.Type; }
public void FixtureSetup() { _validSubject = Node.ForUri(new Uri("http://magi/test/subject")); _validObject = Node.ForUri(new Uri("http://magi/test/object")); _validPredicate = Node.ForUri(new Uri("http://magi/test/predicate")); _graph = Node.ForUri(new Uri("urn:some:graph")); _entityId = new EntityId(new Uri("http://magi/test/subject")); }
public void it_should_match_uri_with_query_string_parameters() { var entityId = new EntityId((Uri)(BaseUri + EntryPoint).AddSegment(Guid.Empty.ToString()).WithParameter("_random", "10")); Uri result = _selector.SelectGraph(entityId, null, null); result.Should().Be(entityId.Uri); }
public void it_should_match_uri() { var entityId = new EntityId((Uri)(BaseUri + EntryPoint).AddSegment(Guid.Empty.ToString())); Uri result = _selector.SelectGraph(entityId, null, null); result.Should().Be(entityId.Uri); }
public ObjectReference(WorldObject obj) { EntityId = obj.EntityId; Level = obj.CasterLevel; m_Object = obj; //Faction = caster.Faction; //ObjectType = caster.Type; }
public static CasterInfo GetOrCreate(Region rgn, EntityId id) { var caster = rgn.GetObject(id); if (caster != null) { return caster.CasterInfo; } return new CasterInfo(id, 1); }
public static ObjectReference GetOrCreate(Map rgn, EntityId id) { var caster = rgn.GetObject(id); if (caster != null) { return caster.SharedReference; } return new ObjectReference(id, 1); }
/// <summary>Executes an ASK query to perform existence check.</summary> public bool EntityExist(EntityId entityId) { var ask = QueryBuilder.Ask() .Graph( MetaGraphUri, graph => graph.Where(triple => triple.Subject("g").PredicateUri("foaf:primaryTopic").Object(entityId.Uri))); ask.Prefixes.Import(_namespaces); return ExecuteAsk(ask.BuildQuery()); }
/// <summary> /// Gets the last received update blocks of the object with the given id and of the given Type /// </summary> /// <param name="type"></param> /// <returns></returns> public ICollection<UpdateBlock> GetUpdateBlocks(EntityId id, UpdateType type) { var blocks = new List<UpdateBlock>(); foreach (var packet in UpdatePackets) { packet.GetBlocks(id, type, blocks); } return blocks; }
public static EntityQuad ToEntityQuad(this VDS.RDF.Triple triple, EntityId id) { return new EntityQuad( id, triple.Subject.ToNode(id), triple.Predicate.ToNode(id), triple.Object.ToNode(id), Node.ForUri(triple.GraphUri)); }
private BlankId(Uri blankNodeUri, EntityId root) : base(blankNodeUri) { while (root is BlankId) { root = ((BlankId)root).RootEntityId; } _root = root; }
private dynamic GetSerializedJson(EntityId id, Stream resource) { string json = _processor.FromRdf(GetQuads(id, resource)); object deserializeObject = JsonConvert.DeserializeObject(Regex.Replace(json, "\"_:autos[0-9]+\"", "\"_:blank\"")); Console.WriteLine("Result JSON:"); Console.WriteLine(deserializeObject.ToString()); return deserializeObject; }
public Uri SelectGraph(EntityId entityId, IEntityMapping entityMapping, IPropertyMapping predicate) { EntityId nonBlankId = entityId; if (nonBlankId is BlankId) { nonBlankId = ((BlankId)nonBlankId).RootEntityId; } return new Uri(System.Text.RegularExpressions.Regex.Replace((nonBlankId != null ? nonBlankId.Uri.AbsoluteUri : ((BlankId)entityId).Graph.AbsoluteUri), "((?<!data.)magi)", "data.magi")); }
private void CheckIfAlreadySavedEntityHasAnySavedEvent(EntityId entityId, int expectedEntityVersion) { if (!EqualsNewEntityVersion(expectedEntityVersion)) { if (!HasAnySavedEventFor(entityId)) { ThrowConcurrencyException(entityId, expectedEntityVersion, NewEntityVersion); } } }
private void RemoveEntity(EntityId entityId) { RailEntity entity; if (this.entities.TryGetValue(entityId, out entity)) { this.entities.Remove(entityId); entity.Room = null; entity.Cleanup(); } }
public override void DeleteEvents(EntityId entityId) { if (EventDescriptorsForEntity(entityId).Any()) { EventDescriptors.Remove(entityId); } else { throw new EntityNotFoundException(entityId); } }
public void SaveEvents(ICommand command, EntityId entityId, IEnumerable<IEvent> events, int expectedEntityVersion) { var aggregateRootId = command.AggregateRootId; Log.Debug("Starting saving events for aggregate '{0}' entity '{1}' entityVersion '{2}' originated by command '{3}'!", aggregateRootId, entityId, expectedEntityVersion, command.CommandId); CheckEntityConsistencyConditions(entityId, expectedEntityVersion); CheckIfEventsAreUpdated(entityId, expectedEntityVersion); var versionedEvents = RewriteVersioningForEvents(expectedEntityVersion, events); SaveEventsOnEventStore(command, entityId, versionedEvents); Log.Debug("Stopped saving events for aggregate '{0}' entity '{1}' entityVersion '{2}' originated by command '{3}'!", aggregateRootId, entityId, expectedEntityVersion, command.CommandId); PublishEvents(versionedEvents); }
public void Two_instances_should_be_equal() { // given const string Id = "urn:test:identifier"; // when var entityId1 = new EntityId(Id); var entityId2 = new EntityId(Id); Assert.That(entityId1, Is.EqualTo(entityId2)); }
public void Two_instances_should_be_equal_when_compared() { // given const string Id = "urn:test:identifier"; // when IComparable entityId1 = new EntityId(Id); var entityId2 = new EntityId(Id); Assert.That(entityId1.CompareTo(entityId2), Is.EqualTo(0)); }
public void URI_id_should_be_more_than_blank_id() { // given const string Id = "urn:test:identifier"; // when IComparable entityId1 = new EntityId(Id); IComparable entityId2 = new BlankId("blank1", (EntityId)entityId1); Assert.That(entityId1.CompareTo(entityId2), Is.GreaterThan(0)); }
public EntityDescriptor Generate(string wsfedEndpoint) { var tokenServiceDescriptor = GetTokenServiceDescriptor(wsfedEndpoint); var id = new EntityId(_options.IssuerUri); var entity = new EntityDescriptor(id); entity.SigningCredentials = new X509SigningCredentials(_options.SigningCertificate); entity.RoleDescriptors.Add(tokenServiceDescriptor); return entity; }
public UpdateBlock(ParsedUpdatePacket parser, int index) { this.index = index; packet = parser; //Offset = parser.index; Type = (UpdateType)ReadByte(); if (!Enum.IsDefined(typeof(UpdateType), (byte)Type)) { throw new Exception("Invalid UpdateType '" + Type + "' in Block " + this); } // Console.WriteLine("Reading {0}-Block...", Type); if (Type == UpdateType.OutOfRange || Type == UpdateType.Near) { var count = ReadUInt(); EntityIds = new EntityId[count]; for (var i = 0; i < count; i++) { EntityIds[i] = ReadPackedEntityId(); } } else { EntityId = ReadPackedEntityId(); if (Type == UpdateType.Create || Type == UpdateType.CreateSelf) { ObjectType = (ObjectTypeId)ReadByte(); } if (Type == UpdateType.Create || Type == UpdateType.CreateSelf || Type == UpdateType.Movement) { m_movement = ReadMovementBlock(); } if (Type != UpdateType.Movement) { Values = ReadValues(); } } if (Type != UpdateType.Create && Type != UpdateType.CreateSelf) { ObjectType = EntityId.ObjectType; } }
public void ReplacePredicateValues(EntityId entityId, Node propertyUri, Func<IEnumerable<Node>> getNewValues, Uri graphUri) { _markedForDeletion = null; var subjectNode = Node.FromEntityId(entityId); RemoveTriples(entityId, subjectNode, propertyUri, graphUri); foreach (var valueNode in getNewValues()) { var triple = new EntityQuad(entityId, subjectNode, propertyUri, valueNode).InGraph(graphUri); _entityQuads.Add(triple); } }
/// <inheritdoc /> public ICommandResponseHandler <TResponse> SendCommand <TCommand, TRequest, TResponse>(IComponentWriter writer, ICommandDescriptor <TCommand, TRequest, TResponse> commandDescriptor, TRequest request, EntityId entityId, TimeSpan?timeout, CommandDelivery commandDelivery = CommandDelivery.RoundTrip) where TCommand : ICommandMetaclass, new() { return(CommandResponseHandler <TResponse> .Wrap(callback => SendCommandInternal(writer, PerformAuthorityCheck, commandDescriptor, request, entityId, callback, timeout, commandDelivery))); }
public void SetMemberId(EntityId val) { this.MemberId = val; }
public static Project From(EntityId id, ProjectName name, ProjectCode code, DateAndTime startDate, Money budget, EntityId clientId, Email owner, ProjectStatus status, ServiceOrderNumber orderNumber, Version version) { var project = new Project(id, name, code, startDate, budget, clientId, owner, status, orderNumber, version); var validator = new ProjectValidator(); project.SetValidationResult(validator.Validate(project)); return(project); }
public EntityComponentId(EntityId entityId, uint componentId) { this.entityId = entityId; this.componentId = componentId; }
public void Activate(EntityId value) { NativeFlowNodeMethods.ActivateOutputEntityId(ParentNodePointer, PortId, value); }
public void DeleteEntity(IComponentWriter writer, EntityId entityId, CommandCallback <DeleteEntityResult> callback, TimeSpan?timeout = null) { DeleteEntityInternal(writer, PerformAuthorityCheck, entityId, callback, timeout); }
public void CreateEntity(EntityId reservedEntityId, Worker.Entity template, CommandCallback <CreateEntityResult> callback, TimeSpan?timeout = null) { CreateEntityInternal(null, SkipAuthorityCheck, reservedEntityId, template, callback, timeout); }
public static SendMessageNotification Deserialize(Stream stream, SendMessageNotification instance, long limit) { instance.RequiredPrivileges = 0uL; while (limit < 0L || stream.get_Position() < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } else { int num2 = num; if (num2 != 10) { if (num2 != 18) { if (num2 != 24) { Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field == 0u) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else { instance.RequiredPrivileges = ProtocolParser.ReadUInt64(stream); } } else if (instance.Message == null) { instance.Message = Message.DeserializeLengthDelimited(stream); } else { Message.DeserializeLengthDelimited(stream, instance.Message); } } else if (instance.AgentId == null) { instance.AgentId = EntityId.DeserializeLengthDelimited(stream); } else { EntityId.DeserializeLengthDelimited(stream, instance.AgentId); } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public Player GetPlayer(EntityId id) { return(_players.Find(p => p.entityId == id)); }
protected override async Task <PullRequestStateContext> ExecuteAsync(IDurableOrchestrationContext context, PullRequestStateContext pullRequestDetailContext, PRCommentCreated comment, JObject parentReviewComment, EntityId entityId) { if (!pullRequestDetailContext.HasCreatedWorkItem(comment.comment.id)) { WorkItem createdWorkItem = await context.CallActivityAsync <WorkItem>(nameof(CreateWorkItemCommand) + "_CreateWorkItem", (parentReviewComment, pullRequestDetailContext)); pullRequestDetailContext.Add( new CreatedWorkItem() { CommentId = comment.comment.id }); var createReplyparameter = new CreateReplyParamter() { PullRequestNumber = comment.pull_request.number, InReplyTo = (int)parentReviewComment["Id"], WorkItem = createdWorkItem }; await context.CallActivityAsync(nameof(CreateWorkItemCommand) + "_CreateReplyComment", createReplyparameter); } return(pullRequestDetailContext); }
public void SetAgentId(EntityId val) { this.AgentId = val; }
public ICommandResponseHandler <DeleteEntityResult> DeleteEntity(IComponentWriter writer, EntityId entityId, TimeSpan?timeout = null) { return(CommandResponseHandler <DeleteEntityResult> .Wrap(callback => DeleteEntity(writer, entityId, callback, timeout))); }
static int Index(this EntityId e) { return((int)((~e.id >> IDX_BITS) & IDX_MASK)); }
public static Project NewRequest(EntityId id, ProjectName name, ProjectCode code, DateAndTime startDate, Money budget, EntityId clientId) { return(From(id, name, code, startDate, budget, clientId, Email.Empty(), ProjectStatus.Default(), ServiceOrderNumber.Empty(), Version.New())); }
private void DeleteEntityInternal(IComponentWriter writer, bool requireAuthority, EntityId entityId, CommandCallback <DeleteEntityResult> callback, TimeSpan?timeout = null) { Action sendAction = () => { var requestId = componentCommander.DeleteEntityInternal(entityId, callback, timeout); TrackRequest(writer, requestId); }; SendGenericCommand(writer, requireAuthority, callback, sendAction); }
internal NonBlittableComponentWriter(World world, Entity entity, EntityId entityId) : base(world, entity, entityId) { }
public void DeleteEntity(EntityId entityId, CommandCallback <DeleteEntityResult> callback, TimeSpan?timeout = null) { DeleteEntityInternal(null, SkipAuthorityCheck, entityId, callback, timeout); }
protected abstract T CreateReceiver(World world, Entity entity, EntityId entityId);
private void CreateEntityInternal(IComponentWriter writer, bool requireAuthority, EntityId reservedEntityId, Worker.Entity template, CommandCallback <CreateEntityResult> callback, TimeSpan?timeout = null) { Action sendAction = () => { var requestId = componentCommander.CreateEntityInternal(reservedEntityId, template, callback, timeout); TrackRequest(writer, requestId); }; SendGenericCommand(writer, requireAuthority, callback, sendAction); }
protected override DependentDataComponentCommandReceiver CreateReceiver(World world, Entity entity, EntityId entityId) { return new DependentDataComponentCommandReceiver(world, entity, entityId); }
public void CreateEntity(IComponentWriter writer, EntityId reservedEntityId, Worker.Entity template, CommandCallback <CreateEntityResult> callback, TimeSpan?timeout = null) { CreateEntityInternal(writer, PerformAuthorityCheck, reservedEntityId, template, callback, timeout); }
public void SendBarCommandCommand(EntityId targetEntityId, global::Improbable.TestSchema.SomeType request, Action<global::Improbable.DependentSchema.DependentDataComponent.BarCommand.ReceivedResponse> callback = null) { var commandRequest = new DependentDataComponent.BarCommand.Request(targetEntityId, request); SendBarCommandCommand(commandRequest, callback); }
public void RemoveTriggerEntity(EntityId entityId) { entityDic.Remove(entityId.Id); }
public void AddFriendAccountId(EntityId val) { this._FriendAccountId.Add(val); }
public Run(EntityId id) : base(id) { AggregateType = "run"; }
public ICommandResponseHandler <CreateEntityResult> CreateEntity(IComponentWriter writer, EntityId reservedEntityId, Worker.Entity template, TimeSpan?timeout = null) { return(CommandResponseHandler <CreateEntityResult> .Wrap(callback => CreateEntity(writer, reservedEntityId, template, callback, timeout))); }
public MoveToOrbitalBodyOrder(OrderId orderId, EntityId targetEntityId, double speedPerTick) : this(orderId, targetEntityId, speedPerTick, null) { }
static uint Generation(this EntityId e) { return(~e.id & GEN_MASK); }
public static Project Empty() { return(From(EntityId.Empty(), ProjectName.Empty(), ProjectCode.Empty(), DateAndTime.Empty(), Money.Zero(), EntityId.Empty(), Email.Empty(), ProjectStatus.Default(), ServiceOrderNumber.Empty(), Version.Empty())); }
/// <summary> /// Creates a Saml2Assertion from a ClaimsIdentity. /// </summary> /// <param name="identity">Claims to include in Assertion.</param> /// <param name="issuer">Issuer to include in assertion.</param> /// <returns>Saml2Assertion</returns> public static Saml2Assertion ToSaml2Assertion(this ClaimsIdentity identity, EntityId issuer) { return(ToSaml2Assertion(identity, issuer, null)); }