Пример #1
0
 private void btnAction_Click(object sender, EventArgs e)
 {
     if (sender == btnReset)
     {
         m_action = ACTION.ACT_RESET;
     }
     else if (sender == btnLeft)
     {
         m_action = ACTION.ACT_PLAYER_A_LEFT;
     }
     else if (sender == btnRight)
     {
         m_action = ACTION.ACT_PLAYER_A_RIGHT;
     }
     else if (sender == btnUp)
     {
         m_action = ACTION.ACT_PLAYER_A_UP;
     }
     else if (sender == btnDown)
     {
         m_action = ACTION.ACT_PLAYER_A_DOWN;
     }
     else if (sender == btnFire)
     {
         m_action = ACTION.ACT_PLAYER_A_FIRE;
     }
     else
     {
         m_action = ACTION.ACT_PLAYER_A_NOOP;
     }
 }
Пример #2
0
        public bool FinishOperation(int operationid)
        {
            //{\"operation_id\":5}
            string outdatacode = "";

            outdatacode = "{\"operation_id\":" + operationid.ToString() + "}";
            outdatacode = AuthCode.Encode(outdatacode, ProgrameData.sign);
            string requeststring = String.Format("uid={0}&outdatacode={1}&req_id={2}", ProgrameData.uid, System.Web.HttpUtility.UrlEncode(outdatacode), ProgrameData.req_id++.ToString());
            int    count         = 0;

            while (true)
            {
                string result = DoPost(ProgrameData.GameAdd + RequestUrls.FinishOperation, requeststring);//不需要解密
                if (ResultPro.Result_Pro(ref result, "Finish_Operation_Pro", true) == 1)
                {
                    return(true);
                }
                if (ResultPro.Result_Pro(ref result, "Finish_Operation_Pro", true) == 0)
                {
                    ACTION.result_error_PRO(result, count++); continue;
                }
                if (ResultPro.Result_Pro(ref result, "Finish_Operation_Pro", true) == -1)
                {
                    return(false); /*特殊处理我还没想好*/;
                }
            }
        }
Пример #3
0
    // Update is called once per frame
    void FixedUpdate()
    {
        float multi = isRun ? sprintMulti : 1f;

        if (isRun)
        {
            projection.SprintBurn();
        }
        NavAgent.speed = multi * masterAbilities.movePoints * MOVEMENT_FORCE;
        Animator.SetFloat("WalkSpeed", Vector3.Magnitude(NavAgent.velocity));

        while (queuedActions.Count > 0)
        {
            ACTION action = queuedActions.Dequeue();


            if (stasis > 0f)
            {
                stasis -= Time.deltaTime;
            }
            else
            {
                stasis = 0f;
                HandleAction(action);
            }
        }
    }
Пример #4
0
 /// <summary>
 /// 사용한 마우스 버튼의 ActionID를 등록하고, 다른 액션의 사용이 불가능하게 만든다.
 /// </summary>
 /// <param name="button"></param>
 /// <param name="actionID"></param>
 public void UseMouseButton(Button button, ACTION actionID)
 {
     if (_actionID == ACTION.None)
     {
         _actionID = actionID;
     }
 }
Пример #5
0
 private void StartEatingIdle()
 {
     Action             = ACTION.IDLE;
     CurrentTime        = 0f;
     transform.rotation = Quaternion.Euler(0, 0, 0);
     Animator.SetTrigger("Idle");
 }
Пример #6
0
        private void calculate(DSA_FEATURES type, int number, ACTION action)
        {
            Dictionary <int, Feature> dictionary = null;
            Feature currentFeature;
            int     factor = 1;

            switch (type)
            {
            case DSA_FEATURES.VORTEIL: dictionary = AdvantageFeatures; break;

            case DSA_FEATURES.NACHTEIL: dictionary = DisAdvantageFeatures; break;
            }
            if (action == ACTION.REMOVE)
            {
                factor = factor * (-1);
            }

            if (dictionary.TryGetValue(number, out currentFeature) == false)
            {
                return;
            }

            CalculateAttributeBonus(currentFeature, factor);

            switch (type)
            {
            case DSA_FEATURES.VORTEIL: CalculaeEnergieBonus(currentFeature, factor); break;

            case DSA_FEATURES.NACHTEIL: CalculaeEnergieMali(currentFeature, factor); break;
            }

            CalculateAdvancedBonus(currentFeature, factor);
            CalculateTalentBonus(currentFeature, factor);
        }
