/// <summary> /// Writes properties of the model to JSON (asynchronous way). /// </summary> /// <param name="writer"></param> /// <param name="options"></param> /// <param name="ct">The cancellation token</param> /// <returns></returns> protected virtual async Task WriteModelPropsToJsonAsync(JsonWriter writer, BitOptions options, CancellationToken ct) { await writer.WritePropertyNameAsync("fver", ct).ConfigureAwait(false); await writer.WriteValueAsync(FormatVersionJson, ct).ConfigureAwait(false); await writer.WritePropertyNameAsync("mver", ct).ConfigureAwait(false); await writer.WriteValueAsync(ModelVersion, ct).ConfigureAwait(false); CheckModelId(); await writer.WritePropertyNameAsync("id", ct).ConfigureAwait(false); await writer.WriteValueAsync(Id, ct).ConfigureAwait(false); await writer.WritePropertyNameAsync("name", ct).ConfigureAwait(false); await writer.WriteValueAsync(Name, ct).ConfigureAwait(false); if (options.Contains(MetaDataReadWriteOptions.Description)) { await writer.WritePropertyNameAsync("desc", ct).ConfigureAwait(false); await writer.WriteValueAsync(Description, ct).ConfigureAwait(false); } if (options.Contains(MetaDataReadWriteOptions.CustomInfo)) { await writer.WritePropertyNameAsync("cstinf", ct).ConfigureAwait(false); await writer.WriteValueAsync(CustomInfo.ToString(), ct).ConfigureAwait(false); } }
public void Indexer() { var info = new CustomInfo(); info["Test"] = "B"; Assert.AreEqual(info["Test"], "B"); }
private void WeightMatch_Load(object sender, EventArgs e) { ultraDateTimeEditor2.Value = ultraDateTimeEditor1.DateTime.Add(TimeSpan.FromMinutes(1439)); ultraDateTimeEditor4.Value = ultraDateTimeEditor3.DateTime.Add(TimeSpan.FromMinutes(1439)); QueryWeightData(); // thread = new Thread(RefreshData); // thread.Start(); ultraCheckEditor1.Checked = false; ultraCheckEditor1.Enabled = false; if (CustomInfo.Equals("leader")) { ultraTextEditor2.ReadOnly = false; } else { ultraTextEditor2.ReadOnly = true; } ultraOptionSet2.CheckedIndex = -1; ultraOptionSet1.CheckedIndex = 0; ultraTextEditor1.BackColor = Color.Pink; ultraTextEditor2.BackColor = Color.Pink; this.QueryAndBindJLDData();//查询绑定计量点信息 //打开视频 this.RecordOpen(0); }
public void Add() { var info = new CustomInfo(); info.Add("Test", "B"); Assert.AreEqual(info["Test"], "B"); }
private void AddCustom() { if (CheckData()) { return; } CustomInfo ci = new CustomInfo { Caddress = txb_address.Text.Trim(), Cmeno = txb_meno.Text.Trim(), Cname = txb_name.Text.Trim(), CTel = txb_tel.Text.Trim(), delflag = false }; int id = cIS.AddCustomInfo(ci); if (id > 0) { ci.id = id; customlist.Add(ci); FixDGV(); ShowTipsMessageBox("添加成功"); } else { ShowErrorMessageBox("添加失败"); } }
public Response SendIMSystemMsg(CustomInfo customeInfo, string userCode) { var reqRest = new RestRequest("v4/openim/sendmsg", Method.POST); MessageInfo messageInfo = new MessageInfo(); messageInfo.SyncOtherMachine = 2; messageInfo.To_Account = userCode; messageInfo.MsgRandom = new Random().Next(999999); MessageBody messageBody = new MessageBody(); messageBody.MsgType = "TIMCustomElem"; MessageContent messageContent = new MessageContent(); DataInfo dataInfo = new DataInfo(); dataInfo.userAction = 10; dataInfo.customInfo = customeInfo; messageContent.Data = JsonConvert.SerializeObject(dataInfo); messageBody.MsgContent = messageContent; messageInfo.MsgBody.Add(messageBody); reqRest.AddJsonBody(messageInfo); return(RestApiHelper.SendIMRequestAndGetResponse(reqRest)); }
public void RequestUserAgentString() { if (Helper.IsNetworkAvailable()) { var info = new CustomInfo { Agent = "MyAgent", Version = "1.0" }; var http = new DefaultRequester(info); var request = new DefaultRequest(); request.Address = new Url("http://httpbin.org/user-agent"); request.Method = HttpMethod.Get; var response = http.RequestAsync(request).Result; Assert.IsNotNull(response); Assert.AreEqual(200, (int)response.StatusCode); Assert.IsTrue(response.Content.CanRead); Assert.IsTrue(response.Headers.Count > 0); var stream = new StreamReader(response.Content); Assert.IsNotNull(stream); var content = stream.ReadToEnd(); Assert.IsTrue(content.Length > 0); Assert.AreEqual("{\n \"user-agent\": \"" + info.Agent + "\"\n}", content); } }
public static CustomInfo CreateCustomInfo(int index) { CustomInfo ci = new CustomInfo(); ci.Add(v[index + 0], v[index + 1]); ci.Add(v[index + 2], v[index + 3]); return(ci); }
public void IndexerNullRemoves() { var info = new CustomInfo(); info["Test"] = "B"; info["Test"] = null; Assert.AreEqual(0, info.Items.Count); }
public void Remove() { var info = new CustomInfo(); info["Test"] = "B"; info.Remove("Test"); Assert.AreEqual(0, info.Items.Count); }
public async Task <ActionResult> DeleteConfirmed(int id) { CustomInfo customInfo = await db.CustomInfos.FindAsync(id); db.CustomInfos.Remove(customInfo); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void AddChanged() { bool changed = false; var info = new CustomInfo(); info.CollectionChanged += () => changed = true; info.Add("Test", "B"); Assert.IsTrue(changed); }
public ActionResult Details() { CustomInfo customInfo = db.CustomInfos.FirstOrDefault(d => d.Cod1s == Cust.Cod1s); if (customInfo == null) { return(HttpNotFound()); } return(View(customInfo)); }
public void IndexerSameDoesNotChange() { bool changed = false; var info = new CustomInfo(); info["Test"] = "B"; info.CollectionChanged += () => changed = true; info["Test"] = "B"; Assert.IsFalse(changed); }
/// <summary> /// 游戏配置信息 /// </summary> /// <param name="xmlNodeList"></param> static void SetCustomInfo(XMLNodeList xmlNodeList) { if (xmlNodeList == null) { LogSystem.LogWarning("SetCustomInfo is null"); return; } ///解析首段中的类型定义 for (int i = 0; i < xmlNodeList.Count; i++) { XMLNode xmlnode = xmlNodeList[i] as XMLNode; XMLNodeList childNodeList1 = xmlnode.GetNodeList("Resource"); if (childNodeList1 != null) { for (int j = 0; j < childNodeList1.Count; j++) { XMLNode childnode = childNodeList1[j] as XMLNode; CustomInfo psInfo = new CustomInfo(); foreach (System.Collections.DictionaryEntry objDE in childnode) { if (objDE.Value == null) { continue; } string strKey = objDE.Key as string; if (strKey[0] != '@') { continue; } strKey = strKey.Substring(1); if (strKey == "ID") { psInfo.strCustomInfoID = objDE.Value as string; } else if (strKey == "Value") { psInfo.strCustomInfoVaule = objDE.Value as string; } } if (mDictCustomInfoList.ContainsKey(psInfo.strCustomInfoID)) { mDictCustomInfoList[psInfo.strCustomInfoID] = psInfo; } else { mDictCustomInfoList.Add(psInfo.strCustomInfoID, psInfo); } } } } }
public async Task <ActionResult> Edit([Bind(Include = "CustomInfoId,Cod1s,Txt,Mail,isEmpty")] CustomInfo customInfo) { if (ModelState.IsValid) { db.Entry(customInfo).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(customInfo)); }
public ActionResult Details() { ViewBag.MenuItem = "info"; CustomInfo customInfo = db.CustomInfos.FirstOrDefault(d => d.Cod1s == Cust.Cod1s); if (customInfo == null) { return(HttpNotFound()); } return(PartialView(customInfo)); }
public async Task <ActionResult> Doc(CustomInfo custominfo) { custominfo.Cod1s = Cust.Cod1s; custominfo.txt = Cust.SmalName; if (ModelState.IsValid) { //CustomInfo customInfo = docsModel.CustomInfo; db.CustomInfos.Add(custominfo); await db.SaveChangesAsync(); } return(RedirectToAction("Doc")); }
public async Task <ActionResult> Create([Bind(Include = "CustomInfoId,Cod1s,Txt,Mail,isEmpty")] CustomInfo customInfo) { customInfo.Cod1s = Cust.Cod1s; customInfo.txt = Cust.SmalName; if (ModelState.IsValid) { db.CustomInfos.Add(customInfo); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(customInfo)); }
public CustomLevelInfo(LevelInfo level) : base(level.path, level.isAssetBundle) { name = level.name; hash = level.hash; path = level.path; previewImage = level.previewImage; isAssetBundle = level.isAssetBundle; author = level.author; Info = new CustomInfo(level.name, level.path, null, isAssetBundle) { ParentObject = this }; }
private void FixControl() { int row = dgv.SelectedRows[0].Index; if (row == -1) { return; } CurrentCustom = customlist[row]; txb_name.Text = CurrentCustom.Cname; txb_tel.Text = CurrentCustom.CTel; txb_address.Text = CurrentCustom.Caddress; txb_meno.Text = CurrentCustom.Cmeno; }
public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomInfo customInfo = await db.CustomInfos.FindAsync(id); if (customInfo == null) { return(HttpNotFound()); } return(View(customInfo)); }
/*/// <summary> * /// Gets or sets a custom object property to store user supplied information in the bug report. You need to handle * /// <see cref="NBug.Settings.ProcessingException"/> event to fill this property with required information. * /// </summary> * public object StaticInfo { get; set; }*/ public override string ToString() { var serializer = CustomInfo != null ? new XmlSerializer(typeof(Report), new[] { CustomInfo.GetType() }) : new XmlSerializer(typeof(Report)); using (var stream = new MemoryStream()) { stream.SetLength(0); serializer.Serialize(stream, this); stream.Position = 0; var doc = XDocument.Load(XmlReader.Create(stream)); return(doc.Root.ToString()); } }
public void SerializingEntitiesCustomInfo() { CustomInfoItem cii = TestHelper.CreateCustomInfoItem(0); String s1 = JsonConvert.SerializeObject(cii); CustomInfoItem cii2 = JsonConvert.DeserializeObject <CustomInfoItem>(s1); Assert.Equal(cii, cii2); CustomInfo ci = TestHelper.CreateCustomInfo(0); String s2 = JsonConvert.SerializeObject(ci); CustomInfo ci2 = JsonConvert.DeserializeObject <CustomInfo>(s2); Assert.Equal(0, UtilityHelper.CompareLists(ci.items, ci2.items)); //Assert.True(ci.items.Equals(ci2.items)); //Assert.Equal(ci.items, ci2.items); }
public async Task <MessageModel <string> > Put([FromBody] CustomInfo custom) { var data = new MessageModel <string>(); if (custom != null && custom.Id > 0) { data.success = await customInfoServices.Update(custom); if (data.success) { data.response = custom?.Id.ObjToString(); data.msg = "修改成功"; } } return(data); }
public static void PopulateCountlyUserDetails(CountlyUserDetails cud, int indexData, int indexCustomInfo) { cud.BirthYear = iv[indexData]; cud.Custom.Add(v[indexData + 0], v[indexData + 1]); cud.Custom.Add(v[indexData + 2], v[indexData + 3]); cud.Email = v[indexData + 4]; cud.Gender = v[indexData + 5]; cud.Username = v[indexData + 6]; cud.Phone = v[indexData + 7]; cud.Organization = v[indexData + 8]; cud.Name = v[indexData + 9]; cud.Picture = v[indexData + 10]; CustomInfo cui = CreateCustomInfo(indexCustomInfo); cud.Custom = cui; }
public async Task <MessageModel <string> > Post([FromBody] CustomInfo custom) { var data = new MessageModel <string>(); custom.CreateTime = DateTime.Now; custom.UpdateTime = DateTime.Now; custom.IsDelete = false; var id = await customInfoServices.Add(custom); data.success = id > 0; if (data.success) { data.response = id.ObjToString(); data.msg = "添加成功"; } return(data); }
public void ComparingEntitiesCustomInfoNull() { CustomInfo ci1 = TestHelper.CreateCustomInfo(0); CustomInfo ci2 = TestHelper.CreateCustomInfo(0); Assert.Equal(ci1, ci2); ci1.items = null; ci2.items = null; Assert.Equal(ci1, ci2); ci1 = TestHelper.CreateCustomInfo(0); ci2 = TestHelper.CreateCustomInfo(0); ci2.items = null; Assert.NotEqual(ci1, ci2); Assert.NotEqual(ci2, ci1); }
public ActionResult Index() { if (String.IsNullOrWhiteSpace(Cust.Cod1s)) { return(View("NoCod1s")); } CustomInfo cinfo = db.CustomInfos.FirstOrDefault(d => d.Cod1s == Cust.Cod1s); if (cinfo == null) { return(RedirectToAction("Create")); } else { return(RedirectToAction("Details")); } }
private void FinInfoByOther(string query) { customInfo = customService.FindCustomByTel(query); ClearData(); if (customInfo == null) { if (ShowQuestionMessageBox("未查询该客户,是否在该界面添加?") == DialogResult.Yes) { gb_custom.Enabled = true; ShowPanel(panel_in); } } else { InitCustomControl(); GetHistory(customInfo.id); ShowPanel(panel_in); } }
public static CustomInfo Parse (string format, int offset, int length, NumberFormatInfo nfi) { char literal = '\0'; bool integerArea = true; bool decimalArea = false; bool exponentArea = false; bool sharpContinues = true; CustomInfo info = new CustomInfo (); int groupSeparatorCounter = 0; for (int i = offset; i - offset < length; i++) { char c = format [i]; if (c == literal && c != '\0') { literal = '\0'; continue; } if (literal != '\0') continue; if (exponentArea && (c != '\0' && c != '0' && c != '#')) { exponentArea = false; integerArea = (info.DecimalPointPos < 0); decimalArea = !integerArea; i--; continue; } switch (c) { case '\\': i++; continue; case '\'': case '\"': if (c == '\"' || c == '\'') { literal = c; } continue; case '#': if (sharpContinues && integerArea) info.IntegerHeadSharpDigits++; else if (decimalArea) info.DecimalTailSharpDigits++; else if (exponentArea) info.ExponentTailSharpDigits++; goto case '0'; case '0': if (c != '#') { sharpContinues = false; if (decimalArea) info.DecimalTailSharpDigits = 0; else if (exponentArea) info.ExponentTailSharpDigits = 0; } if (info.IntegerHeadPos == -1) info.IntegerHeadPos = i; if (integerArea) { info.IntegerDigits++; if (groupSeparatorCounter > 0) info.UseGroup = true; groupSeparatorCounter = 0; } else if (decimalArea) info.DecimalDigits++; else if (exponentArea) info.ExponentDigits++; break; case 'e': case 'E': if (info.UseExponent) break; info.UseExponent = true; integerArea = false; decimalArea = false; exponentArea = true; if (i + 1 - offset < length) { char nc = format [i + 1]; if (nc == '+') info.ExponentNegativeSignOnly = false; if (nc == '+' || nc == '-') i++; else if (nc != '0' && nc != '#') { info.UseExponent = false; if (info.DecimalPointPos < 0) integerArea = true; } } break; case '.': integerArea = false; decimalArea = true; exponentArea = false; if (info.DecimalPointPos == -1) info.DecimalPointPos = i; break; case '%': info.Percents++; break; case '\u2030': info.Permilles++; break; case ',': if (integerArea && info.IntegerDigits > 0) groupSeparatorCounter++; break; default: break; } } if (info.ExponentDigits == 0) info.UseExponent = false; else info.IntegerHeadSharpDigits = 0; if (info.DecimalDigits == 0) info.DecimalPointPos = -1; info.DividePlaces += groupSeparatorCounter * 3; return info; }
public override void SetCameraCustomInfo(CustomInfo[] customInfos) { _camera.CameraInfo.SetAttributes(customInfos); _camera.CameraInfo.RefreshProperties(); }
public virtual void SetCameraCustomInfo(CustomInfo[] customInfos) { }