private void ExecuteOpenTabCommand(EventInformation<MouseEventArgs> e)
        {
            var fileEntry = e.CommandArgument as FileEntryViewModel;
            if (fileEntry == null || fileEntry.Blocks.Any(b => b.Health != FileBlockHealthStatus.Ok)) return;

            var existing = Tabs.SingleOrDefault(t => t.Header == fileEntry.Name);
            if (existing != null)
            {
                SelectedTab = existing;
                return;
            }

            var stfs = fileEntry.Parent;

            if (fileEntry.Name == "PEC")
            {
                var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, ParseStfs(stfs.ExtractPec()));
                Tabs.Add(newTab);
                SelectedTab = newTab;
            }
            else if (fileEntry.Name.EndsWith(".gpd"))
            {
                var gpd = stfs.ExtractFile(fileEntry.Name);
                var model = ModelFactory.GetModel<GpdFile>(gpd);
                model.Parse();
                var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, new GpdFileViewModel(model));
                Tabs.Add(newTab);
                SelectedTab = newTab;
            }
        }
Esempio n. 2
0
 public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
 {
     FunctionCallDataElement el = new FunctionCallDataElement(eventData);
     uint socket = el.GetSimpleArgumentValueAsUInt(1);
     int result = el.ReturnValueAsInt;
     return new CloseEvent(eventInformation, socket, result);
 }
Esempio n. 3
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            EndPoint ep = null;
            XmlNode saNode = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value");
            string family = saNode.SelectSingleNode("field[@name='sin_family']/value/@value").Value;
            if (family == "AF_INET")
            {
                string addr = saNode.SelectSingleNode("field[@name='sin_addr']/value/@value").Value;
                int port = Convert.ToInt32(saNode.SelectSingleNode("field[@name='sin_port']/value/@value").Value);
                ep = new IPEndPoint(IPAddress.Parse(addr), port);
            }

            ConnectResult result;
            if (el.ReturnValueAsInt == 0)
            {
                result = ConnectResult.Success;
            }
            else
            {
                if (el.LastError == 10035)
                    result = ConnectResult.WouldBlock;
                else
                    result = ConnectResult.Error;
            }

            return new ConnectEvent(eventInformation, socket, ep, result);
        }
Esempio n. 4
0
 public ConnectEvent(EventInformation eventInformation, uint socket, EndPoint remoteEP, ConnectResult result)
     : base(eventInformation)
 {
     m_socket = socket;
     m_remoteEndPoint = remoteEP;
     m_result = result;
 }
Esempio n. 5
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            string familyStr = el.FirstArgument;
            AddressFamily family = AddressFamily.Unknown;
            if (familyStr == "AF_INET")
                family = AddressFamily.InterNetwork;
            else if (familyStr == "AF_INET6")
                family = AddressFamily.InterNetworkV6;

            string typeStr = el.SecondArgument;
            SocketType type = SocketType.Unknown;
            if (typeStr == "SOCK_STREAM")
                type = SocketType.Stream;
            else if (typeStr == "SOCK_DGRAM")
                type = SocketType.Dgram;

            string protocolStr = el.ThirdArgument;
            ProtocolType protocol = ProtocolType.Unknown;
            if (protocolStr == "IPPROTO_IP")
                protocol = ProtocolType.IP;

            uint result = el.ReturnValueAsUInt;

            return new CreateEvent(eventInformation, family, type, protocol, result);
        }
Esempio n. 6
0
 public SendEvent(EventInformation eventInformation, uint socket, byte[] buffer, int flags, int result)
     : base(eventInformation)
 {
     m_socket = socket;
     m_buffer = buffer;
     m_flags = flags;
     m_result = result;
 }
Esempio n. 7
0
 public CreateEvent(EventInformation eventInformation, AddressFamily addressFamily, SocketType socketType,
                    ProtocolType protocolType, uint result)
     : base(eventInformation)
 {
     m_addressFamily = addressFamily;
     m_socketType = socketType;
     m_protocolType = protocolType;
     m_result = result;
 }
        //------------------------------------------------------------------------/
        // Data
        //------------------------------------------------------------------------/
        private List <EventTreeElement> BuildEventTree()
        {
            this.events = StratusReflection.GetSubclass <Stratus.StratusEvent>();
            EventInformation[] eventsInformation = new EventInformation[this.events.Length];
            for (int i = 0; i < this.events.Length; ++i)
            {
                eventsInformation[i] = new EventInformation(this.events[i]);
            }

            //var treeBuilder = new TreeBuilder<EventTreeElement, EventInformation>();
            //treeBuilder.AddChildren(eventsInformation, 0);
            //return treeBuilder.ToTree();

            tree = new StratusSerializedTree <EventTreeElement, EventInformation>(eventsInformation);
            return(tree.elements);
        }