Пример #7
0
        private static void SartEgged(List <Bus> buses, out ACTION action, out bool success)
        {
            do
            {
                do
                {
                    Console.WriteLine("choose an action");
                    Console.WriteLine("ADD_BUS, PICK_BUS, MAINTENANCE, REFUELLING, EXIT = -1");
                    success = Enum.TryParse(Console.ReadLine(), out action);
                } while (success == false);
                switch (action)
                {
                case ACTION.ADD_BUS:
                    try
                    {
                        buses.Add(new Bus());
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.Message);
                    }
                    //print all buses
                    foreach (Bus bus in buses)
                    {
                        Console.WriteLine(bus);
                    }
                    break;

                case ACTION.PICK_BUS:
                    Console.WriteLine("enter a license number");
                    string license  = Console.ReadLine().Replace("-", String.Empty);
                    Bus    foundBus = null;
                    foreach (Bus bus in buses)
                    {
                        if (bus.License == license)
                        {
                            foundBus = bus;
                            break;
                        }
                    }
                    if (foundBus != null)
                    {
                        Console.WriteLine(foundBus);
                    }
                    break;

                case ACTION.MAINTENANCE:
                    break;

                case ACTION.REFUELLING:
                    break;

                case ACTION.EXIT:
                    break;

                default:
                    break;
                }
            } while (action != ACTION.EXIT);
        }
Пример #8
0
    public static void changeState(int num)
    {
        switch (num)
        {
        case 0: action = ACTION.NONE; break;

        case 1: action = ACTION.WATER; break;

        case 2: action = ACTION.FERTILIZER; break;

        case 3: action = ACTION.SYNTH; break;

        case 4: action = ACTION.HEATER; break;

        case 5: action = ACTION.SPRAY; break;

        case 6: action = ACTION.COVER; break;

        case 7: if (Reusable.isOpen())
            {
                action = ACTION.MUSIC;
            }
            break;

        case 8: action = ACTION.SWATTER; break;
        }
    }
        public State GetById(Guid id)
        {
            try
            {
                const int ACTION = 2;

                _sqlConn.Open();

                var sqlCommandGetById = new SqlCommand("uspManagerQueryState", _sqlConn)
                {
                    CommandType = System.Data.CommandType.StoredProcedure
                };
                sqlCommandGetById.Parameters.AddWithValue("Action", ACTION.ToString());
                sqlCommandGetById.Parameters.AddWithValue("Id", id.ToString());
                var reader = sqlCommandGetById.ExecuteReader();

                var _state = new State();

                while (reader.Read())
                {
                    _state.Id   = Guid.Parse(reader["Id"].ToString());
                    _state.Name = reader["Name"].ToString();
                    _state.Flag = reader["Flag"].ToString();
                }
                _sqlConn.Close();
                return(_state);
            }
            catch (Exception ex)
            {
                var result = ex.Message;
            }
            return(null);
        }
Пример #10
0
 // Functions
 //--------------------------------------------------
 /// <summary>
 /// Undo 전에 중복을 체크하기 위해 Action을 등록한다.
 /// 리턴값이 True이면 "새로운 Action"이므로 Undo 등록을 해야한다.
 /// 만약 Action 타입이 Add, New.. 계열이면 targetObject가 null일 수 있다. (parent는 null이 되어선 안된다)
 /// </summary>
 /// <param name="label"></param>
 /// <param name="parentObject"></param>
 /// <param name="targtObject"></param>
 /// <param name="isMultiple"></param>
 public bool SetAction(ACTION action, MonoBehaviour parentMonoObject, object targtObject, bool isMultiple)
 {
     if (_action != ACTION.None && _parentMonoObject != null)
     {
         if (_action == action && _parentMonoObject == parentMonoObject && isMultiple == _isMultiple)
         {
             if (_isMultiple)
             {
                 //다중 처리 타입이면 -> targetObject가 달라도 연속된 액션이다.
                 return(false);
             }
             else
             {
                 //Multiple 타입이 아니라면 targetObject도 동일해야한다.
                 //단, 둘다 Null이라면 연속된 타입일 수 없다.
                 if (targtObject == _targetObject && targtObject != null && _targetObject != null)
                 {
                     return(false);                           //연속된 Action이다.
                 }
             }
         }
     }
     _action           = action;
     _parentMonoObject = parentMonoObject;
     _targetObject     = targtObject;
     _isMultiple       = isMultiple;
     return(true);
 }
        public void Update(State state)
        {
            try
            {
                const int ACTION = 2;

                _sqlConn.Open();

                var sqlCommUpdate = new SqlCommand("uspManagerNonQueryState", _sqlConn)
                {
                    CommandType = System.Data.CommandType.StoredProcedure
                };
                sqlCommUpdate.Parameters.AddWithValue("Action", ACTION.ToString());
                sqlCommUpdate.Parameters.AddWithValue("Id", state.Id);
                sqlCommUpdate.Parameters.AddWithValue("Name", state.Name);
                sqlCommUpdate.Parameters.AddWithValue("Flag", state.Flag);

                sqlCommUpdate.ExecuteNonQuery();

                _sqlConn.Close();
            }
            catch (Exception ex)
            {
                var result = ex.Message;
            }
        }
