private void button2_Click(object sender, EventArgs e) { List <Item_Str> ItemList = ItemCtrl.GetItemList(); string file = textBox4.Text + "级物品.txt"; //写文件 FileStream rtfs = new FileStream(file, FileMode.Create, FileAccess.Write); //StreamWriter rt = new StreamWriter(rtfs, Encoding.GetEncoding(950)); StreamWriter rt = new StreamWriter(rtfs, Encoding.Default); rt.BaseStream.Seek(0, SeekOrigin.Begin); rt.BaseStream.Position = 0; //遍历DropList foreach (var it in ItemList) { if (it.limit_level == textBox4.Text) { rt.WriteLine(ItemCtrl.GetIdByCode(it.code) + "\t" + CFormat.ToSimplified(it.code)); } } rt.Close(); rtfs.Close(); MessageBox.Show("输出掉宝资料【" + file + "】成功!"); }
private void FillItemLstV() { List <Item_Str> itemList = ItemCtrl.GetItemList(); lstv_ItemList.Items.Clear(); foreach (var item in itemList) { string code = item.code; string id = ItemCtrl.GetIdByCode(code); ListViewItem lvi = new ListViewItem(); lvi.Text = CFormat.PureString(id); lvi.SubItems.Add(CFormat.PureString(code)); lstv_ItemList.Items.Add(lvi); } lstv_ItemList.EndUpdate(); }