예제 #1
0
    public void OnGet()
    {
        var infoDc = _chromelyInfo.GetInfo() as IDictionary <string, string>;

        if (infoDc != null)
        {
            Objective = infoDc.ContainsKey("divObjective") ? infoDc["divObjective"] : Objective;
            Platform  = infoDc.ContainsKey("divPlatform") ? infoDc["divPlatform"] : Platform;
            Version   = infoDc.ContainsKey("divVersion") ? infoDc["divVersion"] : Version;
        }
    }
예제 #2
0
    public IChromelyResponse Execute(string requestId, string routePath, IDictionary <string, object>?parameters, object?postData, string?requestData)
    {
        if (string.IsNullOrWhiteSpace(routePath))
        {
            return(_chromelyErrorHandler.HandleRouteNotFound(requestId, routePath));
        }

        if (routePath.ToLower().Equals("/info"))
        {
            return(_chromelyInfo.GetInfo(requestId));
        }

        var route = _routeProvider.GetRoute(routePath);

        if (route is null)
        {
            throw new Exception($"Route for path = {routePath} is null or invalid.");
        }

        return(ExecuteRoute(requestId, routePath, parameters, postData, requestData));
    }
예제 #3
0
    public IActionResult Index()
    {
        Info info   = new();
        var  infoDc = _chromelyInfo.GetInfo() as IDictionary <string, string>;

        if (infoDc != null)
        {
            info.Objective = infoDc.ContainsKey("divObjective") ? infoDc["divObjective"] : info.Objective;
            info.Platform  = infoDc.ContainsKey("divPlatform") ? infoDc["divPlatform"] : info.Platform;
            info.Version   = infoDc.ContainsKey("divVersion") ? infoDc["divVersion"] : info.Version;
        }

        return(View(info));
    }
예제 #4
0
        public IChromelyResponse Run(string routeUrl, IDictionary <string, string> parameters, object postData)
        {
            if (string.IsNullOrWhiteSpace(routeUrl))
            {
                return(_chromelyErrorHandler.HandleRouteNotFound(string.Empty, routeUrl));
            }

            if (routeUrl.ToLower().Equals("/info"))
            {
                return(_chromelyInfo?.GetInfo(string.Empty));
            }

            var route = _routeProvider.GetActionRoute(routeUrl);

            if (route == null)
            {
                throw new Exception($"Route for path = {routeUrl} is null or invalid.");
            }

            return(ExecuteRoute(string.Empty, routeUrl, parameters, postData, string.Empty));
        }