Пример #12
0
 private void StartLookAround()
 {
     Action      = ACTION.LOOK_AROUND;
     CurrentTime = 0f;
     Animator.SetTrigger("LookAt");
     // transform.rotation = Quaternion.Euler(0, 0, 0);
 }
        public IEnumerable <State> GetAll()
        {
            try
            {
                const int ACTION = 0;

                _sqlConn.Open();

                var sqlCommandGetAll = new SqlCommand("uspManagerQueryState", _sqlConn)
                {
                    CommandType = System.Data.CommandType.StoredProcedure
                };
                sqlCommandGetAll.Parameters.AddWithValue("Action", ACTION.ToString());
                var reader = sqlCommandGetAll.ExecuteReader();

                while (reader.Read())
                {
                    var _state = new State
                    {
                        Id   = Guid.Parse(reader["Id"].ToString()),
                        Name = reader["Name"].ToString(),
                        Flag = reader["Flag"].ToString()
                    };
                    _states.Add(_state);
                }
                _sqlConn.Close();
                return(_states);
            }
            catch (Exception ex)
            {
                var result = ex.Message;
            }
            return(new List <State>());
        }
Пример #14
0
 public void GenerateActions()
 {
     for (int i = 0; i < height; i++)
     {
         for (int j = 0; j < width; j++)
         {
             for (int act = 0; act < 4; act++)
             {
                 SetPosition(i, j);
                 if (currentCell.CellType.Equals(Cell.Cell_Type.WALL))
                 {
                     break;
                 }
                 ACTION action = (ACTION)act;
                 try
                 {
                     Move(action);
                     if (currentCell.CellType.Equals(Cell.Cell_Type.WALL))
                     {
                         continue;
                     }
                     Move(action, Undo: true);
                     currentCell.AllActions.Add(action);
                 }
                 catch (IndexOutOfRangeException ex)
                 {
                     continue;
                 }
             }
         }
     }
 }
Пример #15
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    void Start()
    {
        //random position to move initially
        if (UnityEngine.Random.Range(0f, 1f) > .5f)
        {
            side = 1;
        }
        else
        {
            side = -1;
        }

        lastSide             = side;
        transform.localScale = new Vector3(side * 1.2f, 1.2f, 1.2f);

        //its not entered yet
        isEntered = false;
        //is entereing
        currentAction = ACTION.ENTERING;
        //reset baloons
        bc.ResetBaloes();
        //reset color
        GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
        //invert position
        Vector3 boundPosition = side > 0 ? leftBound.position : rightBound.position;

        boundPosition.y = -2f;
        //set initial position
        transform.position = boundPosition;
    }
Пример #16
0
    public void ChangeAnim(ACTION action)
    {
        if (animator == null)
        {
            return;
        }
        switch (action)
        {
        case ACTION.MOVE:
            break;

        case ACTION.IDLE:
        {
            animator.SetFloat("Speed_f", 0f);
            animator.SetBool("Eat_b", false);
        }
        break;

        case ACTION.EAT:
        {
            animator.SetFloat("Speed_f", 0f);
            animator.SetBool("Eat_b", true);
        }
        break;

        default:
            break;
        }
    }
