Exemplo n.º 1
0
        public void ForceSetValue(string text, bool update = false)
        {
            var validText = "";

            if (InputCheck == null)
            {
                validText = text;
            }
            else
            {
                foreach (var ch in text)
                {
                    if (InputCheck.Invoke(ch))
                    {
                        validText += ch;
                    }
                }
            }

            if (validText.Length > _limit)
            {
                _textBlock.SetString(validText.Substring(0, _limit));
                _cursorIndex = _textBlock.ToString().Length;
                return;
            }
            _textBlock.SetString(validText);
            _cursorIndex = _textBlock.ToString().Length;
            _textBlock.SetCaretIndex((uint)_cursorIndex);
            if (update)
            {
                OnChange?.Invoke(GetValue());
            }
        }
Exemplo n.º 2
0
        private int currentIndex;  //字段,用于存放当前行的下标

        public FrmLibrarySystem(string adminID)
        {
            InitializeComponent();
            logic        = new WinLogic(); //初始化类的对象
            ch           = new InputCheck();
            this.adminID = adminID;        //把传入的管理员ID赋给字段
        }
        protected override string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "Step":
            {
            }
            break;

            case "LarghezzaPassata":
            {
                error = InputCheck.MaggioreDiZero(LarghezzaPassata);
            } break;

            default:
                error = base.GetValidationError(propertyName);
                break;
            }

            return(error);
        }
        protected override string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "Velocita":
            {
                error = InputCheck.MaggioreDiZero(Velocita);
            }
            break;

            case "AvanzamentoSincrono":
            {
                error = InputCheck.MaggioreDiZero(AvanzamentoSincrono);
            } break;

            case "ProfonditaPassata":
            {
                error = InputCheck.MaggioreDiZero(ProfonditaPassata);
            } break;


            default:
                Debug.Fail("Unexpected property : " + propertyName);
                break;
            }

            return(error);
        }
Exemplo n.º 5
0
        public void ContainsFullWidthAlpthabetTest()
        {
            string target = "";

            // [\uFF21-\uFF3A]
            target = "@";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));

            target = "A";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));

            target = "Z";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));

            target = "[";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));

            // [\uFF41-\uFF5A]
            target = "`";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));

            target = "a";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));

            target = "z";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));

            target = "{";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthAlpthabet(target));
        }
        protected string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "LunghezzaCentroLato":
            {
                error = InputCheck.MaggioreDiZero(LunghezzaCentroLato.ToString());
            }
            break;

            case "Raggio":
            {
                error = InputCheck.MaggioreDiZero(Raggio.ToString());
            }
            break;


            default:
                Debug.Fail("Unexpected property : " + propertyName);
                break;
            }

            return(error);
        }
Exemplo n.º 7
0
        public void ContainsHalfWidthAlpthabetTest()
        {
            string target = "";

            // [\u0041-\u005A]
            target = "@";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));

            target = "A";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));

            target = "Z";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));

            target = "[";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));

            // [\u0061-\u007A]
            target = "`";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));

            target = "a";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));

            target = "z";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));

            target = "{";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthAlpthabet(target));
        }
        protected string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "Profondita":
            {
                error = InputCheck.MaggioreDiZero(Profondita.ToString());
            }
            break;

            case "SicurezzaZ":
            {
                if (SicurezzaZ <= InizioZ)
                {
                    error = "Must be higher than StartZ";
                }
            }
            break;

            default:
                Debug.Fail("Unexpected property : " + propertyName);
                break;
            }

            return(error);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 貸出ボタン押下時のチェック
        /// </summary>
        private void CheckLoanButton()
        {
            // シングルクォーテーションチェック
            InputCheck.IsSingleQuotation(this.txtId);

            // 書籍ID未入力チェック
            if (string.IsNullOrEmpty(this.txtId.Text))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[13].message, GlobalDefine.ERROR_CODE[13].code, txtId);
            }

            // 書籍IDが存在するか
            IsExistBookId();

            // ユーザ名未入力チェック
            if (string.IsNullOrEmpty(this.txtUserName.Text))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[17].message, GlobalDefine.ERROR_CODE[17].code);
            }

            // 返却予定日がnullだった場合
            if (dateReturn.Value == null)
            {
                throw new InputException(GlobalDefine.ERROR_CODE[18].message, GlobalDefine.ERROR_CODE[18].code);
            }

            // 貸出日より前の日付だった場合
            if (dateReturn.Value.Date < dateLoan.Value.Date)
            {
                throw new InputException(GlobalDefine.ERROR_CODE[19].message, GlobalDefine.ERROR_CODE[19].code);
            }
        }
