Write() public method

public Write ( byte bytes ) : void
bytes byte
return void
コード例 #1
0
        private int OnStats(HttpReqResp req)
        {
            try
            {
                var date = GetVisualizationDateFromUrlParameters(req);
                date = VerifyDateForRetrospection(date);
                var visType = GetVisualizationTypesFromUrlParameters(req);

                // get data to display
                var title          = GetRetrospectionTitle(visType, date);
                var dashboard      = ((string)_resourceManager.GetObject("personalanalytics_html"));
                var visualizations = GetVisualizationsHtml(visType, date);
                visualizations.Wait(); // wait for the async task to complete

                // prepare html which is displayed in the browser control
                var html = dashboard.Replace("{title}", title).Replace("{visualizations}", visualizations.Result);
                req.Write(html);

                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            catch (Exception e)
            {
                req.Write(e.ToString());
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            return(200);
        }
コード例 #2
0
        private int OnStats(HttpReqResp req)
        {
            try
            {
                var date = GetVisualizationDateFromUrlParameters(req);
                date = VerifyDateForRetrospection(date);
                var visType = GetVisualizationTypesFromUrlParameters(req);

                // get data to display
                var title = GetRetrospectionTitle(visType, date);
                var dashboard = ((string)_resourceManager.GetObject("personalanalytics_html"));
                var visualizations = GetVisualizationsHtml(visType, date);
                visualizations.Wait(); // wait for the async task to complete

                // prepare html which is displayed in the browser control
                var html = dashboard.Replace("{title}", title).Replace("{visualizations}", visualizations.Result);
                req.Write(html);

                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            catch (Exception e)
            {
                req.Write(e.ToString());
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            return 200;
        }
コード例 #3
0
 private int OnResource(HttpReqResp req)
 {
     try
     {
         req.Write((byte[])_resourceManager.GetObject(req.Script.Replace('.', '_')));
         req.SetHeader("Content-Type", req.Script.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ? "image/png" : "text/javascript");
     }
     catch { }
     return(200);
 }
コード例 #4
0
 private int OnResource(HttpReqResp req)
 {
     try
     {
         req.Write((byte[])_resourceManager.GetObject(req.Script.Replace('.', '_')));
         req.SetHeader("Content-Type", req.Script.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ? "image/png" : "text/javascript");
     }
     catch { }
     return 200;
 }