Пример #17
0
    private void AttackState()
    {
        var pos = GameController.Instance.Player.gameObject.transform.position;

        MoveDirection      = transform.forward * Speed * 2;
        transform.rotation = Utils.LookAtSmooth(transform, pos, 30f);

        if (Target == null || !Target.Alive)
        {
            Target         = null;
            Action         = ACTION.GO_BACK;
            TargetPosition = new Vector3(Positions[CurrentPosition].position.x, StartPosition.y, Positions[CurrentPosition].position.z);
            return;
        }

        if (Vector3.Distance(transform.position, Target.gameObject.transform.position) < 0.15f)
        {
            Animator.SetTrigger("Attack");
            Target.Hit(IHitType.ENEMY);
            Target.gameObject.transform.SetParent(transform);
            Action = ACTION.POS_ATTACK;

            var clone = GameController.Instance.GetPool("WaterSplash").Get();
            clone.transform.position = transform.position;
            clone.SetActive(true);

            SoundController.PlaySound("BigSplash");
            SoundController.PlaySound("Bite");
            SplashSound = false;
        }
    }
Пример #18
0
    /// <summary>
    /// Actions the looking.
    /// </summary>
    void ActionLooking()
    {
        BackAnimation();
        bc.SetBalaoLooking();
        if (cooldownAction > .5f)
        {
            float rnd = UnityEngine.Random.Range(0f, 1f);

            if (rnd < .3f - multAction)
            {
                currentAction = ACTION.LOOKING;
            }
            else if (rnd <= .4f - multAction)
            {
                currentAction = ACTION.LEFT_LOOKING;
            }
            else if (rnd < .45 - multAction)
            {
                currentAction = ACTION.SEARCHING;
            }
            else if (rnd < .6 - multAction)
            {
                currentAction = ACTION.LOOKING_DEEP;
            }

            cooldownAction = 0;
        }
        else
        {
            cooldownAction += Time.deltaTime;
        }
    }
        public void Save(Country country)
        {
            try
            {
                const int ACTION = 1;

                _sqlConn.Open();

                var sqlCommSave = new SqlCommand("uspManagerNonQueryCountry", _sqlConn)
                {
                    CommandType = System.Data.CommandType.StoredProcedure
                };
                sqlCommSave.Parameters.AddWithValue("Action", ACTION.ToString());
                sqlCommSave.Parameters.AddWithValue("Id", country.Id);
                sqlCommSave.Parameters.AddWithValue("Name", country.Name);
                sqlCommSave.Parameters.AddWithValue("Flag", country.Flag);

                sqlCommSave.ExecuteNonQuery();

                _sqlConn.Close();
            }
            catch (Exception ex)
            {
                var result = ex.Message;
            }
        }
Пример #20
0
    public void Play(short direction, ACTION action)
    {
        // 如果动画系统都没有加载,则等到下帧播放
        if (_Character == null)
        {
            _CurrDirection = direction;
            _CurrAction    = action;
            return;
        }

        if (direction == _CurrDirection && action == _CurrAction)
        {
            return;
        }

        _CurrDirection = direction;
        _CurrAction    = action;

        _Animator.SetInteger(_nDirectionID, (int)direction);
        for (int i = 0; i < _nActionID.Length; i++)
        {
            if (i == (int)action)
            {
                _Animator.SetTrigger(_nActionID[i]);
            }
            else
            {
                _Animator.ResetTrigger(_nActionID[i]);
            }
        }
    }
Пример #21
0
        public float Move(ACTION action, bool Undo = false)
        {
            int mul = 1;

            if (Undo)
            {
                mul = -1;
            }
            switch (action)
            {
            case ACTION.DOWN:
                currentPosition[0] = currentPosition[0] + 1 * mul;
                break;

            case ACTION.UP:
                currentPosition[0] = currentPosition[0] - 1 * mul;
                break;

            case ACTION.LEFT:
                currentPosition[1] = currentPosition[1] - 1 * mul;
                break;

            case ACTION.RIGHT:
                currentPosition[1] = currentPosition[1] + 1 * mul;
                break;
            }
            currentCell = grid[currentPosition[0], currentPosition[1]];
            return(currentCell.Reward);
        }
Пример #22
0
 public void Clear()
 {
     _action           = ACTION.None;
     _parentMonoObject = null;
     _targetObject     = null;
     _isMultiple       = false;      //여러 항목을 동시에 처리하는 Batch 액션 중인가
 }
