internal uint GetSearchMemorySize(DataTypeExact DataType) { switch (DataType) { case DataTypeExact.Bytes1: //1 Byte return(1); case DataTypeExact.Bytes2: //2 Bytes return(2); case DataTypeExact.Bytes4: //4 Bytes return(4); case DataTypeExact.Bytes8: //8 Bytes return(8); case DataTypeExact.Float: //Float return((uint)BitConverter.GetBytes(float.MinValue).Length); case DataTypeExact.Double: //Double return((uint)BitConverter.GetBytes(double.MinValue).Length); case DataTypeExact.Raw: //Raw Bytes return((uint)Utilities.GetByteArrayFromByteString(SearchValue.Text).Length); default: //Text return((uint)System.Text.Encoding.Default.GetBytes(SearchValue.Text).Length); } }
public string GetDisplayForByteArray(byte[] p, DataTypeExact DataType) { switch (DataType) { case DataTypeExact.Bytes1: //1 Byte return(((uint)p[0]).ToString()); case DataTypeExact.Bytes2: //2 Bytes return(BitConverter.ToUInt16(p, 0).ToString()); case DataTypeExact.Bytes4: //4 Bytes return(BitConverter.ToUInt32(p, 0).ToString()); case DataTypeExact.Bytes8: //8 Bytes return(BitConverter.ToUInt64(p, 0).ToString()); case DataTypeExact.Float: //Float return(BitConverter.ToSingle(p, 0).ToString()); case DataTypeExact.Double: //Double return(BitConverter.ToDouble(p, 0).ToString()); case DataTypeExact.Raw: //Raw Bytes return(Utilities.GetStringFromByteArray(p)); default: //Text return(System.Text.Encoding.Default.GetString(p)); } }
private byte[] GetByteArrayForDataType(DataTypeExact DataType, string Value) { switch (DataType) { case DataTypeExact.Bytes1: //1 Byte return(new byte[] { (byte)uint.Parse(Value) }); case DataTypeExact.Bytes2: //2 Bytes return(BitConverter.GetBytes(ushort.Parse(Value))); case DataTypeExact.Bytes4: //4 Bytes return(BitConverter.GetBytes(uint.Parse(Value))); case DataTypeExact.Bytes8: //8 Bytes return(BitConverter.GetBytes(ulong.Parse(Value))); case DataTypeExact.Float: //Float return(BitConverter.GetBytes(float.Parse(Value))); case DataTypeExact.Double: //Double return(BitConverter.GetBytes(double.Parse(Value))); case DataTypeExact.Raw: //Raw Bytes return(Utilities.GetByteArrayFromByteString(Value)); case DataTypeExact.Text: //Raw Bytes default: return(System.Text.Encoding.Default.GetBytes(Value)); } }
internal void SetMemory(int RowIndex) { string TextAddress = (string)ValuesGrid[1, RowIndex].Value; string valString = (string)ValuesGrid[3, RowIndex].Value; DataTypeExact type = DataTypeExactTool.GetValue((string)ValuesGrid[4, RowIndex].Value); SetMemory(TextAddress, valString, type, RowIndex); }
internal byte[] GetMemoryAtAddress(string ProcessID, uint Address, DataTypeExact DataType) { if (ProcessID.Contains("|")) { ProcessID = ProcessID.Substring(0, ProcessID.IndexOf('|')); } return(GetMemoryAtAddress(BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(ProcessID), 0), Address, DataType)); }
public static string GetKey(DataTypeExact value) { foreach (string key in Mapping.Keys) { if (Mapping[key] == value) { return key; } } return null; }
public static string GetKey(DataTypeExact value) { foreach (string key in Mapping.Keys) { if (Mapping[key] == value) { return(key); } } return(null); }
internal byte[] GetMemoryAtAddress(uint ProcessID, uint Address, DataTypeExact DataType) { SearchCriteria Criteria = new SearchCriteria(); Criteria.ProcessID = ProcessID; Criteria.DataType = DataType; Criteria.StartAddress = Address; Criteria.Length = Criteria.Size = Form.GetSearchMemorySize(DataType); Criteria.SearchType = SearchTypeBase.Unknown; Criteria.SearchValue = new byte[] { 0 }; Form.NTRConnection.SearchCriteria.Add(Criteria); Form.NTRConnection.SendReadMemoryPacket(Criteria); return(Criteria.AddressesFound.Values.First()); }
private void btnAddSelected_Click(object sender, EventArgs e) { DataTypeExact addrType = DataTypeExactTool.GetValue(comboSelType.Text); if (addrType == DataTypeExact.INVALID) { return; } String addrStr = selectedAddress.ToString("x2").PadLeft(8, '0'); int existingAddressIdx = ResultingCodes.FindIndex(c => c.address == addrStr); if (existingAddressIdx != -1) { ResultingCodes[existingAddressIdx] = new SaveCode(addrType, addrStr, txtSelTitle.Text); } else { ResultingCodes.Add(new SaveCode(DataTypeExactTool.GetValue(comboSelType.Text), addrStr, txtSelTitle.Text)); } RefreshDataGrid(); }
internal byte[] GetMemoryAtAddress(uint ProcessID, string Address, DataTypeExact DataType) { return(GetMemoryAtAddress(ProcessID, BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(Address).Reverse().ToArray(), 0), DataType)); }
internal byte[] GetMemoryAtAddress(string ProcessID, uint Address, DataTypeExact DataType) { return(GetMemoryAtAddress(BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(ProcessID), 0), Address, DataType)); }
internal byte[] GetMemoryAtAddress(uint ProcessID, uint Address, DataTypeExact DataType) { SearchCriteria Criteria = new SearchCriteria(); Criteria.ProcessID = ProcessID; Criteria.DataType = DataType; Criteria.StartAddress = Address; Criteria.Length = Criteria.Size = Form.GetSearchMemorySize(DataType); Criteria.SearchType = SearchTypeBase.Unknown; Criteria.SearchValue = new byte[] { 0 }; Form.NTRConnection.SearchCriteria.Add(Criteria); Form.NTRConnection.SendReadMemoryPacket(Criteria); return Criteria.AddressesFound.Values.First(); }
internal byte[] GetMemoryAtAddress(string ProcessID, uint Address, DataTypeExact DataType) { return GetMemoryAtAddress(BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(ProcessID), 0), Address, DataType); }
internal byte[] GetMemoryAtAddress(uint ProcessID, string Address, DataTypeExact DataType) { return GetMemoryAtAddress(ProcessID, BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(Address).Reverse().ToArray(), 0), DataType); }
public SaveCode(DataTypeExact type, String address, String title) { this.type = type; this.address = address; this.title = title; }
public SaveCode(DataTypeExact type, String address) { this.type = type; this.address = address; }
public SaveCode() { type = DataTypeExact.Raw; address = null; }
internal uint GetSearchMemorySize(DataTypeExact DataType) { switch (DataType) { case DataTypeExact.Bytes1: //1 Byte return 1; case DataTypeExact.Bytes2: //2 Bytes return 2; case DataTypeExact.Bytes4: //4 Bytes return 4; case DataTypeExact.Bytes8: //8 Bytes return 8; case DataTypeExact.Float: //Float return (uint)BitConverter.GetBytes(float.MinValue).Length; case DataTypeExact.Double: //Double return (uint)BitConverter.GetBytes(double.MinValue).Length; case DataTypeExact.Raw: //Raw Bytes return (uint)Utilities.GetByteArrayFromByteString(SearchValue.Text).Length; default: //Text return (uint)System.Text.Encoding.Default.GetBytes(SearchValue.Text).Length; } }
public string GetDisplayForByteArray(byte[] p, DataTypeExact DataType) { switch (DataType) { case DataTypeExact.Bytes1: //1 Byte return ((uint)p[0]).ToString(); case DataTypeExact.Bytes2: //2 Bytes return BitConverter.ToUInt16(p, 0).ToString(); case DataTypeExact.Bytes4: //4 Bytes return BitConverter.ToUInt32(p, 0).ToString(); case DataTypeExact.Bytes8: //8 Bytes return BitConverter.ToUInt64(p, 0).ToString(); case DataTypeExact.Float: //Float return BitConverter.ToSingle(p, 0).ToString(); case DataTypeExact.Double: //Double return BitConverter.ToDouble(p, 0).ToString(); case DataTypeExact.Raw: //Raw Bytes return Utilities.GetStringFromByteArray(p); default: //Text return System.Text.Encoding.Default.GetString(p); } }
internal void SetMemory(string address, string value, DataTypeExact type, int RowIndex = -1) { MemoryDispatch MemoryDispatch = new MemoryDispatch(); MemoryDispatch.Row = RowIndex; MemoryDispatch.TextAddress = address; MemoryDispatch.Type = type; if (MemoryDispatch.Type == DataTypeExact.INVALID) { return; } //check value for type range bool inputInvalidOrOutOfRange; switch (MemoryDispatch.Type) { case DataTypeExact.Bytes1: try { byte.Parse(value); inputInvalidOrOutOfRange = false; } catch { inputInvalidOrOutOfRange = true; } break; case DataTypeExact.Bytes2: try { UInt16.Parse(value); inputInvalidOrOutOfRange = false; } catch { inputInvalidOrOutOfRange = true; } break; case DataTypeExact.Bytes4: try { UInt32.Parse(value); inputInvalidOrOutOfRange = false; } catch { inputInvalidOrOutOfRange = true; } break; case DataTypeExact.Bytes8: try { UInt64.Parse(value); inputInvalidOrOutOfRange = false; } catch { inputInvalidOrOutOfRange = true; } break; case DataTypeExact.Float: try { float.Parse(value); inputInvalidOrOutOfRange = false; } catch { inputInvalidOrOutOfRange = true; } break; case DataTypeExact.Double: try { double.Parse(value); inputInvalidOrOutOfRange = false; } catch { inputInvalidOrOutOfRange = true; } break; default: inputInvalidOrOutOfRange = false; break; } if (!inputInvalidOrOutOfRange) { MemoryDispatch.Value = GetByteArrayForDataType(MemoryDispatch.Type, value); ThreadEventDispatcher.WriteAddress.Enqueue(MemoryDispatch); if (RowIndex >= 0) { ValuesGrid[4, RowIndex].ErrorText = ""; ValuesGrid[4, RowIndex].Style.BackColor = System.Drawing.Color.Transparent; } } else { if (RowIndex >= 0) { ValuesGrid[4, RowIndex].ErrorText = "Value is out of range"; ValuesGrid[4, RowIndex].Style.BackColor = System.Drawing.Color.Red; } } }
private byte[] GetValueForDataType(DataTypeExact CurrentSelectedDataType, string Value) { switch (CurrentSelectedDataType) { case DataTypeExact.Bytes1: //1 Byte return new byte[] { (byte)uint.Parse(Value) }; case DataTypeExact.Bytes2: //2 Bytes return BitConverter.GetBytes(ushort.Parse(Value)); case DataTypeExact.Bytes4: //4 Bytes return BitConverter.GetBytes(uint.Parse(Value)); case DataTypeExact.Bytes8: //8 Bytes return BitConverter.GetBytes(ulong.Parse(Value)); case DataTypeExact.Float: //Float return BitConverter.GetBytes(float.Parse(Value)); case DataTypeExact.Double: //Double return BitConverter.GetBytes(double.Parse(Value)); case DataTypeExact.Raw: //Raw Bytes return Utilities.GetByteArrayFromByteString(Value); default: //Text return System.Text.Encoding.Default.GetBytes(Value); } }