Example #1
0
        public void GetPublishersJson_no_searchString_Test()
        {
            HelperController c = new HelperController();
            var res            = (Publisher[])c.GetPublishersJson().Data;

            Assert.IsTrue(res.Length > 0);
        }
Example #2
0
        public void GetPublishersJson_search_Test()
        {
            HelperController c = new HelperController();
            var res            = (Publisher[])c.GetPublishersJson("Nemi").Data;

            Assert.IsTrue(res.Length == 1);
        }
Example #3
0
        public async Task Invoke(HttpContext context /* other dependencies */)
        {
            // TextWriter txtWr;
            try
            {
                var webRoot = _env.ContentRootPath;
                fileName = "log_";

                var path = HelperController.GetPath(webRoot, fileName + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".txt", "logs/");

                File.AppendAllText(path, "--------------------------Request--------------------\n");
                File.AppendAllText(path, await FormatRequest(context.Request));



                var originalBodyStream = context.Response.Body;
                using (var responseBody = new MemoryStream())
                {
                    context.Response.Body = responseBody;

                    await next(context);

                    File.AppendAllText(path, "--------------------------Response--------------------\n");
                    System.IO.File.AppendAllText(path, await FormatResponse(context.Response));
                    await responseBody.CopyToAsync(originalBodyStream);
                }
            }
            catch (Exception ex)
            {
                await HandleExceptionAsync(context, ex);
            }
        }
Example #4
0
        public override string GetVaryByCustomString(HttpContext context, string custom)
        {
            if (custom == "device")
            {
                string deviceType = string.Empty;

                if (HelperController.IsMobile())
                {
                    deviceType = "Mobile";
                }
                else
                {
                    deviceType = "PC";
                }

                //return context.Request.Browser.Browser +
                //       context.Request.Browser.MajorVersion;

                return(deviceType);
            }
            else
            {
                return(base.GetVaryByCustomString(context, custom));
            }
        }
Example #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.H) && !inScene)
        {
            player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();

            SetHelperActive();

            inScene = true;

            //pop out textBox
            helperController = FindObjectOfType <HelperController>();
            helperController.StartCoroutine(helperController.TriggerTextBox());
            helperController.textDisplay.text = "Hello! Looks like you need my help";
        }

        else if (Input.GetKeyDown(KeyCode.H) && inScene)
        {
            //pop out textBox
            helperController = FindObjectOfType <HelperController>();
            helperController.StartCoroutine(helperController.TriggerTextBox());
            helperController.textDisplay.text = "GoodBye!";

            SetHelperActive();

            inScene = false;
        }
    }
        public void SuperUserTest()
        {
            SelectList expected = null; // TODO: Initialize to an appropriate value
            SelectList actual;

            actual = HelperController.SuperUser();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #7
0
 // Use this for initialization
 void Start()
 {
     soundMan.PlaySound (Snd.byz);
     isStart = true;
     showInfo = true;
     angel = player.GetComponent<AngelControl> ();
     follower = escort.GetComponent<HelperController> ();
     follower.speed = 0;
     follower.anim.SetTrigger ("Walk");
     title.gameObject.SetActive (true);
 }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            // Detecting Device
            ViewBag._IsMobile = HelperController.IsMobile();


            #region Select View ( PC / Mobile )

            string actionName = this.ControllerContext.RouteData.Values["action"].ToString();
            ViewBag._ViewName = actionName;

            // Web.config 에 IsMobileViewSupport 설정에 따라
            string isMobileViewSupport = ConfigurationManager.AppSettings["IsMobileViewSupport"].ToString();

            if (isMobileViewSupport.ToUpper().Equals("Y"))
            {
                // Mobile View 대상이 아닌 Action 검사
                string[] ignoredActions = ConfigurationManager.AppSettings["IgnoredActions"].Split(new string[1] {
                    "|"
                }, StringSplitOptions.RemoveEmptyEntries);
                bool isIgnoredAction = false;

                foreach (string n in ignoredActions)
                {
                    if (actionName.ToLower().Equals(n.ToLower()))
                    {
                        isIgnoredAction = true;
                        break;
                    }
                }

                // Formal View 의 경우 모바일 / PC 분기 ( Custom Partial View 의 경우 따로 분기 처리 하지 않음 )
                if (!string.IsNullOrEmpty(actionName) && actionName.Substring(0, 1) != "_" && isIgnoredAction == false)
                {
                    string viewName = HelperController.GetViewName((Controller)this.ControllerContext.Controller, this.ControllerContext.RouteData.Values["action"].ToString());

                    // View 가 존재하지 않아 Response.Redirect 처리 됐을 경우 더 이상 서버 요소 변경하지 않아야 함. ( Warning 유발 방지 )
                    if (viewName.Equals("-1"))
                    {
                        filterContext.Result = new RedirectResult("/package/main");
                        return;
                    }

                    ViewBag._ViewName = viewName;
                }
            }
            else
            {
                // Action 에서의 Data 처리가 Mobile 로 분기되는 것을 막기 위해 False 처리
                ViewBag._IsMobile = false;
            }

            #endregion / Select View ( PC / Mobile )
        }
Example #9
0
        private static Task HandleExceptionAsync(HttpContext context, Exception ex)
        {
            var webRoot = _env.ContentRootPath;

            fileName = "error_";
            var        path  = HelperController.GetPath(webRoot, fileName + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".txt", "logs/");
            TextWriter txtWr = new StreamWriter(path, true);

            txtWr.WriteLine(JsonConvert.SerializeObject(ex).ToString());
            txtWr.Flush();
            txtWr.Close();
            return(context.Response.WriteAsync(ex.Message));
        }
 // Use this for initialization
 void Start()
 {
     helper = GameObject.Find("Helper").GetComponent <HelperController>();
     player = FindObjectOfType <Player>();
 }
Example #11
0
        public void ScrapeAuthors_Test()
        {
            HelperController c = new HelperController();

            c.AuthorScrapeWiki();
        }
Example #12
0
 public taskController()
 {
     _helper  = new HelperController();
     _context = new ApplicationDbContext();
 }