public VdOtherType(XmlNode otherNode, OtherType type) { Id = otherNode.Name; Type = type; SourceName = AtributeValue(ref otherNode, "SourcePath"); if (Type == OtherType.ProjectOutput) { // Real DestName should be parsed from .csproj file which is really difficult // Instead simply keep only file name (without path) DestName = AtributeValue(ref otherNode, "TargetName"); if (String.IsNullOrEmpty(DestName)) { int iPos = SourceName.LastIndexOf('\\'); if (iPos > 0) { DestName = SourceName.Substring(iPos + 1); } else { DestName = SourceName; } } } else { DestName = AtributeValue(ref otherNode, "TargetName"); } FolderId = AtributeValue(ref otherNode, "Folder"); Exclude = VdProduct.AtrToBool(AtributeValue(ref otherNode, "Exclude")); }
public IHttpActionResult PutOtherType(int id, OtherType otherType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != otherType.ID) { return(BadRequest()); } db.Entry(otherType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!OtherTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/// <summary> /// Initializes a new instance of the <see cref="ChangingAttachmentsEventArgs"/> class. /// </summary> /// <param name="item"><inheritdoc cref="ChangingAttributesEventArgs.OldItem"/></param> /// <param name="newSight"><inheritdoc cref="ChangingAttributesEventArgs.NewSight"/></param> /// <param name="newBarrel"><inheritdoc cref="ChangingAttributesEventArgs.NewBarrel"/></param> /// <param name="newOther"><inheritdoc cref="ChangingAttributesEventArgs.NewOther"/></param> /// <param name="isAllowed"><inheritdoc cref="ChangingAttributesEventArgs.IsAllowed"/></param> public ChangingAttachmentsEventArgs(Inventory.SyncItemInfo item, SightType newSight, BarrelType newBarrel, OtherType newOther, bool isAllowed = true) : base(item, item, isAllowed) { NewSight = newSight; NewBarrel = newBarrel; NewOther = newOther; }
/// <summary> /// Initializes a new instance of the <see cref="ChangingAttachmentsEventArgs"/> class. /// </summary> /// <param name="item"><inheritdoc cref="ChangingAttributesEventArgs.OldItem"/></param> /// <param name="newSight"><inheritdoc cref="NewSight"/></param> /// <param name="newBarrel"><inheritdoc cref="NewBarrel"/></param> /// <param name="newOther"><inheritdoc cref="NewOther"/></param> /// <param name="isAllowed"><inheritdoc cref="ChangingAttributesEventArgs.IsAllowed"/></param> public ChangingAttachmentsEventArgs(Firearm item, SightType newSight, BarrelType newBarrel, OtherType newOther, bool isAllowed = true) : base(item, item, isAllowed) { NewSight = newSight; NewBarrel = newBarrel; NewOther = newOther; OldItem = (API.Features.Items.Firearm)Item.Get(item); }
public bool InsertOtherType(OtherType otherType) { using (EShopDB db = new EShopDB()) { db.OtherType.Add(otherType); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public void can_get_othertype_typed() { var item = new OtherType<bool>() { Item1 = true }; var tstr = JsonSerializer.SerializeToString(item); Assert.True(tstr.Contains(":true")); var deser = JsonSerializer.DeserializeFromString<OtherType<bool>>(tstr); Assert.True(deser.Item1); //works }
public void ComplexDataStructure2EqualType() { // arrange var t1 = new OtherType() { Id = Guid.Parse("8e6ce36f-3ce4-4d2f-bff8-6e78db373001"), Name = "type_1" }; var t2_1 = new DotNetType() { Id = Guid.Parse("8e6ce36f-3ce4-4d2f-bff8-6e78db373002"), Name = "type_2", Type = typeof(bool) }; var t2_2 = new DotNetType() { Id = Guid.Parse("8e6ce36f-3ce4-4d2f-bff8-6e78db373002"), Name = "type_2", Type = typeof(bool) }; var t3 = new DotNetType() { Id = Guid.Parse("8e6ce36f-3ce4-4d2f-bff8-6e78db373003"), Name = "type_3", Type = typeof(bool) }; var t4 = new DotNetType() { Id = Guid.Parse("8e6ce36f-3ce4-4d2f-bff8-6e78db373004"), Name = "type_4", Type = typeof(int) }; // act & assert Assert.IsTrue(t1.Equals(t1)); Assert.IsFalse(t1.Equals(t2_1)); Assert.IsFalse(t1.Equals(t2_2)); Assert.IsFalse(t1.Equals(t3)); Assert.IsFalse(t1.Equals(t4)); Assert.IsFalse(t2_1.Equals(t1)); Assert.IsTrue(t2_1.Equals(t2_1)); Assert.IsTrue(t2_1.Equals(t2_2)); Assert.IsFalse(t2_1.Equals(t3)); Assert.IsFalse(t2_1.Equals(t4)); Assert.IsFalse(t2_2.Equals(t1)); Assert.IsTrue(t2_2.Equals(t2_1)); Assert.IsTrue(t2_2.Equals(t2_2)); Assert.IsFalse(t2_2.Equals(t3)); Assert.IsFalse(t2_2.Equals(t4)); Assert.IsFalse(t3.Equals(t1)); Assert.IsFalse(t3.Equals(t2_1)); Assert.IsFalse(t3.Equals(t2_2)); Assert.IsTrue(t3.Equals(t3)); Assert.IsFalse(t3.Equals(t4)); Assert.IsFalse(t4.Equals(t1)); Assert.IsFalse(t4.Equals(t2_1)); Assert.IsFalse(t4.Equals(t2_2)); Assert.IsFalse(t4.Equals(t3)); Assert.IsTrue(t4.Equals(t4)); }
public IHttpActionResult GetOtherType(int id) { OtherType otherType = db.OtherType.Find(id); if (otherType == null) { return(NotFound()); } return(Ok(otherType)); }
static void Handle(OtherType other) { if (other.Status) { Console.WriteLine("Status received ok"); } else { Console.WriteLine("Status received not okay"); } }
public IHttpActionResult PostOtherType(OtherType otherType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.OtherType.Add(otherType); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = otherType.ID }, otherType)); }
public ActionResult EditSearchInfo(string searchId, string typeContent) { OtherType ot = otManager.FindById(searchId); ot.TypeContent = typeContent; bool result = otManager.UpdateOtherType(ot); if (result) { TempData["mess"] = "内容‘" + typeContent + "’修改成功"; } return(Redirect("Index")); }
public bool DeleteOtherType(string id) { using (EShopDB db = new EShopDB()) { OtherType otherType = new OtherType() { Id = id }; db.OtherType.Attach(otherType); db.OtherType.Remove(otherType); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public void can_get_othertype_typed() { var item = new OtherType <bool>() { Item1 = true }; var tstr = JsonSerializer.SerializeToString(item); Assert.True(tstr.Contains(":true")); var deser = JsonSerializer.DeserializeFromString <OtherType <bool> >(tstr); Assert.True(deser.Item1); //works }
public IHttpActionResult DeleteOtherType(int id) { OtherType otherType = db.OtherType.Find(id); if (otherType == null) { return(NotFound()); } db.OtherType.Remove(otherType); db.SaveChanges(); return(Ok(otherType)); }
public void ShouldSerializePolymorphicTypesWithNullValues() { var expected = new OtherType { Object = null, Interface = null, Abstract = null }; byte[] serialized = _serializer.Serialize(expected); var actual = _serializer.Deserialize <OtherType>(serialized); AssertProperties(expected, actual); }
public LMCookieJS OnOtherLogin(OtherType otherType, string otherId, string email, string firstName, string lastName) { var db = driverLow.create(); email = email.ToLower(); var userObj = db.userReadForEdit<User_Data>(email); userObj.dataObj = new LMCookieJS { VerifyStatus = VerifyStates.ok, EMail = email, Type = otherType, TypeId = otherId, FirstName = firstName, LastName = lastName, created = LowUtils.nowToNum(), }; db.SaveChanges(); return userObj.dataObj; }
public static void NegativeMakeTypedReference() { OtherType data = new OtherType { oneStruct = new OneStruct { field = "field", b = 2343 } }; Type dataType = data.GetType(); Assert.Throws <ArgumentNullException>(() => { TypedReference.MakeTypedReference(null, dataType.GetFields()); }); Assert.Throws <ArgumentNullException>(() => { TypedReference.MakeTypedReference(data, null); }); Assert.Throws <ArgumentException>(() => { TypedReference.MakeTypedReference(data, Array.Empty <FieldInfo>()); }); Assert.Throws <ArgumentException>(() => { TypedReference.MakeTypedReference(data, new FieldInfo[] { dataType.GetField("oneStruct"), null }); }); Assert.Throws <ArgumentException>(() => { TypedReference.MakeTypedReference(data, new FieldInfo[] { dataType.GetField("oneStruct"), typeof(OneStruct).GetField("b") }); }); }
public static void MakeTypedReference_ToObjectTests() { OneStruct structObj = new OneStruct { field = "field", b = 2343 }; OtherType data = new OtherType { oneStruct = structObj }; Type dataType = data.GetType(); TypedReference reference = TypedReference.MakeTypedReference(data, new FieldInfo[] { dataType.GetField("oneStruct"), typeof(OneStruct).GetField("field") }); Assert.Equal("field", TypedReference.ToObject(reference)); reference = TypedReference.MakeTypedReference(data, new FieldInfo[] { dataType.GetField("oneStruct") }); Assert.Equal(structObj, TypedReference.ToObject(reference)); }
public ActionResult AddNewSearch(int typeCode, string typeContent) { OtherType ot = new OtherType() { Id = Guid.NewGuid().ToString(), TypeName = "hotSearch", TypeCode = typeCode, TypeContent = typeContent }; bool success = otManager.InsertOtherType(ot);//.InsertBookType(bt);//.AddInfo(upi); if (success) { TempData["mess"] = "成功添加新内容:" + ot.TypeContent; } return(Redirect("Index")); }
public bool UpdateOtherType(OtherType otherType) { using (EShopDB db = new EShopDB()) { var oldOtherType = db.OtherType.Find(otherType.Id); if (oldOtherType != null) { oldOtherType.TypeCode = otherType.TypeCode; oldOtherType.TypeContent = otherType.TypeContent; bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } else { return(false); } } }
public void ShouldSerializePolymorphicTypes() { var expected = new OtherType { Object = new PolyImpl { Text = "aaa", Int = 3 }, Interface = new PolyImpl { Text = "bbb", Int = 4 }, Abstract = new PolyImpl { Text = "ccc", Int = 5 } }; byte[] serialized = _serializer.Serialize(expected); var actual = _serializer.Deserialize <OtherType>(serialized); AssertProperties(expected, actual); }
public string GetItemName(float type, float id) { switch (type) { case (int)TypeOfItem.Type.Weapon: return((WeaponType.GetWeaponName(id) + "_" + (id + 1).ToString()).ToUpper()); case (int)TypeOfItem.Type.Ring: return((RingType.GetRingName(id) + "_" + (id + 1).ToString()).ToUpper()); case (int)TypeOfItem.Type.Amulet: return((AmuletType.GetAmuletName(id) + "_" + (id + 1).ToString()).ToUpper()); case (int)TypeOfItem.Type.Armor: return((ArmorType.GetArmorName(id) + "_" + (id + 1).ToString()).ToUpper()); default: return((OtherType.GetOtherName(id) + "_" + (id + 1).ToString()).ToUpper()); } }
public void CreateForm(OtherType type) { switch (type) { case OtherType.UploadScreenshot: #region UploadScreenshot this.Size = new Size(257, 129); OpenFileDialog.InitialDirectory = SettingsManager.screenshots_path; OpenFileDialog.Filter = L18n.Get("OtherHelper", "Text_imgexts"); wrapper.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); wrapper.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); btnUpload.Click += UploadScreenshot_Click; wrapper.Controls.Add(label, 0, 0); wrapper.Controls.Add(btnChoose, 1, 0); wrapper.Controls.Add(txbLink, 0, 1); wrapper.Controls.Add(btnUpload, 1, 1); this.Controls.Add(wrapper); #endregion break; case OtherType.UploadVideo: #region UploadVideo this.Size = new Size(322, 144); OpenFileDialog.InitialDirectory = SettingsManager.videos_path; OpenFileDialog.Filter = L18n.Get("OtherHelper", "Text_videoexts"); wrapper.RowStyles.Add(new RowStyle(SizeType.Percent, 30F)); wrapper.RowStyles.Add(new RowStyle(SizeType.Percent, 40F)); wrapper.RowStyles.Add(new RowStyle(SizeType.Percent, 30F)); btnUpload.Click += UploadVideo_Click; wrapper.Controls.Add(label, 0, 0); wrapper.Controls.Add(btnChoose, 1, 0); wrapper.Controls.Add(group, 0, 1); wrapper.SetColumnSpan(group, 3); wrapper.Controls.Add(btnUpload, 1, 2); this.Controls.Add(wrapper); #endregion break; } }
public static void parseOtherTypeId(Int64 id, out OtherType type, out int otherId) { otherId = (int)id; type = (OtherType)(int)(id >> 56); }
public static Int64 otherTypeId(OtherType type, int otherId) { return ((Int64)type << 56) + otherId; }
protected override SomeType GetX(OtherType r) => r?.abc?.FirstOrDefault();
protected abstract SomeType GetX(OtherType r);
public void Method() { var a = new OtherType(); }
protected override string readProfileLow(OtherType otherType, string otherId, string email) { var db = Machines.getContext(false); var res = db.Users.Where(usr => usr.OtherType == (short)otherType && usr.OtherId == otherId).Select(usr => usr.Data).FirstOrDefault(); if (res != null) return res; return db.Users.Where(usr => usr.EMail == email && usr.Roles != null && usr.Id > 0).Select(usr => usr.Data).FirstOrDefault(); }
public static ProfileData readOtherProfile(OtherType type, string id, string email) { return fromString(Instance.readProfileLow(type, id, email)); }
public BaseType(OtherType other) { }
/*public static bool onGoogleFacebookLogin(HttpContext ctx, bool isFacebook, string id, string firstName, string lastName, string sex, string courseId, getOtherData otherDataEvent, object eventData) { LMCookie cook = LMStatus.Cookie; if (cook != null && cook.facebookId != 0 && isFacebook && cook.facebookId.ToString() == id && courseId == cook.courseId) return true; if (cook != null && cook.googleId != null && !isFacebook && cook.googleId == id && courseId == cook.courseId) return true; OtherType type = isFacebook ? OtherType.Facebook : OtherType.Google; return onGoogleFacebookLogin(ctx, type, id, id + "@" + type.ToString() + ".fake", firstName, lastName, sex, courseId, otherDataEvent, eventData); }*/ public static bool onGoogleFacebookLogin(HttpContext ctx, OtherType type, string id, string email, string firstName, string lastName, string sex, string courseId, getOtherData otherDataEvent, object eventData) { if (string.IsNullOrEmpty(email)) return false; email = email.ToLower(); //hotovo: string dataStr = otherDataEvent != null ? otherDataEvent(eventData) : null; ProfileData prof = LMComDataProvider.readOtherProfile(type, id, email); if (string.IsNullOrEmpty(email)) { if (prof != null) email = prof.Email; if (string.IsNullOrEmpty(email)) email = "fake@" + type.ToString() + ".www"; } if (prof == null) { //profil neni zalozen v databazi - zaloz prof = LMComDataProvider.createProfileStart(Domains.com); prof.OtherType = type; prof.OtherId = id; prof.Roles = 0; prof.Email = email; prof.Address.FirstName = firstName; prof.Address.LastName = lastName; prof.Male = sex == null ? true : sex.ToLower() == "male"; prof.Site = Domains.com; prof.OtherData = dataStr; LMComDataProvider.WriteProfile(prof); } else { prof.Site = Domains.com; prof.OtherData = dataStr; prof.OtherType = type; prof.OtherId = id; prof.Email = email; prof.Address.FirstName = firstName; prof.Address.LastName = lastName; } //vymaz ostatni profily s tim samym emailem LMComDataProvider.removeDuplicetedEMails(email, prof.Id); // LMComDataProvider.setProfileToCache(prof); LMCookie cook = new LMCookie(); cook.EMail = prof.Email; cook.id = prof.Id; cook.Type = type; cook.TypeId = id; cook.FirstName = firstName; cook.LastName = lastName; HttpContext.Current.Items[LowUtils.c_cookieName] = cook; LMComDataProvider.checkProfileInCache(ctx, cook.id); //refreshLastRequest(ctx, cook); return false; }
public bool UpdateOtherType(OtherType otherType) { return(_otherTypeService.UpdateOtherType(otherType)); }
public bool InsertOtherType(OtherType otherType) { return(_otherTypeService.InsertOtherType(otherType)); }
/// <summary> /// Sets other modification of the weapon. /// </summary> /// <param name="player">The player instance.</param> /// <param name="weapon">The weapon with attachment.</param> /// <param name="type">Type of the other.</param> public static void SetOther(this Player player, Inventory.SyncItemInfo weapon, OtherType type) { WeaponManager wmanager = player.ReferenceHub.weaponManager; if (weapon.id.IsWeapon()) { WeaponManager.Weapon wep = wmanager.weapons.FirstOrDefault(wp => wp.inventoryID == weapon.id); if (wep != null) { string name = type.ToString("g").SplitCamelCase(); int weaponMod = wep.mod_others.Select((s, i) => new { s, i }).Where(e => e.s.name == name).Select(e => e.i).FirstOrDefault(); int weaponId = player.Inventory.items.FindIndex(s => s == weapon); weapon.modOther = weaponMod; if (weaponId > -1) { player.Inventory.items[weaponId] = weapon; } } } }
public static string createOtherTypeTicket(OtherType type, int otherId, string email, string firstName, string lastName) { LMCookie cook = new LMCookie() { id = otherTypeId(type, otherId), EMail = email, FirstName = firstName, LastName = lastName, CreateTick = DateTime.UtcNow.Ticks }; return string.Format("ticket={0}", cook.ToString()); }
public void Map_InvalidBinaryExpression_ThrowsArgumentException() { var otherType = new OtherType(); Assert.Throws <ArgumentException>("expression", () => Map(p => otherType.Value + 1)); }
public static LMCookieJS OnOtherLogin(OtherType otherType, string otherId, string email, string firstName, string lastName) { var db = Lib.CreateContext(); var el = new El(email, null); var usr = db.Users.FirstOrDefault(u => u.EMail == el.email && u.Login == null); if (usr == null) db.Users.Add(usr = new Users() { EMail = email, Created = DateTime.UtcNow }); usr.VerifyStatus = (short)VerifyStates.ok; usr.OtherType = (short)otherType; usr.OtherId = otherId; usr.FirstName = firstName; usr.LastName = lastName; Lib.SaveChanges(db); return user2cookie(usr); }
public override Int64 otherIdToId(OtherType type, string id) { return (from usr in Machines.getContext(false).Users where usr.OtherType == (short)type && usr.OtherId == id select usr.Id).SingleOrDefault<Int64>(); }
public void Map_InvalidMethodExpression_ThrowsArgumentException() { var otherType = new OtherType(); Assert.Throws <ArgumentException>("expression", () => Map(p => otherType.Value.ToString())); }
public static Int64 rew_OnOtherLogin(OtherType type, string id, string email, string firstName, string lastName) { if (string.IsNullOrEmpty(email)) return -1; email = email.ToLower(); //hotovo: ProfileData prof = LMComDataProvider.readOtherProfile(type, id, email); if (prof == null) { //profil neni zalozen v databazi - zaloz prof = LMComDataProvider.createProfileStart(Domains.com); prof.OtherType = type; prof.OtherId = id; prof.Roles = 0; prof.Email = email; prof.Address.FirstName = firstName; prof.Address.LastName = lastName; prof.Site = Domains.com; } else { prof.Site = Domains.com; prof.OtherType = type; prof.OtherId = id; prof.Email = email; prof.Address.FirstName = firstName; prof.Address.LastName = lastName; } //vymaz ostatni profily s tim samym emailem LMComDataProvider.removeDuplicetedEMails(email, prof.Id); LMComDataProvider.WriteProfile(prof); return prof.Id; }
public abstract Int64 otherIdToId(OtherType type, string id);
protected override string readProfileLow(OtherType otherType, string otherId) { var db = Machines.getContext(false); return db.Users.Where(usr => usr.OtherType == (short)otherType && usr.OtherId == otherId).Select(usr => usr.Data).FirstOrDefault(); }
protected abstract string readProfileLow(OtherType type, string id, string email);