public static void FindEvent(EventType eventName, PlayerSetup.Player player, string option) { var room = Cache.ReturnRooms() .FirstOrDefault( x => x.area.Equals(player.Area) && x.areaId.Equals(player.AreaId) && x.region.Equals(player.Region)); if (room == null) { //logerror return; } if (eventName.Equals(EventType.Wear)) { EvokeEvent(room, player, option); } if (eventName.Equals(EventType.Look)) { EvokeEvent(room, player, option); } if (eventName.Equals(EventType.Death)) { EvokeEvent(room, player, option); } if (eventName.Equals(EventType.Wake)) { EvokeEvent(room, player, option); } }
public override void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT) || type.Equals(EventType.RENDER_IMAGE)) { String tagName = GetTagName(data, type); if ((tagName == null && layerName == null) || (layerName != null && layerName.Equals(tagName))) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; SetFillColor(renderInfo.GetGraphicsState().GetFillColor()); SetPdfFont(renderInfo.GetGraphicsState().GetFont()); base.EventOccurred(data, type); } else { if (type.Equals(EventType.RENDER_IMAGE)) { ImageRenderInfo renderInfo = (ImageRenderInfo)data; Matrix ctm = renderInfo.GetImageCtm(); SetImageBBoxRectangle(new Rectangle(ctm.Get(6), ctm.Get(7), ctm.Get(0), ctm.Get(4))); } } } } }
public override void EventOccurred(IEventData data, EventType type) { if (!type.Equals(EventType.RENDER_TEXT)) { return; } TextRenderInfo renderInfo = (TextRenderInfo)data; string curFont = renderInfo.GetFont().GetFontProgram().ToString(); float curFontSize = renderInfo.GetFontSize(); IList <TextRenderInfo> text = renderInfo.GetCharacterRenderInfos(); foreach (TextRenderInfo t in text) { string letter = t.GetText(); Vector l_start = t.GetBaseline().GetStartPoint(), l_end = t.GetAscentLine().GetEndPoint(); Rectangle l_rect = new Rectangle(l_start.Get(0), l_start.Get(1), l_end.Get(0) - l_start.Get(0), l_end.Get(1) - l_start.Get(1)); if (letter != " " && !letter.Contains(' ')) { TextResult.Add(new TextChunk() { Text = letter, Rect = l_rect, FontFamily = curFont, FontSize = curFontSize, }); } } }
/// <summary> /// Returns true if Event instances are equal /// </summary> /// <param name="other">Instance of Event to be compared</param> /// <returns>Boolean</returns> public bool Equals(Event other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EventType == other.EventType || EventType.Equals(other.EventType) ) && ( EntityType == other.EntityType || EntityType.Equals(other.EntityType) ) && ( EntityId == other.EntityId || EntityId != null && EntityId.Equals(other.EntityId) ) && ( TimeStamp == other.TimeStamp || TimeStamp != null && TimeStamp.Equals(other.TimeStamp) )); }
/// <summary> /// Returns true if DutySendEvent instances are equal /// </summary> /// <param name="other">Instance of DutySendEvent to be compared</param> /// <returns>Boolean</returns> public bool Equals(DutySendEvent other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EventType == other.EventType || EventType != null && EventType.Equals(other.EventType) ) && ( Destination == other.Destination || Destination.Equals(other.Destination) ) && ( Duty == other.Duty || Duty != null && Duty.Equals(other.Duty) )); }
/// <summary> /// Returns true if ExecProviderEvent instances are equal /// </summary> /// <param name="other">Instance of ExecProviderEvent to be compared</param> /// <returns>Boolean</returns> public bool Equals(ExecProviderEvent other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( BatchId == other.BatchId || BatchId != null && BatchId.Equals(other.BatchId) ) && ( ExeScript == other.ExeScript || ExeScript != null && ExeScript.Equals(other.ExeScript) ) && ( EventType == other.EventType || EventType != null && EventType.Equals(other.EventType) ) && ( ActivityId == other.ActivityId || ActivityId != null && ActivityId.Equals(other.ActivityId) )); }
/// <summary> /// Returns true if CreateActivityProviderEvent instances are equal /// </summary> /// <param name="other">Instance of CreateActivityProviderEvent to be compared</param> /// <returns>Boolean</returns> public bool Equals(CreateActivityProviderEvent other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AgreementId == other.AgreementId || AgreementId != null && AgreementId.Equals(other.AgreementId) ) && ( EventType == other.EventType || EventType != null && EventType.Equals(other.EventType) ) && ( ActivityId == other.ActivityId || ActivityId != null && ActivityId.Equals(other.ActivityId) )); }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { lineSegments.Add(((TextRenderInfo)data).GetBaseline()); } }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (GetType() != obj.GetType()) { return(false); } Event other = (Event)obj; if (SourceAppId == null) { if (other.SourceAppId != null) { return(false); } } else if (!SourceAppId.Equals(other.SourceAppId)) { return(false); } if (!EventType.Equals(other.EventType)) { return(false); } return(true); }
public PipelineEventType GetEventType() { PipelineEventType _eventType = PipelineEventType.BuildStarted; if (EventType.Equals("git.push", StringComparison.InvariantCultureIgnoreCase)) { _eventType = PipelineEventType.BuildStarted; } if (EventType.Equals("build.complete", StringComparison.InvariantCultureIgnoreCase)) { _eventType = PipelineEventType.BuildCompleted; } if (EventType.Equals("ms.vss-release.deployment-started-event", StringComparison.InvariantCultureIgnoreCase)) { _eventType = PipelineEventType.ReleaseStarted; } if (EventType.Equals("ms.vss-release.deployment-approval-pending-event", StringComparison.InvariantCultureIgnoreCase)) { _eventType = PipelineEventType.ReleasePendingApproval; } if (EventType.Equals("ms.vss-release.deployment-approval-completed-event", StringComparison.InvariantCultureIgnoreCase)) { _eventType = PipelineEventType.ReleaseCompletedApproval; } if (EventType.Equals("ms.vss-release.deployment-completed-event", StringComparison.InvariantCultureIgnoreCase)) { _eventType = PipelineEventType.ReleaseCompleted; } return(_eventType); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { var results = new List <ValidationResult>(); if (EventType.Equals(EventType.Inactive)) { if (EventValueType != EventValueType.Empty) { results.Add(new ValidationResult($"The EventValueType must be Empty for EventType.{EventType}", new string[] { "EventValueType" })); } if (EventFrequency != EventFrequency.EveryMinute) { results.Add(new ValidationResult($"The EventFrequency must be EveryMinute for EventType.{EventType}", new string[] { "EventFrequency" })); } if (!BoschIoTSuiteApiConnector.gateways.Select(gateway => gateway.thingId).ToList().Contains(Variable)) { results.Add(new ValidationResult($"The Variable must be a valid Bosch IoT Things ThingId", new string[] { "Variable" })); } } if (EventType.Equals(EventType.Threshold)) { if (EventValueType.Equals(EventValueType.Empty)) { results.Add(new ValidationResult($"The EventValueType must not be {EventValueType} for EventType.{EventType}", new string[] { "EventValueType" })); } if (EventFrequency != EventFrequency.Never) { results.Add(new ValidationResult($"The EventFrequency must be Never for EventType.{EventType}", new string[] { "EventFrequency" })); } if (!BoschIoTSuiteApiConnector.gateways.Select(gateway => gateway.attributes.configuration.devices).Select(devices => devices.Where(device => device.deviceId.Equals(Variable))).First().Any()) { results.Add(new ValidationResult($"The Variable must be a valid Bosch IoT Things device", new string[] { "Variable" })); } } if (EventType.Equals(EventType.Algorithm)) { if (EventValueType != EventValueType.Empty) { results.Add(new ValidationResult($"The EventValueType must be Empty for EventType.{EventType}", new string[] { "EventValueType" })); } if (EventFrequency == EventFrequency.Never | EventFrequency == EventFrequency.EveryMinute) { results.Add(new ValidationResult($"The EventFrequency must not be {EventFrequency} for EventType.{EventType}", new string[] { "EventFrequency" })); } if (!BoschIoTSuiteApiConnector.gateways.Select(gateway => gateway.attributes.configuration.devices).Select(devices => devices.Where(device => device.deviceId.Equals(Variable))).First().Any()) { results.Add(new ValidationResult($"The Variable must be a valid Bosch IoT Things device", new string[] { "Variable" })); } } return(results); }
public bool IsChanged(LastEventData other) { if (other != null && type.Equals(other.type) && tool.Equals(other.tool) && coordinates.SequenceEqual(other.coordinates)) { return(otherParameters.SequenceEqual(other.otherParameters)); } return(false); }
private void UpdateAmmoBar() { _needRecalcAmmoBar = false; _currentWeapon = _inventoryControl.CurrentItem; if (_currentWeapon != null) { if (_currentWeapon.GameItem.activeSelf && _magazine > 0 && _triggeredEvent.Equals(EventType.AMMO_DISCHARGE)) { RederAmmoBarWithinShots(1); _triggeredEvent = EventType.INFO; } else if (_triggeredEvent.Equals(EventType.AMMO_RELOAD)) { RenderFullAmmoBar(); _triggeredEvent = EventType.INFO; } else if (_currentWeapon.GameItem.activeSelf && _magazine == 0) { _magazine = _currentWeapon.GameItem.GetComponent <IDamagable>().Magazine; var type = ItemUtil.DetermineMagazineTypeByWeapon(_currentWeapon); _ammoMaxForCurrentWeapon = (int)type; RenderFullAmmoBar(); } else if (_currentWeapon.GameItem.activeSelf) { _magazine = _currentWeapon.GameItem.GetComponent <IDamagable>().Magazine; var type = ItemUtil.DetermineMagazineTypeByWeapon(_currentWeapon); _ammoMaxForCurrentWeapon = (int)type; if (_ammoMaxForCurrentWeapon != 0) { RenderAmmoBarWithinMagazine(); } } if (!_currentWeapon.GameItem.activeSelf) { RenderMinAmmoBar(); } } else if (_currentWeapon == null) { RenderMinAmmoBar(); } }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_PATH)) { PathRenderInfo pathRenderInfo = (PathRenderInfo)data; pathRenderInfo.PreserveGraphicsState(); content.Add(data); } }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; bool firstRender = result.Length == 0; bool hardReturn = false; LineSegment segment = renderInfo.GetBaseline(); Vector start = segment.GetStartPoint(); Vector end = segment.GetEndPoint(); if (!firstRender) { Vector x1 = lastStart; Vector x2 = lastEnd; // see http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html float dist = (x2.Subtract(x1)).Cross((x1.Subtract(start))).LengthSquared() / x2.Subtract(x1).LengthSquared (); float sameLineThreshold = 1f; // we should probably base this on the current font metrics, but 1 pt seems to be sufficient for the time being if (dist > sameLineThreshold) { hardReturn = true; } } // Note: Technically, we should check both the start and end positions, in case the angle of the text changed without any displacement // but this sort of thing probably doesn't happen much in reality, so we'll leave it alone for now if (hardReturn) { //System.out.println("<< Hard Return >>"); AppendTextChunk("\n"); } else { if (!firstRender) { if (result[result.Length - 1] != ' ' && renderInfo.GetText().Length > 0 && renderInfo.GetText()[0] != ' ') { // we only insert a blank space if the trailing character of the previous string wasn't a space, and the leading character of the current string isn't a space float spacing = lastEnd.Subtract(start).Length(); if (spacing > renderInfo.GetSingleSpaceWidth() / 2f) { AppendTextChunk(" "); } } } } //System.out.println("Inserting implied space before '" + renderInfo.getText() + "'"); //System.out.println("Displaying first string of content '" + text + "' :: x1 = " + x1); //System.out.println("[" + renderInfo.getStartPoint() + "]->[" + renderInfo.getEndPoint() + "] " + renderInfo.getText()); AppendTextChunk(renderInfo.GetText()); lastStart = start; lastEnd = end; } }
private String GetTagName(IEventData data, EventType type) { IList <CanvasTag> tagHierarchy = null; if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo textRenderInfo = (TextRenderInfo)data; tagHierarchy = textRenderInfo.GetCanvasTagHierarchy(); } else { if (type.Equals(EventType.RENDER_IMAGE)) { ImageRenderInfo imageRenderInfo = (ImageRenderInfo)data; tagHierarchy = imageRenderInfo.GetCanvasTagHierarchy(); } } return((tagHierarchy == null || tagHierarchy.Count == 0 || tagHierarchy[0].GetProperties().Get(PdfName.Name ) == null) ? null : tagHierarchy[0].GetProperties().Get(PdfName.Name).ToString()); }
public List<PetriEvent> getEventsByType(EventType eventType) { List<PetriEvent> ret = new List<PetriEvent>(); foreach (PetriEvent petriEvent in this.events) { if (eventType.Equals(petriEvent.Type)) { ret.Add(petriEvent); } } return ret; }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; IList <TextRenderInfo> subs = renderInfo.GetCharacterRenderInfos(); for (int i = 0; i < subs.Count; i++) { TextRenderInfo charInfo = subs[i]; glyphWith = charInfo.GetBaseline().GetLength(); } } }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; LineSegment segment = renderInfo.GetBaseline(); if (renderInfo.GetRise() != 0) { // remove the rise from the baseline - we do this because the text from a super/subscript render operations should probably be considered as part of the baseline of the text the super/sub is relative to Matrix riseOffsetTransform = new Matrix(0, -renderInfo.GetRise()); segment = segment.TransformBy(riseOffsetTransform); } if (useActualText) { CanvasTag lastTagWithActualText = lastTextRenderInfo != null?FindLastTagWithActualText(lastTextRenderInfo .GetCanvasTagHierarchy()) : null; if (lastTagWithActualText != null && lastTagWithActualText == FindLastTagWithActualText(renderInfo.GetCanvasTagHierarchy ())) { // Merge two text pieces, assume they will be in the same line LocationTextExtractionStrategy.TextChunk lastTextChunk = locationalResult[locationalResult.Count - 1]; Vector mergedStart = new Vector(Math.Min(lastTextChunk.GetLocation().GetStartLocation().Get(0), segment.GetStartPoint ().Get(0)), Math.Min(lastTextChunk.GetLocation().GetStartLocation().Get(1), segment.GetStartPoint().Get (1)), Math.Min(lastTextChunk.GetLocation().GetStartLocation().Get(2), segment.GetStartPoint().Get(2))); Vector mergedEnd = new Vector(Math.Max(lastTextChunk.GetLocation().GetEndLocation().Get(0), segment.GetEndPoint ().Get(0)), Math.Max(lastTextChunk.GetLocation().GetEndLocation().Get(1), segment.GetEndPoint().Get(1) ), Math.Max(lastTextChunk.GetLocation().GetEndLocation().Get(2), segment.GetEndPoint().Get(2))); LocationTextExtractionStrategy.TextChunk merged = new LocationTextExtractionStrategy.TextChunk(lastTextChunk .GetText(), tclStrat.CreateLocation(renderInfo, new LineSegment(mergedStart, mergedEnd))); locationalResult[locationalResult.Count - 1] = merged; } else { String actualText = renderInfo.GetActualText(); LocationTextExtractionStrategy.TextChunk tc = new LocationTextExtractionStrategy.TextChunk(actualText != null ? actualText : renderInfo.GetText(), tclStrat.CreateLocation(renderInfo, segment)); locationalResult.Add(tc); } } else { LocationTextExtractionStrategy.TextChunk tc = new LocationTextExtractionStrategy.TextChunk(renderInfo.GetText (), tclStrat.CreateLocation(renderInfo, segment)); locationalResult.Add(tc); } lastTextRenderInfo = renderInfo; } }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo textRenderInfo = (TextRenderInfo)data; foreach (TextRenderInfo glyphRenderInfo in textRenderInfo.GetCharacterRenderInfos()) { delegate_.EventOccurred(glyphRenderInfo, type); } } else { delegate_.EventOccurred(data, type); } }
public override bool Accept(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; PdfFont font = renderInfo.GetFont(); if (null != font) { String fontName = font.GetFontProgram().GetFontNames().GetFontName(); return(fontName.EndsWith("Bold") || fontName.EndsWith("Oblique")); } } return(false); }
public bool Equals(ResultInfo p) { // If parameter is null return false: if ((object)p == null) { return(false); } // Return true if the fields match: return(DateTime.Equals(p.DateTime) && FileName.Equals(p.FileName) && EventType.Equals(p.EventType) && UploadStatus.Equals(p.UploadStatus) && Link.Equals(p.Link)); }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; IList <TextRenderInfo> subs = renderInfo.GetCharacterRenderInfos(); TextRenderInfo previousCharInfo = subs[0]; for (int i = 1; i < subs.Count; i++) { TextRenderInfo charInfo = subs[i]; Vector previousEndPoint = previousCharInfo.GetBaseline().GetEndPoint(); Vector currentStartPoint = charInfo.GetBaseline().GetStartPoint(); AssertVectorsEqual(charInfo.GetText(), previousEndPoint, currentStartPoint); previousCharInfo = charInfo; } } }
public override void EventOccurred(IEventData data, EventType type) { if (!type.Equals(EventType.RENDER_TEXT)) { return; } TextRenderInfo renderInfo = (TextRenderInfo)data; string curFont = renderInfo.GetFont().GetFontProgram().ToString(); float curFontSize = renderInfo.GetFontSize(); IList <TextRenderInfo> text = renderInfo.GetCharacterRenderInfos(); foreach (TextRenderInfo t in text) { string letter = t.GetText(); Vector letterStart = t.GetDescentLine().GetStartPoint(); Vector letterEnd = t.GetAscentLine().GetEndPoint(); if (letter != " " && !letter.Contains(" ")) { TextChar c = new TextChar(); chars.Add(c); c.text = letter; c.x1 = letterStart.Get(0); c.x2 = letterEnd.Get(0); c.y1 = letterStart.Get(1); c.y2 = letterEnd.Get(1); if (c.y1 > c.y2) { c.y1 = letterEnd.Get(1); c.y2 = letterStart.Get(1); } c.fontFamily = curFont; c.fontSize = curFontSize; } } }
public virtual void EventOccurred(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; if (firstTextRenderInfo == null) { firstTextRenderInfo = renderInfo; firstTextRenderInfo.PreserveGraphicsState(); } IList <TextRenderInfo> subs = renderInfo.GetCharacterRenderInfos(); for (int i = 0; i < subs.Count; i++) { TextRenderInfo charInfo = subs[i]; glyphWidth = charInfo.GetBaseline().GetLength(); } } }
public virtual bool Accept(IEventData data, EventType type) { if (type.Equals(EventType.RENDER_TEXT)) { TextRenderInfo renderInfo = (TextRenderInfo)data; LineSegment segment = renderInfo.GetBaseline(); Vector startPoint = segment.GetStartPoint(); Vector endPoint = segment.GetEndPoint(); float x1 = startPoint.Get(Vector.I1); float y1 = startPoint.Get(Vector.I2); float x2 = endPoint.Get(Vector.I1); float y2 = endPoint.Get(Vector.I2); return(filterRect == null || filterRect.IntersectsLine(x1, y1, x2, y2)); } else { return(false); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CashDrawerShiftEvent other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) && ((EventType == null && other.EventType == null) || (EventType?.Equals(other.EventType) == true)) && ((EventMoney == null && other.EventMoney == null) || (EventMoney?.Equals(other.EventMoney) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true))); }
/// <summary> /// Initialize frame contents from the stream /// </summary> protected override async Task InitializeAsync() { EventType = await Reader.ReadStringAsync().ConfigureAwait(false); if (EventType.Equals("TOPOLOGY_CHANGE", StringComparison.InvariantCultureIgnoreCase) || EventType.Equals("STATUS_CHANGE", StringComparison.InvariantCultureIgnoreCase)) { Change = await Reader.ReadStringAsync().ConfigureAwait(false); Node = await Reader.ReadInetAsync().ConfigureAwait(false); } else if (EventType.Equals("TOPOLOGY_CHANGE", StringComparison.InvariantCultureIgnoreCase)) { Change = await Reader.ReadStringAsync().ConfigureAwait(false); KeySpace = await Reader.ReadStringAsync().ConfigureAwait(false); Table = await Reader.ReadStringAsync().ConfigureAwait(false); } }
public override bool Equals(object o) { if (this == o) { return true; } if (o == null || GetType() != o.GetType()) { return false; } var that = (EventTypePropertyPair) o; if (!eventType.Equals(that.eventType)) { return false; } if (!propertyName.Equals(that.propertyName)) { return false; } return true; }
/* * Two entities are said to be equal if their trip id, * stop sequence, service date, and event type are the same * */ public override bool Equals(object obj) { var item = obj as EntityIdentifier; if (item == null) { return(false); } // Null check for trip id. // Ideally this condition never happens. In case it happens return false if (string.IsNullOrEmpty(TripId) || string.IsNullOrEmpty(item.TripId)) { return(false); } return(TripId.Equals(item.TripId) && StopSequence == item.StopSequence && item.ServiceDate.Equals(ServiceDate) && EventType.Equals(item.EventType)); }
public override void EventOccurred(IEventData data, EventType type) { if (!type.Equals(EventType.RENDER_TEXT)) return; TextRenderInfo renderInfo = (TextRenderInfo)data; IList<TextRenderInfo> text = renderInfo.GetCharacterRenderInfos(); foreach (TextRenderInfo t in text) { string letter = t.GetText(); Vector letterStart = t.GetBaseline().GetStartPoint(); Vector letterEnd = t.GetAscentLine().GetEndPoint(); Rectangle letterRect = new Rectangle(letterStart.Get(0), letterStart.Get(1), letterEnd.Get(0) - letterStart.Get(0), letterEnd.Get(1) - letterStart.Get(1)); TextMyChunk chunk = new TextMyChunk(); chunk.Text = letter; chunk.Rect = letterRect; chunk.FontFamily = t.GetFont().GetFontProgram().ToString(); chunk.FontSize = t.GetFontSize(); chunk.SpaceWidth = t.GetSingleSpaceWidth(); objectResult.Add(chunk); } }