Esempio n. 9
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            string encodedBuffer = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value").InnerText.Trim();

            byte[] buffer = Convert.FromBase64String(encodedBuffer);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return(new SendEvent(eventInformation, socket, buffer, flags, result));
        }
 public RenderingContext(RenderingContext copy, Uri contextUri, EmbeddedImageHashtable embeddedImages, ImageStreamNames imageStreamNames, ICatalogItemContext subreportICatalogItemContext)
 {
     this.m_commonInfo       = copy.m_commonInfo;
     this.m_inPageSection    = false;
     this.m_prefix           = null;
     this.m_eventInfo        = copy.m_eventInfo;
     this.m_reportSnapshot   = copy.ReportSnapshot;
     this.m_processedItems   = null;
     this.m_cachedHiddenInfo = copy.m_cachedHiddenInfo;
     this.m_contextUri       = contextUri;
     this.m_embeddedImages   = embeddedImages;
     this.m_imageStreamNames = imageStreamNames;
     this.m_currentReportICatalogItemContext = subreportICatalogItemContext;
     this.m_jobContext     = copy.m_jobContext;
     this.m_dataProtection = copy.m_dataProtection;
 }
 public RenderingContext(ReportSnapshot reportSnapshot, string rendererID, DateTime executionTime, EmbeddedImageHashtable embeddedImages, ImageStreamNames imageStreamNames, EventInformation eventInfo, ICatalogItemContext reportContext, Uri contextUri, NameValueCollection reportParameters, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.GetReportChunk getChunkCallback, ChunkManager.RenderingChunkManager chunkManager, IGetResource getResourceCallback, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.GetChunkMimeType getChunkMimeType, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.StoreServerParameters storeServerParameters, bool retrieveRenderingInfo, UserProfileState allowUserProfileState, ReportRuntimeSetup reportRuntimeSetup, IJobContext jobContext, IDataProtection dataProtection)
 {
     this.m_commonInfo       = new CommonInfo(rendererID, executionTime, reportContext, reportParameters, getChunkCallback, chunkManager, getResourceCallback, getChunkMimeType, storeServerParameters, retrieveRenderingInfo, allowUserProfileState, reportRuntimeSetup, reportSnapshot.Report.IntermediateFormatVersion);
     this.m_inPageSection    = false;
     this.m_prefix           = null;
     this.m_eventInfo        = eventInfo;
     this.m_reportSnapshot   = reportSnapshot;
     this.m_processedItems   = null;
     this.m_cachedHiddenInfo = null;
     this.m_contextUri       = contextUri;
     this.m_embeddedImages   = embeddedImages;
     this.m_imageStreamNames = imageStreamNames;
     this.m_currentReportICatalogItemContext = this.m_commonInfo.TopLevelReportContext;
     this.m_jobContext     = jobContext;
     this.m_dataProtection = dataProtection;
 }
 public RenderingContext(RenderingContext copy, string prefix)
 {
     this.m_commonInfo       = copy.m_commonInfo;
     this.m_inPageSection    = true;
     this.m_prefix           = prefix;
     this.m_eventInfo        = null;
     this.m_reportSnapshot   = null;
     this.m_processedItems   = null;
     this.m_cachedHiddenInfo = null;
     this.m_contextUri       = copy.m_contextUri;
     this.m_embeddedImages   = copy.EmbeddedImages;
     this.m_imageStreamNames = copy.ImageStreamNames;
     this.m_currentReportICatalogItemContext = this.m_commonInfo.TopLevelReportContext;
     this.m_jobContext     = copy.m_jobContext;
     this.m_dataProtection = copy.m_dataProtection;
 }
