void EventInput_CharEntered(object sender, EventInput.CharacterEventArgs e)
 {
     //Su dung subcriber de lay thong tin tu keyboard
     if (_subscriber == null)
         return;
     if (char.IsControl(e.Character))
     {
         //ctrl-v
         if (e.Character == 0x16)
         {
             //XNA runs in Multiple Thread Apartment state, which cannot recieve clipboard
             Thread thread = new Thread(PasteThread);
             thread.SetApartmentState(ApartmentState.STA);
             thread.Start();
             thread.Join();
             _subscriber.RecieveTextInput(_pasteResult);
         }
         else
         {
             _subscriber.RecieveCommandInput(e.Character);
         }
     }
     else
     {
         _subscriber.RecieveTextInput(e.Character);
     }
 }
        public override void OnCharEntered(EventInput.CharacterEventArgs e)
        {
            base.OnCharEntered(e);
            if ((int)e.Character < 32 || (int)e.Character > 126) //From space to tilde
                return; //Do nothing

            if (inFocus)
            {
                value += e.Character;
            }
        }
Esempio n. 3
0
 public override void OnCharEntered(EventInput.CharacterEventArgs e)
 {
     if ((int)e.Character < 32 || (int)e.Character > 126) //From space to tilde
         return; //Do nothing
     if (_P.chatMode != ChatMessageType.None)
     {
         //Chat delay to avoid entering the "start chat" key, an unfortunate side effect of the new key bind system
         TimeSpan diff = DateTime.Now - startChat;
         if (diff.Milliseconds >= 2)
             if (!(Keyboard.GetState().IsKeyDown(Keys.LeftControl) || Keyboard.GetState().IsKeyDown(Keys.RightControl)))
             {
                 _P.chatEntryBuffer += e.Character;
             }
     }
 }
        public static void Main()
        {
            string xml = @"  
                    <EventInput> 
                        <Group>12345</Group> 
                        <Events> 
                            <Event Id=""100"" /> 
                            <Event Id=""101"" /> 
                            <Event Id=""102"" /> 
                            <Event Id=""103"" /> 
                            <Event Id=""104"" /> 
                            </Events> 
                    </EventInput>";

            XmlSerializer serializer = new XmlSerializer(typeof(EventInput));
            EventInput    ei         = (EventInput)serializer.Deserialize(new StringReader(xml));

            Console.WriteLine(ei.Group);
            foreach (Event e in ei.Events)
            {
                Console.WriteLine(e.Id);
            }

            Console.WriteLine("\n=============================\n");

            ei = new EventInput()
            {
                Group  = "1111",
                Events = new Event[] {
                    new Event()
                    {
                        Id = 3
                    },
                    new Event()
                    {
                        Id = 7
                    },
                    new Event()
                    {
                        Id = 10
                    }
                }
            };

            serializer.Serialize(Console.Out, ei);
        }
Esempio n. 5
0
        public Game1()
        {
            myGraphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = 1280,
                PreferredBackBufferHeight = 720
            };

            GameInfo.myMouseFunction = SetMouseVisibility;
            GameInfo.myScreenSize.X  = myGraphicsDeviceManager.PreferredBackBufferWidth;
            GameInfo.myScreenSize.Y  = myGraphicsDeviceManager.PreferredBackBufferHeight;

            //graphics.SynchronizeWithVerticalRetrace = false;
            //IsFixedTimeStep = false;

            Content.RootDirectory = "Content";

            ContentManagerInstance.Content = Content;
            EventInput.Initialize(Window);
        }
Esempio n. 6
0
        public ArtistInput getArtist(int id)
        {
            var ArtistTMP = _contx.Artist.Where(e => e.IdArtist == id).FirstOrDefault();

            if (ArtistTMP == null)
            {
                throw new Exc_SthMissing("Artist with this ID is not existing");
            }

            ArtistInput res = new ArtistInput()
            {
                IdArtist = ArtistTMP.IdArtist,
                NickName = ArtistTMP.NickName
            };

            var Event = from art in _contx.Artist
                        join art_evn in _contx.ArtistEvent on art.IdArtist equals art_evn.IdArtist
                        join evn in _contx.Event on art_evn.IdEvent equals evn.IdEvent
                        where art.IdArtist == ArtistTMP.IdArtist
                        orderby evn.StartDate
                        select new { evn.IdEvent, evn.Name, evn.StartDate, evn.EndDate };

            if (!Event.Any())
            {
                throw new Exc_SthMissing("Artist with this ID havent participated in any event yet");
            }

            foreach (var x in Event)
            {
                EventInput eventInput = new EventInput()
                {
                    IdEvent   = x.IdEvent,
                    Name      = x.Name,
                    StartDate = x.StartDate,
                    EndDate   = x.EndDate
                };

                res.EventParticipate.Add(eventInput);
            }
            return(res);
        }
Esempio n. 7
0
        public (int, TaskCompletionSource <EventOutput>) Create(EventInput input, Type[] resultType, int timeout = 1000 * 100)
        {
            int  id = 0;
            long expiredTime;

            lock (this)
            {
                mID++;
                if (mID >= mEndID)
                {
                    mID = mStartID;
                }
                id = mID;
            }
            expiredTime = EventCenter.Watch.ElapsedMilliseconds + timeout;
            var item = new OutputAwaiter();

            item.ID = id;
            mAwaiterItemGroup.Set(item.ID, item);
            return(id, item.Create(expiredTime));
        }
Esempio n. 8
0
        public void Creating_Event()
        {
            string   name             = "Åpen dag";
            DateTime date             = new DateTime(2020, 1, 1);
            string   adress           = "Skogen 3b, 1708 Halden";
            DateTime ageLimit         = new DateTime(2005, 1, 1);
            float    ticketPrice      = 200;
            string   eventInfo        = "";
            long     availableTickets = 1000;

            //Wrong
            var EventInput   = new Event("", new DateTime(1999, 1, 1), "", new DateTime(1999, 1, 1), 0, "", 0);
            var EventCorrect = new Event("Åpen dag", new DateTime(2020, 1, 1), "Skogen 3b, 1708 Halden", new DateTime(2005, 1, 1), 200, "", 1000);

            if (name != "" && date >= DateTime.Now && adress != "" && ageLimit >= new DateTime(2005, 1, 1))
            {
                //Right
                EventInput = new Event(name, date, adress, ageLimit, ticketPrice, eventInfo, availableTickets);
            }

            Assert.True(EventCorrect.ToString() == EventInput.ToString());
        }
