예제 #1
0
        public ActionResult Hub(string gameid, string realm, string hub, string action)
        {
            var file = new Infrastructure.FileHandler(Server);
            var text = file.ReadHub(realm, hub);

            var vm = Parser.HubGrammar.Instance.ParseString(text);

            if (!vm.Options.Any(x => x.Action == action))
            {
                // ERROR?
                return(Redirect(Request.Url.AbsoluteUri));
            }

            var parts = action.Split('/');

            switch (parts[0])
            {
            case "event":
                return(Redirect(Request.Url.AbsoluteUri));

            case "shop":
                return(Redirect(Request.Url.AbsoluteUri));

            case "visit":
                if (!vm.Locations.Any(x => x == parts[1]))
                {
                    return(Redirect(Request.Url.AbsoluteUri));
                }
                return(Redirect(Request.Url.Child(parts[1]).ToAbsolute()));

            default:
                return(Redirect(Request.Url.AbsoluteUri));
            }
        }
예제 #2
0
        public ActionResult Hub(string gameid, string realm, string hub)
        {
            try
            {
                var file = new Infrastructure.FileHandler(Server);
                var text = file.ReadHub(realm, hub);

                var vm = Parser.HubGrammar.Instance.ParseString(text);

                return(View(vm));
            }
            catch (Exception ex)
            {
                return(View("ErrorEx", ex));
            }
        }