mroschk Posted November 10, 2013 Report Posted November 10, 2013 Hello, i want to create a Offset for use with the .Net C# application at runtime. So i have a TextBox where i can enter the Offset. Then i read this as a String Variable and then i want to create the Offset like this: private Offset<short> _FsuipcOffset; string _Offset = "0x4433"; _FsuipcOffset = new Offset<short>(_Offset); But that code will not work because we have to enter a Hex Value like this: _FsuipcOffset = new Offset<short>(0x4433); How can i do this? Thanks Matthias
Paul Henty Posted November 10, 2013 Report Posted November 10, 2013 Hi Matthias, All you need to do is convert the string into an integer that you can pass to the offset constructor. Int32 has a parse Method that will convert a string in hex into an integer. You need to remove the '0x' though. Here's the code: string _Offset = "0x4433"; int intOffset = Int32.Parse(_Offset.Substring(2), System.Globalization.NumberStyles.HexNumber); _FsuipcOffset = new Offset<short>(intOffset); When you've finished with the offset, make sure you call Disconnect() before you make a new one. If you don't, the DLL will still have a copy of it and will still read it when you call Process(); _FsuipcOffset.Disconnect(); Paul
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now