Esempio n. 9
0
        public async Task <EventDataWrapper> GetListAsync(int characterId, EventInput eventInput)
        {
            if (!eventInput.Limit.HasValue)
            {
                throw new BusinessException(ExceptionMessages.BN004, "BN004");
            }

            if (eventInput.Limit > 100)
            {
                throw new BusinessException(ExceptionMessages.BN001, "BN001");
            }

            if (eventInput.Limit < 1)
            {
                throw new BusinessException(ExceptionMessages.BN002, "BN002");
            }

            if (!eventInput.Offset.HasValue)
            {
                eventInput.Offset = 0;
            }

            return(await _eventRepository.GetEventsByCharacter(characterId, eventInput));
        }
Esempio n. 10
0
        protected override void Initialize()
        {
            VertexPositions.Initialize();
            EventInput.Initialize(Window);
            Blocks.InitialzizeBlocks();

            _graphics.PreferredBackBufferWidth  = Config.Width;
            _graphics.PreferredBackBufferHeight = Config.Height;

            if (!Config.VSync)
            {
                IsFixedTimeStep = false;
                _graphics.SynchronizeWithVerticalRetrace = false;
            }
            _graphics.ApplyChanges();

            _camera      = new Camera(0.3f, 0.002f, GraphicsDevice); //move speed, rotate speed, ...
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _statistics = new StatisticOverlay(Content.Load <SpriteFont>("NormalFont"), new Vector2(48, 48)); //debug
            _mainMenu   = new MainMenu(Content);

            base.Initialize();
        }
Esempio n. 11
0
 public async Task <Event> CreateNewEvent(EventInput eventInput)
 {
     return(await _mediator.Send(new CreateEventCommand(eventInput)));
 }
Esempio n. 12
0
 public override void OnCharEntered(EventInput.CharacterEventArgs e)
 {
     base.OnCharEntered(e);
     foreach (InterfaceElement element in elements)
     {
         element.OnCharEntered(e);
     }
 }
Esempio n. 13
0
 public Event MapToEvent(EventInput ev)
 {
     return(_mapper.Map <Event>(ev));
 }
Esempio n. 14
0
        public async Task <EventDataWrapper> GetEventsByCharacter(int characterId, EventInput eventInput)
        {
            var query = _context.Set <Event>().AsNoTracking().AsQueryable();

            var creatorIds = DataHelper.GetIdList(eventInput.Creators);
            var comicIds   = DataHelper.GetIdList(eventInput.Comics);
            var serieIds   = DataHelper.GetIdList(eventInput.Series);
            var storyIds   = DataHelper.GetIdList(eventInput.Stories);

            query = query
                    .Include(i => i.CharacterEvents).ThenInclude(t => t.Character)
                    .Include(i => i.ComicEvents).ThenInclude(t => t.Comic)
                    .Include(i => i.EventCreators).ThenInclude(t => t.Creator)
                    .Include(i => i.EventSeries).ThenInclude(t => t.Serie)
                    .Include(i => i.EventStories).ThenInclude(t => t.Story)
                    .Include(i => i.Thumbnail)
                    .Include(i => i.Urls)
                    .Where(w => (w.CharacterEvents.Any(a => a.CharacterId == characterId)) &&
                           (string.IsNullOrEmpty(eventInput.Name) || w.Title.ToLowerInvariant().Contains(eventInput.Name.ToLowerInvariant())) &&
                           (string.IsNullOrEmpty(eventInput.NameStartsWith) || w.Title.ToLowerInvariant().StartsWith(eventInput.NameStartsWith.ToLowerInvariant())) &&
                           (!eventInput.ModifiedSince.HasValue || w.Modified.Date > eventInput.ModifiedSince.Value.Date) &&
                           (!creatorIds.Any() || w.EventCreators.Any(s => creatorIds.Contains(s.CreatorId))) &&
                           (!comicIds.Any() || w.ComicEvents.Any(s => comicIds.Contains(s.EventId))) &&
                           (!serieIds.Any() || w.EventSeries.Any(s => serieIds.Contains(s.SerieId))) &&
                           (!storyIds.Any() || w.EventStories.Any(s => storyIds.Contains(s.StoryId)))
                           );

            switch (eventInput.OrderBy)
            {
            case Domain.Enums.EventOrderByEnum.name:
                query = query.OrderBy(o => o.Title);
                break;

            case Domain.Enums.EventOrderByEnum.startDate:
                query = query.OrderBy(o => o.Start);
                break;

            case Domain.Enums.EventOrderByEnum.modified:
                query = query.OrderBy(o => o.Modified);
                break;

            case Domain.Enums.EventOrderByEnum.nameDesc:
                query = query.OrderByDescending(o => o.Title);
                break;

            case Domain.Enums.EventOrderByEnum.startDateDesc:
                query = query.OrderByDescending(o => o.Start);
                break;

            case Domain.Enums.EventOrderByEnum.modifiedDesc:
                query = query.OrderByDescending(o => o.Modified);
                break;

            default:
                query = query.OrderByDescending(o => o.Title);
                break;
            }

            var result = await query.ToPagedListAsync(eventInput.Offset.Value, eventInput.Limit.Value);

            var eventDataWrapper = EventDataWrapperFaker.Create().Generate();

            eventDataWrapper.Data = new EventDataContainer()
            {
                Count   = result.Count,
                Limit   = result.Limit,
                Offset  = result.Offset,
                Total   = result.Total,
                Results = result.Results.Select(s => new EventModel()
                {
                    Id          = s.Id,
                    Title       = s.Title,
                    Description = s.Description,
                    ResourceUri = s.ResourceUri,
                    Urls        = s.Urls.Select(s1 => new UrlModel()
                    {
                        Type = s1.Type,
                        Url  = s1.FullUrl
                    }).ToList(),
                    Modified  = s.Modified,
                    Start     = s.Start,
                    End       = s.End,
                    Thumbnail = new ThumbnailModel()
                    {
                        Extension = s.Thumbnail.Extension,
                        Path      = s.Thumbnail.Path
                    },
                    Comics = new ComicList()
                    {
                        Available     = s.ComicEvents.Count,
                        CollectionURI = Guid.NewGuid().ToString(),
                        Returned      = s.ComicEvents.Count,
                        Items         = s.ComicEvents.Select(s1 => new ComicSummary()
                        {
                            Name        = s1.Comic.Title,
                            ResourceURI = Guid.NewGuid().ToString()
                        }).ToList()
                    },
                    Stories = new StoryList()
                    {
                        Available     = s.EventStories.Count,
                        CollectionURI = Guid.NewGuid().ToString(),
                        Returned      = s.EventStories.Count,
                        Items         = s.EventStories.Select(s1 => new StorySummary()
                        {
                            Name        = s1.Story.Title,
                            ResourceURI = Guid.NewGuid().ToString(),
                            Type        = s1.Story.Type
                        }).ToList()
                    },
                    Series = new SerieList()
                    {
                        Available     = s.EventSeries.Count,
                        CollectionURI = Guid.NewGuid().ToString(),
                        Returned      = s.EventSeries.Count,
                        Items         = s.EventSeries.Select(s1 => new SerieSummary()
                        {
                            Name        = s1.Serie.Title,
                            ResourceURI = Guid.NewGuid().ToString()
                        }).ToList()
                    },
                    Characters = new CharacterList()
                    {
                        Available     = s.CharacterEvents.Count,
                        CollectionURI = Guid.NewGuid().ToString(),
                        Returned      = s.CharacterEvents.Count,
                        Items         = s.CharacterEvents.Select(s1 => new CharacterSummary()
                        {
                            Name        = s1.Character.Name,
                            ResourceURI = Guid.NewGuid().ToString()
                        }).ToList()
                    },
                    Creators = new CreatorList()
                    {
                        Available     = s.EventCreators.Count,
                        CollectionURI = Guid.NewGuid().ToString(),
                        Returned      = s.EventCreators.Count,
                        Items         = s.EventCreators.Select(s1 => new CreatorSummary()
                        {
                            Name        = s1.Creator.Name,
                            ResourceUri = Guid.NewGuid().ToString(),
                            Role        = s1.Creator.Role
                        }).ToList()
                    }
                }).ToList()
            };

            return(eventDataWrapper);
        }