Exemplo n.º 10
0
        protected string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "Radius":
            {
                error = InputCheck.MaggioreDiZero(Radius.ToString());
            }
            break;

            case "SideCount":
            {
                if (SideCount < 3)
                {
                    error = "Minimum 3 side";
                }
            }
            break;

            default:
                Debug.Fail("Unexpected property : " + propertyName);
                break;
            }

            return(error);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 書籍ID LostFocusチェック
        /// </summary>
        private void CheckTxtId()
        {
            // シングルクォーテーションチェック
            InputCheck.IsSingleQuotation(this.txtId);

            // 書籍IDが存在するか
            IsExistBookId();

            // 書籍が貸出中か
            DBAdapter dba   = SingletonObject.GetDbAdapter();
            string    query = string.Format("SELECT * FROM BOOK_STATUS WHERE BOOK_ID = '{0}'", txtId.Text);

            if (dba.FindRecord(query))
            {
                query = string.Format("SELECT " +
                                      "* " +
                                      "FROM " +
                                      "(SELECT * FROM BOOK_STATUS WHERE BOOK_ID = '{0}') " +
                                      "WHERE " +
                                      "(LENDING_STATUS = 0)",
                                      txtId.Text);

                if (!dba.FindRecord(query))
                {
                    throw new InputException(GlobalDefine.ERROR_CODE[20].message, GlobalDefine.ERROR_CODE[20].code, txtId);
                }
            }
        }
Exemplo n.º 12
0
    // Update is called once per frame
    void Update()
    {
        accel = accel_catch.GetComponent <InputCheck> ();
        a_x   = accel.acceleration.x;
        a_y   = accel.acceleration.y;
        a_z   = accel.acceleration.z;
        v_x  += a_x * h;
        if (1 <= r_x && r_x <= 3.3)
        {
            r_x += v_x * h;
        }
        if (1 > r_x && v_x > 0)
        {
            r_x += v_x * h;
        }
        if (3.3 < r_x && v_x < 0)
        {
            r_x += v_x * h;
        }
        //p_x = Mathf.Pow (r_x, 10);

        a_y  = accel.acceleration.y;
        v_y += a_y * h;
        if (1 <= r_y && r_y <= 2.5f)
        {
            r_y += v_y * h;
        }
        if (1 <= a_y && v_y > 0)
        {
            r_y += v_y * h;
        }
        if (2.50 < r_y && v_y < 0)
        {
            r_y += v_y * h;
        }


        /*if (m == 1) {
         *      if (a_x > 5) {
         *              m++;
         *              audioSource.clip = audioclip2;
         *      }
         * }*/

        //p_y = Mathf.Pow(10, 1 + r_x);

        if (a_x > 5)
        {
            oto [3].Play();
        }
        if (a_y > 5)
        {
            oto [4].Play();
        }
        if (a_z > 5)
        {
            oto [5].Play();
        }
    }
Exemplo n.º 13
0
        public void IsForceExecute_Multiple_Newlines_Should_Return_Expected(string input, bool expectedIsForceExecute)
        {
            var inputCheck = new InputCheck();

            var isForceExecute = inputCheck.IsForceExecute(input);

            Assert.That(isForceExecute, Is.EqualTo(expectedIsForceExecute));
        }
Exemplo n.º 14
0
        /// <summary>
        /// 確定ボタン押下時のチェック
        /// </summary>
        private void ApplyButtonCheck()
        {
            InputCheck.IsSingleQuotation(this.txtTitle);

            if (string.IsNullOrEmpty(this.txtTitle.Text))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[23].message, GlobalDefine.ERROR_CODE[23].code, this.txtTitle);
            }
        }
