What's new

Fix CRC??

  • Thread starter Experiment5X
  • Start date
  • Views 487
E

Experiment5X

Newbie
Messages
5
Reaction score
0
Allright i am trying to fix the crc for MW2 mpdata. I am using packageIO and i am using this code

private void Checksum(string File)
{
PackageIO.IO IO = new PackageIO.IO(File, Endian.Big, 0xD008);
PackageIO.Algorithms.CRC32 Crc = new PackageIO.Algorithms.CRC32();
byte[] b = IO.Reader.ReadBytes(0x1FFC);
IO.Position = 0xD004;
IO.Writer.Write(Crc.Compute(B));
IO.Close();
}

when i paste this into a new project i get now errors but of coarse when i put it into my project i get this error which i have no idea how to fix and and have tried to fix for about 30 mins with no luck, here it is

'PackageIO.Algorithms.CRC32.Compute(byte[])' cannot be accessed with an instance reference; qualify it with a type name instead

any help would be great, thanks
 
L

Lolzorz

Enthusiast
Messages
824
Reaction score
60
To bad this isn't your own code, or you would've know how to fix it....
 
L

Luxurious Meat

Enthusiast
Messages
610
Reaction score
124
To bad this isn't your own code, or you would've know how to fix it....
Too bad you don't know how to fix it either, and had to make a useless post. It's a public library, how could it possibly be his code?

I don't have the library so I can't check if the method 'Compute' is a static method, but that's what it sounds like from the error. If that's the case, static members can only be accessed through the type name, and not a instance of the class. Try this:

Code:
private void Checksum(string File)
{
PackageIO.IO IO = new PackageIO.IO(File, Endian.Big, 0xD008);
byte[] b = IO.Reader.ReadBytes(0x1FFC);
IO.Position = 0xD004;
IO.Writer.Write(PackageIO.Algorithms.CRC32.Compute(B));
IO.Close();
}
 
Top Bottom