Esempio n. 15
0
 void EventInput_CharEntered(object sender, EventInput.CharacterEventArgs e)
 {
     if (e.Character != '\b' && e.Character != '\r' && e.Character != '\t' && playerName.Length < 15 && !(ServiceHelper.Get<IKeyboardService>().TouchePressee(Keys.LeftControl)) && !(ServiceHelper.Get<IKeyboardService>().TouchePressee(Keys.RightControl)))
         playerName += e.Character;
 }
 public virtual void OnCharEntered(EventInput.CharacterEventArgs e)
 {
 }
Esempio n. 17
0
        public ApiResult <EventInfo> EventUpdate(long EventID, EventInput input)
        {
            //TODO: Verify Event belongs to user if updating. Right now anyone can update any event.
            var apiresult = new ApiResult <EventInfo>();

            if (UserContext == null)
            {
                return(apiresult.Failure("Must be logged in."));
            }
            if (!UserContext.IsVerifiedLogin)
            {
                return(apiresult.Failure("Insufficient account permissions."));
            }

            if (EventID <= 0)
            {
                return(apiresult.Failure("Invalid ID"));
            }
            DBEventFeedItemExtended existing = null;

            try {
                existing = Factory.EventManager.EventGetByID(EventID);
                if (existing == null)
                {
                    return(apiresult.Failure("Event Does not exist."));
                }
            } catch (Exception ex) { return(apiresult.Failure(ex)); }


            if (input == null)
            {
                return(apiresult.Failure("Input is null."));
            }
            if (input.Title != null && existing.Title != input.Title)
            {
                existing.Title = input.Title;
            }
            if (input.Caption != null && existing.Caption != input.Caption)
            {
                existing.Caption = input.Caption;
            }
            if (input.Description != null && existing.Details != input.Description)
            {
                existing.Details = input.Description;
            }
            if (input.EventTypeID > 0 && existing.EventTypeID != input.EventTypeID)
            {
                existing.EventTypeID = input.EventTypeID;
            }
            if (input.DateStart != default && existing.DateStart != input.DateStart)
            {
                existing.DateStart = input.DateStart;
            }
            if (input.DateEnd != default && existing.DateEnd != input.DateEnd)
            {
                existing.DateEnd = input.DateEnd;
            }

            //TODO sanitize Title, Caption, and Description to be free of javascript
            if (existing.Title.CountAlphaNumeric() <= 5)
            {
                return(apiresult.Failure("Title to short."));
            }
            if (existing.Caption.CountAlphaNumeric() <= 8)
            {
                return(apiresult.Failure("Caption to short."));
            }
            if (existing.DateStart.ToUniversalTime() < DateTime.UtcNow)
            {
                apiresult.Failure("DateStart in the past.");
                if (UserContext.IsAdmin)
                {
                    apiresult.AppendMessage("(AdminOverride)");
                }
                else
                {
                    return(apiresult);
                }
            }
            if (existing.DateEnd.ToUniversalTime() < input.DateStart.ToUniversalTime())
            {
                return(apiresult.Failure("DateEnd is before DateStart"));
            }
            if (existing.DateStart.AddDays(14).ToUniversalTime() < input.DateEnd.ToUniversalTime())
            {
                return(apiresult.Failure("Events cannot last longer than 2 weeks."));
            }


            DBEventType eventType = Factory.EventTypeManager[existing.EventTypeID];

            if (eventType == null)
            {
                return(apiresult.Failure("EventType does not exist."));
            }


            List <DBTag> newTags     = null;
            List <DBTag> removedTags = null;

            DBTag[] eventTags = null;

            if (input.Tags != null && input.Tags.Length > 0)
            {
                DBTag[] previousTags = existing.TagIds.Select(x => Factory.TagManager[x]).ToArray();
                existing.TagIds = new long[input.Tags.Length];
                eventTags       = new DBTag[input.Tags.Length];
                newTags         = new List <DBTag>();
                removedTags     = new List <DBTag>();

                for (int i = 0; i < input.Tags.Length; i++)
                {
                    DBTag tag = eventTags[i] = Factory.TagManager[input.Tags[i]];
                    if (tag == null)
                    {
                        return(apiresult.Failure("Invalid Tag: " + input.Tags[i].ToString()));
                    }
                    existing.TagIds[i] = tag.TagID;
                    if (Array.IndexOf(previousTags, tag) == -1)
                    {
                        newTags.Add(tag);
                    }
                }
                for (int i = 0; i < previousTags.Length; i++)
                {
                    DBTag tag = previousTags[i];
                    if (Array.IndexOf(eventTags, tag) == -1)
                    {
                        removedTags.Add(tag);
                    }
                }
            }
            else
            {
                eventTags = new DBTag[existing.TagIds.Length];
                for (int i = 0; i < existing.TagIds.Length; i++)
                {
                    DBTag tag = Factory.TagManager[existing.TagIds[i]];
                    if (tag == null)
                    {
                        return(apiresult.Failure("Invalid Tag: " + input.Tags[i].ToString()));
                    }
                    eventTags[i] = tag;
                }
            }



            bool bLocChange = false;

            if (input.Location != null)
            {
                var loc = input.Location;
                if (loc.Name != null && existing.LocationName != loc.Name)
                {
                    existing.LocationName = loc.Name; bLocChange = true;
                }
                if (loc.AddressLine != null && existing.AddressLine != loc.AddressLine)
                {
                    existing.AddressLine = loc.AddressLine; bLocChange = true;
                }
                if (loc.Locality != null && existing.Locality != loc.Name)
                {
                    existing.Locality = loc.Locality; bLocChange = true;
                }
                if (loc.PostalCode != null && existing.PostalCode != loc.PostalCode)
                {
                    existing.PostalCode = loc.PostalCode; bLocChange = true;
                }
                if (loc.AdminDistrict != null && existing.AdminDistrict != loc.Name)
                {
                    existing.AdminDistrict = loc.AdminDistrict; bLocChange = true;
                }
                if (loc.CountryRegion != null && existing.CountryRegion != loc.CountryRegion)
                {
                    existing.CountryRegion = loc.CountryRegion; bLocChange = true;
                }

                if (bLocChange)
                {
                    LocationNode.CountryRegionNode oCountry = Factory.LocationManager.QueryCachedCountries(existing.CountryRegion).FirstOrDefault();
                    if (oCountry == null)
                    {
                        return(apiresult.Failure("Invalid Country"));
                    }

                    LocationNode.AdminDistrictNode oState = Factory.LocationManager.QueryCachedStates(existing.AdminDistrict).FirstOrDefault();
                    if (oState == null)
                    {
                        return(apiresult.Failure("Invalid State"));
                    }

                    if (existing.PostalCode.CountAlphaNumeric() < 3)
                    {
                        return(apiresult.Failure("Invalid PostalCode"));
                    }
                    if (oCountry.Abbreviation == "USA")
                    {
                        LocationNode.PostalCodeNode oZip = Factory.LocationManager.QueryCachedPostalCodes(existing.PostalCode).FirstOrDefault();
                        if (oZip == null)
                        {
                            return(apiresult.Failure("Invalid PostalCode"));
                        }
                    }

                    if (existing.Locality.CountAlphaNumeric() < 3)
                    {
                        return(apiresult.Failure("Invalid City"));
                    }
                }
            }

            StreetAddress address = new StreetAddress()
            {
                ParentLocationID = existing.ParentLocationID,
                LocationID       = existing.LocationID,
                Name             = existing.LocationName,
                AddressLine      = existing.AddressLine,
                Locality         = existing.Locality,
                AdminDistrict    = existing.AdminDistrict,
                PostalCode       = existing.PostalCode,
                CountryRegion    = existing.CountryRegion
            };

            if (bLocChange)
            {
                try {
                    address = new StreetAddress(Factory.LocationManager.GetOrCreateDBLocation(address));
                } catch (Exception ex) { return(apiresult.Failure(ex)); }
            }

            try {
                Factory.EventManager.UpdateEvent(EventID, existing.EventTypeID, existing.DateStart, existing.DateEnd, UserContext.AccountID, existing.LocationID, existing.Title, existing.Caption, existing.Details);
                EventInfo info = new EventInfo()
                {
                    EventID      = existing.EventID,
                    DateStart    = existing.DateStart,
                    DateEnd      = existing.DateEnd,
                    Title        = existing.Title,
                    Caption      = existing.Title,
                    EventTypeID  = existing.EventTypeID,
                    EventType    = eventType,
                    LocationID   = existing.LocationID,
                    LocationName = address.Name,
                    AddressLine  = Helpers.FormatAddress(null, address.AddressLine, address.Locality, address.AdminDistrict, address.PostalCode, address.CountryRegion),
                    AccountID    = existing.AccountID,
                    Host         = String.IsNullOrWhiteSpace(UserContext.UserDisplayName) ? UserContext.UserName : UserContext.UserDisplayName,
                    Tags         = eventTags,
                    Details      = existing.Details
                };

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                if (newTags != null)
                {
                    for (int i = 0; i < newTags.Count; i++)
                    {
                        Factory.TagManager.LinkTagToEvent(info.EventID, newTags[i].TagID);
                    }
                }
                if (removedTags != null)
                {
                    for (int i = 0; i < removedTags.Count; i++)
                    {
                        Factory.TagManager.RemoveTagFromEvent(info.EventID, removedTags[i].TagID);
                    }
                }
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                return(apiresult.Success(info));
            } catch (Exception ex) {
                return(apiresult.Failure(ex));
            }
        }