Exemplo n.º 15
0
        public void ContainsFullWidthSybolTest()
        {
            string target = "";

            // [\uFF01-\uFF0F]
            target = "＀";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "!";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "/";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "0";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));

            // [\uFF1A-\uFF20]
            target = "9";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = ":";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "@";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "A";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));

            // [\uFF3B-\uFF40]
            target = "Z";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "[";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "`";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "a";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));

            // [\uFF5B-\uFF65]
            target = "z";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "{";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "・";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthSybol(target));

            target = "ヲ";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthSybol(target));
        }
Exemplo n.º 16
0
        public void ContainsHalfWidthSybolTest()
        {
            string target = "";

            // [\u0021-\002F]
            target = " ";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "!";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "/";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "0";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            // [\u003A-\u0040]
            target = "9";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = ":";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "@";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "A";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            // [\u007B-\u007F]
            target = "Z";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "[";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "`";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "a";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            // [\u007B-\u007F]
            target = "z";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "{";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthSybol(target));

            target = "€";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthSybol(target));
        }
Exemplo n.º 17
0
    static int hMax = 300; //高さの最大値
    static void Main(string[] args)
    {
        float r = InputCheck.GetNumber("半径", rMin, rMax);
        float h = InputCheck.GetNumber("高さ", hMin, hMax);
        float s = 0; //底面積
        float v = 0; //体積

        s = GetCircleSurface(r);
        v = GetCylinderVolume(r, h);
        Console.WriteLine("底面積は{0},体積は{1}", s, v);
    }
Exemplo n.º 18
0
 public static bool isItType(string abc)
 {
     try
     {
         InputCheck.isType(abc);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 19
0
 public static bool isItInt(string abc)
 {
     try
     {
         InputCheck.isInt(abc, "test");
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// 検索条件チェック
        /// </summary>
        private void SearchInputChecks()
        {
            // シングルクォーテーションチェック
            InputCheck.IsSingleQuotation(txtId);
            InputCheck.IsSingleQuotation(txtTitle);

            // 貸出日より前の日付だった場合
            if (dateLoanStart.Value.Date > dateLoanEnd.Value.Date)
            {
                throw new InputException(GlobalDefine.ERROR_CODE[21].message, GlobalDefine.ERROR_CODE[21].code);
            }
        }
Exemplo n.º 21
0
 public override void OnStart()
 {
     shakeText.SetActive(true);
     canvas       = GameObject.Find("Canvas");
     input        = GameObject.Find("GameController").GetComponent <InputCheck>();
     birdInstance = Instantiate(bird, birdSpawnPosition, Quaternion.identity).gameObject;
     foreach (DiscoballRetract dr in canvas.GetComponentsInChildren <DiscoballRetract>())
     {
         dr.Retract();
     }
     Invoke("BeforeEnd", miniGameTimer - 2);
     Invoke("QuitState", miniGameTimer);
 }
Exemplo n.º 22
0
        protected string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            //case "SovrametalloPerFinitura":
            //    {
            //        error = InputCheck.MaggioreOUgualeDiZero(SovrametalloPerFinitura);
            //    }
            //    break;

            case "Sovrametallo":
            {
                error = InputCheck.MaggioreDiZero(Sovrametallo);
            }
            break;

            case "SicurezzaZ":
            {
                if (SicurezzaZ <= InizioLavorazioneZ)
                {
                    error = "Z Secure Level Too Low";
                }
            }
            break;

            case "Lunghezza":
            {
                error = InputCheck.MaggioreDiZero(Lunghezza);
            } break;

            case "ProfonditaLavorazioneZ":
            {
                error = InputCheck.MaggioreDiZero(ProfonditaLavorazioneZ);
            } break;

            default:
                Debug.Fail("Unexpected property : " + propertyName);
                break;
            }

            return(error);
        }
Exemplo n.º 23
0
        public void ContainsFullWidthNumberTest()
        {
            string target = "";

            // [\uFF10-\uFF19]
            target = "/";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthNumber(target));

            target = "0";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthNumber(target));

            target = "9";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthNumber(target));

            target = ":";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthNumber(target));
        }
