An object reference is required for the non-static field, method, or property

  • Thread starter Thread starter MigrationUser 1
  • Start date Start date
M

MigrationUser 1

Guest
public void Memo4Change(Object Sender)
{

int i;
int k;
bool b;
IsClientPacket = true;
StringBuilder sb = new StringBuilder(Temp);
b = false;
for (k = 0; k <= richTextBox1.Lines.Count() - 1; k++)
{
Temp = richTextBox1.Lines[k];
for (i = 1; i <= Temp.Length; i++)
{
if (!(new ArrayList(new char[] { '0', 'a', 'A', ' ' }).Contains(Temp)))
{
sb = ' ';
b = true;
}
}
if (b)
{

richTextBox1.Lines[k] = Temp;
}
}
TPacketViewFrame.ParsePacket("This", IsClientPacket);
}



And in another class.cs


public void ParsePacket(string pkt, bool isClientPacket)
{
if (pkt is null)
{
throw new System.ArgumentNullException(nameof(pkt));
}

TPacketReader Reader;
int i;
byte ID1;
byte ID2;
string PacketName;
string PacketStuctFullStr;
TReadType ReadType;
string StructName;
// pkt types
long aInt64Q;
int aCardinalD;
ushort aWordH;
byte aByteC;
double aDoubleF;
string aStringS;
itemTag = 2;
t3.Items.Clear();
t.Items.Clear();

Reader = new TPacketReader(pkt);
try
{
uGlobalFunctionsUnit.GetPacketID(pkt, out ID1, out ID2);
if ((ID1 == 0xD0) || (ID1 == 0xFE))
{
if (isClientPacket)
{
PacketStuctFullStr = READ_VALUE("client", ID1.ToString("x") + ID2.ToString("x"), FileLocation);
}
else
{
PacketStuctFullStr = READ_VALUE("server", ID1.ToString("x") + ID2.ToString("x"), FileLocation);
}
}
else
{
if (isClientPacket)
{
PacketStuctFullStr = READ_VALUE("client", ID1.ToString("x"), "FileLocation");
}
else
{
PacketStuctFullStr = READ_VALUE("server", ID1.ToString("x"), FileLocation);
}
}
PacketName = uGlobalFunctionsUnit.GetPacketName(PacketStuctFullStr);
if (PacketName == "")
{
PacketName = "Unknown" + ID1.ToString("x");
}
// packet ID
if (!Reader.isValidC())
{
return;
}
aByteC = Reader.ReadC();
AddPacketType(PacketName, aByteC);

uGlobalFunctionsUnit.ExtractPacketStruct(PacketStuctFullStr);
if (uGlobalFunctionsUnit.CurPktStuct.Length == 0)
{
//AddRestHex(Reader.ToHex());
}
else
{
i = 0;
while (i < uGlobalFunctionsUnit.CurPktStuct.Length)
{
if (uGlobalFunctionsUnit.CurPktStuct.Length == 0)
{
return;
}
if (uGlobalFunctionsUnit.pktIsLoop(uGlobalFunctionsUnit.CurPktStuct))
{
}
else
{
uGlobalFunctionsUnit.GetReadType(uGlobalFunctionsUnit.CurPktStuct, out ReadType);
StructName = uGlobalFunctionsUnit.GetPacketStructName(uGlobalFunctionsUnit.CurPktStuct);
if ((ReadType == ((TReadType)(uGlobalFunctions.TReadType.d))))
{
aCardinalD = Reader.ReadD();
AddPacketTypeD(StructName, aCardinalD);
}
else if ((ReadType == ((TReadType)(uGlobalFunctions.TReadType.h))))
{
aWordH = Reader.ReadH();
AddPacketTypeH(StructName, aWordH);
}
else if ((ReadType == ((TReadType)(uGlobalFunctions.TReadType.q))))
{
aInt64Q = Reader.ReadQ();
AddPacketTypeQ(StructName, aInt64Q);
}
else if ((ReadType == ((TReadType)(uGlobalFunctions.TReadType.s))))
{
if (Reader.isValidS())
{
aStringS = Reader.ReadS();
AddPacketTypeS(StructName, aStringS);
}
}
else if ((ReadType == ((TReadType)(uGlobalFunctions.TReadType.c))))
{
if (Reader.isValidC())
{
aByteC = Reader.ReadC();
AddPacketTypeC(StructName, aByteC);
}
}
i++;
}
}
}
}
finally
{
}
}

An object reference is required for the non-static field, method, or property 'TPacketViewFrame.ParsePacket(string, bool)'


TIA

Continue reading...
 
Back
Top