Esempio n. 18
0
    private void SendInputToEvent()
    {
        switch (this.KeyCommand)
        {
        case Control.Confirm:
            EventInput.ReceiveInput(EventInput.Lcircle | 8192u);
            break;

        case Control.Cancel:
            EventInput.ReceiveInput(16384u | EventInput.Lx);
            break;

        case Control.Menu:
            EventInput.ReceiveInput(16781312u);
            break;

        case Control.Special:
            EventInput.ReceiveInput(557056u);
            break;

        case Control.LeftBumper:
            EventInput.ReceiveInput(1049600u);
            break;

        case Control.RightBumper:
            EventInput.ReceiveInput(2099200u);
            break;

        case Control.LeftTrigger:
            EventInput.ReceiveInput(4194560u);
            break;

        case Control.RightTrigger:
            EventInput.ReceiveInput(8389120u);
            break;

        case Control.Pause:
            EventInput.ReceiveInput(8u);
            break;

        case Control.Select:
            EventInput.ReceiveInput(1u);
            break;

        case Control.Up:
            EventInput.ReceiveInput(16u);
            break;

        case Control.Down:
            EventInput.ReceiveInput(64u);
            break;

        case Control.Left:
            EventInput.ReceiveInput(128u);
            break;

        case Control.Right:
            EventInput.ReceiveInput(32u);
            break;
        }
    }
Esempio n. 19
0
 //Keyboard input
 public void EventInput_CharEntered(object sender, EventInput.CharacterEventArgs e)
 {
     if (currentState != null)
         currentState.OnCharEntered(e);
 }
Esempio n. 20
0
 void EventInput_KeyUp(object sender, EventInput.KeyEventArgs e)
 {
     //throw new NotImplementedException();
 }
Esempio n. 21
0
        void EventInput_CharEntered(object sender, EventInput.CharacterEventArgs e)
        {
            //throw new NotImplementedException();
            if (e.Character == '\b')
            {
                if(CurrentEntry.Length>0)
                    CurrentEntry = CurrentEntry.Remove(CurrentEntry.Length - 1);
            }
            else if (e.Character == '\xD')
            {

                EntryRoutine(gameobj, CurrentEntry);

            }
            else
            {
                Debug.Print("character is " + (int)e.Character);

                CurrentEntry += e.Character;
            }
        }
 public async Task <IActionResult> GetCharacterEvents(ApiVersion apiVersion, int characterId, [FromQuery] EventInput eventInput)
 {
     return(Ok(await _eventUseCase.GetListAsync(characterId, eventInput)));
 }
