public int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; uint sig = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; if (sig == SIGNATURE) { version = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; uint entries = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; // decrypt old versions first (v4 first unencryted) // note: this might need different passwords for other versions if (version <= VERSION3) { #if WINCLR && X86 uint streamlength = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; uint expectedresponse = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; Crush32.Decrypt(Buffer, cursor, (int)streamlength, version, expectedresponse, PASSWORDV3); #else throw new Exception(RooFile.ERRORCRUSHPLATFORM); #endif } // now load strings StringResources.Clear(); StringResources.Capacity = (int)entries + 100; for (int i = 0; i < entries; i++) { RsbResourceID entry = new RsbResourceID(version, Buffer, cursor); cursor += entry.ByteLength; StringResources.Add(entry); } } else { throw new Exception("Wrong RSC file signature: " + sig + " (expected " + SIGNATURE + ")."); } return(cursor - StartIndex); }
protected bool IsFilterMatch(RsbResourceID ID) { return (!chkFilterID.Checked || ID.ID == numFilterID.Value) && (!chkFilterLanguage.Checked || ID.Language == (LanguageCode)cbFilterLanguage.SelectedValue) && (!chkFilterText.Checked || txtFilterText.Text.Length < 3 || ID.Text.Contains(txtFilterText.Text)); }
public int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; uint sig= BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; if (sig == SIGNATURE) { version = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; uint entries = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; // decrypt old versions first (v4 first unencryted) // note: this might need different passwords for other versions if (version <= VERSION3) { #if WINCLR && X86 uint streamlength = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; uint expectedresponse = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; Crush32.Decrypt(Buffer, cursor, (int)streamlength, version, expectedresponse, PASSWORDV3); #else throw new Exception(RooFile.ERRORCRUSHPLATFORM); #endif } // now load strings StringResources.Clear(); StringResources.Capacity = (int)entries + 100; for (int i = 0; i < entries; i++) { RsbResourceID entry = new RsbResourceID(version, Buffer, cursor); cursor += entry.ByteLength; StringResources.Add(entry); } } else throw new Exception("Wrong RSC file signature: " + sig + " (expected " + SIGNATURE + ")."); return cursor - StartIndex; }