예제 #1
0
        public void Post([FromBody] Coll value)
        {
            //Db:
            //------------------------------------------------------
            string conStr =
                System.Configuration.ConfigurationManager.
                ConnectionStrings["Model1"].ConnectionString;

            using (SqlConnection con = new SqlConnection(conStr))
            {
                try
                {
                    //
                    // Open the SqlConnection.
                    //
                    con.Open();
                    //
                    // The following code uses an SqlCommand based on the SqlConnection.
                    //
                    using (SqlCommand command = new SqlCommand("CREATE TABLE " + value.ColName + "(feedID int NOT NULL IDENTITY(1, 1), feedUrl varchar(50));", con))
                        command.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #2
0
        //// POST: api/Collections
        //public void Post([FromBody]string value)
        //{
        //}
        //удаление коллекции:
        // POST: api/Collections
        public void Post([FromBody] Coll value)
        {
            //Db:
            //drop table:
            //------------------------------------------------------
            string conStr =
                System.Configuration.ConfigurationManager.
                ConnectionStrings["Model1"].ConnectionString;

            using (SqlConnection con = new SqlConnection(conStr))
            {
                try
                {
                    //
                    // Open the SqlConnection.
                    //
                    con.Open();
                    //
                    // The following code uses an SqlCommand based on the SqlConnection.
                    //
                    using (SqlCommand command = new SqlCommand("DROP TABLE " + value.ColName, con))
                        command.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                }
            }
        }
        /// <summary>
        /// Given a string dictionary, parse the .config file for entries matching a prefix and midfix (located after the prefix), and add to the dictionary
        /// </summary>
        /// <param name="Coll">Your dictionary</param>
        /// <param name="Prefix">Your prefix</param>
        /// <param name="Midfix">Your "midfix"</param>
        public static void BuildCollectionFromConfig(StringDictionary Coll, string Prefix, string Midfix)
        {
            if (Coll == null)
            {
                Coll = new StringDictionary();
            }

            if (Midfix == null)
            {
                Midfix = string.Empty;
            }

            if (string.IsNullOrEmpty(Prefix))
            {
                throw new ApplicationException("SetupCollectionFromConfig requires a prefix and optional midfix to lookup values.");
            }

            string[] Keys = ServerDependentSection.AllKeys;
            foreach (string Key in Keys)
            {
                if (Key.StartsWith(Prefix + Midfix) && !Coll.ContainsKey(Key))
                {
                    Coll.Add(Key.Remove(0, Prefix.Length), ServerDependentSection[Key]);
                }
            }
        }
예제 #4
0
        private static void LogOperateOne(dynamic user, Enum business, string operateType, string id, object content = null, string update = null, string title = null)
        {
            var    time   = DateTime.Now;
            string filter = null;

            if (operateType != BusinessOperateType.InsertOne)
            {
                filter = $"{{_id:\"{id}\"}}";
                if (ObjectId.TryParse(id, out _))
                {
                    filter += $" | {{ _id: ObjectId('{id}')}}";
                }
            }
            var log = new BusinessLog
            {
                App         = App,
                Business    = business.ToString(),
                Title       = title,
                OperateType = operateType,
                Operator    = new() { Rid = user.Rid, Name = user.Name, Time = time },
                Key         = id,
                Filter      = filter,
                Update      = update,
                EffectCount = 1,
                Content     = content?.ToJson(),
                Text        = $"[{user.Name}:{user.Rid}] [{time:yyyy-MM-dd}] [{operateType}] [_id:{id}] [{App.Name}]"
            };

            Coll.InsertOne(log);
        }
예제 #5
0
 void Movement()
 {
     if (Faceleft)
     {
         if (Coll.IsTouchingLayers(Ground))
         {
             Anim.SetBool("jumping", true);
             rb.velocity = new Vector2(-Speed, JumpForce);
         }
         if (transform.position.x < leftx)
         {
             transform.localScale = new Vector3(-1, 1, 1);
             Faceleft             = false;
         }
     }
     else
     {
         if (Coll.IsTouchingLayers(Ground))
         {
             Anim.SetBool("jumping", true);
             rb.velocity = new Vector2(Speed, JumpForce);
         }
         if (transform.position.x > rightx)
         {
             transform.localScale = new Vector3(1, 1, 1);
             Faceleft             = true;
         }
     }
 }
예제 #6
0
        /// <summary>
        /// What do when a collision ends
        /// </summary>
        /// <param name="sender">Who WAS I colliding with?</param>
        /// <param name="e">Ignore this</param>
        protected override void HandleCollisionExit(object sender, EventArgs e)
        {
            //Cast to a Collider
            Collider other = (Collider)sender;

            switch (state)
            {
            case PlayerState.OnLand:
                //If you walk off a platform, you should fall if you're no longer colliding below with anything
                if (other.Host is Platform)
                {
                    if (!CollBelow.CollidingWith <Platform>() && !Coll.CollidingWith <Water>())
                    {
                        Acceleration = airAcceleration;
                        state        = PlayerState.InAir;
                    }
                }
                break;

            case PlayerState.InAir:
                break;

            case PlayerState.InWater:
                break;

            case PlayerState.IsDead:
                break;

            default:
                break;
            }
        }
예제 #7
0
파일: test-188.cs 프로젝트: nobled/mono
	public static int Main(String[] args)
	{
		Coll coll = new Coll ();
		foreach (char c in coll) {
		}
		return (coll.disposed ? 0 : 1);
	}
        public void Where_IfElse_Queryable()
        {
            var query     = Coll.Array(1, 2, 3, 4, 5, 6, 7, 8).AsQueryable();
            var condition = true;

            Assert.Equal(4, query.Where(condition, x => x % 2 == 0, x => x % 3 == 0).Count());
            Assert.Equal(2, query.Where(!condition, x => x % 2 == 0, x => x % 3 == 0).Count());
        }
예제 #9
0
        public void Where_IfElse()
        {
            var list      = Coll.Array(1, 2, 3, 4, 5, 6, 7, 8);
            var condition = true;

            Assert.Equal(4, list.Where(condition, x => x % 2 == 0, x => x % 3 == 0).Count());
            Assert.Equal(2, list.Where(!condition, x => x % 2 == 0, x => x % 3 == 0).Count());
        }
예제 #10
0
        public void Split_Empty_ClearEmpty()
        {
            var empty = Coll.Array <int>();
            var r     = empty.Split(x => x == 1, clearEmpty: true);

            Assert.NotNull(r);
            Assert.Empty(r);
        }
예제 #11
0
    public static int Main(String[] args)
    {
        Coll coll = new Coll();

        foreach (char c in coll)
        {
        }
        return(coll.disposed ? 0 : 1);
    }
예제 #12
0
        public void Split_Empty()
        {
            var empty = Coll.Array <int>();
            var r     = empty.Split(x => x == 1);

            Assert.NotNull(r);
            Assert.Equal(1, r.Count());
            Assert.Empty(r.ElementAt(0));
        }
예제 #13
0
        public void Where_If()
        {
            //Setup
            var list      = Coll.Array(1, 2, 3, 4, 5, 6, 7, 8);
            var condition = true;

            //Exercise & Verify
            Assert.Equal(4, list.Where(condition, x => x % 2 == 0).Count());
            Assert.Equal(list.Count(), list.Where(!condition, x => x % 2 == 0).Count());
        }
예제 #14
0
        public void Array()
        {
            var r = Coll.Array(1, 2, 3, 3, 5);

            Assert.Equal(5, r.Length);
            Assert.Equal(1, r[0]);
            Assert.Equal(2, r[1]);
            Assert.Equal(3, r[2]);
            Assert.Equal(3, r[3]);
            Assert.Equal(5, r[4]);
        }
예제 #15
0
        public void ContainsAny_ArrayItems_ShouldContainAnyItems()
        {
            // Setup
            var sut = Coll.Array(1, 2, 3, 4, 5, 6, 7, 8);

            // Exercise
            var actual = sut.ContainsAny(new int[] { 1, 3, 5 });

            // Verify
            Assert.True(actual);
        }
        public static IDictionary <TKey, TValue> Merge <TKey, TValue>(
            this IDictionary <TKey, TValue> source,
            IDictionary <TKey, TValue> arg)
        {
            if (arg == null)
            {
                throw new ArgumentNullException("arg");
            }

            return(source.Merge(Coll.Array(arg)));
        }
예제 #17
0
 private Collider2D TouchedCollider(Vector2 TouchPosition)
 {
     foreach (Collider2D Coll in dPad.GetComponents <Collider2D>())
     {
         if (Coll.OverlapPoint(TouchPosition))
         {
             return(Coll);
         }
     }
     return(null);
 }
예제 #18
0
        /// <summary>
        /// Clear all ID3 Tag information
        /// </summary>
        public void ClearAll()
        {
            foreach (FrameCollectionBase Coll in _CollectionFrames.Values)
            {
                Coll.Clear();
            }

            _SingleFrames.Clear();

            _HaveTag = false;
        }
예제 #19
0
        public void ContainsAll_ArrayItems_ShouldContainAllItems()
        {
            // Setup
            var sut = Coll.Array(1, 2, 3, 4, 5, 6, 7, 8);
            var expectedContainedArray = new int[] { 1, 2, 3, 4 };

            // Exercise
            var actual = sut.ContainsAll(expectedContainedArray);

            // Verify
            Assert.True(actual);
        }
예제 #20
0
        public void ForEach_MultipleParameters()
        {
            var list = Coll.Array(1, 2, 3, 4);
            var acc  = 0;

            list.ForEach((i, o) =>
            {
                acc += (i * o);
            });

            Assert.Equal(20, acc);
        }
예제 #21
0
        public void ForEach_SingleParameter()
        {
            var list = Coll.Array(1, 2, 3, 4, 5, 6, 7, 8);
            var acc  = 0;

            list.ForEach((i) =>
            {
                acc += i;
            });

            Assert.Equal(list.Sum(), acc);
        }
예제 #22
0
        //Add Rss :
        // POST: api/AddAllFeeds
        public List <RSS> Post([FromBody] Coll value)
        {
            //System.Threading.Thread.Sleep(1000);

            List <RSS> RSSList = RssReaderVS2017.Models.RssReader.GetAllRssFeeds(value.ColName);

            //Thread.Sleep(10000);

            // return RSSList.Skip(Math.Max(0, RSSList.Count() - LastN)).ToList();
            //выбераем первые 5 постов:
            return(RSSList.Take(5).ToList());
        }
        public void WhereBetween()
        {
            var query = Coll.Array(
                DateTime.Today.AddMonths(-2),
                DateTime.Today,
                DateTime.Today.AddMonths(2)
                ).AsQueryable();

            var queryFiltered = query.WhereBetween(x => x, DateTime.Today.AddMonths(-1), DateTime.Today.AddMonths(1));

            Assert.Equal(1, queryFiltered.Count());
            Assert.True(queryFiltered.Contains(query.ElementAt(1)));
            Assert.False(queryFiltered.ContainsAny(query.ElementAt(0), query.ElementAt(2)));
        }
예제 #24
0
    private void OnCollisionStay(Collision collision)
    {
        Coll coll = collision.collider.GetComponent <Coll> ();

        if (coll != null)
        {
            // hit Collider:
            woodFxEmission.enabled    = true;
            woodFx.transform.position = collision.contacts [0].point;

            coll.HitCollider(hitDamage);
            wood.Hit(coll.index, hitDamage);
        }
    }
예제 #25
0
        public void Where_In_TProp_TPropNullableItems_ReturnsDTO1()
        {
            var dto1 = new WhereInDTO(1, "zzz", 1);
            var dto2 = new WhereInDTO(2, "aaa", null);
            var dto3 = new WhereInDTO(3, "hhh", 3);

            var items = Enumerable.Range(1, 1).Cast <int?>();

            var query = Coll.Array(dto1, dto2, dto3);

            var res = query.Where(x => x.Property1, items);

            Assert.Equal(dto1, res.ElementAt(0));
            Assert.Equal(1, res.Count());
        }
예제 #26
0
        public void FinishParse()
        {
            EntityShape es = GetShape(DamageMode, out Location offset, false);

            Coll = es.GetCollidableInstance();
            Coll.LocalPosition = offset.ToBVector();
            Vector3    zero  = Vector3.Zero;
            Quaternion ident = Quaternion.Identity;

            Coll.UpdateWorldTransform(ref zero, ref ident);
            RigidTransform rt = new RigidTransform(zero, ident);

            Coll.UpdateBoundingBoxForTransform(ref rt);
            EntityShape es2 = GetShape(DamageMode, out offset, true);
        }
예제 #27
0
        /// <summary>
        /// Check for a collision with water when we're not swimming
        /// </summary>
        /// <param name="other">Collider to check with</param>
        private void CheckForWaterWhenNotSwimming()
        {
            if (Coll.CollidingWith <Water>() && !CollBelow.CollidingWith <Platform>())
            {
                state        = PlayerState.InWater;
                Acceleration = .05f * airAcceleration;
                Velocity.Y   = MathHelper.Clamp(Velocity.Y, -MoveSpeed, MoveSpeed);

                //Turn blue to match water
                DrawColor = Color.Blue;

                //Loop ambient swim noise
                GameManager.LoopSFX("WaterLoop");
            }
        }
예제 #28
0
 void SwitchAnim()
 {
     if (Anim.GetBool("jumping"))
     {
         if (rb.velocity.y < 0.1)
         {
             Anim.SetBool("jumping", false);
             Anim.SetBool("falling", true);
         }
     }
     if (Coll.IsTouchingLayers(Ground) && Anim.GetBool("falling"))
     {
         Anim.SetBool("falling", false);
     }
 }
예제 #29
0
        public static string ToHumanFileSize(this long bytes)
        {
            var sizes = Coll.Array("B", "KB", "MB", "GB");

            var len   = bytes;
            var order = 0;

            while (len >= 1024 && order + 1 < sizes.Length)
            {
                order = order + 1;
                len   = len / 1024;
            }

            return(string.Format("{0:0.##} {1}", len, sizes[order]));
        }
예제 #30
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.F))
     {
         Collider[] Colliders = Physics.OverlapSphere(transform.position, radius);
         foreach (Collider Coll in Colliders)
         {
             Vector3 direction = Coll.transform.position - transform.position;
             if (Vector3.Dot(transform.forward, direction) > 0.5f)
             {
                 Coll.SendMessage("Operate", SendMessageOptions.DontRequireReceiver);
             }
         }
     }
 }
예제 #31
0
        public void Where_In_TProp_TPropNullableItems_NullItems_ReturnsAll()
        {
            var dto1 = new WhereInDTO(1, "zzz", 1);
            var dto2 = new WhereInDTO(2, "aaa", null);
            var dto3 = new WhereInDTO(3, "hhh", 3);

            IEnumerable <int?> items = null;

            var query = Coll.Array(dto1, dto2, dto3);

            var res = query.Where(x => x.Property1, items);

            Assert.Equal(dto1, res.ElementAt(0));
            Assert.Equal(dto2, res.ElementAt(1));
            Assert.Equal(dto3, res.ElementAt(2));
        }
 private void OnCollisionEnter(Coll{caret}ision other)
예제 #33
0
파일: test-188.cs 프로젝트: nobled/mono
	public RealEnumerator (Coll c) {
		this.c = c;
	}