Пример #23
0
        private void Initialize(ACTION action, Reward reward, DateTime timeStamp)
        {
            // Main container
            this.Margin = new Thickness(0, 10, 0, 10);
            this.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            this.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            });

            // Message
            TextBlock messageTextBlock = new TextBlock
            {
                Margin = new Thickness(10, 0, 0, 10),
                Text   = action + ": " + reward.ToString()
            };

            Grid.SetColumn(messageTextBlock, 0);

            // Timestamp
            TextBlock timeStampTextBlock = new TextBlock
            {
                Margin = new Thickness(0, 0, 10, 0),
                Text   = timeStamp.ToString()
            };

            Grid.SetColumn(timeStampTextBlock, 1);

            this.Children.Add(messageTextBlock);
            this.Children.Add(timeStampTextBlock);
        }
Пример #24
0
 public Node()
 {
     left = right = null;
     key = -1;
     number = 0;
     action = ACTION.NONE;
 }
Пример #25
0
        public void Update(FriendShip friendShip)
        {
            try
            {
                const int ACTION = 2;

                _sqlConn.Open();

                var sqlCommUpdate = new SqlCommand("uspManagerNonQueryFriendShip", _sqlConn)
                {
                    CommandType = System.Data.CommandType.StoredProcedure
                };
                sqlCommUpdate.Parameters.AddWithValue("Action", ACTION.ToString());
                sqlCommUpdate.Parameters.AddWithValue("Id", friendShip.Id);
                sqlCommUpdate.Parameters.AddWithValue("RequestedById", friendShip.RequestedById);
                sqlCommUpdate.Parameters.AddWithValue("RequestedToId", friendShip.RequestedToId);
                sqlCommUpdate.Parameters.AddWithValue("RequestTime", friendShip.RequestTime);
                sqlCommUpdate.Parameters.AddWithValue("Status", friendShip.Status);
                //sqlCommUpdate.Parameters.AddWithValue("Profile_Id", friendShip.RequestedBy);
                //sqlCommUpdate.Parameters.AddWithValue("Profile_Id1", friendShip.RequestedTo);

                sqlCommUpdate.ExecuteNonQuery();

                _sqlConn.Close();
            }
            catch (Exception ex)
            {
                var result = ex.Message;
            }
        }
Пример #26
0
            /// <summary>
            /// Ctor - create encr data field
            /// </summary>
            /// <param name="type"></param>
            /// <param name="id">Action ID</param>
            /// <param name="aes">AesEncryption</param>
            /// <param name="sIV">Only for testing, normally pass null to generate</param>
            public E_ACTION(type type, int id, AesEncryption aes, string sIV = null)
            {
                ACTION action = new ACTION(type, id);

                this.data = MakeEncr(action, aes, sIV);
                this.mac  = hmac(data, aes);
            }
Пример #27
0
 public Node(double value, ACTION action)
 {
     left = right = null;
     key = value;
     number = 0;
     this.action = action;
 }
Пример #28
0
 public Node(double value)
 {
     left = right = null;
     key = value;
     number = 0;
     action = ACTION.NONE;
 }
Пример #29
0
        private async Task ActionTask(ACTION act)
        {
            if (SelectedItem != null)
            {
                switch (act)
                {
                case ACTION.RUN:
                    await SendRequest.GET(SelectedItem.Run);

                    break;

                case ACTION.DELETE:
                    await SendRequest.GET(SelectedItem.Delete);

                    break;

                case ACTION.HIDE:
                    await SendRequest.GET(SelectedItem.Hide);

                    break;

                case ACTION.UNHIDE:
                    await SendRequest.GET(SelectedItem.Unhide);

                    break;

                case ACTION.ENCRYPT:
                    await SendRequest.GET(SelectedItem.Encrypt);

                    break;

                case ACTION.DECRYPT:
                    await SendRequest.GET(SelectedItem.Decrypt);

                    break;

                case ACTION.PUBLIC:
                    await SendRequest.GET(SelectedItem.Public);

                    break;

                case ACTION.PRIVATE:
                    await SendRequest.GET(SelectedItem.Private);

                    break;

                case ACTION.UPLOAD:
                    await SendRequest.GET(SelectedItem.Upload);

                    break;

                case ACTION.DOWNLOAD:
                    await SendRequest.GET(SelectedItem.Download);

                    break;
                }
                ViewModelManager.RunningProcessViewModelInstance.LoadData();
            }
        }