Exemplo n.º 24
0
        public void ContainsFullWidthHiraganaTest()
        {
            string target = "";

            // [\u3041-\u3096]
            target = "぀";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthHiragana(target));

            target = "ぁ";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthHiragana(target));

            target = "ゖ";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthHiragana(target));

            target = "゗";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthHiragana(target));
        }
Exemplo n.º 25
0
        public void ContainsFullWidthKanaTest()
        {
            string target = "";

            // [\u30A1-\u30FA]
            target = "゠";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthKana(target));

            target = "ァ";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthKana(target));

            target = "ヺ";
            Assert.AreEqual(true, InputCheck.ContainsFullWidthKana(target));

            target = "・";
            Assert.AreNotEqual(true, InputCheck.ContainsFullWidthKana(target));
        }
Exemplo n.º 26
0
        public void ContainsHalfWidthKanaTest()
        {
            string target = "";

            // [\uFF61-\uFF9F]
            target = "⦆";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthKana(target));

            target = "。";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthKana(target));

            target = "゚";
            Assert.AreEqual(true, InputCheck.ContainsHalfWidthKana(target));

            target = "ᅠ";
            Assert.AreNotEqual(true, InputCheck.ContainsHalfWidthKana(target));
        }
Exemplo n.º 27
0
 public override void OnStart()
 {
     freestyleText.SetActive(true);
     freestyleUI.SetActive(true);
     recentMovesP1 = new List <TempMove>();
     recentMovesP2 = new List <TempMove>();
     inputCheck    = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputCheck>();
     scoringSystem = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoringSystem>();
     canvas        = GameObject.Find("Canvas");
     foreach (DiscoballRetract dr in canvas.GetComponentsInChildren <DiscoballRetract>())
     {
         dr.Retract();
     }
     foreach (FreestyleDiscoball dr in canvas.GetComponentsInChildren <FreestyleDiscoball>())
     {
         dr.Extend();
     }
 }
        protected string GetValidationError(string propertyName)
        {
            if (Array.IndexOf(ValidatedProperties, propertyName) < 0)
            {
                return(null);
            }

            string error = null;

            switch (propertyName)
            {
            case "LarghezzaCava":
            {
                error = InputCheck.MaggioreDiZero(LarghezzaCava);
            }
            break;

            case "SicurezzaZ":
            {
                if (InizioLavorazioneZ >= SicurezzaZ)
                {
                    error = "Z Secure Level Too Low";
                }
            }
            break;

            case "ProfonditaLavorazioneZ":
            {
                error = InputCheck.MaggioreDiZero(ProfonditaLavorazioneZ);
            } break;

            case "LunghezzaCava":
            {
                error = InputCheck.MaggioreDiZero(LunghezzaCava);
            } break;

            default:
                Debug.Fail("Unexpected property : " + propertyName);
                break;
            }

            return(error);
        }
        public static void Main(string[] args)
        {
            SecretGenerator  secretGenerator = new SecretGenerator();
            BullsAndCowsGame game            = new BullsAndCowsGame(secretGenerator);
            InputCheck       inputCheck      = new InputCheck();

            while (game.CanContinue)
            {
                var input = Console.ReadLine();
                input = inputCheck.CheckInput(input);
                if (!IsNullOrEmpty(input))
                {
                    var output = game.Guess(input);
                    Console.WriteLine(output);
                }
            }

            Console.WriteLine("Game Over");
        }
Exemplo n.º 30
0
        public void PassesWhen_GoodFirstNameInput(string input)
        {
            //arrange
            InputCheck        inputCheck = new InputCheck();
            ArgumentException actual     = null;

            //act
            try
            {
                inputCheck.FirstNameToCheck = input;
                inputCheck.CheckFirstNameField();
            }
            catch (ArgumentException exception)
            {
                actual = exception;
            }

            //assert
            Assert.IsNull(actual);
        }