Still Need Help! The best overloaded method match for 'XDevkit.IXboxDebugTarget.GetMemory(uint, uint, byte[], out uint)' has some invalid arguments [duplicate]
-
16-06-2021 - |
문제
Possible Duplicate:
The best overloaded method match for 'XDevkit.IXboxDebugTarget.GetMemory(uint, uint, byte[], out uint)' has some invalid arguments
Not sure why this is being voted down, I just need help. I have been struggling with this for hours and I am about done, please if you don't like the post just move on don't vote this down so no one can see it!
Ok I have googled and read through answers and questions like this forever, but have not found an explanation that I can understand for either of these problems I am having, I hope someone on here can help!
Error1: The best overloaded method match for 'XDevkit.IXboxDebugTarget.GetMemory(uint, uint, byte[], out uint)' has some invalid arguments
The Base Code:
XDevkit.IXboxDebugTarget.GetMemory(uint, uint, byte[], out uint)
What I have NEW:
uint num1;
uint num2;
uint num4;
num1 = Convert.ToUInt32(textBox2.Text);
num2 = Convert.ToUInt32(textBox3.Text);
num4 = Convert.ToUInt32(textBox5.Text);
byte[] num3;
num3 = BitConverter.GetBytes(Convert.ToInt32(textBox3.Text));
IXboxManager xbm = new XboxManager();
IXboxConsole xbc = xbm.OpenConsole("textBox1.Text"); //Or Console Name in ""
IXboxDebugTarget xdt = xbc.DebugTarget;
xdt.ConnectAsDebugger("XeDevMemPatcher", XboxDebugConnectFlags.Force); // this isn't always needed
IXboxDebugTarget.GetMemory(num1, num2, num3[], out num4);
}
EDIT Current Errors With This Code
1) The name 'Encoding' does not exist in the current context
2) The best overloaded method match for 'XDevkit.IXboxDebugTarget.GetMemory(uint, uint, byte[], out uint)' has some invalid 2222arguments
3) Argument 3: cannot convert from 'byte' to 'byte[]'
Ok, so this is apparently exceptionally confusing as nothing I do alone or based on answers works, so I am just going to post the entire source on here for you guys to view and hopefully that will help: Sorry I cannot post a picture of the GUI because I do not have enough REP, but hopefully this should be fine:
using System; using System.Windows.Forms;
namespace XDevkit { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void button1_Click(object sender, EventArgs e)
{
IXboxManager xbm = new XboxManager();
//IXboxConsole xbc = xbm.OpenConsole(xbm.DefaultConsole); // dev
IXboxConsole xbc = xbm.OpenConsole("textBox1.Text");
IXboxDebugTarget xdt = xbc.DebugTarget;
xdt.ConnectAsDebugger("XeDevMemPatcher", XboxDebugConnectFlags.Force);
}
private void button2_Click(object sender, EventArgs e)
{
uint num1 = Convert.ToUInt32(textBox2.Text);
uint num2 = Convert.ToUInt32(textBox3.Text);
byte[] num3 = Encoding.ASCII.GetBytes(textBox4.Text);
uint num4 = Convert.ToUInt32(textBox5.Text);
int num5 = Convert.ToInt32(textBox4.Text);
// ...
if (num3.Length > 1)
{
IXboxManager xbm = new XboxManager();
IXboxConsole xbc = xbm.OpenConsole("textBox1.Text");
IXboxDebugTarget xdt = xbc.DebugTarget;
xdt.ConnectAsDebugger("XeDevMemPatcher", XboxDebugConnectFlags.Force);
IXboxDebugTarget.GetMemory(num1, num2, num3[1], out num4);
}
private void button3_Click(object sender, EventArgs e)
{
string a;
a = "textBox6.Text";
IXboxManager xbm = new XboxManager();
IXboxConsole xbc = xbm.OpenConsole(textBox1.Text);
IXboxConsole.ScreenShot(a)
}
}
}
해결책
Error 1: num3
is of type byte
, which doesn't have an indexer.
The example might work if you modified the code to the following:
uint num1 = Convert.ToUInt32(textBox2.Text);
uint num2 = Convert.ToUInt32(textBox3.Text);
byte[] num3 = Encoding.ASCII.GetBytes(textBox4.Text);
uint num4 = Convert.ToUInt32(textBox5.Text);
int num5 = Convert.ToInt32(textBox4.Text);
// ...
if (num3.Length > 1) {
IXboxManager xbm = new XboxManager();
IXboxConsole xbc = xbm.OpenConsole("textBox1.Text");
IXboxDebugTarget xdt = xbc.DebugTarget;
xdt.ConnectAsDebugger("XeDevMemPatcher", XboxDebugConnectFlags.Force);
IXboxDebugTarget.GetMemory(num1, num2, num3[1], out num4);
}
Error 2: IXboxConsole.ScreenShot
is an instance method and not a class (aka static) method. You have to create an instance before you can call instance methods:
IXboxManager xbm = new XboxManager();
IXboxConsole xbc = xbm.OpenConsole(textBox1.Text);
xbc.ScreenShot("screenshot");
다른 팁
It's pretty clear from the error message. num3
is not a byte array so you cannot access it with an array index. You will need to convert whatever textbox3.Text
is to a byte array if you want to access it like you want. You haven't provided us with this information.
Edit:
If you want to convert the value in the textbox to a byte array, you can do the following:
byte[] num3 = BitConvert.GetBytes(Convert.ToInt32(textBox3.Text));
Then you can access num3[1]
as desired (providing the array is at least a length of 1).