Пример #30
0
        private async Task Stay()
        {
            this.dog.Task.ClearAll();
            Main.ShowNotification($"~y~[ETF]*{Main.settings.dict["stay"]}*");
            await this.dog.Task.PlayAnimation("creatures@rottweiler@amb@world_dog_sitting@base", "base", 8.0f, -4.0f, -1, AnimationFlags.Loop, 0.0f);

            this.action = ACTION.Stay;
        }
Пример #31
0
 public Node(Node left, Node right)
 {
     this.left = left;
     this.right = right;
     key = left.key + right.key;
     number = 0;
     action = ACTION.NONE;
 }
Пример #32
0
 public Node(double key, ACTION action, double number, Node left, Node right)
 {
     this.left = left;
     this.right = right;
     this.key = key;
     this.number = number;
     this.action = action;
 }
Пример #33
0
 // Get / Set
 //-------------------------------------------------------------------
 public apMouse.MouseBtnStatus GetStatus(Button button, ACTION actionID)
 {
     if (_actionID == ACTION.None || _actionID == actionID)
     {
         return(_mouseBtn[(int)button].Status);
     }
     return(apMouse.MouseBtnStatus.Released);           //<<유효하지 않은 처리다.
 }
Пример #34
0
    public static void Parse(string text)
    {
        int c = text[0] - '0';

        action = (ACTION)c;

        Debug.Log("From IM: " + action);
    }
