private void saveHistoryData() { string hash = Utf8Sha1(tbSend.Text); string name = sendNameBox.Text; SendDataStruct sd = new SendDataStruct(hash, name, tbSend.Text, cfg.send_encode); int index = sds.IndexOf(hash); if (-1 == index) { sds.dataList.Insert(0, sd); sds.Save(); addHistoryBox(sd, true); } else { SendDataStruct sd0 = sds.dataList[index]; if (sd0.name != sd.name) { sd0.name = sd.name; sds.Save(); ListViewItem item = historyDataBox.Items[index]; item.Text = sd.name; } } }
private void loadData(string conf) { conf = confNameToDataName(conf); if (conf == null) { return; } SendDataStorage s = SendDataStorage.Load(conf); if (s == null) { s = new SendDataStorage(); s.file_name = conf; s.Save(); } sds = s; historyDataBox.BeginUpdate(); for (int i = 0; i < sds.dataList.Count; i++) { SendDataStruct sd = sds.dataList[i]; addHistoryBox(sd); } historyDataBox.EndUpdate(); }