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) { } } }
//// 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]); } } }
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); }
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; } } }
/// <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; } }
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()); }
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()); }
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); }
public static int Main(String[] args) { Coll coll = new Coll(); foreach (char c in coll) { } return(coll.disposed ? 0 : 1); }
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)); }
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()); }
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]); }
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))); }
private Collider2D TouchedCollider(Vector2 TouchPosition) { foreach (Collider2D Coll in dPad.GetComponents <Collider2D>()) { if (Coll.OverlapPoint(TouchPosition)) { return(Coll); } } return(null); }
/// <summary> /// Clear all ID3 Tag information /// </summary> public void ClearAll() { foreach (FrameCollectionBase Coll in _CollectionFrames.Values) { Coll.Clear(); } _SingleFrames.Clear(); _HaveTag = false; }
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); }
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); }
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); }
//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))); }
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); } }
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()); }
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); }
/// <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"); } }
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); } }
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])); }
// 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); } } } }
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)
public RealEnumerator (Coll c) { this.c = c; }