Esempio n. 23
0
        /// <summary>
        /// Creates a new engine with an optional pointer to a draw surface, if none is provided a window is used
        /// </summary>
        /// <param name="game"></param>
        /// <param name="drawSurface"></param>
        public static void Init(Game game, IntPtr?drawSurface = null)
        {
            if (_instance != null)
            {
                throw new InvalidOperationException("Init cannot be called more than once");
            }

            _instance = new Engine();

            // Set engine variables
            Instance.ClearColor  = Color.Black;
            Instance.game        = game;
            game.IsFixedTimeStep = false;
            game.IsMouseVisible  = true;

            // Make sure to stop audio and save the config before exiting
            game.Exiting += (s, a) =>
            {
                AudioManager.Instance.Shutdown();
                ConfigManager.Instance.Write(CONFIG_PATH);
                Environment.Exit(0);
            };

            CultureInfo.CurrentCulture = new CultureInfo("en-GB");
            Instance.Version           = RetrieveLinkerTimestamp().ToString("dd MMM yyyy HH:mm");

            // set up a normal window
            if (drawSurface == null)
            {
                game.Window.Title = $"{ENGINE_NAME} - {Instance.Version}";
                System.Windows.Forms.Form form = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle(game.Window.Handle);
                form.Location = new System.Drawing.Point(0, 0);
            }
            // set up a custom draw surface
            else
            {
                System.Windows.Forms.Form form = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle(game.Window.Handle);
                form.Hide();
            }

            // initialise helper classes
            RandomHelper.Init();
            EventInput.Init(game.Window.Handle);

            // set up managers
            AppDomain.CurrentDomain.UnhandledException += (s, a) => Console.WriteLine($"UNHANDLED EXCEPTION: {a.ExceptionObject.ToString()}", MsgType.Failed);
            // run the config file as a script
            ConsoleManager.Instance.RunScript(CONFIG_PATH);
            GraphicsManager.Init(game, drawSurface);

            // set up content manager and load core content
            Instance.Content = new ContentPackManager(game.Content.ServiceProvider, "Content");
            Instance.Content.LoadPack("Core.acp");

            InitGUIDefaults();
            GraphicsHelper.Init(GraphicsManager.Instance.Device);
            RichText.Init();
#if DEBUG
            Console.WriteLine("ASSEMBLY IN DEBUG MODE", MsgType.Warning);
#endif
        }
Esempio n. 24
0
 public CreateEventCommand(EventInput eventInput)
 {
     this.EventInput = eventInput;
 }
Esempio n. 25
0
    public override void OnEnable()
    {
        base.OnEnable();
        ShootComponents.OnAdd().Subscribe(entity =>
        {
            var networkIdentityComponent = entity.GetComponent <NetworkIdentityComponent>();
            var shootComponent           = entity.GetComponent <ShootComponent>();

            shootComponent.WeaponIndex.DistinctUntilChanged().Subscribe(index =>
            {
                if (index >= 0 && index < shootComponent.Weapons.Count)
                {
                    var name   = shootComponent.Weapons[index];
                    var path   = WeaponDAO.GetPath(name);
                    var prefab = Resources.Load <GameObject>(path);
                    var bullet = WeaponDAO.GetBullet(name);

                    if (shootComponent.CurrentWeaponEntity != null)
                    {
                        PoolFactory.Despawn(shootComponent.CurrentWeaponEntity);
                    }

                    shootComponent.CurrentWeaponEntity   = PoolFactory.Spawn(prefab, shootComponent.Parent);
                    shootComponent.bulletPrefab          = Resources.Load <GameObject>(BulletDAO.GetPath(bullet));
                    shootComponent.muzzleFlashesPrefab   = Resources.Load <GameObject>(WeaponDAO.GetMuzzleFlashesEffectPath(name));
                    shootComponent.adsPosition           = WeaponDAO.GetADSPosition(name);
                    shootComponent.bulletLocalPosition   = WeaponDAO.GetBulletSpawnPosition(name);
                    shootComponent.muzzleFlashesPosition = WeaponDAO.GetMuzzleFlashesPosition(name);
                    shootComponent.holeSize = BulletDAO.GetHoleSize(bullet);
                    shootComponent.speed    = WeaponDAO.GetSpeed(name);
                    shootComponent.cooldown = WeaponDAO.GetCooldown(name);

                    if (shootComponent.CurrentWeaponEntity != null)
                    {
                        var weaponViewComponent = shootComponent.CurrentWeaponEntity.GetComponent <ViewComponent>();

                        weaponViewComponent.Transforms[0].localPosition = WeaponDAO.GetPosition(name);
                        shootComponent.weaponLocalRotation = Quaternion.Euler(new Vector3(0, 90, 90));
                        weaponViewComponent.Transforms[0].localRotation = shootComponent.weaponLocalRotation;
                    }
                }
                else
                {
                    shootComponent.WeaponIndex.Value = Mathf.Clamp(index, 0, shootComponent.Weapons.Count);
                }
            }).AddTo(this.Disposer).AddTo(shootComponent.Disposer);

            for (int i = 0; i < shootComponent.Weapons.Count; i++)
            {
                var path   = BulletDAO.GetPath(WeaponDAO.GetBullet(shootComponent.Weapons[i]));
                var prefab = Resources.Load <GameObject>(path);
                for (int j = 0; j < WarmupBullets; j++)
                {
                    PoolFactory.Despawn(PoolFactory.Spawn(prefab, networkIdentityComponent.Identity.UserId, 0));
                }
            }
        }).AddTo(this.Disposer);

        NetwrokTimeline.OnForward(data =>
        {
            var networkIdentityComponent = data.Entity.GetComponent <NetworkIdentityComponent>();
            var playerControlComponent   = data.Entity.GetComponent <PlayerControlComponent>();
            var shootComponent           = data.Entity.GetComponent <ShootComponent>();
            var animator            = data.Entity.GetComponent <Animator>();
            var weaponViewComponent = shootComponent.CurrentWeaponEntity != null ? shootComponent.CurrentWeaponEntity.GetComponent <ViewComponent>() : null;
            var userInputData       = data.UserInputData[0];
            var mouseInput          = userInputData[0].GetInput <MouseInput>();
            var keyInput            = userInputData[1].GetInput <KeyInput>();
            var eventInputs         = userInputData[2].GetInputs <EventInput>();

            EventInput eventInput = null;

            for (int i = 0; i < eventInputs.Length; i++)
            {
                if (eventInputs[i].Type == EventCode.PlayerCamera)
                {
                    eventInput = eventInputs[i];
                    break;
                }
            }

            if (mouseInput != null && keyInput != null)
            {
                if (playerControlComponent.Aim.Value == AimMode.Free && keyInput.KeyCodes.Contains((int)KeyCode.LeftAlt))
                {
                }
                else if (weaponViewComponent != null && eventInput != null)
                {
                    // The point hit by the muzzle is different from the point hit in the center of the screen.
                    // So how to solve this problem, my solution is like this:

                    // First, get the hit point in the center of the screen.
                    // 0 - camera position, 1 - camera dirstion, 2 - camera far clip plane.
                    RaycastHit hit;
                    var ray   = new Ray((Vector3)eventInput.Get <FixVector3>(0), (Vector3)eventInput.Get <FixVector3>(1));
                    var point = Physics.Raycast(ray, out hit, (float)eventInput.Get <Fix64>(2)) ? hit.point : ray.origin + (float)eventInput.Get <Fix64>(2) * ray.direction;

                    // Reset rotation to default rotation
                    weaponViewComponent.Transforms[0].localRotation = shootComponent.weaponLocalRotation;

                    // If not in aim down sight mode, then I can fine-tune the angle of the gun to make the direction of
                    // the bullet closer to the point at the center of the screen
                    if (playerControlComponent.Aim.Value != AimMode.AimDownSight)
                    {
                        var targetDirection = (point - weaponViewComponent.Transforms[0].TransformPoint(shootComponent.bulletLocalPosition)).normalized;
                        var angle           = Vector3.Angle(weaponViewComponent.Transforms[0].forward, targetDirection);
                        var t        = angle == 0 ? 1 : Mathf.Clamp01(shootComponent.LimitAngle / angle);
                        var rotation = Quaternion.LookRotation(Vector3.Lerp(weaponViewComponent.Transforms[0].forward, targetDirection, t));

                        weaponViewComponent.Transforms[0].rotation = rotation;
                    }
                }

                animator.SetBool(Shoot_b, mouseInput.MouseButtons.Contains(0));

                if (mouseInput.MouseButtons.Contains(0) && shootComponent.cooldownTime <= 0)
                {
                    var entity              = PoolFactory.Spawn(shootComponent.bulletPrefab, networkIdentityComponent.Identity.UserId, data.TickId);
                    var bulletComponent     = entity.GetComponent <BulletComponent>();
                    var bulletViewComponent = entity.GetComponent <ViewComponent>();

                    if (weaponViewComponent != null)
                    {
                        bulletViewComponent.Transforms[0].position = weaponViewComponent.Transforms[0].TransformPoint(shootComponent.bulletLocalPosition);
                        bulletViewComponent.Transforms[0].rotation = Quaternion.LookRotation(weaponViewComponent.Transforms[0].forward, weaponViewComponent.Transforms[0].up);
                        bulletComponent.velocity = shootComponent.speed * (FixVector3)bulletViewComponent.Transforms[0].forward;
                        bulletComponent.holeSize = shootComponent.holeSize;

                        StartCoroutine(AsyncMuzzleFlashes(shootComponent.muzzleFlashesPrefab, weaponViewComponent.Transforms[0].TransformPoint(shootComponent.muzzleFlashesPosition), weaponViewComponent.Transforms[0].rotation));
                    }

                    shootComponent.cooldownTime = shootComponent.cooldown;
                }
            }
            shootComponent.cooldownTime -= data.DeltaTime;

            return(null);
        }).AddTo(this.Disposer);
    }