Esempio n. 13
0
        public void Invalidate <T>()
        {
            var type = typeof(T);

            if (_configuredTypes.TryGetValue(type, out ConfigurationForType configurationForType))
            {
                var componentType = configurationForType.ComponentType;
                var cacheKey      = configurationForType.CacheKey.RemoveKey(componentType);
                var deleteInfo    = new EventInformation(cacheKey, componentType.ConfiguredType, null, null);
                _cache.Delete(deleteInfo);
            }
            else
            {
                throw new ArgumentException(string.Format(isNotARegisteredComponentMessage, type));
            }
        }
Esempio n. 14
0
 void ApplyIntel()
 {
     if (pnlIntel.Visible)
     {
         textBox.Select(_start, textBox.SelectionStart);
         string           value = intelBox.SelectedItem.ToString();
         int              index = values.IndexOf(value);
         EventInformation info  = Manager.Events.Values[index];
         string           add   = "(";
         if (info._paramNames.Length == 0)
         {
             add += ");" + Environment.NewLine;
         }
         textBox.SelectedText = value + add;
         pnlIntel.Hide();
     }
 }
Esempio n. 15
0
        public static RoutedEventInformation GetDefaultEvent(ITypeResolver typeResolver, IType typeId)
        {
            RoutedEventInformation eventInformation1 = (RoutedEventInformation)null;

            foreach (RoutedEventInformation eventInformation2 in EventInformation.GetEventsForType(typeResolver, typeId, MemberType.RoutedEvent))
            {
                if (eventInformation2.RoutedEvent != null && eventInformation2.RoutedEvent == FrameworkElement.LoadedEvent)
                {
                    return(eventInformation2);
                }
                if ((TriggerSourceInformation)eventInformation1 == (TriggerSourceInformation)null)
                {
                    eventInformation1 = eventInformation2;
                }
            }
            return(eventInformation1);
        }
Esempio n. 16
0
        private IDictionary <string, UserData> BuildUserDataMap(IList <EventData> events)
        {
            var userMap = new Dictionary <string, UserData>();

            foreach (EventData e in events)
            {
                // var geoIpTask = _freeGeoIpClient.GetGeoIpInformation(e.Ip);
                var geoIpTask = _freeGeoIpClient.GetGeoIpInformation(GetRandomDomain());
                e.Password = _cryptoService.DecryptTextAes(e.Password);
                var eventInformation = new EventInformation(e, geoIpTask.Result);

                var userData = GetUserData(e.User, userMap);
                userData.EventsList.Add(eventInformation);
                VerifyAlert(userData);
            }

            return(userMap);
        }
 public RenderingContext(RenderingContext parentContext, bool hasReportItemReferences)
 {
     this.m_rendererID         = parentContext.m_rendererID;
     this.m_isSubReportContext = true;
     this.m_pageEvaluation     = null;
     this.m_dynamicInstances   = null;
     this.m_eventInfo          = parentContext.EventInfo;
     this.m_reportSnapshot     = parentContext.m_reportSnapshot;
     this.m_oldReportSnapshot  = parentContext.m_oldReportSnapshot;
     this.m_chunkManager       = parentContext.m_chunkManager;
     if (this.m_oldReportSnapshot != null)
     {
         this.m_odpContext = parentContext.OdpContext;
     }
     else
     {
         this.m_odpContext = new OnDemandProcessingContext(parentContext.m_odpContext, hasReportItemReferences, this.m_reportSnapshot.Report);
     }
 }
Esempio n. 18
0
        public List <EventInformation> GetEvents()
        {
            List <EventInformation> retValue = new List <EventInformation>();

            using (CX418DataAccess.cx418timingEntities context = new CX418DataAccess.cx418timingEntities())
            {
                var events = (from t in context.Events
                              select t);

                foreach (var eventEntity in events)
                {
                    EventInformation newEventInfo = new EventInformation(eventEntity);

                    retValue.Add(newEventInfo);
                }
            }

            return(retValue);
        }
