コード例 #1
0
ファイル: PictureWindow.cs プロジェクト: Wiladams/NewTOAPIA
        public PictureWindow(int locx, int locy)
            : base("Run Length Encoding Viewer", locx, locy, 640, 480)
        {
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("marbles.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("xing_b24.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("xing_b32.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("xing_t24.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("xing_t32.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("ctc24.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("flag_t32.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("flag_b32.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("utc32.tga");
            //picture = NewTOAPIA.Drawing.TargaLoader.CreatePixelDataFromFile("utc24.tga");
            //picture = CreateColorTestImage(40,40);
            //picture = CreateSteppedTestImage(128, 32);
            picture = CreateBarsTestImage(10);

            // Perform the runlength encoding on the image
            pixMap = new PixelArray<BGRb>(picture);

            RLC rlc = new RLC();
            //NewTOAPIA.Imaging.RunLengthCodec rlc = new RunLengthCodec();
            MemoryStream ms = new MemoryStream();

            rlc.Encode(new PixelAccessorBGRb(pixMap), ms);
            byte[] imageBytes = ms.GetBuffer();


            //Console.WriteLine("Image Bytes: {0}", imageBytes.Length);

            // Now decode the bytes back into a new image
            ms.Seek(0, SeekOrigin.Begin);

            tPic = new PixelArray<BGRb>(pixMap.Width, pixMap.Height, pixMap.Orientation, new PixelInformation(PixelLayout.Bgr, PixelComponentType.Byte));
            PixelAccessorBGRb accessor = new PixelAccessorBGRb(tPic);
            rlc.Decode(ms, accessor);
        }
コード例 #2
0
 /// <summary>
 /// This function used to Add tne  RubricLevel in the RubricLevelList
 /// </summary>
 /// <param name="rl">Object of the Rubric</param>
 public void AddRubricLevelList(RubricLevelClass rl)
 {
     RLC.Add(rl);
 }
コード例 #3
0
 /// <summary>
 /// This function used to Remove tne  RubricLevel from the RubricLevelList
 /// </summary>
 public void RemoveFromRubricLevel()
 {
     RLC.Clear();
 }
コード例 #4
0
        // GET: Base
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);


            string controllerName = filterContext.RouteData.Values["controller"].ToString();
            string actionName     = filterContext.ActionDescriptor.ActionName;
            RLC    rlc            = new RLC();
            RLCCRD rl             = new RLCCRD();

            rlc.actionName          = actionName;
            rlc.controlName         = controllerName;
            rlc.IsauthAuthenticated = filterContext.HttpContext.User.Identity.IsAuthenticated;
            rlc.UserId = filterContext.HttpContext.Session.IsCookieless.ToString() == null ? "" : filterContext.HttpContext.User.Identity.Name.ToString(); // filterContext.HttpContext.User.Identity.Name;
            rlc        = rl.RoleControl(rlc);
            if (rlc != null)
            {
                // Response.Redirect(Url.Action(rlc.actionName, rlc.controlName));
                filterContext.Result = new RedirectToRouteResult(
                    new RouteValueDictionary {
                    { "controller", rlc.controlName },
                    { "action", rlc.actionName }
                }); return;
            }



            //filterContext.Result = new RedirectToRouteResult(
            //             new RouteValueDictionary{{ "controller", rlc.controlName},
            //                         { "action", rlc.actionName }

            //                                });


            //if (controllerName != "Account")
            //{
            //    if (!filterContext.HttpContext.User.Identity.IsAuthenticated)
            //    {
            //        _controllerName = "Account";
            //        _actionName = "Login";


            //        filterContext.Result = new RedirectToRouteResult(
            //             new RouteValueDictionary{{ "controller", _controllerName.ToString()},
            //                          { "action", _actionName.ToString() }

            //                              }); return;
            //    }
            //    else if (_controllerName != "Home" || _actionName != "Index")
            //    {
            //        string name = filterContext.HttpContext.User.Identity.Name;
            //        int cnt = db.Database.SqlQuery<Fttx_Orm.Models.AllMenu>("SELECT * FROM AllMenu WHERE AllMenu.MenuId in (SELECT MenuId FROM RoleMenu WHERE RoleId IN(SELECT RoleId FROM RoleUser WHERE  UserId='" + name + "') ) AND ControlerName ='" + controllerName + "'  AND ActionName ='" + actionName + "'").ToList().Count();

            //        if (cnt <= 0)
            //        {
            //            _controllerName = "Home";
            //            _actionName = "Index";

            //            filterContext.Result = new RedirectToRouteResult(
            //                 new RouteValueDictionary{{ "controller", _controllerName.ToString()},
            //                          { "action", _actionName.ToString() }

            //                                  }); return;
            //        }
            //    }
            //}
        }