1

I have a program where I hard read some offsets, right now the offsets are hard coded in my code like this:

public static int VecViewOffset = 0x00000104;
public static int VecPunch = 0x00002FF8;

But what I would like to do is to read these offsets from a .ini / .txt file so I do not have to change the offsets in in my code which I did. How ever, I read the offset as a string from the file and I need to parse it to and int. But it doesn't work.

This is how I am trying to do it.

public int GetInt(string section, string key)
{
    var keyValue = SettingsData[section][key];
    var setting = int.Parse(keyValue);
    return setting;
}

I can parse "12" to and in just fine, but I can't parse "0x00000104" to and int Any ideas? .

Glorin Oakenfoot
  • 2,455
  • 1
  • 17
  • 19
Joakim Carlsson
  • 1,540
  • 5
  • 19
  • 42

0 Answers0