Esempio n. 19
0
        private CachedItem executeAndPutInCache(EventInformation eventInformation, IEnumerable <string> dependingRemoveKeys, Func <object> originalMethod)
        {
            var methodResult = originalMethod();
            var cachedItem   = new CachedItem(eventInformation, methodResult);
            var key          = cachedItem.EventInformation.CacheKey;
            var dependedKeys = dependingRemoveKeys.ToList();

            dependedKeys.Add(mainCacheKey);
            createDependencies(dependedKeys);

            var policy = new CacheItemPolicy
            {
                AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(_timeoutMinutes),
                RemovedCallback    = arguments => _eventListenersCallback.OnCacheRemoval(cachedItem)
            };

            policy.ChangeMonitors.Add(cache.CreateCacheEntryChangeMonitor(dependedKeys));
            cache.Set(key, cachedItem, policy);
            return(cachedItem);
        }
Esempio n. 20
0
        public bool ParseEvent(string EventURL, List <EventInformation> EventList)
        {
            string EventContents;

            if (!IsAxsUrl(EventURL))
            {
                return(false);
            }

            EventContents = PageDownloader.GetPageContents(EventURL);

            EventInformation EventInfo = new EventInformation();

            EventInfo.SetStartDate(GetStartDate(EventContents));
            EventInfo.Title       = GetTitle(EventContents);
            EventInfo.Description = EventURL;
            EventInfo.Location    = GetLocation(EventContents);

            return(true);
        }
Esempio n. 21
0
        public void Intercept(IInvocation invocation)
        {
            if (!_configurationForType.EnabledCache)
            {
                invocation.Proceed();
                return;
            }

            var method = invocation.Method;

            //ugly hack
            if (method.IsGenericMethod && !_configurationForType.CachedMethods.Contains(method, MethodInfoComparer.Instance))
            {
                invocation.Proceed();
                return;
            }
            var proxy     = (ICachingComponent)invocation.Proxy;
            var arguments = invocation.Arguments;

            var keyAndItsDependingKeys = _configurationForType.CacheKey.GetAndPutKey(_configurationForType.ComponentType, proxy, method, arguments);

            if (keyAndItsDependingKeys.Key == null)
            {
                invocation.Proceed();
            }
            else
            {
                var eventInfo = new EventInformation(keyAndItsDependingKeys.Key, _configurationForType.ComponentType.ConfiguredType, invocation.Method, invocation.Arguments);
                var hasCalledOriginalMethod = false;
                var result = _cache.GetAndPutIfNonExisting(eventInfo, keyAndItsDependingKeys.DependingRemoveKeys, () =>
                {
                    invocation.Proceed();
                    hasCalledOriginalMethod = true;
                    return(invocation.ReturnValue);
                });
                if (!hasCalledOriginalMethod)
                {
                    invocation.ReturnValue = result;
                }
            }
        }
Esempio n. 22
0
        public async Task AddEvent(EventInformation eventInformation)
        {
            var registrant = new Registrant
            {
                FirstName       = eventInformation.City,
                LastName        = eventInformation.Zip,
                SportId         = eventInformation.SportId,
                ProgramId       = eventInformation.ProgramId,
                RegistrantPhone = new List <RegistrantPhone>
                {
                    new RegistrantPhone
                    {
                        CanText = true, Phone = eventInformation.From.Substring(2), PhoneType = "cell", PhoneTypeId = 1
                    }
                },
            };

            await _context.Registrant.AddAsync(registrant);

            _context.SaveChanges();
        }
Esempio n. 23
0
        public void UpdateEventNotFound()
        {
            //Arrange
            SetBasicMockDb();
            var controller = new EventController(_logs, _eventRepo);

            var newEventInfo = new EventInformation()
            {
                EventId     = "0",
                Name        = "newName",
                Description = "newDescription",
                Location    = "newLocation",
                Room        = "newRoom"
            };

            //Act
            var result = controller.UpdateEvent(newEventInfo);

            //Assert
            Assert.IsType <NotFoundResult>(result);
        }