Пример #35
0
        public ActionResult DeleteConfirmed(int id)
        {
            ACTION aCTION = db.ACTIONs.Find(id);

            db.ACTIONs.Remove(aCTION);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #36
0
        public RuleHeader(String header)
        {
            this.raw = header;

            String[] headers = header.Split(new[] { " " }, StringSplitOptions.None);

            if (headers.Length != 7)
            {
                throw new Exception("not correct argument");
            }

            //action
            ACTION parseAction;
            if (!Enum.TryParse(headers[0].ToUpper(), out parseAction))
            {
                throw new Exception("no match action");
            }
            this.ruleAction = parseAction;

            //rule Protocol;
            PROTOCOL parseProtocol;
            if (!Enum.TryParse(headers[1].ToUpper(), out parseProtocol))
            {
                throw new Exception("no match protocol");
            }
            this.ruleProtocol = parseProtocol;

            //rule Senderip
            this.senderIp = headers[2];

            //rule Senderport
            this.senderPort = headers[3];

            //rule Direct
            this.ruleDirect = headers[4];

            //rule Receiveip
            this.receiveIp = headers[5];

            //rule Receiveport
            this.receivePort = headers[6];
        }
        /// <summary>
        /// 切换同级别设置项
        /// </summary>
        /// <param name="action"></param>
        private void switchMenuItem(ACTION action) {
            ItemType curItem = SettingTitle_Grid.DataContext as ItemType;
            ItemType actionItem = new ItemType();
            if (action == ACTION.LEFT)
                actionItem = curItem.LeftItemWithFinalLevel;
            else if (action == ACTION.RIGHT)
                actionItem = curItem.RightItemWithFinalLevel;
            if (actionItem == curItem)
                return;
            SettingData setting = DseFunctions.GetSettingByMenu(GlobalDefines.StaName, GlobalDefines.EquName, actionItem); ;
            if (setting.Count == 0) {
                SettingData errSetting = new SettingData() {
                    Name = "加载失败,请检查配置文件!"
                };

                setting.Add(errSetting);
            }

            Setting_Grid.DataContext = setting;
            SettingContent_ListBox.SelectedIndex = 0;
            ListBoxUtil.SetSvRoll(SettingContent_ListBox, 23);
        }
Пример #38
0
        private void push(ref Node node, int left, int right, ACTION action, double value)
        {
            int center = (left + right) / 2;

            if (node.left != null)
                push(ref node.left, left, center, node.action, node.number);

            if (node.right != null)
                push(ref node.right, center + 1, right, node.action, node.number);

            if (node.action == ACTION.LIST)
                node.key = do_action(node.key, action, value);
            else
            {
                double left_value = 0, right_value = 0;

                if (node.left.action == ACTION.UPDATE)
                    left_value = (center - left + 1) * node.left.number;
                else if (node.left.action == ACTION.ADD)
                    left_value = node.left.key + (center - left + 1) * node.left.number;
                else
                    left_value = node.left.key;

                if (node.right.action == ACTION.UPDATE)
                    right_value = (center - left + 1) * node.right.number;
                else if (node.right.action == ACTION.ADD)
                    right_value = node.right.key + (center - left + 1) * node.right.number;
                else
                    right_value = node.right.key;

                node.key = left_value + right_value;

                node.action = action;
                node.number = value;
            }
        }
Пример #39
0
        public static bool DataSector(ACTION action)
        {
            if (InitCard())
            {
                if (Authentify(KEY_A))
                {
                    if (action == ACTION.Read)
                    {
                        return ReadSector();
                    }
                    else
                    {
                        return WriteSector();
                    }
                }
            }

            return false;
        }
Пример #40
0
        private double do_action(double number, ACTION action, double value)
        {
            switch (action)
            {
                case ACTION.ADD:
                    number += value;
                    break;
                case ACTION.UPDATE:
                    number = value;
                    break;
                default:
                    break;
            }

            return number;
        }
 private void caculateAction()
 {
     if (newSession == null)
         this.action = ACTION.DELETE;
     else if (existingSession == null)
         this.action = ACTION.ADD;
     else if ((newSession.Hostname.Equals(existingSession.Hostname)) &&
              (newSession.FolderName.Equals(existingSession.FolderName)) &&
              (newSession.Protocol.Equals(existingSession.Protocol)) &&
              (newSession.Portnumber == existingSession.Portnumber) )
         this.action = ACTION.NONE;
     else
         this.action = ACTION.UPDATE;
 }
Пример #42
0
        private void mass_update(ref Node node, int left, int right, int query_left, int query_right, ACTION action, double value)
        {
            if (query_left > query_right)
                return;

            if (left == query_left && right == query_right)
            {
                if (left == right)
                    node.key = do_action(node.key, action, value);
                else if (action == ACTION.UPDATE)
                {
                    clear(ref node);
                    node.action = action;
                    node.number = value;
                }
                else
                {
                    push(ref node, left, right);
                    node.action = action;
                    node.number += value;
                }
            }
            else
            {
                if (node.action == ACTION.ADD || node.action == ACTION.UPDATE)
                    push(ref node, left, right);

                int center = (left + right) / 2;

                mass_update(ref node.left, left, center, query_left, Math.Min(query_right, center), action, value);
                mass_update(ref node.right, center + 1, right, Math.Max(query_left, center + 1), query_right, action, value);

                double left_value = 0, right_value = 0;

                if (node.left.action == ACTION.UPDATE)
                    left_value = (center - left + 1) * node.left.number;
                else if (node.left.action == ACTION.ADD)
                    left_value = node.left.key + (center - left + 1) * node.left.number;
                else
                    left_value = node.left.key;

                if (node.right.action == ACTION.UPDATE)
                    right_value = (center - left + 1) * node.right.number;
                else if (node.right.action == ACTION.ADD)
                    right_value = node.right.key + (center - left + 1) * node.right.number;
                else
                    right_value = node.right.key;

                node.key = left_value + right_value;
            }
        }
Пример #43
0
 void ParseProgramArguments(string[] args)
     {
     int i = 0;
     while (i < args.Length)
         {
         string arg = args[i];
         if (IsProgramCommand(arg))
             {
             string command = arg.Substring(1).ToLowerInvariant();
             switch (command)
                 {
             case "nice":
                 Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
                 break;
             case "felony":
                 this.action = ACTION.Felony;
                 break;
             case "f":
                 this.nadirFiles.Add(new NadirFileDesc(NextArg(ref i, args)));
                 this.action = ACTION.Parse;
                 break;
             case "fasta":
                 this.fastaFile = NextArg(ref i, args);
                 break;
             case "amplicon":
                 this.ichAmplicon = Convert.ToInt32(NextArg(ref i, args));
                 this.cchAmplicon = Convert.ToInt32(NextArg(ref i, args));
                 break;
             case "forward":
                 this.forwardPrimer = NextArg(ref i, args);
                 break;
             case "reverse":
                 this.reversePrimer = NextArg(ref i, args);
                 break;
             case "distill":
                 this.globalToDistill = NextArg(ref i, args);
                 this.fNoDistill = false;
                 break;
             case "nodistill":
                 this.fNoDistill = true;
                 break;
             case "nodesigntrace":
                 this.DesignVerbose = false;
                 break;
             case "designtrace":
                 i++;
                 this.DesignVerbose = true;
                 if (i < args.Length && !IsProgramCommand(args[i]))
                     {
                     this.DesignIterTrace = Convert.ToInt64(args[i]);
                     }
                 else
                     i--;
                 break;
             case "designsweep":
                 this.DesignIterMutSweep = Convert.ToInt64(NextArg(ref i, args));
                 break;
             case "designgoal":
                 this.DesignGoal = Convert.ToDouble(NextArg(ref i, args));
                 break;
             case "designbad":
                 this.DesignPessimize = true;
                 break;
             case "keepbest":
                 this.DesignBestScoreKeepCount = Convert.ToInt32(NextArg(ref i, args));
                 break;
             case "designmin":
                 this.DesignIterMin = Convert.ToInt64(NextArg(ref i, args));
                 break;
             case "designmax":
                 this.DesignIterMax = Convert.ToInt64(NextArg(ref i, args));
                 break;
             case "designtemp":
                 this.DesignTemp = Convert.ToInt32(NextArg(ref i, args));
                 break;
             case "designrate":
                 this.DesignMutationsPerIteration = Convert.ToDouble(NextArg(ref i, args));
                 break;
             case "design":
                 i++;
                 if (i < args.Length)
                     {
                     if (!IsProgramCommand(args[i]))
                         {
                         this.globalToDesign = args[i];      // name of the sequence designer to use
                         }
                     else
                         {
                         i--;
                         this.globalToDesign = "";           // empty string indictates default designer
                         }
                     }
                 else
                     this.globalToDesign = "";               // empty string indictates default designer
                 this.fNoDesign = false;
                 break;
             case "nodesign":
                 this.fNoDesign = true;
                 this.fOutputNucleotides = false;
                 break;
             case "verbose":
                 this.Verbose = PrettyPrintContext.VerboseDefault = true;
                 break;
             case "noverbose":
                 this.Verbose = PrettyPrintContext.VerboseDefault = false;
                 break;
             case "debug":
                 PrettyPrintContext.DebugDefault = true;
                 break;
             case "domconn":
                 PrettyPrintContext.DomainConnectionsDefault = true;
                 break;
             case "nt":
                 this.fOutputNucleotides = true;
                 break;
             case "debugtrace":
                 this.FTracingToDebug = true;
                 break;
             case "consoletrace":
                 this.FTracingToDebug = false;
                 break;
             case "dumpparse":
                 this.FDumpParse = true;
                 break;
             case "dumptrees":
                 this.FDumpTrees = true;
                 break;
             case "out":
                 switch (NextArg(ref i, args))
                     {
                 case "text":    
                     this.outputAsText = true;
                     break;
                 case "graph":   
                     this.outputAsGraph = true;
                     break;
                 default:
                     Usage(); 
                     break;
                     }
                 break;
             case "seed":
                 int seed = int.Parse(NextArg(ref i, args));
                 MiscUtil.SetRandomSeed(seed);
                 break;
             case "test":
                 this.test = Convert.ToInt32(NextArg(ref i, args));
                 this.action = ACTION.Test;
                 break;
             case "??":
                 this.showHiddenUsage = true;
                 Usage();
                 break;
             case "?":
             default:
                 Usage();
                 break;
                 }
             }
         else
             {
             // It's not a command arg: treat it as an input file as if -f had been specified
             //
             this.nadirFiles.Add(new NadirFileDesc(args[i]));
             this.action = ACTION.Parse;
             }
         //
         i++;
         }
     }
Пример #44
0
 private void cbbxAction_SelectedIndexChanged(object sender, EventArgs e)
 {
     curAction = (ACTION)cbbxAction.SelectedIndex;
     switch (curAction)
     {
         case ACTION.SEARCHIMAGE:
             tbxKeyword.Text = Settings.Default.keyword;
             mbxPerpage.Enabled = false;
             break;
         case ACTION.DOWNLOADSET:
             tbxKeyword.Text = Settings.Default.setID;
             mbxPerpage.Enabled = true;
             break;
     }
 }
Пример #45
0
        private void pointed_update(ref Node node, int left, int right, int position, ACTION action, double value)
        {
            if (left == right)
                node.key = do_action(node.key, action, value);
            else
            {
                int center = (left + right) / 2;

                if (node.action == ACTION.UPDATE)
                    push(ref node, left, right);

                if (position <= center)
                    pointed_update(ref node.left, left, center, position, action, value);
                else
                    pointed_update(ref node.right, center + 1, right, position, action, value);

                node.key = node.left.key + node.right.key;
            }
        }