Esempio n. 26
0
 private UInt32 getPad()
 {
     return(EventInput.ReadInput());
 }
Esempio n. 27
0
    public static UInt32 ReadInput()
    {
        UInt32 num = 0u;

        if (!EventInput.isProcessingInput)
        {
            EventInput.ResetWorldTriggerButton();
            return(num);
        }
        Int32   fldMapNo = (Int32)FF9StateSystem.Common.FF9.fldMapNo;
        Int32   gMode    = PersistenSingleton <EventEngine> .Instance.gMode;
        Boolean isKeyboardOrJoystickInput = EventInput.IsKeyboardOrJoystickInput;

        if (Singleton <BubbleUI> .Instance.IsActive)
        {
            if (gMode == 1)
            {
                if (fldMapNo == 1420 && EventInput.CheckLadderFlag())
                {
                    num = EventInput.ProcessInput(false, false);
                }
                else
                {
                    num = EventInput.ProcessInput(false, true);
                }
            }
            else if (gMode == 3)
            {
                if (FF9StateSystem.MobilePlatform)
                {
                    num = EventInput.ProcessInput(false, isKeyboardOrJoystickInput);
                    EventInput.GetWorldTriggerButton(ref num);
                }
                else
                {
                    num = EventInput.ProcessInput(false, true);
                }
            }
        }
        else if (EventHUD.CurrentHUD != MinigameHUD.None)
        {
            MinigameHUD currentHUD = EventHUD.CurrentHUD;
            if (currentHUD != MinigameHUD.Chanbara)
            {
                if (currentHUD != MinigameHUD.RacingHippaul)
                {
                    num = EventInput.ProcessInput(false, true);
                }
                else
                {
                    num = EventInput.ProcessInput(false, false);
                }
            }
            else
            {
                num  = EventInput.ProcessInput(true, true);
                num &= EventInput.ChanbaraMask;
                if (FF9StateSystem.MobilePlatform)
                {
                    if ((num & 8u) > 0u)
                    {
                        EventInput.IsNeedAddStartSignal = true;
                    }
                    else if (EventInput.addStartSignal > 0)
                    {
                        num |= 8u;
                        EventInput.addStartSignal--;
                        EventInput.InputLog("Extra Start");
                    }
                }
            }
        }
        else if (fldMapNo == 606)
        {
            if (EventHUD.CurrentHUD == MinigameHUD.Telescope)
            {
                num = EventInput.ProcessInput(false, true);
            }
        }
        else if (fldMapNo == 2204 && TimerUI.Enable)
        {
            num = EventInput.ProcessInput(false, false);
        }
        else if (fldMapNo == 1607)
        {
            num = EventInput.ProcessInput(false, false);
        }
        else if (fldMapNo == 1420)
        {
            num = EventInput.ProcessInput(false, true);
        }
        else if (fldMapNo == 1422)
        {
            num = EventInput.ProcessInput(false, true);
        }
        else
        {
            Dialog mognetDialog = Singleton <DialogManager> .Instance.GetMognetDialog();

            if (mognetDialog != (UnityEngine.Object)null)
            {
                if (mognetDialog.IsChoiceReady)
                {
                    num = EventInput.ProcessInput(false, true);
                }
            }
            else if (FF9StateSystem.MobilePlatform)
            {
                num = EventInput.ProcessInput(false, isKeyboardOrJoystickInput);
                if (isKeyboardOrJoystickInput)
                {
                    UIManager.Input.ResetTriggerEvent();
                }
                EventInput.GetWorldTriggerButton(ref num);
            }
            else
            {
                num = EventInput.ProcessInput(false, true);
            }
        }
        num |= EventInput.eventButtonInput;
        if (EventInput.isDialogConfirm)
        {
            num |= EventInput.ConfirmMask;
            EventInput.isDialogConfirm = false;
        }
        if (HonoBehaviorSystem.Instance.IsFastForwardModeActive())
        {
            if (FF9StateSystem.MobilePlatform)
            {
                if (fldMapNo == 909 || fldMapNo == 1909)
                {
                    num = EventInput.FastForwardProcess(gMode, fldMapNo, num);
                }
            }
            else
            {
                num = EventInput.FastForwardProcess(gMode, fldMapNo, num);
            }
        }
        num &= ~EventInput.PSXCntlPadMask[0];
        if (FF9StateSystem.MobilePlatform && gMode == 3 && EventCollision.IsRidingChocobo())
        {
            if ((num & 524288u) > 0u || (num & 32768u) > 0u)
            {
                EventInput.isPressedDig = true;
            }
            else if ((num & 16777216u) > 0u || (num & 4096u) > 0u)
            {
                EventInput.isPressedDig = false;
            }
            else if ((num & EventInput.Lx) > 0u || (num & 16384u) > 0u)
            {
                EventInput.isPressedDig = false;
            }
            else if ((num & 1u) > 0u || (num & 1u) > 0u)
            {
                EventInput.isPressedDig = false;
            }
        }
        if (gMode == 3 && EventEngineUtils.IsMogCalled(PersistenSingleton <EventEngine> .Instance))
        {
            ff9.w_isMogActive = true;
        }
        if (gMode == 3 && EMinigame.CheckBeachMinigame() && EventCollision.IsWorldTrigger() && (num & CancelMask) > 0u)
        {
            num &= ~CancelMask;
            EventInput.InputLog("Remove cancel mask for <SQEX> #2893");
        }
        EventInput.eventButtonInput = 0u;
        EventInput.ResetWorldTriggerButton();
        return(num);
    }
        public override void OnCharEntered(EventInput.CharacterEventArgs e)
        {
            if ((int)e.Character < 32 || (int)e.Character > 126) //From space to tilde
                return; //Do nothing

            //Only respond if entering an ip and control is not pressed
            if (directConnectIPEnter && !(Keyboard.GetState().IsKeyDown(Keys.LeftControl) || Keyboard.GetState().IsKeyDown(Keys.RightControl)))
            {
                directConnectIP += e.Character;
            }
        }
