private void lbModify_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e) { string[] serverlist = (string[])memcacheServer.ToArray(typeof(string)); MemCacheTools_V2 tools = new MemCacheTools_V2(serverlist); string key = this.txtKey.Text; string value = this.txtValue.Text; tools.Add(key, value); MessageBox.Show("修改成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; }
private void ReadValue(string filePath, string index) { StreamReader sr; string key = string.Empty; string value = string.Empty; MemCacheTools_V2 tools = new MemCacheTools_V2(serverList); using (sr = new StreamReader(filePath, Encoding.UTF8)) { key = GetFileName(filePath).Replace(".txt", ""); value = sr.ReadToEnd(); help.totalNum++; frm.WriteState("正在还原Item" + index + "【key=" + key + "】,已处理" + help.totalNum + "个"); tools.Add(key, value); } }
private void lbDelete_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e) { string[] serverlist = (string[])memcacheServer.ToArray(typeof(string)); MemCacheTools_V2 tools = new MemCacheTools_V2(serverlist); string key = this.txtKey.Text; if (MessageBox.Show("确定要删除key=【" + key + "】吗?", "提示信息", MessageBoxButtons.YesNo).ToString() == "Yes") { tools.Clear(key); MessageBox.Show("删除成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { return; } }
private void btnSet_Click(object sender, EventArgs e) { MemCacheTools_V2 tools = new MemCacheTools_V2((string[])serverList.ToArray(typeof(string))); string key = this.txtkey.Text; string value = this.txtValue.Text; if (string.IsNullOrEmpty(key)) { MessageBox.Show("Key不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(value)) { MessageBox.Show("Value不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } tools.Add(key, value); MessageBox.Show("写入数据成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtkey.Text = this.txtValue.Text = ""; }
private void btnSaveToMemCache_Click(object sender, EventArgs e) { MemCacheTools_V2 tools = new MemCacheTools_V2((string[])serverList.ToArray(typeof(string))); string key = this.txtKeyAdd.Text; string value = this.txtValueAdd.Text; if (string.IsNullOrEmpty(key)) { MessageBox.Show("Key不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(value)) { MessageBox.Show("Value不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBox.Show("确定要添加数据到服务器" + serverList[0].ToString() + "?", "提示信息", MessageBoxButtons.YesNo).ToString() == "Yes") { tools.Add(key, value); MessageBox.Show("写入数据成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtKeyAdd.Text = this.txtValueAdd.Text = ""; } }