Esempio n. 24
0
        public void Invalidate <T>(Expression <Func <T, object> > method, bool matchParameterValues)
        {
            string key;

            object[] arguments;
            var      methodInfo = ExpressionHelper.MemberName(method.Body);

            if (matchParameterValues && methodInfo.GetParameters().Any())
            {
                arguments = ExpressionHelper.ExtractArguments(method.Body).ToArray();
                key       = _cacheKey.RemoveKey(_componentType, this, methodInfo, arguments);
            }
            else
            {
                arguments = new object[0];
                key       = _cacheKey.RemoveKey(_componentType, this, methodInfo);
            }
            var deleteInfo = new EventInformation(key, _componentType.ConfiguredType, methodInfo, arguments);

            _cache.Delete(deleteInfo);
        }
        private static void FixUpEventNameImpl(BehaviorEventTriggerNode eventTriggerNode, SceneNode sourceNode)
        {
            if (sourceNode == null)
            {
                return;
            }
            IEnumerable <EventInformation> eventsForType = EventInformation.GetEventsForType((ITypeResolver)eventTriggerNode.ProjectContext, sourceNode.Type, MemberType.LocalEvent);

            if (!Enumerable.Any <EventInformation>(eventsForType, (Func <EventInformation, bool>)(info => info.EventName.Equals(eventTriggerNode.EventName, StringComparison.Ordinal))))
            {
                bool flag = false;
                DefaultEventAttribute defaultEventAttribute = TypeUtilities.GetAttribute <DefaultEventAttribute>(sourceNode.TargetType);
                if (defaultEventAttribute != null && !string.IsNullOrEmpty(defaultEventAttribute.Name) && (TriggerSourceInformation)Enumerable.SingleOrDefault <EventInformation>(eventsForType, (Func <EventInformation, bool>)(eventInfo => eventInfo.EventName == defaultEventAttribute.Name)) != (TriggerSourceInformation)null)
                {
                    eventTriggerNode.SetValue(BehaviorEventTriggerNode.EventNameProperty, (object)defaultEventAttribute.Name);
                    flag = true;
                }
                if (!flag && Enumerable.Any <EventInformation>(eventsForType, (Func <EventInformation, bool>)(info => info.EventName.Equals("Loaded", StringComparison.Ordinal))))
                {
                    eventTriggerNode.SetValue(BehaviorEventTriggerNode.EventNameProperty, (object)"Loaded");
                }
                else
                {
                    eventTriggerNode.ClearValue(BehaviorEventTriggerNode.EventNameProperty);
                }
            }
            ISceneNodeCollection <SceneNode> collectionForProperty = eventTriggerNode.Parent.GetCollectionForProperty(BehaviorHelper.BehaviorTriggersProperty);
            BehaviorTriggerBaseNode          matchingTriggerNode   = BehaviorHelper.FindMatchingTriggerNode(eventTriggerNode.DocumentNode, collectionForProperty);

            if (matchingTriggerNode == null || matchingTriggerNode.Equals((object)eventTriggerNode))
            {
                return;
            }
            for (int index = eventTriggerNode.Actions.Count - 1; index >= 0; --index)
            {
                BehaviorTriggerActionNode action = (BehaviorTriggerActionNode)eventTriggerNode.Actions[index];
                BehaviorHelper.ReparentAction(collectionForProperty, (BehaviorTriggerBaseNode)eventTriggerNode, matchingTriggerNode, action);
            }
            collectionForProperty.Remove((SceneNode)eventTriggerNode);
        }
Esempio n. 26
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            string        familyStr = el.FirstArgument;
            AddressFamily family    = AddressFamily.Unknown;

            if (familyStr == "AF_INET")
            {
                family = AddressFamily.InterNetwork;
            }
            else if (familyStr == "AF_INET6")
            {
                family = AddressFamily.InterNetworkV6;
            }

            string     typeStr = el.SecondArgument;
            SocketType type    = SocketType.Unknown;

            if (typeStr == "SOCK_STREAM")
            {
                type = SocketType.Stream;
            }
            else if (typeStr == "SOCK_DGRAM")
            {
                type = SocketType.Dgram;
            }

            string       protocolStr = el.ThirdArgument;
            ProtocolType protocol    = ProtocolType.Unknown;

            if (protocolStr == "IPPROTO_IP")
            {
                protocol = ProtocolType.IP;
            }

            uint result = el.ReturnValueAsUInt;

            return(new CreateEvent(eventInformation, family, type, protocol, result));
        }
