本文整理汇总了C#中ASObject.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# ASObject.ContainsKey方法的具体用法?C# ASObject.ContainsKey怎么用?C# ASObject.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASObject
的用法示例。
在下文中一共展示了ASObject.ContainsKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GGChatUser
public GGChatUser(ASObject user)
{
try
{
if( user.ContainsKey("banned") )
_banned = bool.Parse(user["banned"].ToString());
if (user.ContainsKey("color"))
_color = (string)user["color"];
if (user.ContainsKey("id"))
_id = int.Parse(user["id"].ToString());
if (user.ContainsKey("level"))
_level = int.Parse(user["level"].ToString());
if (user.ContainsKey("name"))
_name = (string)user["name"];
if (user.ContainsKey("sex"))
_gender = int.Parse(user["sex"].ToString());
}
catch { }
}
示例2: updateMailRecord
/// <summary>
/// 更新邮件记录
/// </summary>
/// <param name="mail"></param>
/// <param name="updateFields"></param>
public void updateMailRecord(ASObject mail, string[] updateFields)
{
if (mail == null || updateFields == null || updateFields.Length == 0)
return;
string sql = @"update ML_Mail set ";
StringBuilder sb = new StringBuilder();
sb.Append(sql);
foreach (string field in updateFields)
{
sb.Append(field).Append("[email protected]").Append(field).Append(",");
}
if (sb.ToString().LastIndexOf(",") != -1)
sb.Remove(sb.ToString().LastIndexOf(","), 1);
if(mail.ContainsKey("id"))
sb.Append(" where [email protected]");
else
sb.Append(" where [email protected]");
SQLiteCommand cmd = null;
try
{
cmd = new SQLiteCommand(sb.ToString(), DBWorker.GetConnection());
if (mail.ContainsKey("id"))
cmd.Parameters.AddWithValue("@id", mail["id"]);
else
cmd.Parameters.AddWithValue("@uuid", mail["uuid"]);
foreach (string field in updateFields)
{
cmd.Parameters.AddWithValue("@" + field, mail[field]);
}
cmd.ExecuteNonQuery();
cmd.Dispose();
}
catch (Exception ex)
{
System.Diagnostics.Debug.Write(ex.StackTrace);
}
finally
{
if (cmd != null)
{
cmd.Dispose();
}
}
}
示例3: ChangeData
private void ChangeData()
{
if (createList.Count > 0)
{
try
{
foreach (ASObject account in createList)
{
ASObject policy = new ASObject();
ASObject ac = new ASObject();
ASObjectUtil.copyTo(account, ac);
if (ac.ContainsKey("distribution_policy"))
{
ac.Remove("distribution_policy");
policy["distribution_policy"] = account.getObject("distribution_policy");
}
Remoting.call("MailManager.createMailAccount", new object[] { ac, ASObjectUtil.toJObject(policy).ToString() });
_initImportList.Add(account);
}
createList.Clear();
}
catch (Exception ex)
{
createList.Clear();
throw ex;
}
}
if (updateList.Count > 0)
{
try
{
foreach (ASObject account in updateList)
{
ASObject policy = new ASObject();
ASObject ac = new ASObject();
ASObjectUtil.copyTo(account, ac);
if (ac.ContainsKey("distribution_policy"))
{
ac.Remove("distribution_policy");
policy["distribution_policy"] = account.getObject("distribution_policy");
}
Remoting.call("MailManager.updateMailAccount", new object[] { ac, ASObjectUtil.toJObject(policy).ToString() });
}
updateList.Clear();
}
catch (Exception ex)
{
updateList.Clear();
throw ex;
}
}
if (removeList.Count > 0)
{
try
{
foreach (ASObject account in removeList)
{
Remoting.call("MailManager.removeMailAccount", new object[] { account.getLong("id") });
}
removeList.Clear();
}
catch (Exception ex)
{
removeList.Clear();
throw ex;
}
}
Remoting.call("MailManager.reloadMailAccount", new object[] { }, this);
}
示例4: AddUpdate
private void AddUpdate(ASObject account)
{
if (account.ContainsKey("id") && !updateList.Contains(account))
updateList.Add(account);
}
示例5: GGChatMessage
public GGChatMessage(ASObject msg)
{
if (msg.ContainsKey("id"))
_id = int.Parse(msg["id"].ToString());
if (msg.ContainsKey("privacy"))
_privacy = int.Parse(msg["privacy"].ToString());
if (msg.ContainsKey("recipient"))
{
var tmprec = msg["recipient"].ToString();
_recipient = (tmprec == "0" ? "" : tmprec);
}
if (msg.ContainsKey("sender"))
_sender = new GGChatUser((ASObject)msg["sender"]);
if (msg.ContainsKey("status"))
_status = int.Parse(msg["status"].ToString());
if (msg.ContainsKey("text"))
_text = (string)msg["text"];
if (msg.ContainsKey("time"))
_time = (string)msg["time"];
}
示例6: OnHtmlEditorImageChangedEvent
void OnHtmlEditorImageChangedEvent(HtmlEditor.Event eventType, ASObject value)
{
StringBuilder sb = new StringBuilder();
sb.Append("<img src='").Append(value.getString("path")).Append("'");
if(value.ContainsKey("width"))
sb.Append(" width='").Append(value.getString("width")).Append("px'");
if (value.ContainsKey("height"))
sb.Append(" height='").Append(value.getString("height")).Append("px'");
if(value.ContainsKey("alt"))
sb.Append(" alt='").Append(value.getString("alt")).Append("'");
sb.Append(" />");
if(eventType == Event.Create)
runtime.call("HtmlEditorInsertContent", new object[] { sb.ToString()});
else if(eventType == Event.Update)
runtime.call("HtmlEditorReplaceContent", new object[] { sb.ToString() });
}
示例7: showMail
private void showMail(ASObject mail)
{
try
{
if (Mail_Type == MailType.Dsbox)
{
btnSave.IsEnabled = false;
btnAudit.IsEnabled = false;
}
txtTo.TextChanged -= txtTo_TextChanged;
cboFrom.SelectionChanged -= cboFrom_SelectionChanged;
string mail_account = mail["mail_account"] as string;
from = MailSendWorker.instance.findAccount(mail_account);
if (from == null)
{
txtTo.TextChanged += txtTo_TextChanged;
cboFrom.SelectionChanged += cboFrom_SelectionChanged;
}
string file = mail.getString("mail_file");
StringBuilder sb = new StringBuilder();
Mail_Message = MailWorker.instance.ParseMail(file);
if (Mail_Type == MailType.Transmit)
txtSubject.Text = "Fw:" + mail["subject"] as string;
else if (Mail_Type == MailType.Reply || Mail_Type == MailType.AllReply)
{
txtSubject.Text = "Re:" + mail["subject"] as string;
}
else
txtSubject.Text = mail["subject"] as string;
sb.Clear();
Mail_t_AddressList addresses = Mail_Message.Cc;
if (addresses != null)
{
foreach (Mail_t_Mailbox mailbox in addresses.Mailboxes)
{
sb.Append(mailbox.Address).Append(";");
}
if (sb.ToString().LastIndexOf(";") != -1)
sb.Remove(sb.ToString().LastIndexOf(";"), 1);
txtCc.Text = sb.ToString();
}
if (Mail_Type == MailType.Draft || Mail_Type == MailType.Dsbox)
txtTo.Text = mail["mail_to"] as string;
else if (Mail_Type != MailType.Transmit)
txtTo.Text = mail["contact_mail"] as string;
if (Mail_Type != MailType.Transmit)
{
//审核人
if (mail.ContainsKey("reviewer_id") && !String.IsNullOrWhiteSpace(mail.getString("reviewer_id")))
{
txtAudit.Text = mail.getString("reviewer_name");
}
}
sb.Clear();
string uid = mail["uuid"] as string;
DirectoryInfo dirinfo = Directory.GetParent(store_path + file);
string dir = dirinfo.FullName + "/" + uid + ".parts";
if (Mail_Type == MailType.Transmit)
{
sb.Append(getTransmitVm(mail, Mail_Message));
sb.Append("<blockquote id=\"isReplyContent\" style=\"PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid\">");
}
else if (Mail_Type == MailType.Reply || Mail_Type == MailType.AllReply)
{
sb.Append(getReplyVm(mail, Mail_Message));
sb.Append("<blockquote id=\"isReplyContent\" style=\"PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid\">");
}
string textHtml = parseMIMEContent(Mail_Message, dir);
sb.Append(textHtml);
if (Mail_Type == MailType.Transmit || Mail_Type == MailType.Reply || Mail_Type == MailType.AllReply)
{
sb.Append("</blockquote>");
}
htmlEditor.ContentHtml = sb.ToString();
if (Mail_Type == MailType.Draft || Mail_Type == MailType.Dsbox)
{
_saveMail = _mail;
}
}
catch (Exception e)
{
System.Diagnostics.Debug.Write(e.StackTrace);
ime.controls.MessageBox.Show(e.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
}