public byte[] GetResourceData() { if (stream != null) return ReadStream (stream); if (data != null) return data; if (offset.HasValue) return reader.GetManagedResource (offset.Value); throw new InvalidOperationException (); }
public byte[] decrypt(EmbeddedResource resource) { if (!CanDecrypt) throw new ApplicationException("Can't decrypt resources"); var encryptedData = resource.GetResourceData(); return decrypt(encryptedData); }