Esempio n. 27
0
        public Event CreateEvent(EventInformation eventInformation, XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            byte[]  buffer     = null;
            XmlNode bufferNode = eventData.SelectSingleNode("/event/arguments[@direction='out']/argument[1]/value/value");

            if (bufferNode != null)
            {
                buffer = Convert.FromBase64String(bufferNode.InnerText.Trim());
            }

            int bufferSize = el.GetSimpleArgumentValueAsInt(3);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return(new ReceiveEvent(eventInformation, socket, buffer, bufferSize, flags, result));
        }
        private void cboType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboType.SelectedIndex == -1)
            {
                return;
            }
            if (lstParameters.SelectedIndex == -1)
            {
                return;
            }
            int index = lstParameters.SelectedIndex;

            //Change the type to the type selected and update the view window.

            param = NewEvent[index];

            if (param.ParamType != (ParamType)cboType.SelectedIndex)
            {
                int ind = param.Index;
                EventInformation info = NewEvent.Info;
                string           name = ((ParamType)cboType.SelectedIndex).ToString();

                int value = 0;

                Parameter p = NewEvent[ind];
                if (p is EventValue || p is EventScalar || p is EventBool)
                {
                    value = p.Data;
                }

                NewEvent.RemoveAt(ind);

                ParamType t = ((ParamType)cboType.SelectedIndex);

                NewEvent.NewParam(ind, value, (int)t);
            }

            DisplayParameter(index);
        }
        /// <summary>
        /// Retrieves the specified information about the OpenCL event.
        /// </summary>
        /// <typeparam name="T">The type of the data that is to be returned.</param>
        /// <param name="eventInformation">The kind of information that is to be retrieved.</param>
        /// <exception cref="OpenClException">If the information could not be retrieved, then an <see cref="OpenClException"/> is thrown.</exception>
        /// <returns>Returns the specified information.</returns>
        private T GetEventInformation <T>(EventInformation eventInformation)
        {
            // Retrieves the size of the return value in bytes, this is used to later get the full information
            UIntPtr returnValueSize;
            Result  result = EventsNativeApi.GetEventInformation(this.Handle, eventInformation, UIntPtr.Zero, null, out returnValueSize);

            if (result != Result.Success)
            {
                throw new OpenClException("The event information could not be retrieved.", result);
            }

            // Allocates enough memory for the return value and retrieves it
            byte[] output = new byte[returnValueSize.ToUInt32()];
            result = EventsNativeApi.GetEventInformation(this.Handle, eventInformation, new UIntPtr((uint)output.Length), output, out returnValueSize);
            if (result != Result.Success)
            {
                throw new OpenClException("The event information could not be retrieved.", result);
            }

            // Returns the output
            return(InteropConverter.To <T>(output));
        }
Esempio n. 30
0
        public bool ParseEvent(string EventURL, List <EventInformation> EventList)
        {
            string EventContents;
            Match  match;

            EventContents = PageDownloader.GetPageContents(EventURL);

            match = Regex.Match(EventContents, @"<div id=""maplocation"" style=""line-height:100%;"">(.*?) at (.*?), (.*?)<div id=""address"" style=""font-size:12px;margin-top:3px;"">(.*?)\(");
            // match = Regex.Match(EventContents, @"<script type=""application/ld\+json"">(.*?)</script>", RegexOptions.Singleline);
            if (match.Success)
            {
                string EventTitle;

                // TODO -- This is ugly but seems to mostly work. We still need a fuzzy/NLP date parser as DateTime.Parse is pretty dumb/rigid.
                DateTime StartTime = DateTime.Parse($"{match.Groups[1].Value} {DateTime.Now.Year} {match.Groups[2].Value}");

                Match match2 = Regex.Match(EventContents, @"<link rel=""alternate"" type=""application/rss\+xml"" title=""(.*?)""");
                if (match2.Success)
                {
                    EventTitle = match2.Groups[1].Value;
                }
                else
                {
                    EventTitle = "Error! Couldn't determine title!";
                }

                EventInformation eventInfo = new EventInformation()
                {
                    Title = EventTitle, Location = $"{match.Groups[3].Value} ({match.Groups[4].Value})", Description = EventURL
                };
                eventInfo.SetStartDate(StartTime.ToString());
                EventList.Add(eventInfo);

                return(true);
            }

            return(false);
        }
