private void DataGridView1_CellValueChanged(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) { if (mhw == null) { return; } if (e.ColumnIndex == 4) { if ((bool)dataGridView1.CurrentCell.EditedFormattedValue) { ((Item[])dataGridView1.DataSource)[e.RowIndex].locked = true; locks.Add(((Item[])dataGridView1.DataSource)[e.RowIndex]); } else { locks.Remove(((Item[])dataGridView1.DataSource)[e.RowIndex]); ((Item[])dataGridView1.DataSource)[e.RowIndex].locked = false; } } if (e.ColumnIndex == 2 && ((Item[])dataGridView1.DataSource)[e.RowIndex].locked == false) { var item = ((Item[])dataGridView1.DataSource)[e.RowIndex]; ProcessIO.WriteInt32(handle, item.address + 4, int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue)); ((Item[])dataGridView1.DataSource)[e.RowIndex].count = int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue); } if (e.ColumnIndex == 0 && ((Item[])dataGridView1.DataSource)[e.RowIndex].locked == false) { var item = ((Item[])dataGridView1.DataSource)[e.RowIndex]; ProcessIO.WriteInt32(handle, item.address, int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue)); ((Item[])dataGridView1.DataSource)[e.RowIndex].id = int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue); } }
private void Set_btn_Click(object sender, EventArgs e) { gold = int.Parse(gold_tb.Text); sp = int.Parse(SP_tb.Text); exp = int.Parse(exp_tb.Text); level = int.Parse(level_tb.Text); ProcessIO.WriteInt32(handle, baseAddress, gold); ProcessIO.WriteInt32(handle, baseAddress + 4, sp); ProcessIO.WriteInt32(handle, baseAddress + 8, exp); ProcessIO.WriteInt32(handle, baseAddress - 4, level); }
private void checklock(Form a) { while (true) { for (int i = 0; i < locks.Count; i++) { try { var item = locks[i]; ProcessIO.WriteInt32(handle, item.address, item.id); ProcessIO.WriteInt32(handle, item.address + 4, item.count); Thread.Sleep(100); } catch (Exception) { } } Thread.Sleep(1000); } }
private void DataGridView1_CellValidating(object sender, System.Windows.Forms.DataGridViewCellValidatingEventArgs e) { if (e.ColumnIndex == 4) { if ((bool)e.FormattedValue) { locks.Add(((Item[])dataGridView1.DataSource)[e.RowIndex]); } else { locks.Remove(((Item[])dataGridView1.DataSource)[e.RowIndex]); } } if (e.ColumnIndex < 3 && ((Item[])dataGridView1.DataSource)[e.RowIndex].locked == false) { var item = ((Item[])dataGridView1.DataSource)[e.RowIndex]; ProcessIO.WriteInt32(handle, item.address, item.id); ProcessIO.WriteInt32(handle, item.address + 4, item.count); } return; }