Esempio n. 29
0
 public void EventInput_KeyUp(object sender, EventInput.KeyEventArgs e)
 {
     if (currentState != null)
         currentState.OnKeyUp(e.KeyCode);
 }
Esempio n. 30
0
    private static UInt32 ProcessInput(Boolean isTriggerDirection, Boolean isTriggerButton)
    {
        UInt32  num    = 0u;
        Vector2 vector = Vector2.zero;

        if (VirtualAnalog.HasInput())
        {
            vector = VirtualAnalog.GetAnalogValue();
            if (Mathf.Abs(vector.x) >= 0.1f || Mathf.Abs(vector.y) >= 0.1f)
            {
                if (vector.y > 0f)
                {
                    num |= 16u;
                }
                if (vector.y < 0f)
                {
                    num |= 64u;
                }
                if (vector.x < 0f)
                {
                    num |= 128u;
                }
                if (vector.x > 0f)
                {
                    num |= 32u;
                }
            }
        }
        if (EventInput.GetKey(Control.Menu, isTriggerButton))
        {
            num |= 16781312u;
            EventInput.InputLog("Press /_\\");
        }
        if (EventInput.GetKey(Control.Confirm, isTriggerButton))
        {
            num |= (8192u | EventInput.Lcircle);
            EventInput.InputLog("Press 0");
        }
        if (EventInput.GetKey(Control.Cancel, isTriggerButton))
        {
            num |= (16384u | EventInput.Lx);
            EventInput.InputLog("Press X");
        }
        if (EventInput.GetKey(Control.Special, isTriggerButton))
        {
            num |= 557056u;
            EventInput.InputLog("Press []");
        }
        if (EventInput.GetKey(Control.Select, isTriggerButton))
        {
            num |= 1u;
            EventInput.InputLog("Press Select");
        }
        if (EventInput.GetKey(Control.Pause, isTriggerButton))
        {
            num |= 8u;
            EventInput.InputLog("Press Start");
        }
        if (EventInput.GetKey(Control.LeftBumper, isTriggerButton))
        {
            num |= 1049600u;
            EventInput.InputLog("Press L1");
        }
        if (EventInput.GetKey(Control.RightBumper, isTriggerButton))
        {
            num |= 2099200u;
            EventInput.InputLog("Press R1");
        }
        if (EventInput.GetKey(Control.LeftTrigger, isTriggerButton))
        {
            num |= 4194560u;
            EventInput.InputLog("Press L2");
        }
        if (EventInput.GetKey(Control.RightTrigger, isTriggerButton))
        {
            num |= 8389120u;
            EventInput.InputLog("Press R2");
        }
        if (EventInput.GetKey(Control.Up, isTriggerDirection))
        {
            num |= 16u;
            EventInput.InputLog("Press ^");
        }
        if (EventInput.GetKey(Control.Down, isTriggerDirection))
        {
            num |= 64u;
            EventInput.InputLog("Press v");
        }
        if (EventInput.GetKey(Control.Left, isTriggerDirection))
        {
            num |= 128u;
            EventInput.InputLog("Press <");
        }
        if (EventInput.GetKey(Control.Right, isTriggerDirection))
        {
            num |= 32u;
            EventInput.InputLog("Press >");
        }
        return(num);
    }
