Exemplo n.º 1
0
        public static List <KeyColor> getKeyColor(Utils.MyRawBitmapData bitmapData, int num)
        {
            List <KeyColor> ret = new List <KeyColor>();
            Dictionary <Utils.MyColor, PostValue> htColor = new Dictionary <Utils.MyColor, PostValue>(new Utils.MyColor.EqualityComparer());

            for (int y = 0; y < bitmapData.height; y++)
            {
                for (int x = 0; x < bitmapData.width; x++)
                {
                    Utils.MyColor m = bitmapData.GetColor(x, y);
                    if (htColor.ContainsKey(m))
                    {
                        htColor[m].inc();
                    }
                    else
                    {
                        htColor[m] = new PostValue(1, new Point(x, y));
                    }
                }
            }
            foreach (Utils.MyColor m in htColor.Keys)
            {
                if (htColor[m].value == 1)
                {
                    ret.Add(new KeyColor(m, htColor[m].pos));
                    //Console.WriteLine("getKeyColor " + m + " " + htColor[m].pos);
                    if (ret.Count >= num)
                    {
                        break;
                    }
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
        private void Send_GetGrade_Req()
        {
            string PostValue;
            Regex  input      = new Regex("input type=\"hidden\" name=\".*?\" value=\".*?\"");
            Regex  inputname  = new Regex("name=\".*?\"");
            Regex  inputvalue = new Regex("value=\".*?\"");
            Regex  Time       = new Regex("\\d{4}");

            Match yearmatch = Time.Match(YearOfGrade);

            MatchCollection inputmatch = input.Matches(WebCode);

            PostValue  = inputname.Match(inputmatch[0].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=xnd&" + inputname.Match(inputmatch[1].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=&" + inputname.Match(inputmatch[2].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=" + inputvalue.Match(inputmatch[2].Value).ToString().Replace("name=\"", "").Replace("\"", "").Replace("+", "%2b") + "&hidLanguage=&ddlXN=";
            PostValue += yearmatch.Value + "-" + Convert.ToString(Convert.ToInt32(yearmatch.Value) + 1) + "&ddlXQ=" + TermOfGrade + "&ddl_kcxz=&btn_xq=%D1%A7%C6%DA%B3%C9%BC%A8";
            PostValue  = PostValue.Replace("value=", "");
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(PostValue);

            Send_Post Post = new Send_Post(Url, Url, bytes);

            if (Post.GetStatus() == false)
            {
                IsSucceed = false;
                return;
            }

            WebCode = Post.GetOutPut();

            RegexGrade();
        }
Exemplo n.º 3
0
        public IEnumerable <string> Post([FromBody] PostValue value)
        {
            //Rake.Rake rake = new Rake.Rake("stopwords.txt");
            Rake.Rake rake = new Rake.Rake();

            var teste = rake.Run(value.Value);

            return(teste.Where((s, d) => s.Value > 1).Select((s, d) => s.Key));
        }
        public async Task Errors_DeserializeContentTypeNotFound()
        {
            var postValue = new PostValue {
                X = 10, Y = 5
            };

            var response = await Post("/IntMath/Add", postValue);

            Assert.NotNull(response);
            Assert.Equal(HttpStatusCode.UnsupportedMediaType, response.StatusCode);
        }
Exemplo n.º 5
0
        public async Task Serialization_MessagePack_Simple()
        {
            var postValue = new PostValue {
                X = 10, Y = 5
            };

            var response = await Post("/IntMath/Add", postValue);

            var result = await Deserialize <int>(response);

            Assert.Equal(postValue.X + postValue.Y, result);
        }