Esempio n. 31
0
        public EventInformation GetEvent(string _id)
        {
            int intEventId;

            EventInformation retValue = null;

            if (int.TryParse(_id, out intEventId))
            {
                using (CX418DataAccess.cx418timingEntities context = new CX418DataAccess.cx418timingEntities())
                {
                    var curEvent = (from t in context.Events
                                    where t.ID == intEventId
                                    select t).FirstOrDefault();

                    if (curEvent != null)
                    {
                        retValue = new EventInformation(curEvent);
                    }
                }
            }

            return(retValue);
        }
        private void btnChangeEvent_Click(object sender, EventArgs e)
        {
            //Pass in the event Event.
            frmEventList.eventEvent = NewEvent.EventID;
            frmEventList.p          = NewEvent._root;
            frmEventList.ShowDialog();

            //Retrieve and setup the new event according to the new event Event.
            if (frmEventList.status == DialogResult.OK)
            {
                _newEv = new Event()
                {
                    _script = _origEvent._script
                };

                NewEvent.EventID = (uint)frmEventList.eventEvent;
                EventInformation info = NewEvent.Info;

                NewEvent.Reset();
            }

            DisplayEvent();
        }
Esempio n. 33
0
        private async Task <EventInformation> From(EventRow eventRow)
        {
            var eventInformation = new EventInformation {
                Id            = Guid.Parse(eventRow.RowKey),
                IsStarted     = eventRow.IsStarted,
                IsDone        = eventRow.IsDone,
                IsSuccessful  = eventRow.IsSuccessful,
                ExecutionDate = eventRow.ExecutionDate,
                Type          = eventRow.Type
            };

            if (string.IsNullOrEmpty(eventRow.Actions))
            {
                return(eventInformation);
            }
            var actionIdentifiers = eventRow.GetActionIdentifiers(_jsonConverter);

            if (actionIdentifiers.Any())
            {
                eventInformation.CommandInformations = (await GetCommandInformation(actionIdentifiers)).ToArray();
            }
            return(eventInformation);
        }
Esempio n. 34
0
        public CachedItem GetAndPutIfNonExisting(EventInformation eventInformation, Func <IEnumerable <string> > dependingRemoveKeys, Func <object> originalMethod)
        {
            var cachedItem = (CachedItem)cache.Get(eventInformation.CacheKey);

            if (cachedItem != null)
            {
                _eventListenersCallback.OnCacheHit(cachedItem);
                return(cachedItem);
            }

            lock (lockObject(eventInformation))
            {
                var cachedItem2 = (CachedItem)cache.Get(eventInformation.CacheKey);
                if (cachedItem2 != null)
                {
                    _eventListenersCallback.OnCacheHit(cachedItem2);
                    return(cachedItem2);
                }
                var addedValue = executeAndPutInCache(eventInformation, dependingRemoveKeys(), originalMethod);
                _eventListenersCallback.OnCacheMiss(addedValue);
                return(addedValue);
            }
        }
Esempio n. 35
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            EndPoint ep     = null;
            XmlNode  saNode = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value");
            string   family = saNode.SelectSingleNode("field[@name='sin_family']/value/@value").Value;

            if (family == "AF_INET")
            {
                string addr = saNode.SelectSingleNode("field[@name='sin_addr']/value/@value").Value;
                int    port = Convert.ToInt32(saNode.SelectSingleNode("field[@name='sin_port']/value/@value").Value);
                ep = new IPEndPoint(IPAddress.Parse(addr), port);
            }

            ConnectResult result;

            if (el.ReturnValueAsInt == 0)
            {
                result = ConnectResult.Success;
            }
            else
            {
                if (el.LastError == 10035)
                {
                    result = ConnectResult.WouldBlock;
                }
                else
                {
                    result = ConnectResult.Error;
                }
            }

            return(new ConnectEvent(eventInformation, socket, ep, result));
        }
Esempio n. 36
0
        private static bool ParseFacebookEventListing(string URL, string EventContents, out EventInformation EventInfo)
        {
            string StartDate;
            string EndDate;

            EventInfo          = new EventInformation();
            EventInfo.Location = GetEventLocation(EventContents);

            EventInfo.Title = GetEventTitle(EventContents);
            if (string.IsNullOrEmpty(EventInfo.Title))
            {
                return(false);
            }

            EventInfo.Description = "Source: " + URL + "\n";

            if (!GetEventDates(EventContents, out StartDate, out EndDate))
            {
                return(false);
            }

            EventInfo.SetStartDate(StartDate);
            if (string.IsNullOrEmpty(EndDate))
            {
                //
                // If we don't have an explicit end date time just add an hour.
                //
                EventInfo.SetEndDate((DateTime.Parse(StartDate)).Add(new TimeSpan(1, 0, 0)).ToString());
            }
            else
            {
                EventInfo.SetEndDate(EndDate);
            }

            return(true);
        }