Esempio n. 31
0
    public void ReadSystemData(Action callback)
    {
        ISharedDataSerializer.OnReadSystemData func = (errNo, metaData) =>
        {
            if (errNo == DataSerializerErrorCode.Success)
            {
                SystemAchievementStatuses = metaData.SystemAchievementStatuses;
                ScreenRotation            = metaData.ScreenRotation;
                if (ScreenRotation == 0)
                {
                    Debug.Log("serializer.ReadSystemData.callback 0.5 ReadSystemData : ScreenRotation == 0. Old save file.");
                    ScreenRotation = 3;
                }
                Debug.Log("serializer.ReadSystemData.callback 1 ReadSystemData : ScreenRotation = " + ScreenRotation);
                LatestSlot = metaData.LatestSlot;
                LatestSave = metaData.LatestSave;
                switch (metaData.SelectedLanguage)
                {
                case 0:
                    CurrentLanguage = "English(US)";
                    break;

                case 1:
                    CurrentLanguage = "English(UK)";
                    break;

                case 2:
                    CurrentLanguage = "English(US)";
                    break;

                case 3:
                    CurrentLanguage = "German";
                    break;

                case 4:
                    CurrentLanguage = "French";
                    break;

                case 5:
                    CurrentLanguage = "Italian";
                    break;

                case 6:
                    CurrentLanguage = "Spanish";
                    break;

                default:
                    CurrentLanguage = GetSystemLanguage();
                    break;
                }
            }
            else
            {
                SystemAchievementStatuses = null;
                ScreenRotation            = 3;
                CurrentLanguage           = GetSystemLanguage();
                Debug.Log("serializer.ReadSystemData.callback 2 ReadSystemData : fail");
            }
            PersistenSingleton <UIManager> .Instance.TitleScene.SetRotateScreen();

            Localization.localizationHasBeenSet = false;
            Localization.language = CurrentLanguage;
            UIManager.Field.InitializeATEText();
            StartCoroutine(PersistenSingleton <FF9TextTool> .Instance.UpdateTextLocalization(callback));
            EventInput.ChangeInputLayout(CurrentLanguage);
        };

        FF9StateSystem.Serializer.ReadSystemData(func);
    }
Esempio n. 32
0
 public static void PSXCntlClearPadMask(Int32 _pad_no, UInt32 _lbtn_flags)
 {
     EventInput.PSXCntlPadMask[_pad_no] &= ~_lbtn_flags;
     EventInput.CheckPlayerControl();
 }
Esempio n. 33
0
        public ApiResult <EventInfo> EventCreate(EventInput input)
        {
            var apiresult = new ApiResult <EventInfo>();

            if (UserContext == null)
            {
                return(apiresult.Failure("Must be logged in."));
            }
            if (!UserContext.IsVerifiedLogin)
            {
                return(apiresult.Failure("Insufficient account permissions."));
            }

            if (input == null)
            {
                return(apiresult.Failure("Bad Post. Input is null."));
            }
            if (input.Location == null)
            {
                return(apiresult.Failure("Location Invalid"));
            }
            //TODO sanitize Title, Caption, and Description to be free of javascript
            if (input.Title.CountAlphaNumeric() <= 5)
            {
                return(apiresult.Failure("Title to short."));
            }
            if (input.Caption.CountAlphaNumeric() <= 8)
            {
                return(apiresult.Failure("Caption to short."));
            }
            if (input.DateStart.ToUniversalTime() < DateTime.UtcNow)
            {
                return(apiresult.Failure("DateStart in the past."));
            }
            if (input.DateEnd.ToUniversalTime() < input.DateStart.ToUniversalTime())
            {
                return(apiresult.Failure("DateEnd is before DateStart"));
            }
            if (input.DateStart.AddDays(14).ToUniversalTime() < input.DateEnd.ToUniversalTime())
            {
                return(apiresult.Failure("Events cannot last longer than 2 weeks."));
            }



            DBEventType eventType = Factory.EventTypeManager[input.EventTypeID];

            if (eventType == null)
            {
                return(apiresult.Failure("EventType does not exist."));
            }

            if (input.Tags == null || input.Tags.Length == 0)
            {
                return(apiresult.Failure("Include at least one EventTag."));
            }
            DBTag[] eventTags = new DBTag[input.Tags.Length];
            for (int i = 0; i < input.Tags.Length; i++)
            {
                DBTag tag = Factory.TagManager[input.Tags[i]];
                if (tag == null)
                {
                    return(apiresult.Failure("Invalid Tag: " + input.Tags[i].ToString()));
                }
                eventTags[i] = tag;
            }

            LocationNode.CountryRegionNode oCountry = Factory.LocationManager.QueryCachedCountries(input.Location.CountryRegion).FirstOrDefault();
            if (oCountry == null)
            {
                return(apiresult.Failure("Invalid Country"));
            }

            LocationNode.AdminDistrictNode oState = Factory.LocationManager.QueryCachedStates(input.Location.AdminDistrict).FirstOrDefault();
            if (oState == null)
            {
                return(apiresult.Failure("Invalid State"));
            }

            if (input.Location.PostalCode.CountAlphaNumeric() < 3)
            {
                return(apiresult.Failure("Invalid PostalCode"));
            }
            if (oCountry.Abbreviation == "USA")
            {
                LocationNode.PostalCodeNode oZip = Factory.LocationManager.QueryCachedPostalCodes(input.Location.PostalCode).FirstOrDefault();
                if (oZip == null)
                {
                    return(apiresult.Failure("Invalid PostalCode"));
                }
            }

            if (input.Location.Locality.CountAlphaNumeric() < 3)
            {
                return(apiresult.Failure("Invalid City"));
            }


            try {
                StreetAddress   address     = new StreetAddress(Factory.LocationManager.GetOrCreateDBLocation(input.Location));
                DBEventFeedItem dbEventItem = Factory.EventManager.CreateEvent(eventType.EventTypeID, input.DateStart, input.DateEnd, UserContext.AccountID, address.LocationID.UnBox(), input.Title, input.Caption, input.Description);
                EventInfo       info        = new EventInfo()
                {
                    EventID      = dbEventItem.EventID,
                    DateStart    = dbEventItem.DateStart,
                    DateEnd      = dbEventItem.DateEnd,
                    Title        = dbEventItem.Title,
                    Caption      = dbEventItem.Title,
                    EventTypeID  = dbEventItem.EventTypeID,
                    EventType    = eventType,
                    LocationID   = dbEventItem.LocationID,
                    LocationName = address.Name,
                    AddressLine  = Helpers.FormatAddress(null, address.AddressLine, address.Locality, address.AdminDistrict, address.PostalCode, address.CountryRegion),
                    AccountID    = dbEventItem.AccountID,
                    Host         = String.IsNullOrWhiteSpace(UserContext.UserDisplayName) ? UserContext.UserName : UserContext.UserDisplayName,
                    Tags         = eventTags,
                    Details      = input.Description
                };

                for (int i = 0; i < eventTags.Length; i++)
                {
                    DBTag tag = eventTags[i];
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                    Factory.TagManager.LinkTagToEvent(info.EventID, tag.TagID);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                }

                return(apiresult.Success(info));
            } catch (Exception ex) {
                return(apiresult.Failure(ex));
            }
        }
        void EventInput_KeyDown(object sender, EventInput.KeyEventArgs e)
        {
            if (_subscriber == null)
                return;

            _subscriber.RecieveSpecialInput(e.KeyCode);
        }