Exemple #1
0
        /// <summary>
        /// 初始化菜单页面
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public IActionResult CompanyForm(SysUser user, Company entity = null)
        {
            if (Request.IsAjaxRequest())
            {
                //保存菜单
                StateCode code = ServiceIoc.Get <CompanyService>().Save(user.id, entity);

                //初始化
                AppGlobal.Instance.Initial();

                //返回数据
                return(Json(GetResult(code)));
            }
            else
            {
                List <Company> menuList = ServiceIoc.Get <CompanyService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                menuList.Insert(0, new Company()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Parents = menuList;

                entity = ServiceIoc.Get <CompanyService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Page.Title   = "Setup Ballot Page Banner Ad";
                H1.InnerHtml = "Setup Ballot Page Banner Ad";
                _SetupAdDialogInfo.LoadControls();
                FeedbackSetupAd.AddInfo("Ad information loaded.");
                SetupSampleAd();
            }

            var body = Master.FindControl("body") as HtmlGenericControl;

            Debug.Assert(body != null, "body != null");
            body.Attributes.Add("data-state", StateCode);

            AdRate.InnerText =
                DB.Vote.Master.GetBallotAdRate(0)
                .ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
            State.InnerText = StateCache.GetStateName(StateCode.SafeString());

            if (AdminPageLevel == AdminPageLevel.Unknown)
            {
                UpdateControls.Visible = false;
                NoJurisdiction.CreateStateLinks("/admin/SetupBallotPageBannerAd.aspx?state={StateCode}");
                NoJurisdiction.Visible = true;
            }
        }
        /// <summary>
        /// 保存扩展属性
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public JsonResult SaveExtAttrName(SysUser user, ExtAttrName extAttrName, string attrvals)
        {
            //属性值集合
            string[] arr_val = null;
            if (attrvals != null && attrvals.IndexOf(",") != -1)
            {
                attrvals = attrvals.Replace(",", ",");
            }

            arr_val = StringHelper.StringToArray(attrvals);

            if (extAttrName.id == 0)
            {
                extAttrName.created_user_id = user.id;
                extAttrName.created_date    = DateTime.Now;
            }
            else
            {
                extAttrName.updated_user_id = user.id;
                extAttrName.updated_date    = DateTime.Now;
            }

            //保存
            StateCode state = ServiceIoc.Get <ExtAttrNameService>().Save(extAttrName, arr_val);

            return(Json(GetResult(state)));
        }
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public JsonResult ResetPsw(SysUser user)
        {
            string    psw   = ConfigManage.AppSettings <string>("AppSettings:DefaultPassWord");
            StateCode state = ServiceIoc.Get <SysUserService>().ResetPsw(bid, psw);

            return(Json(GetResult(StateCode.State_200)));
        }
Exemple #5
0
    public static void TakeDamage(int damage)
    {
        int hp_ = hp;

        if (state != StateCode.takingHit && state != StateCode.die)
        {
            hp_   = (hp_ - damage > 0) ? hp_ - damage : 0;
            state = PlayerManager.StateCode.takingHit;

            if (mode == ModeCode.normal)
            {
                instance.anim.SetTrigger("TakeHit");
            }
            else
            {
                instance.anim_t.SetTrigger("TakeHit");
            }
        }

        if (hp_ == 0 && state != StateCode.die)
        {
            if (mode != ModeCode.normal)
            {
                instance.player_transform.GetComponent <P_Transform>().Transform(ModeCode.normal);
            }

            instance.anim.SetBool("Die", true);
            instance.anim.SetTrigger("DieT");
            state = StateCode.die;
        }

        hp = hp_;
    }
Exemple #6
0
        /// <summary>
        /// 关闭订单
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public JsonResult CloseOrder(long id)
        {
            StateCode state = StateCode.State_200;

            try
            {
                ProductOrder order = ServiceIoc.Get <ProductOrderService>().GetById(id);

                if (order == null)
                {
                    state = StateCode.State_1;
                }
                else
                {
                    order.status       = OrderStatus.Close;
                    order.updated_date = DateTime.Now;
                    ServiceIoc.Get <ProductOrderService>().Update(order);
                }
            }
            catch
            {
                state = StateCode.State_500;
            }
            return(Json(GetResult(state)));
        }
        /// <summary>
        /// 初始化菜单页面
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public ActionResult SysMenuForm(SysUser user, SysModelMenu entity = null)
        {
            if (Request.IsAjaxRequest())
            {
                //保存菜单
                StateCode code = ServiceIoc.Get <SysModelMenuService>().Save(user.id, entity);

                //初始化
                AppGlobal.Instance.Initial();

                //返回数据
                return(Json(GetResult(code)));
            }
            else
            {
                List <SysModelMenu> menuList = ServiceIoc.Get <SysModelMenuService>().GetChildrenTag(0, 0, System.Web.HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                menuList.Insert(0, new SysModelMenu()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Parents = menuList;

                entity = ServiceIoc.Get <SysModelMenuService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
Exemple #8
0
 /// <summary>
 /// 初始化返回结果
 /// </summary>
 /// <param name="code">状态码</param>
 /// <param name="message">消息</param>
 /// <param name="data">数据</param>
 public Result(StateCode code, string message, dynamic data = null) : base(null)
 {
     Code          = code.Value();
     Message       = message;
     Data          = data;
     OperationTime = DateTime.Now;
 }
Exemple #9
0
        /// <summary>
        /// 品牌信息页面
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name="imgmsg"></param>
        /// <returns></returns>
        public IActionResult BrandForm(SysUser user, ProductBrand entity, string imgmsg)
        {
            if (NHttpContext.Current.Request.IsAjaxRequest())
            {
                //获取状态
                StateCode state = ServiceIoc.Get <ProductBrandService>().Save(user.id, entity, imgmsg);
                return(Json(GetResult(state)));
            }
            else
            {
                ViewBag.Ticket = StringHelper.GetEncryption(ImgType.Product_Brand + "#" + bid);
                ViewBag.defurl = ResXmlConfig.Instance.DefaultImgSrc(AppGlobal.Res, ImgType.Product_Brand);
                ViewBag.imgurl = ViewBag.imgurl;

                entity = ServiceIoc.Get <ProductBrandService>().GetById(bid);
                if (entity != null)
                {
                    Img img = ServiceIoc.Get <ImgService>().GetImg(ImgType.Product_Brand, entity.id);
                    if (img != null)
                    {
                        ViewBag.imgurl = string.IsNullOrEmpty(img.getImgUrl()) ? ViewBag.defimgurl : img.getImgUrl();
                    }
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
        /// <summary>
        /// 设置角色是否可用
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public JsonResult SetEnableSysRole(bool status)
        {
            //获取状态
            StateCode state = ServiceIoc.Get <SysRoleService>().SetEnable(bid, status);

            return(Json(GetResult(state)));
        }
Exemple #11
0
        /// <summary>
        /// 显示、隐藏 导购分类
        /// </summary>
        /// <param name="id"></param>
        /// <param name="isshow"></param>
        /// <returns></returns>
        public JsonResult SetEnableGuideProductCgty(int id, bool isshow)
        {
            //获取状态
            StateCode state = ServiceIoc.Get <GuideProductCatgService>().SetEnable(id, isshow);

            return(Json(GetResult(state)));
        }
Exemple #12
0
        /// <summary>
        /// 删除导购分类
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult DeletePdtGuideCatg()
        {
            //获取状态
            StateCode state = ServiceIoc.Get <GuideProductCatgService>().Delete(bid);

            return(Json(GetResult(state)));
        }
Exemple #13
0
 /// <summary>
 /// 前端导购分类
 /// </summary>
 /// <returns></returns>
 public IActionResult GuidePdtCatgForm(SysUser user, GuideProductCatg entity = null, string imgmsg = null)
 {
     if (NHttpContext.Current.Request.IsAjaxRequest())
     {
         //获取状态
         StateCode state = ServiceIoc.Get <GuideProductCatgService>().Save(user.id, entity, imgmsg);
         return(Json(GetResult(state)));
     }
     else
     {
         //所属分类
         List <GuideProductCatg> Parents = ServiceIoc.Get <GuideProductCatgService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
         Parents.Insert(0, new GuideProductCatg()
         {
             name = "根", id = 0
         });
         ViewBag.Parents = Parents;
         //当前商品分类
         entity = ServiceIoc.Get <GuideProductCatgService>().GetById(bid);
         if (entity != null)
         {
             ViewBag.entity = JsonConvert.SerializeObject(entity);
         }
     }
     return(View());
 }
Exemple #14
0
        /// <summary>
        /// 保存商品类别
        /// </summary>
        /// <returns></returns>
        public JsonResult SaveProductCgty(SysUser user, ProductCatg productCgty, string imgMsg)
        {
            //获取状态
            StateCode state = ServiceIoc.Get <ProductCatgService>().Save(user, productCgty, imgMsg);

            return(Json(GetResult(state)));
        }
Exemple #15
0
        /// <summary>
        ///     接收到的普通数据处中心
        /// </summary>
        /// <param name="stateOne">StateBase</param>
        /// <param name="stateCode">StateCode</param>
        internal void CommonCodeManage(StateBase stateOne, StateCode stateCode)
        {
            if (stateCode == null || stateOne == null)
            {
                return;
            }
            switch (stateCode.State)
            {
            case PasswordCode._textCode:                                   //文本信息
                Send(stateOne, stateCode.ReplyDate);
                OnAcceptString(stateOne.IpEndPoint, stateCode.Datestring); //触发文本收到的事件
                break;

            case PasswordCode._photographCode:                         //图片信息
                Send(stateOne, stateCode.ReplyDate);
                OnAcceptByte(stateOne.IpEndPoint, stateCode.DateByte); //触发图片收到的事件
                break;

            case PasswordCode._dateSuccess:         //数据发送成功
                stateOne.SendDate = null;
                OndateSuccess(stateOne.IpEndPoint); //对方收到触发事件
                break;

            case 0:     //说明这个数据只要直接回复给对方就可以了
                Send(stateOne, stateCode.ReplyDate);
                break;
            }
        }
        /// <summary>
        /// 修改个人信息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name="imgmsg"></param>
        /// <returns></returns>
        public ActionResult UpdateUserForm(SysUser user, Employee entity = null, string imgmsg = null)
        {
            if (Request.IsAjaxRequest())
            {
                //保存菜单
                StateCode code = ServiceIoc.Get <EmployeeService>().Save(user.id, entity, imgmsg);
                //返回数据
                return(Json(GetResult(code)));
            }
            else
            {
                //缺省图片路径
                ViewBag.defurl = ResXmlConfig.Instance.DefaultImgSrc(AppGlobal.Res, ImgType.Sys_User);
                //用户图片路径
                ViewBag.imgurl = ViewBag.defurl;
                //当前用户加密ID
                ViewBag.Ticket = StringHelper.GetEncryption(ImgType.Sys_User + "#" + bid);

                //当前用户信息
                entity = ServiceIoc.Get <EmployeeService>().GetByUserId(LoginUser.Instance.User.id);
                if (entity != null)
                {
                    //当前用户实体
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                    Img img = ServiceIoc.Get <ImgService>().GetImg(ImgType.Sys_User, entity.id);
                    if (img != null)
                    {
                        ViewBag.imgurl = string.IsNullOrEmpty(img.getImgUrl()) ? ViewBag.defurl : img.getImgUrl();
                    }
                }
            }

            return(View());
        }
Exemple #17
0
 public State(Boat boat, List <Creature> leftSideCreatures, List <Creature> rightSideCreatures, StateCode preStateCode)
 {
     Boat = boat;
     LeftSideCreatures  = leftSideCreatures;
     RightSideCreatures = rightSideCreatures;
     PreStateCode       = preStateCode;
 }
        /// <summary>
        /// 角色页面
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name="pIds"></param>
        /// <returns></returns>
        public ActionResult SysRoleForm(SysUser user, SysRole entity = null, string pIds = "")
        {
            if (Request.IsAjaxRequest())
            {
                StateCode state = ServiceIoc.Get <SysRoleService>().Save(user.id, entity, pIds);
                //返回数据
                return(Json(GetResult(state)));
            }
            else
            {
                entity = ServiceIoc.Get <SysRoleService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                    List <SysRolePermission> rolePermissions = ServiceIoc.Get <SysRolePermissionService>().GetPermissionsByRoleId(bid);
                    ViewBag.pids = string.Join(",", rolePermissions.Select(p => p.permission_id.ToString()).ToArray());
                }
            }

            //系统所有权限
            List <SysPermission> permissions = ServiceIoc.Get <SysPermissionService>().GetList("order by order_index desc", "");

            ViewBag.permissions = permissions.Where(p => p.parent_id == 0).ToList();

            ViewBag.childrens = permissions.Where(p => p.parent_id != 0).ToList();

            return(View());
        }
Exemple #19
0
 /// <summary>
 /// 返回数据
 /// 针对dynamic
 /// </summary>
 /// <param name="code"></param>
 /// <param name="Data"></param>
 /// <returns></returns>
 public ContentResult ContentResult(StateCode code, dynamic Data)
 {
     return(new ContentResult()
     {
         Content = JsonConvert.SerializeObject(GetResult(code, Data)), ContentType = "application/json"
     });
 }
        /// <summary>
        /// 权限页面
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name=""></param>
        /// <returns></returns>
        public ActionResult SysPermissionForm(SysUser user, SysPermission entity = null)
        {
            //所属分类数据
            List <SysPermission> modulePermissions = new List <SysPermission>();

            modulePermissions.Add(new SysPermission()
            {
                name = "根", id = 0
            });
            modulePermissions.AddRange(GetModuleSysPermission());
            ViewBag.module = modulePermissions;

            if (Request.IsAjaxRequest())
            {
                StateCode state = ServiceIoc.Get <SysPermissionService>().Save(user.id, entity);
                AppGlobal.Instance.Initial();
                return(Json(GetResult(state)));
            }
            else
            {
                entity = ServiceIoc.Get <SysPermissionService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
Exemple #21
0
        /// <summary>
        ///     数据第二层分配中心;把数据归类
        /// </summary>
        /// <param name="stateOne"></param>
        /// <param name="statecode"></param>
        internal void codeManage(StateBase stateOne, StateCode statecode)
        {
            if (statecode == null || stateOne == null)
            {
                return;
            }
            StateCode stateCode = null;

            switch (statecode.State)
            {
            case PasswordCode._commonCode:     //普通数据信息;抛给普通Code去处理
                stateCode = EncryptionDecrypt.deciphering(statecode.DateByte, stateOne);
                CommonCodeManage(stateOne, stateCode);
                break;

            case PasswordCode._bigDateCode:     //抛给分包Code去处理
                stateCode = EncryptionDecryptSeparateDate.FileDecrypt(statecode.DateByte, stateOne);
                CommonCodeManage(stateOne, stateCode);
                break;

            case PasswordCode._fileCode:     //抛给文件处理器去处理;如果返回null就不用发送了
                byte[] haveDate = FileStart.ReceiveDateTO(statecode.DateByte, stateOne);
                if (haveDate != null)
                {
                    Send(stateOne, haveDate);
                }
                break;
            }
        }
Exemple #22
0
 /// <summary>
 /// 初始化返回结果
 /// </summary>
 /// <param name="code">状态码</param>
 /// <param name="message">消息</param>
 /// <param name="data">数据</param>
 /// <param name="title">标题</param>
 public ApiResult(StateCode code, string message, dynamic data = null, string title = "") : base(null)
 {
     _code    = code;
     _message = message;
     _data    = data;
     _title   = title;
 }
Exemple #23
0
        public override List <string> OnQuotesReceived(string[] names, CandleDataBidAsk[] quotes, bool isHistoryStartOff)
        {
            var evtList   = new List <string>();
            var deltaMils = lastCheckTime.HasValue
                                ? (DateTime.Now - lastCheckTime.Value).TotalMilliseconds
                                : int.MaxValue;

            if (deltaMils >= IntervalCheckMils)
            {
                lastState     = CheckDeposit();
                lastCheckTime = DateTime.Now;
            }
            if (lastState == StateCode.OK)
            {
                return(evtList);
            }
            // осуществить стопаут?
            var countStopout = new Cortege2 <int, int>(0, 0);

            if (lastState == StateCode.Stopout)
            {
                countStopout = PerformStopout();
            }
            // разослать сообщение
            PerformDelivery(countStopout);
            if (countStopout.a > 0)
            {
                Logger.InfoFormat("DrawDownStopoutChecker: закрыто {0} сделок из {1}",
                                  countStopout.a, countStopout.a + countStopout.b);
            }
            return(evtList);
        }
Exemple #24
0
        public static StateCode RetrieveEntityState(string entityName, Guid entityId)
        {
            Entity    entity    = OrganizationService.Retrieve(entityName, entityId, new ColumnSet("statecode"));
            StateCode stateCode = (StateCode)((OptionSetValue)(entity.Attributes["statecode"])).Value;

            return(stateCode);
        }
Exemple #25
0
        /// <summary>
        ///     接收到信息的回调函数
        /// </summary>
        /// <param name="iar"></param>
        private void EndReceiveFromCallback(IAsyncResult iar)
        {
            int byteRead = 0;

            try
            {
                //完成接收
                byteRead = state.WorkSocket.EndReceiveFrom(iar, ref state.RemoteEP);
            }
            catch
            {
            }
            if (byteRead > 0)
            {
                state.IpEndPoint = (IPEndPoint)state.RemoteEP;
                byte[] haveDate = ReceiveDateOne.DateOneManage(state, byteRead); //接收完成之后对数组进行重置
                BeginReceiveFrom();
                int havePort = UdpPortSetGet.GetPort(ref haveDate);
                if (havePort != 0)
                {
                    state.IpEndPoint.Port = havePort;
                }
                StateCode statecode = ReceiveDateDistribution.Distribution(haveDate);
                codeManage(state, statecode);
            }
            else
            {
                BeginReceiveFrom();
            }
        }
        /// <summary>
        /// 保存商品规格
        /// </summary>
        /// <param name="user"></param>
        /// <param name="specName"></param>
        /// <param name="specValues"></param>
        /// <returns></returns>
        public JsonResult SaveSpecName(SysUser user, SpecName specName, string specValues)
        {
            //属性值集合
            string[] arr_val = null;
            if (specValues != null && specValues.IndexOf(",") != -1)
            {
                specValues = specValues.Replace(",", ",");
            }
            arr_val = StringHelper.StringToArray(specValues);

            if (specName.id == 0)
            {
                specName.created_user_id = user.id;
                specName.created_date    = DateTime.Now;
            }
            else
            {
                specName.updated_user_id = user.id;
                specName.updated_date    = DateTime.Now;
            }

            //保存
            StateCode state = ServiceIoc.Get <SpecNameService>().Save(specName, arr_val);

            return(Json(GetResult(state)));
        }
Exemple #27
0
        /// <summary>
        /// 部门表单页
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IActionResult DepartmentForm(SysUser user, Department entity)
        {
            if (Request.IsAjaxRequest())
            {
                StateCode code = ServiceIoc.Get <DepartmentService>().Save(user.id, entity);
                return(Json(GetResult(code)));
            }
            else
            {
                List <Company> menuList = ServiceIoc.Get <CompanyService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                menuList.Insert(0, new Company()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Parents = menuList;

                List <Department> departments = ServiceIoc.Get <DepartmentService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                departments.Insert(0, new Department()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Departments = departments;

                entity = ServiceIoc.Get <DepartmentService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
Exemple #28
0
        public int OnInterrupt()
        {
            if (_dcpu16 != null)
            {
                switch ((InterruptOperation)_dcpu16.A)
                {
                case InterruptOperation.PollDevice:
                    _dcpu16.B = (ushort)_state;
                    _dcpu16.C = (ushort)ErrorCode.None;
                    break;

                case InterruptOperation.MapRegion:
                    _memoryMap   = _dcpu16.X;
                    _vertexCount = (ushort)(_dcpu16.Y % 128);

                    _state = _vertexCount == 0 ? StateCode.NoData : StateCode.Running;

                    break;

                case InterruptOperation.RotateDevice:
                    _targetRotation = (ushort)(_dcpu16.X % 360);

                    if (Math.Abs(_targetRotation - _currentRotation) > 1f)
                    {
                        _state = StateCode.Turning;
                    }
                    break;
                }
            }
            return(0);
        }
Exemple #29
0
 /// <summary>
 /// 返回消息方法
 /// </summary>
 /// <param name="code">识别码</param>
 /// <param name="data">数据</param>
 /// <param name="msg">消息</param>
 /// <returns></returns>
 public static IActionResult ReturnData(StateCode code, dynamic data = null, string msg = null)
 {
     _code    = code;
     _message = msg;
     CheckMessage(); // 静态方法
     _data = data;
     return(new JsonResult(new { code = _code, msg = _message, data = _data }));
 }
        /// <summary>
        /// 运费模板管理
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name="FRegions"></param>
        /// <returns></returns>
        public JsonResult DoFreightTemplateForm(SysUser user, [FromBody] dynamic entity)
        {
            FreightTemplate      fTemplate = JsonConvert.DeserializeObject <FreightTemplate>(entity.entity.ToString());
            List <FreightRegion> FRegions  = JsonConvert.DeserializeObject <List <FreightRegion> >(entity.FRegions.ToString());
            StateCode            code      = ServiceIoc.Get <FreightTemplateService>().Save(user.id, fTemplate, FRegions);

            return(Json(GetResult(code)));
        }
 public override List<string> OnQuotesReceived(string[] names, CandleDataBidAsk[] quotes, bool isHistoryStartOff)
 {
     var evtList = new List<string>();
     var deltaMils = lastCheckTime.HasValue
                         ? (DateTime.Now - lastCheckTime.Value).TotalMilliseconds
                         : int.MaxValue;
     if (deltaMils >= IntervalCheckMils)
     {
         lastState = CheckDeposit();
         lastCheckTime = DateTime.Now;
     }
     if (lastState == StateCode.OK) return evtList;
     // осуществить стопаут?
     var countStopout = new Cortege2<int, int>(0, 0);
     if (lastState == StateCode.Stopout) countStopout = PerformStopout();
     // разослать сообщение
     PerformDelivery(countStopout);
     if (countStopout.a > 0)
     {
         Logger.InfoFormat("DrawDownStopoutChecker: закрыто {0} сделок из {1}",
             countStopout.a, countStopout.a + countStopout.b);
     }
     return evtList;
 }
Exemple #32
0
        public int OnInterrupt()
        {
            if (_dcpu16 != null)
            {
                switch ((InterruptOperation)_dcpu16.A)
                {
                    case InterruptOperation.PollDevice:
                        _dcpu16.B = (ushort)_state;
                        _dcpu16.C = (ushort)ErrorCode.None;
                        break;

                    case InterruptOperation.MapRegion:
                        _memoryMap = _dcpu16.X;
                        _vertexCount = (ushort)(_dcpu16.Y % 128);

                        _state = _vertexCount == 0 ? StateCode.NoData : StateCode.Running;

                        break;

                    case InterruptOperation.RotateDevice:
                        _targetRotation = (ushort)(_dcpu16.X % 360);

                        if (Math.Abs(_targetRotation - _currentRotation) > 1f)
                        {
                            _state = StateCode.Turning;
                        }
                        break;
                }
            }
            return 0;
        }
Exemple #33
0
 private Omnibroker.Administrator NewAdministrator()
 {
     Omnibroker.Administrator result = new Omnibroker.Administrator();
     Push (result);
     State = StateCode.Administrator_Start;
     return result;
 }
        public override void Initialize(BacktestServerProxy.RobotContext grobotContext, CurrentProtectedContext protectedContext)
        {
            base.Initialize(grobotContext, protectedContext);

            depoWarning = HighWaterMark*(1 - PercentYellow/100M);
            depoStopout = HighWaterMark*(1 - PercentRed/100M);
            lastCheckTime = null;
            lastState = StateCode.OK;
            orderStorage = new MarketOrderSafeStorage(1000, 10 * 1000, grobotContext);
        }
 /// <summary>
 /// 初始化EasyUi提交表单返回结果
 /// </summary>
 /// <param name="code">状态码</param>
 /// <param name="message">消息</param>
 /// <param name="data">数据</param>
 public EasyUiResult( StateCode code, string message, IEnumerable<object> data = null ) {
     _code = code;
     _message = message;
     _data = data;
 }
Exemple #36
0
        private void Init()
        {
            if (_initialized) return;
            lock (Locker)
            {
                if (_initialized) return;
                _acDomain.MessageDispatcher.DispatchMessage(new MemorySetInitingEvent(this));
                List.Clear();
                var stateCodeEnumType = typeof(Status);
                var members = stateCodeEnumType.GetFields();
                var list = new List<StateCode>();
                var ok = new StateCode((int)Status.Ok, "Ok", "成功");
                list.Add(ok);

                // 通过反射构建状态码对象
                foreach (var item in members)
                {
                    if (item.DeclaringType == stateCodeEnumType)
                    {
                        var value = (Status)item.GetValue(Status.Ok);
                        if (value != Status.Ok)
                        {
                            var attrs = item.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true);
                            var description = attrs.Length > 0 ? ((DescriptionAttribute)attrs[0]).Description : item.Name;
                            var reasonPhrase = value.ToString();
                            var entity = new StateCode((int)value, reasonPhrase, description);
                            list.Add(entity);
                        }
                    }
                }
                foreach (var item in list.OrderBy(a => a.Code))
                {
                    List.Add(item);
                }
                _initialized = true;
                _acDomain.MessageDispatcher.DispatchMessage(new MemorySetInitializedEvent(this));
            }
        }
Exemple #37
0
 private Omnibroker.Port NewPort()
 {
     Omnibroker.Port result = new Omnibroker.Port();
     Push (result);
     State = StateCode.Port_Start;
     return result;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public virtual bool CheckLogin()
        {
            var query = new Dictionary<string, string>();
            query["Handler"] = "Validate";
            query["Token"] = Token;
            string queryString = HttpUtils.BuildPostParams(query);
            queryString = AppendSign(queryString);
            string json;
            using (var response = Send(queryString, _timeout))
            {
                var responseStream = response.GetResponseStream();
                if (responseStream == null)
                {
                    TraceLog.Write("Response stream is null.\r\nUrl:{0}/?{1}", _url, queryString);
                    return false;
                }
                using (var sr = new StreamReader(responseStream, Encoding.UTF8))
                {
                    json = sr.ReadToEnd();
                    responseStream.Close();
                }
            }
            var body = JsonUtils.Deserialize<ResponseBody<LoginToken>>(json);
            if (body == null)
            {
                TraceLog.Write("Response stream convert to json error.Json:{0}\r\nUrl:{1}/?{2}", json, _url, queryString);
                State = StateCode.ParseError;
                return false;
            }

            State = body.StateCode;
            if (body.StateCode == StateCode.OK)
            {
                var token = body.Data as LoginToken;
                if (token != null)
                {
                    PassportID = token.PassportId;
                    UserID = token.UserId.ToString();
                    UserType = token.UserType;
                    return true;
                }
            }
            if (body.StateCode == StateCode.TokenExpired || body.StateCode == StateCode.NoToken)
            {
                TraceLog.Write("AccountServer login fail, StateCode:{0}-{1}", body.StateCode, body.StateDescription);
                throw new HandlerException(body.StateCode, body.StateDescription);
            }
            TraceLog.WriteError("AccountServer login error:{0}", json);
            return false;
        }
Exemple #39
0
 private Omnibroker.Encryption NewEncryption()
 {
     Omnibroker.Encryption result = new Omnibroker.Encryption();
     Push (result);
     State = StateCode.Encryption_Start;
     return result;
 }
Exemple #40
0
 private Omnibroker.Expires NewExpires()
 {
     Omnibroker.Expires result = new Omnibroker.Expires();
     Push (result);
     State = StateCode.Expires_Start;
     return result;
 }
Exemple #41
0
 private Omnibroker.Connection NewConnection()
 {
     Omnibroker.Connection result = new Omnibroker.Connection();
     Push (result);
     State = StateCode.Connection_Start;
     return result;
 }
Exemple #42
0
 private Omnibroker.Client NewClient()
 {
     Omnibroker.Client result = new Omnibroker.Client();
     Push (result);
     State = StateCode.Client_Start;
     return result;
 }
Exemple #43
0
 private Omnibroker.Authentication NewAuthentication()
 {
     Omnibroker.Authentication result = new Omnibroker.Authentication();
     Push (result);
     State = StateCode.Authentication_Start;
     return result;
 }
Exemple #44
0
        public override void OnUpdate()
        {
            if (_dcpu16 == null)
            {
                ClearLines();
            }
            else
            {
                var vertexDataLength = _vertexCount * 2;

                var currentVertices = new ushort[vertexDataLength];
                Array.Copy(_dcpu16.Memory, _memoryMap, currentVertices, 0, vertexDataLength);

                if (!currentVertices.SequenceEqual(_lastDrawnVertices))
                {
                    DrawVertices(GetVertices(currentVertices));

                    _lastDrawnVertices = currentVertices;
                }

                var maxRotation = TimeWarp.deltaTime * RotationRateDegreesPerSecond;
                var rotationDifference = Math.Abs(_targetRotation - _currentRotation);

                if (rotationDifference > 0.1f)
                {
                    float rotationAdjustment;
                    if (rotationDifference > maxRotation)
                    {
                        _currentRotation = (_currentRotation + maxRotation) % 360f;
                        rotationAdjustment = maxRotation;
                    }
                    else
                    {
                        _currentRotation = _targetRotation;
                        rotationAdjustment = rotationDifference;
                    }

                    foreach (var lineRenderer in _lineRenderers)
                    {
                        lineRenderer.transform.Translate(new Vector3(0.5f, 0.5f, 0f));
                        lineRenderer.transform.Rotate(Vector3.forward, rotationAdjustment);
                        lineRenderer.transform.Translate(new Vector3(-0.5f, -0.5f, 0f));
                    }
                }
                else
                {
                    _state = _vertexCount == 0 ? StateCode.NoData : StateCode.Running;
                }
            }
        }
Exemple #45
0
 private Omnibroker.Query NewQuery()
 {
     Omnibroker.Query result = new Omnibroker.Query();
     Push (result);
     State = StateCode.Query_Start;
     return result;
 }
Exemple #46
0
        public override void OnLoad(ConfigNode node)
        {
            uint version;
            if (UInt32.TryParse(node.GetValue(ConfigKeyVersion), out version) && version == 1)
            {
                float x;
                if (Single.TryParse(node.GetValue(ConfigKeyWindowPositionX), out x))
                {
                    _windowPosition.x = x;
                }

                float y;
                if (Single.TryParse(node.GetValue(ConfigKeyWindowPositionY), out y))
                {
                    _windowPosition.y = y;
                }

                _isWindowPositionInit = true;

                bool showWindow;
                if (Boolean.TryParse(node.GetValue(ConfigKeyShowWindow), out showWindow))
                {
                    _showWindow = showWindow;
                }

                ushort currentStateCode;
                if (UInt16.TryParse(node.GetValue(ConfigKeyCurrentStateCode), out currentStateCode))
                {
                    _currentStateCode = (StateCode)currentStateCode;
                }

                ushort lastErrorCode;
                if (UInt16.TryParse(node.GetValue(ConfigKeyLastErrorCode), out lastErrorCode))
                {
                    _lastErrorCode = (ErrorCode)lastErrorCode;
                }

                int currentTrack;
                if (Int32.TryParse(node.GetValue(ConfigKeyCurrentTrack), out currentTrack))
                {
                    _currentTrack = currentTrack;
                }

                var i = 0;
                while (node.HasNode(ConfigKeyDiskPrefix + i))
                {
                    var diskNode = node.GetNode(ConfigKeyDiskPrefix + i);

                    var label = diskNode.GetValue(ConfigKeyLabel);
                    bool isWriteProtected; Boolean.TryParse(diskNode.GetValue(ConfigKeyIsWriteProtected), out isWriteProtected);
                    var data = diskNode.GetValue(ConfigKeyData);

                    _allDisks.Add(new FloppyDisk(data) { Label = label, IsWriteProtected = isWriteProtected });

                    i++;
                }

                int diskIndex;
                if (Int32.TryParse(node.GetValue(ConfigKeyInsertedDiskIndex), out diskIndex))
                {
                    if (diskIndex >= 0)
                    {
                        _disk = _allDisks[diskIndex];
                    }
                }
            }
        }
Exemple #47
0
 private Omnibroker.Scope NewScope()
 {
     Omnibroker.Scope result = new Omnibroker.Scope();
     Push (result);
     State = StateCode.Scope_Start;
     return result;
 }
Exemple #48
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="stateCode"></param>
 /// <param name="error"></param>
 public HandlerException(StateCode stateCode, string error)
     : base(error)
 {
     StateCode = stateCode;
 }
Exemple #49
0
 private Omnibroker.Seed NewSeed()
 {
     Omnibroker.Seed result = new Omnibroker.Seed();
     Push (result);
     State = StateCode.Seed_Start;
     return result;
 }
Exemple #50
0
 /// <summary>
 /// 初始化EasyUi提交表单返回结果
 /// </summary>
 /// <param name="code">状态码</param>
 /// <param name="message">消息</param>
 public EasyUiResult( StateCode code, string message ) 
 {
     _code = code;
     _message = message;
 }
Exemple #51
0
 private Omnibroker.Ticket NewTicket()
 {
     Omnibroker.Ticket result = new Omnibroker.Ticket();
     Push (result);
     State = StateCode.Ticket_Start;
     return result;
 }
Exemple #52
0
        public override void OnLoad(ConfigNode node)
        {
            uint version;
            if (UInt32.TryParse(node.GetValue(ConfigKeyVersion), out version) && version == 1)
            {
                ushort state;
                if (UInt16.TryParse(node.GetValue(ConfigKeyState), out state))
                {
                    _state = (StateCode)state;
                }

                ushort memoryMap;
                if (UInt16.TryParse(node.GetValue(ConfigKeyMemoryMap), out memoryMap))
                {
                    _memoryMap = memoryMap;
                }

                ushort vertexCount;
                if (UInt16.TryParse(node.GetValue(ConfigKeyVertexCount), out vertexCount))
                {
                    _vertexCount = vertexCount;
                }

                ushort targetRotation;
                if (UInt16.TryParse(node.GetValue(ConfigKeyTargetRotation), out targetRotation))
                {
                    _targetRotation = targetRotation;
                }

                float currentRotation;
                if (Single.TryParse(node.GetValue(ConfigKeyCurrentRotation), out  currentRotation))
                {
                    _currentRotation = currentRotation;
                }
            }
        }
Exemple #53
0
 private Omnibroker.Address NewAddress()
 {
     Omnibroker.Address result = new Omnibroker.Address();
     Push (result);
     State = StateCode.Address_Start;
     return result;
 }
Exemple #54
0
        private void SetErrorOrState(ErrorCode? error = null, StateCode? state = null)
        {
            var doInterrupt = _dcpu16 != null && _interruptMessage != 0 && (error != _lastErrorCode || state != _currentStateCode);

            if (error != null)
            {
                _lastErrorCode = error.Value;
            }

            if (state != null)
            {
                _currentStateCode = state.Value;
            }

            if (doInterrupt)
            {
                _dcpu16.Interrupt(_interruptMessage);
            }
        }
Exemple #55
0
        void Pop()
        {
            if (Stack.Count == 0) throw new Exception ("Internal Parser Error");

            _StackItem Item = Stack[Stack.Count -1];
            State = Item.State;
            Current = Item.Token;

            Stack.RemoveAt (Stack.Count -1 ) ;

            //Console.WriteLine ("$$$$POP {0}", Current);
        }
Exemple #56
0
 /// <summary>
 /// 初始化Mvc返回结果
 /// </summary>
 /// <param name="code">状态码</param>
 /// <param name="message">消息</param>
 /// <param name="data">数据</param>
 public AjaxResponse(StateCode code, string message, IEnumerable<object> data = null)
 {
     _code = code;
     _message = message;
     _data = data;
 }
Exemple #57
0
        public Configure()
        {
            Top = new List<Omnibroker._Choice> () ;
            Registry = new Registry <Omnibroker._Choice> ();
            State = StateCode._Start;
            Stack = new List <_StackItem> ();
            _StartOfEntry = true;

            TYPE__Handle = Registry.TYPE ("Handle");
        }
Exemple #58
0
        public override void Process(TokenType Token, Position Position, string Text)
        {
            CurrentToken = Token;
            CurrentPosition = Position;
            CurrentText = Text;

            if ((Token == TokenType.SEPARATOR) |
                (Token == TokenType.NULL) |
                (Token == TokenType.COMMENT)) return;
            if (Token == TokenType.INVALID)
                throw new Exception("Invalid Token");

            bool Represent = true;

            while (Represent) {
                //Console.WriteLine ("    {3}: {0} {1} '{2}'", Token, Position, Text, State);

                Represent = false;
                switch (State) {
                    case StateCode._Start:                 //      BEGIN
                        if (Token == TokenType.BEGIN) {
                            State = StateCode._Choice;
                            break;
                            }
                        else throw new Exception("Parser Error Expected START");

                    case StateCode._Choice:                //      LABEL Class | END
                        if (Token == TokenType.LABEL) {
                            Omnibroker.ConfigureType LabelType = _Reserved (Text);
                            if (false |
                                    (LabelType == Omnibroker.ConfigureType.Connect) |
                                    (LabelType == Omnibroker.ConfigureType.Query) |
                                    (LabelType == Omnibroker.ConfigureType.Client)) {
                                Top.Add(New_Choice(Text));
                                }
                            else {
                                throw new Exception("Parser Error Expected [Class]");
                                }
                            break;
                            }
                        if (Token == TokenType.END) {
                            State = StateCode._End;
                            break;
                            }
                        else throw new Exception("Parser Error Expected [Class]");

                    case StateCode._End:                   //      -
                        throw new Exception("Too Many Closing Braces");

                    case StateCode.Connect_Start:
                        if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) {
                            Omnibroker.Connect Current_Cast = (Omnibroker.Connect)Current;
                            Current_Cast.Id = Registry.ID(Position, Text, TYPE__Handle, Current_Cast);
                            State = StateCode.Connect__Id;
                            break;
                            }
                        throw new Exception("Expected LABEL or LITERAL");

                    case StateCode.Connect__Id:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Connect Current_Cast = (Omnibroker.Connect)Current;
                            Current_Cast.Domain = Text;
                            State = StateCode.Connect__Domain;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Connect__Domain:
                        if (Token == TokenType.BEGIN) {
                            State = StateCode.Connect__Options;
                            }
                        else {
                            Pop ();
                            Represent = true;
                            }
                        break;
                    case StateCode.Connect__Options:
                        if (Token == TokenType.END) {
                            Pop();
                            break;
                            }

                        // Parser transition for OPTIONS $$$$$
                        else if (Token == TokenType.LABEL) {
                            Omnibroker.Connect Current_Cast = (Omnibroker.Connect)Current;
                            Omnibroker.ConfigureType LabelType = _Reserved (Text);
                            switch (LabelType) {
                                case Omnibroker.ConfigureType.Port : {

                                    // Port  Port
                                    Current_Cast.Port = NewPort ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Seed : {

                                    // Secrets  Seed
                                    Current_Cast.Secrets.Add (NewSeed ());
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Encryption : {

                                    // EncryptionAlgorithms  Encryption
                                    Current_Cast.EncryptionAlgorithms.Add (NewEncryption ());
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Authentication : {

                                    // AuthenticationAlgorithms  Authentication
                                    Current_Cast.AuthenticationAlgorithms.Add (NewAuthentication ());
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Administrator : {

                                    // Administrators  Administrator
                                    Current_Cast.Administrators.Add (NewAdministrator ());
                                    break;
                                    }
                                default : {
                                    throw new Exception("Parser Error Expected [Port Seed Encryption Authentication Administrator ]");
                                    }
                                }
                            }
                        break;

                    case StateCode.Query_Start:
                        if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) {
                            Omnibroker.Query Current_Cast = (Omnibroker.Query)Current;
                            Current_Cast.Id = Registry.ID(Position, Text, TYPE__Handle, Current_Cast);
                            State = StateCode.Query__Id;
                            break;
                            }
                        throw new Exception("Expected LABEL or LITERAL");

                    case StateCode.Query__Id:
                        if (Token == TokenType.BEGIN) {
                            State = StateCode.Query__Options;
                            }
                        else {
                            Pop ();
                            Represent = true;
                            }
                        break;
                    case StateCode.Query__Options:
                        if (Token == TokenType.END) {
                            Pop();
                            break;
                            }

                        // Parser transition for OPTIONS $$$$$
                        else if (Token == TokenType.LABEL) {
                            Omnibroker.Query Current_Cast = (Omnibroker.Query)Current;
                            Omnibroker.ConfigureType LabelType = _Reserved (Text);
                            switch (LabelType) {
                                case Omnibroker.ConfigureType.Seed : {

                                    // Secret  Seed
                                    Current_Cast.Secret.Add (NewSeed ());
                                    break;
                                    }
                                default : {
                                    throw new Exception("Parser Error Expected [Seed ]");
                                    }
                                }
                            }
                        break;

                    case StateCode.Client_Start:
                        if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) {
                            Omnibroker.Client Current_Cast = (Omnibroker.Client)Current;
                            Current_Cast.Id = Registry.ID(Position, Text, TYPE__Handle, Current_Cast);
                            State = StateCode.Client__Id;
                            break;
                            }
                        throw new Exception("Expected LABEL or LITERAL");

                    case StateCode.Client__Id:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Client Current_Cast = (Omnibroker.Client)Current;
                            Current_Cast.Account = Text;
                            State = StateCode.Client__Account;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Client__Account:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Client Current_Cast = (Omnibroker.Client)Current;
                            Current_Cast.Service = Text;
                            State = StateCode.Client__Service;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Client__Service:
                        if (Token == TokenType.BEGIN) {
                            State = StateCode.Client__Options;
                            }
                        else {
                            Pop ();
                            Represent = true;
                            }
                        break;
                    case StateCode.Client__Options:
                        if (Token == TokenType.END) {
                            Pop();
                            break;
                            }

                        // Parser transition for OPTIONS $$$$$
                        else if (Token == TokenType.LABEL) {
                            Omnibroker.Client Current_Cast = (Omnibroker.Client)Current;
                            Omnibroker.ConfigureType LabelType = _Reserved (Text);
                            switch (LabelType) {
                                case Omnibroker.ConfigureType.Scope : {

                                    // Scopes  Scope
                                    Current_Cast.Scopes.Add (NewScope ());
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Secret : {

                                    // Secret  Secret
                                    Current_Cast.Secret = NewSecret ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Ticket : {

                                    // Ticket  Ticket
                                    Current_Cast.Ticket = NewTicket ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Encryption : {

                                    // EncryptionAlgorithm  Encryption
                                    Current_Cast.EncryptionAlgorithm = NewEncryption ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Authentication : {

                                    // AuthenticationAlgorithm  Authentication
                                    Current_Cast.AuthenticationAlgorithm = NewAuthentication ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Expires : {

                                    // Expires  Expires
                                    Current_Cast.Expires = NewExpires ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Connection : {

                                    // Connections  Connection
                                    Current_Cast.Connections.Add (NewConnection ());
                                    break;
                                    }
                                default : {
                                    throw new Exception("Parser Error Expected [Scope Secret Ticket Encryption Authentication Expires Connection ]");
                                    }
                                }
                            }
                        break;

                    case StateCode.Administrator_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Administrator Current_Cast = (Omnibroker.Administrator)Current;
                            Current_Cast.Account = Text;
                            State = StateCode.Administrator__Account;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Administrator__Account:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Connection_Start:
                        if (Token == TokenType.BEGIN) {
                            State = StateCode.Connection__Options;
                            }
                        else {
                            Pop ();
                            Represent = true;
                            }
                        break;
                    case StateCode.Connection__Options:
                        if (Token == TokenType.END) {
                            Pop();
                            break;
                            }

                        // Parser transition for OPTIONS $$$$$
                        else if (Token == TokenType.LABEL) {
                            Omnibroker.Connection Current_Cast = (Omnibroker.Connection)Current;
                            Omnibroker.ConfigureType LabelType = _Reserved (Text);
                            switch (LabelType) {
                                case Omnibroker.ConfigureType.Scope : {

                                    // Scopes  Scope
                                    Current_Cast.Scopes.Add (NewScope ());
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Secret : {

                                    // Secret  Secret
                                    Current_Cast.Secret = NewSecret ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Ticket : {

                                    // Ticket  Ticket
                                    Current_Cast.Ticket = NewTicket ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Encryption : {

                                    // EncryptionAlgorithm  Encryption
                                    Current_Cast.EncryptionAlgorithm = NewEncryption ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Authentication : {

                                    // AuthenticationAlgorithm  Authentication
                                    Current_Cast.AuthenticationAlgorithm = NewAuthentication ();
                                    break;
                                    }
                                case Omnibroker.ConfigureType.Expires : {

                                    // Expires  Expires
                                    Current_Cast.Expires = NewExpires ();
                                    break;
                                    }
                                default : {
                                    throw new Exception("Parser Error Expected [Scope Secret Ticket Encryption Authentication Expires ]");
                                    }
                                }
                            }
                        break;

                    case StateCode.Seed_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Seed Current_Cast = (Omnibroker.Seed)Current;
                            Current_Cast.Data = Text;
                            State = StateCode.Seed__Data;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Seed__Data:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Seed Current_Cast = (Omnibroker.Seed)Current;
                            Current_Cast.Expiry = Text;
                            State = StateCode.Seed__Expiry;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Seed__Expiry:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Secret_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Secret Current_Cast = (Omnibroker.Secret)Current;
                            Current_Cast.Data = Text;
                            State = StateCode.Secret__Data;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Secret__Data:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Ticket_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Ticket Current_Cast = (Omnibroker.Ticket)Current;
                            Current_Cast.Data = Text;
                            State = StateCode.Ticket__Data;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Ticket__Data:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Port_Start:
                        if (Token == TokenType.INTEGER) {
                            Omnibroker.Port Current_Cast = (Omnibroker.Port)Current;
                            Current_Cast.Data = Convert.ToInt32(Text);
                            State = StateCode.Port__Data;
                            break;
                            }
                        throw new Exception("Expected Integer");

                    case StateCode.Port__Data:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Address_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Address Current_Cast = (Omnibroker.Address)Current;
                            Current_Cast.IP = Text;
                            State = StateCode.Address__IP;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Address__IP:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Scope_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Scope Current_Cast = (Omnibroker.Scope)Current;
                            Current_Cast.Domain = Text;
                            State = StateCode.Scope__Domain;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Scope__Domain:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Expires_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Expires Current_Cast = (Omnibroker.Expires)Current;
                            Current_Cast.Expiry = Text;
                            State = StateCode.Expires__Expiry;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Expires__Expiry:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Encryption_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Encryption Current_Cast = (Omnibroker.Encryption)Current;
                            Current_Cast.Algorithm = Text;
                            State = StateCode.Encryption__Algorithm;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Encryption__Algorithm:
                        Pop ();
                        Represent = true;
                        break;
                    case StateCode.Authentication_Start:
                        if (Token == TokenType.STRING) {
                            Omnibroker.Authentication Current_Cast = (Omnibroker.Authentication)Current;
                            Current_Cast.Algorithm = Text;
                            State = StateCode.Authentication__Algorithm;
                            break;
                            }
                        throw new Exception("Expected String");

                    case StateCode.Authentication__Algorithm:
                        Pop ();
                        Represent = true;
                        break;

                    default:
                        throw new Exception("Unreachable code reached");
                    }
                }
        }
Exemple #59
0
 public void OnDisconnect()
 {
     _dcpu16 = default(IDcpu16);
     _lastDrawnVertices = new ushort[0];
     _state = default(StateCode);
     _memoryMap = default(ushort);
     _vertexCount = default(ushort);
     _targetRotation = default(ushort);
     _currentRotation = default(float);
     ClearLines();
 }