Esempio n. 37
0
        public void ListOfMessages_BuildMessage_CorrectMessage()
        {
            EventInformation eventInfo = new EventInformation {
                Name = "Event1", OriginalDateTime = "2020/02/01"
            };

            Mock <IDateTimeService> iDateTime = new Mock <IDateTimeService>();
            Mock <IRead>            iRead     = new Mock <IRead>();
            Mock <ISelector>        iSelector = new Mock <ISelector>();

            iRead.Setup(m => m.GetListEvent()).Returns(new List <IDatos> {
                eventInfo
            });
            iDateTime.Setup(m => m.DateIsAfterCurrent(It.IsAny <IDatos>())).Returns(true);
            iDateTime.Setup(m => m.GetElapsedTime(It.IsAny <IDatos>(), It.IsAny <bool>())).Returns(new TimeSpan(2, 0, 0, 0));
            iSelector.Setup(m => m.GetInstance(It.IsAny <TimeSpan>())).Returns(new MessageDay());

            var    eventHandler = new EventProcessingHandler(iDateTime.Object, iRead.Object, iSelector.Object);
            string actual       = eventHandler.ListOfMessages().FirstOrDefault();

            string expected = $"{eventInfo.Name},{eventInfo.OriginalDateTime} ocurrirá dentro de 2 día(s)";

            Assert.AreEqual(expected, actual);
        }
Esempio n. 38
0
        public Event CreateEvent(EventInformation eventInformation, XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            byte[] buffer = null;
            XmlNode bufferNode = eventData.SelectSingleNode("/event/arguments[@direction='out']/argument[1]/value/value");
            if (bufferNode != null)
            {
                buffer = Convert.FromBase64String(bufferNode.InnerText.Trim());
            }

            int bufferSize = el.GetSimpleArgumentValueAsInt(3);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return new ReceiveEvent(eventInformation, socket, buffer, bufferSize, flags, result);
        }
Esempio n. 39
0
 private void InputTextData_KeyDown(EventInformation<KeyEventArgs> ei)
 {
     var input = ei.Sender as TextBox;
     if (ei.EventArgs.Key == Key.Enter)
     {
         _textInputHelper.RaiseTextInputFinishedEvent(input.Text);
     }
 }
Esempio n. 40
0
 /// <summary>
 /// Действие, которое выполняется при взаимодействии пользователя с окном
 /// </summary>
 /// <param name="e">Аргументы события</param>
 protected virtual void Action(EventInformation<RoutedEventArgs> e)
 {
     var handler = ActionHappened;
     handler?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 41
0
 public CloseEvent(EventInformation eventInformation, uint socket, int result)
     : base(eventInformation)
 {
     m_socket = socket;
     m_result = result;
 }
Esempio n. 42
0
 private void ExecuteSwitchPaneCommand(EventInformation<KeyEventArgs> eventInformation)
 {
     OtherPane.SetActive();
     eventInformation.EventArgs.Handled = true;
 }
Esempio n. 43
0
 public ReceiveEvent(EventInformation eventInformation, uint socket, byte[] buffer, int bufferSize, int flags,
                     int result)
     : base(eventInformation)
 {
     m_socket = socket;
     m_buffer = buffer;
     m_bufferSize = bufferSize;
     m_flags = flags;
     m_result = result;
 }
Esempio n. 44
0
 private bool CanExecuteSwitchPaneCommand(EventInformation<KeyEventArgs> eventInformation)
 {
     return eventInformation.EventArgs.Key == Key.Tab;
 }
Esempio n. 45
0
 private void OnMouseDown(EventInformation<MouseEventArgs> obj)
 {
     var point = obj.EventArgs.GetPosition((IInputElement)obj.Sender);
     OnMouseDown(point);
 }
Esempio n. 46
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            string encodedBuffer = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value").InnerText.Trim();
            byte[] buffer = Convert.FromBase64String(encodedBuffer);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return new SendEvent(eventInformation, socket, buffer, flags, result);
        }