private DBList <DBBreak> CreateBreaks(IDateTimeIterator _dtIterator, DateTime _startDate, DateTime _endDate, int _count) { var breaks = new DBList <DBBreak>(); _count = _count.Min(MAX_BREAKS); foreach (var dt in _dtIterator.GetIterator(_startDate, _endDate, 0, _count)) { //Abwesenheit in MT Auftrag evtl. verboten //ANF-06805-F1G6Z2|Lifta| if (!Data.IsAbsenceAllowed(WorkerNr, dt + Begin.TimeOfDay, mandant.MTOhneAbwesenheiten)) { continue; } foreach (var workerNr in workerNrs) { var b = MakeBreak(); b.WorkerNr = workerNr; b.Nr = Data.GetBreakSequence(); if (groupNr == 0) { groupNr = b.Nr; } b.GroupNr = groupNr; b.GroupRule = groupRule; b.Begin = dt + Begin.TimeOfDay; b.Date = dt; breaks.Add(b); EventHub.Handle(lang, EventType.WorkerBreak, DateTime.Now, this.GetType().Name, this.username, EventParams.Create("workernr", workerNr, "info", FLS.Texts.Text.Get(lang, FLS.Texts.Text.Pauseaenderung), "text", FLS.Texts.Text.Get(lang, FLS.Texts.Text.Pauseaenderung) + ":" + b.Begin, "shift", shift)); } } return(breaks); }
// extract entities from recognizerResult public static EventParams GetEntities(RecognizerResult recognizerResult) { var entities = recognizerResult.Entities; var date = entities["datetime"]; var instance = entities["$instance"]; var location = entities["Places_AbsoluteLocation"]; var city = entities["geographyV2_city"]; EventParams eventParams = new EventParams(); if (date != null) { var text = instance["datetime"][0]["text"].ToString(); try { List <DateTime> dates = ParseDateEntitie(text); eventParams.StartDate = dates[0].ToString(); eventParams.EndDate = dates[1].ToString(); } catch (Exception) { } } if (location != null) { string loc = location[0].ToString(); eventParams.City = loc; } if (city != null) { eventParams.City = city[0].ToString(); } return(eventParams); }
/** * @brief Read llDetectedGrab, etc, values from XML * <EventQueue> * <DetectParams>...</DetectParams> * . * . * . * </EventQueue> */ private LinkedList <EventParams> RestoreEventQueue(XmlNode eventsN) { LinkedList <EventParams> eventQueue = new LinkedList <EventParams>(); if (eventsN != null) { XmlNodeList eventL = eventsN.SelectNodes("Event"); foreach (XmlNode evnt in eventL) { string name = ((XmlElement)evnt).GetAttribute("Name"); object[] parms = ExtractXMLObjectArray(evnt, "param"); DetectParams[] detects = RestoreDetectParams(evnt); if (parms == null) { parms = zeroObjectArray; } if (detects == null) { detects = zeroDetectParams; } EventParams evt = new EventParams(name, parms, detects); eventQueue.AddLast(evt); } } return(eventQueue); }
/// <summary> /// Post event to an entire prim /// </summary> /// <param name="localID"></param> /// <param name="p"></param> /// <returns></returns> public bool PostObjectEvent(uint localID, EventParams p) { bool result = false; lock (m_PrimObjects) { if (!m_PrimObjects.ContainsKey(localID)) { return(false); } foreach (UUID itemID in m_PrimObjects[localID]) { if (m_Scripts.ContainsKey(itemID)) { IScriptInstance instance = m_Scripts[itemID]; if (instance != null) { instance.PostEvent(p); result = true; } } } } return(result); }
private void ClearQueueExceptLinkMessages() { lock (m_QueueLock) { EventParams[] linkMessages = new EventParams[m_EventQueue.Count]; int n = 0; foreach (EventParams evt2 in m_EventQueue) { if (evt2.EventName == "link_message") { linkMessages[n++] = evt2; } } m_EventQueue.Clear(); for (int i = m_EventCounts.Length; --i >= 0;) { m_EventCounts[i] = 0; } for (int i = 0; i < n; i++) { m_EventQueue.AddLast(linkMessages[i]); } m_EventCounts[(int)ScriptEventCode.link_message] = n; } }
public void CancelEvent(string eventName) { ScriptEventCode evc; try { evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), eventName); } catch { return; } lock (m_QueueLock) { if (m_EventQueue.Count == 0) { return; } LinkedListNode <EventParams> lln2 = null; for (lln2 = m_EventQueue.First; lln2 != null; lln2 = lln2.Next) { EventParams evt2 = lln2.Value; if (evt2.EventName.Equals(eventName)) { m_EventQueue.Remove(lln2); if (evc >= 0 && m_EventCounts[(int)evc] > 0) { m_EventCounts[(int)evc]--; } } } } }
private async Task <DialogTurnResult> PromptForDateAsync( WaterfallStepContext stepContext, CancellationToken cancellationToken = default(CancellationToken)) { EventParams eventParams = await _accessors.EventParamState.GetAsync(stepContext.Context); string date = eventParams.StartDate; if (date != null) { return(await stepContext.NextAsync()); } else { return(await stepContext.PromptAsync( EventDatePrompt, new PromptOptions { Prompt = MessageFactory.Text("When must the event take place?"), RetryPrompt = MessageFactory.Text("Please enter a valid time description like 'today', 'this weekend' or '10th of March'. \nEnd this search by typing 'end'"), }, cancellationToken )); } }
internal PlayedTrade(string symbol, long time, int sequence, int time_nanos, char exchange_code, double price, int size, int tick, double change, int raw_flags, double day_volume, double day_turnover, Direction direction, bool is_eth, Scope scope) { this.EventSymbol = symbol; this.Time = Tools.UnixTimeToDate(time); this.Sequence = sequence; this.TimeNanoPart = time_nanos; this.ExchangeCode = exchange_code; this.Price = price; this.Size = size; this.Change = change; this.Tick = tick; this.RawFlags = raw_flags; this.DayVolume = day_volume; this.DayTurnover = day_turnover; this.TickDirection = direction; this.IsExtendedTradingHours = is_eth; this.Scope = scope; Params = new EventParams(0, 0, 0); Data = new DxTestTrade(time, sequence, time_nanos, exchange_code, price, size, tick, change, raw_flags, day_volume, day_turnover, direction, is_eth, scope); }
public bool PostScriptEvent(UUID itemID, EventParams p) { uint localID = m_ScriptManager.GetLocalID(itemID); return(m_EventQueueManager.AddToScriptQueue(localID, itemID, p.EventName, p.DetectParams, p.Params)); }
/// <summary> /// Creates Candle event from another object. /// </summary> /// <param name="candle">Other Candle object.</param> internal PlayedCandle(IDxCandle candle) { EventSymbol = CandleSymbol.ValueOf(candle.EventSymbol.ToString()); EventFlags = candle.EventFlags; TimeStamp = candle.TimeStamp; Time = Tools.UnixTimeToDate(TimeStamp); Sequence = candle.Sequence; Count = candle.Count; Open = candle.Open; High = candle.High; Low = candle.Low; Close = candle.Close; Volume = candle.Volume; VWAP = candle.VWAP; BidVolume = candle.BidVolume; AskVolume = candle.AskVolume; DateTime = Tools.UnixTimeToDate(TimeStamp); Index = candle.Index; ImpVolatility = candle.ImpVolatility; OpenInterest = candle.OpenInterest; Params = new EventParams(EventFlags, ((ulong)TimeStamp << 32) + (uint)Sequence, 0); Data = new DxTestCandle(EventFlags, Index, Tools.DateToUnixTime(Time), Sequence, Count, Open, High, Low, Close, Volume, VWAP, BidVolume, AskVolume, (int)OpenInterest, ImpVolatility); }
public EventInfo(RemotePromotion remotePromotion) { this.DescriptionRows = new List <DescriptionRow>(); EventParams parsedCustomParams = remotePromotion.ParsedCustomParams as EventParams; this.Title = remotePromotion.ParsedLoca.PopupHeadline; this.Subtitle = remotePromotion.ParsedLoca.PopupTitle; this.Flavor = remotePromotion.ParsedLoca.PopupDescription; this.DescriptionRows.Clear(); if (!string.IsNullOrEmpty(remotePromotion.ParsedLoca.PopupBody)) { char[] separator = new char[] { ';' }; string[] strArray = remotePromotion.ParsedLoca.PopupBody.Split(separator); for (int i = 0; i < strArray.Length; i++) { string str = strArray[i]; if (str != null) { str = str.Trim(); if (!string.IsNullOrEmpty(str)) { SpriteAtlasEntry entry = (parsedCustomParams.DescriptionIcons.Count <= i) ? null : parsedCustomParams.DescriptionIcons[i]; DescriptionRow item = new DescriptionRow(); item.Icon = entry; item.Text = str; this.DescriptionRows.Add(item); } } } } }
/// <summary> /// Creates Order event from another object. /// </summary> /// <param name="order">Other Order object.</param> internal PlayedOrder(IDxOrder order) { this.EventSymbol = order.EventSymbol; this.EventFlags = order.EventFlags; this.Index = order.Index; this.Time = order.Time; this.TimeNanoPart = order.TimeNanoPart; this.Sequence = order.Sequence; Action = order.Action; ActionTime = order.ActionTime; OrderId = order.OrderId; AuxOrderId = order.AuxOrderId; this.Price = order.Price; this.Size = order.Size; this.Count = order.Count; TradeId = order.TradeId; TradePrice = order.TradePrice; TradeSize = order.TradeSize; this.Scope = order.Scope; this.Side = order.Side; this.ExchangeCode = order.ExchangeCode; this.Source = order.Source; this.MarketMaker = order.MarketMaker; marketMakerCharArray = MarketMaker.ToString().ToCharArray(); IntPtr marketMakerCharsPtr = Marshal.UnsafeAddrOfPinnedArrayElement(marketMakerCharArray, 0); Params = new EventParams(EventFlags, (ulong)Index, 0); Data = new DxTestOrder(EventFlags, Index, Tools.DateToUnixTime(Time), TimeNanoPart, Sequence, Price, (int)Size, Count, Scope, Side, ExchangeCode, Source, marketMakerCharsPtr); }
private void TryEvent(EventParams ep) { int hr; int i = 0; IntPtr ip = IntPtr.Zero; if (!m_bWorked) { DVRStreamDesc sd = new DVRStreamDesc(); ip = IntPtr.Zero; i = 0; try { hr = m_se.GetEvent(ep.EventID, ep.Param3, ref i, ip); Debug.WriteLine(string.Format("{0} {1}", hr, i)); if (hr >= 0) { ip = Marshal.AllocCoTaskMem(i); hr = m_se.GetEvent(ep.EventID, ep.Param3, ref i, ip); Marshal.PtrToStructure(ip, sd); m_bWorked = hr >= 0 && sd.guidFormatType == sd.MediaType.formatType && sd.guidFormatType != Guid.Empty; } } finally { Marshal.FreeCoTaskMem(ip); } } }
public async Task <PagedList <Event> > GetAllEventsAsync(EventParams eventParams) { var query = _context.Events.AsQueryable(); return(await PagedList <Event> .CreateAsync(query.ProjectTo <Event>(_mapper.ConfigurationProvider) .AsNoTracking(), eventParams.PageNumber, eventParams.PageSize)); }
internal unsafe PlayedOrder(string symbol, EventFlag event_flags, long index, long time, int time_nanos, int sequence, double price, int size, int count, Scope scope, Side side, char exchange_code, IndexedEventSource source, string mm) { this.EventSymbol = symbol; this.EventFlags = event_flags; this.Index = index; this.Time = Tools.UnixTimeToDate(time); this.TimeNanoPart = time_nanos; this.Sequence = sequence; this.Price = price; this.Size = size; this.Count = count; this.Scope = scope; this.Side = side; this.ExchangeCode = exchange_code; this.Source = source; fixed(char *pMarketMaker = mm.ToCharArray()) { this.MarketMaker = new string(pMarketMaker); } marketMakerCharArray = mm.ToCharArray(); IntPtr marketMakerCharsPtr = Marshal.UnsafeAddrOfPinnedArrayElement(marketMakerCharArray, 0); Params = new EventParams(EventFlags, (ulong)Index, 0); Data = new DxTestOrder(event_flags, index, time, time_nanos, sequence, price, size, count, scope, side, exchange_code, source, marketMakerCharsPtr); }
/// <summary> /// Creates Candle events via all parameters. /// </summary> /// <param name="symbol"></param> /// <param name="time"></param> /// <param name="sequence"></param> /// <param name="count"></param> /// <param name="open"></param> /// <param name="high"></param> /// <param name="low"></param> /// <param name="close"></param> /// <param name="volume"></param> /// <param name="vwap"></param> /// <param name="bidVolume"></param> /// <param name="askVolume"></param> /// <param name="index"></param> /// <param name="openInterest"></param> /// <param name="impVolatility"></param> /// <param name="eventFlags"></param> internal PlayedCandle(string symbol, long time, int sequence, double count, double open, double high, double low, double close, double volume, double vwap, double bidVolume, double askVolume, long index, long openInterest, double impVolatility, EventFlag eventFlags) { EventSymbol = CandleSymbol.ValueOf(symbol); EventFlags = eventFlags; TimeStamp = time; Time = Tools.UnixTimeToDate(time); Sequence = sequence; Count = count; Open = open; High = high; Low = low; Close = close; Volume = volume; VWAP = vwap; BidVolume = bidVolume; AskVolume = askVolume; DateTime = Tools.UnixTimeToDate(time); Index = index; ImpVolatility = impVolatility; OpenInterest = openInterest; Params = new EventParams(EventFlags, ((ulong)time << 32) + (uint)sequence, 0); Data = new DxTestCandle(eventFlags, index, time, sequence, count, open, high, low, close, volume, vwap, bidVolume, askVolume, (int)openInterest, impVolatility); }
public void CancelEvent(string eventName) { if (!m_eventCodeMap.TryGetValue(eventName, out ScriptEventCode evc)) { return; } lock (m_QueueLock) { if (m_EventQueue.Count == 0) { return; } LinkedListNode <EventParams> lln2 = null; for (lln2 = m_EventQueue.First; lln2 != null; lln2 = lln2.Next) { EventParams evt2 = lln2.Value; if (evt2.EventName.Equals(eventName)) { m_EventQueue.Remove(lln2); if (evc >= 0 && m_EventCounts[(int)evc] > 0) { m_EventCounts[(int)evc]--; } } } } }
public void TestLlRequestUrl() { TestHelpers.InMethod(); string requestId = m_lslApi.llRequestURL(); Assert.That(requestId, Is.Not.EqualTo(UUID.Zero.ToString())); string returnedUri; { // Check that URL is correctly set up Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); List <EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; Assert.That(events.Count, Is.EqualTo(1)); EventParams eventParams = events[0]; Assert.That(eventParams.EventName, Is.EqualTo("http_request")); UUID returnKey; string rawReturnKey = eventParams.Params[0].ToString(); string method = eventParams.Params[1].ToString(); returnedUri = eventParams.Params[2].ToString(); Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); Assert.That(method, Is.EqualTo(ScriptBaseClass.URL_REQUEST_GRANTED)); Assert.That(Uri.IsWellFormedUriString(returnedUri, UriKind.Absolute), Is.True); } { // Check that request to URL works. string testResponse = "Hello World"; m_engine.ClearPostedEvents(); m_engine.PostEventHook += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse); // Console.WriteLine("Trying {0}", returnedUri); AssertHttpResponse(returnedUri, testResponse); Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); List <EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; Assert.That(events.Count, Is.EqualTo(1)); EventParams eventParams = events[0]; Assert.That(eventParams.EventName, Is.EqualTo("http_request")); UUID returnKey; string rawReturnKey = eventParams.Params[0].ToString(); string method = eventParams.Params[1].ToString(); string body = eventParams.Params[2].ToString(); Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); Assert.That(method, Is.EqualTo("GET")); Assert.That(body, Is.EqualTo("")); } }
public async Task <PagedList <EventDto> > GetEventsAsync([FromQuery] EventParams eventParams) { var events = await _unitOfWork.EventRepository.GetEventsAsync(eventParams); Response.AddPaginationHeader(events.CurrentPage, events.PageSize, events.TotalCount, events.TotalPages); return(events); }
public double[] CalcListResult(EventParams runParams) { for (int i = 0; i < exprs.Count; i++) { result[i] = exprs[i].Execute(runParams); } return(result); }
public void Execute(EventParams eventParams) { method(eventParams, parameters); if (NextCall != null) { NextCall.Execute(eventParams); } }
protected override void InternalExecute(INode sender, EventParams paramsValue) { if (Source != null) { Source.Filter = EditFilterForm.ExecuteEditFilter(Source.Filter); Source.DataView.Open(); // Ensure the DataView is open in case a previous filter change caused it to close } }
public async Task <ActionResult <PagedList <Event> > > GetEvents([FromQuery] EventParams eventParams) { var events = await _unitOfWork.EventRepository.GetAllEventsAsync(eventParams); var eventsToReturn = _mapper.Map <IEnumerable <Event> >(events); Response.AddPaginationHeader(events.CurrentPage, events.PageSize, events.TotalCount, events.TotalPages); return(Ok(eventsToReturn)); }
internal unsafe NativeEventBuffer(EventType type, IntPtr symbol, IntPtr head, int size, EventParams eventParams, Func <IntPtr, int, string, T> readEvent) { this.type = type; this.head = head; this.size = size; this.readEvent = readEvent; this.symbol = new string((char *)symbol.ToPointer()); this.eventParams = eventParams; }
private bool PostObjectEvent(SceneObjectPart part, EventParams evParams) { foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems(InventoryType.LSL)) { PostScriptEvent(item.ItemID, evParams); } return(true); }
public async Task <ActionResult <IEnumerable <EventDto> > > GetAllEvents([FromQuery] EventParams eventParams) { var events = await _eventsRepository.GetPaginatedEventsAsync(eventParams); // var user = await _userRepository.GetUserByUsernameAsync(eventParams.username); Response.AddPaginationHeader(events.CurrentPage, eventParams.PageSize, events.TotalCount, events.TotalPages); return(Ok(events)); }
// event trigger with a string passed as a parameter. public static void TriggerEvent(string eventName, EventParams eventParams) { ThisEvent thisEvent = null; if (Instance.eventParamDictionary.TryGetValue(eventName, out thisEvent)) { // finally passes the message. thisEvent.Invoke(eventParams); } }
public async Task <IActionResult> GetEvents([FromQuery] EventParams eventParams) { var eventFromRepo = await _repo.GetEvents(eventParams); Response.AddPagination(eventFromRepo.CurrentPage, eventFromRepo.PageSize, eventFromRepo.TotalCount, eventFromRepo.TotalPages); var eventsToReturn = _mapper.Map <IEnumerable <EventForReturnDto> >(eventFromRepo); return(Ok(eventsToReturn)); }
public static double NoEqual(double a, ExprBase nextExpr, EventParams envParams) { try { return((a != nextExpr.Execute(envParams)) ? 1 : 0); } catch { Console.WriteLine("参与计算的数据类型不匹配"); return(0); } }
public static double Divide(double a, ExprBase nextExpr, EventParams envParams) { try { return(a / nextExpr.Execute(envParams)); } catch { Console.WriteLine("参与计算的数据类型不匹配"); return(0); } }
public static void Deserialize(string xml, ScriptInstance instance) { XmlDocument doc = new XmlDocument(); Dictionary<string, object> vars = instance.GetVars(); instance.PluginData = new Object[0]; // Avoid removal of whitepace from LSL string vars doc.PreserveWhitespace = true; doc.LoadXml(xml); XmlNodeList rootL = doc.GetElementsByTagName("ScriptState"); if (rootL.Count != 1) { return; } XmlNode rootNode = rootL[0]; if (rootNode != null) { object varValue; XmlNodeList partL = rootNode.ChildNodes; foreach (XmlNode part in partL) { switch (part.Name) { case "State": instance.State=part.InnerText; break; case "Running": instance.Running=bool.Parse(part.InnerText); break; case "Variables": XmlNodeList varL = part.ChildNodes; foreach (XmlNode var in varL) { string varName; varValue=ReadTypedValue(var, out varName); if (vars.ContainsKey(varName)) { vars[varName] = varValue; } } instance.SetVars(vars); break; case "Queue": XmlNodeList itemL = part.ChildNodes; foreach (XmlNode item in itemL) { List<Object> parms = new List<Object>(); List<DetectParams> detected = new List<DetectParams>(); string eventName = item.Attributes.GetNamedItem("event").Value; XmlNodeList eventL = item.ChildNodes; foreach (XmlNode evt in eventL) { switch (evt.Name) { case "Params": XmlNodeList prms = evt.ChildNodes; foreach (XmlNode pm in prms) parms.Add(ReadTypedValue(pm)); break; case "Detected": XmlNodeList detL = evt.ChildNodes; foreach (XmlNode det in detL) { string vect = det.Attributes.GetNamedItem( "pos").Value; LSL_Types.Vector3 v = new LSL_Types.Vector3(vect); int d_linkNum=0; UUID d_group = UUID.Zero; string d_name = String.Empty; UUID d_owner = UUID.Zero; LSL_Types.Vector3 d_position = new LSL_Types.Vector3(); LSL_Types.Quaternion d_rotation = new LSL_Types.Quaternion(); int d_type = 0; LSL_Types.Vector3 d_velocity = new LSL_Types.Vector3(); try { string tmp; tmp = det.Attributes.GetNamedItem( "linkNum").Value; int.TryParse(tmp, out d_linkNum); tmp = det.Attributes.GetNamedItem( "group").Value; UUID.TryParse(tmp, out d_group); d_name = det.Attributes.GetNamedItem( "name").Value; tmp = det.Attributes.GetNamedItem( "owner").Value; UUID.TryParse(tmp, out d_owner); tmp = det.Attributes.GetNamedItem( "position").Value; d_position = new LSL_Types.Vector3(tmp); tmp = det.Attributes.GetNamedItem( "rotation").Value; d_rotation = new LSL_Types.Quaternion(tmp); tmp = det.Attributes.GetNamedItem( "type").Value; int.TryParse(tmp, out d_type); tmp = det.Attributes.GetNamedItem( "velocity").Value; d_velocity = new LSL_Types.Vector3(tmp); } catch (Exception) // Old version XML { } UUID uuid = new UUID(); UUID.TryParse(det.InnerText, out uuid); DetectParams d = new DetectParams(); d.Key = uuid; d.OffsetPos = v; d.LinkNum = d_linkNum; d.Group = d_group; d.Name = d_name; d.Owner = d_owner; d.Position = d_position; d.Rotation = d_rotation; d.Type = d_type; d.Velocity = d_velocity; detected.Add(d); } break; } } EventParams ep = new EventParams( eventName, parms.ToArray(), detected.ToArray()); instance.EnqueueEvent(ep); } break; case "Plugins": instance.PluginData = ReadList(part).Data; break; case "Permissions": string tmpPerm; int mask = 0; tmpPerm = part.Attributes.GetNamedItem("mask").Value; if (tmpPerm != null) { int.TryParse(tmpPerm, out mask); if (mask != 0) { tmpPerm = part.Attributes.GetNamedItem("granter").Value; if (tmpPerm != null) { UUID granter = new UUID(); UUID.TryParse(tmpPerm, out granter); if (granter != UUID.Zero) { instance.ScriptTask.PermsMask = mask; instance.ScriptTask.PermsGranter = granter; } } } } break; case "MinEventDelay": double minEventDelay = 0.0; double.TryParse(part.InnerText, NumberStyles.Float, Culture.NumberFormatInfo, out minEventDelay); instance.MinEventDelay = minEventDelay; break; } } } }
/// <summary> /// Post an event to this script instance. /// </summary> /// <remarks> /// The request to run the event is sent /// </remarks> /// <param name="data"></param> public void PostEvent(EventParams data) { // m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}", // PrimName, ScriptName, data.EventName, State); if (!Running) return; // If min event delay is set then ignore any events untill the time has expired // This currently only allows 1 event of any type in the given time period. // This may need extending to allow for a time for each individual event type. if (m_eventDelayTicks != 0) { if (DateTime.Now.Ticks < m_nextEventTimeTicks) return; m_nextEventTimeTicks = DateTime.Now.Ticks + m_eventDelayTicks; } lock (EventQueue) { if (EventQueue.Count >= m_MaxScriptQueue) return; if (data.EventName == "timer") { if (m_TimerQueued) return; m_TimerQueued = true; } if (data.EventName == "control") { int held = ((LSL_Types.LSLInteger)data.Params[1]).value; // int changed = ((LSL_Types.LSLInteger)data.Params[2]).value; // If the last message was a 0 (nothing held) // and this one is also nothing held, drop it // if (m_LastControlLevel == held && held == 0) return; // If there is one or more queued, then queue // only changed ones, else queue unconditionally // if (m_ControlEventsInQueue > 0) { if (m_LastControlLevel == held) return; } m_LastControlLevel = held; m_ControlEventsInQueue++; } if (data.EventName == "collision") { if (m_CollisionInQueue) return; if (data.DetectParams == null) return; m_CollisionInQueue = true; } EventQueue.Enqueue(data); if (m_CurrentWorkItem == null) { m_CurrentWorkItem = Engine.QueueEventHandler(this); } } }
void _timeoutObject_OnTimeout(object sender, EventParams.TimeoutAsyncArgs e) { TearDown(); if (OnTimeout != null) { OnTimeout(sender, e); } }