本文整理汇总了C#中Mono.Cecil.EmbeddedResource.GetResourceData方法的典型用法代码示例。如果您正苦于以下问题:C# EmbeddedResource.GetResourceData方法的具体用法?C# EmbeddedResource.GetResourceData怎么用?C# EmbeddedResource.GetResourceData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.EmbeddedResource
的用法示例。
在下文中一共展示了EmbeddedResource.GetResourceData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: decrypt
public byte[] decrypt(EmbeddedResource resource)
{
if (!CanDecrypt)
throw new ApplicationException("Can't decrypt resources");
var encryptedData = resource.GetResourceData();
return decrypt(encryptedData);
}
示例2: initialize
public void initialize(ISimpleDeobfuscator simpleDeobfuscator, IDeobfuscator deob)
{
if (methodsDecrypter == null)
return;
encryptedResource = BabelUtils.findEmbeddedResource(module, methodsDecrypter, simpleDeobfuscator, deob);
if (encryptedResource == null) {
Log.w("Could not find encrypted methods resource");
return;
}
addImageReader("", new ResourceDecrypter(module).decrypt(encryptedResource.GetResourceData()));
}
示例3: decryptResourceV3
protected static byte[] decryptResourceV3(EmbeddedResource resource)
{
return decryptResourceV3(resource.GetResourceData());
}
示例4: ShowBinary
public void ShowBinary(EmbeddedResource er, bool showingGridBinary)
{
ShowBinary(er.GetResourceData(), showingGridBinary);
}
示例5: decryptResourceV41SL
protected static byte[] decryptResourceV41SL(EmbeddedResource resource)
{
var data = resource.GetResourceData();
byte k = data[0];
for (int i = 0; i < data.Length - 1; i++)
data[i + 1] ^= (byte)((k << (i & 5)) + i);
return inflateIfNeeded(data, 1, data.Length - 1);
}
示例6: initialize
public void initialize(ISimpleDeobfuscator simpleDeobfuscator, IDeobfuscator deob)
{
if (methodsDecrypter == null)
return;
encryptedResource = BabelUtils.findEmbeddedResource(module, methodsDecrypter, simpleDeobfuscator, deob);
if (encryptedResource != null)
addImageReader("", resourceDecrypter.decrypt(encryptedResource.GetResourceData()));
}
示例7: SaveResourceFile
private void SaveResourceFile(EmbeddedResource er, string outputFile)
{
byte[] bytes = er.GetResourceData();
using (FileStream fs = File.Create(outputFile))
{
fs.Write(bytes, 0, bytes.Length);
}
_form.SetStatusText(String.Format("{0} saved.", outputFile));
if (PathUtils.IsResourceExt(outputFile))
{
using (ResourceReader rr = new ResourceReader(er.GetResourceStream()))
{
string resxFile = Path.ChangeExtension(outputFile, ".resx");
using (ResXResourceWriter xw = new ResXResourceWriter(resxFile))
{
IDictionaryEnumerator de = rr.GetEnumerator();
while (de.MoveNext())
{
bool handled = false;
if (de.Value != null)
{
Type type = de.Value.GetType();
if (type.FullName.EndsWith("Stream"))
{
Stream s = de.Value as Stream;
if (s != null)
{
byte[] tmpBytes = new byte[s.Length];
if (s.CanSeek) s.Seek(0, SeekOrigin.Begin);
s.Read(tmpBytes, 0, tmpBytes.Length);
xw.AddResource(de.Key.ToString(), new MemoryStream(tmpBytes));
handled = true;
}
}
}
if (handled) continue;
xw.AddResource(de.Key.ToString(), de.Value);
}
}
}
}
else if (PathUtils.IsBamlExt(outputFile))
{
try
{
using (StreamWriter sw = File.CreateText(Path.ChangeExtension(outputFile, ".xaml")))
{
sw.WriteLine(_form.ResourceHandler.DecompileBaml(new MemoryStream(bytes)));
}
}
catch (Exception ex)
{
_form.SetStatusText(String.Format("Failed to translate {0}: {1}", er.Name, ex.Message));
}
}
}
示例8: initialize
public void initialize(ISimpleDeobfuscator simpleDeobfuscator, IDeobfuscator deob)
{
if (resolverType == null)
return;
encryptedResource = BabelUtils.findEmbeddedResource(module, resolverType, simpleDeobfuscator, deob);
if (encryptedResource == null) {
Log.w("Could not find embedded assemblies resource");
return;
}
var decrypted = resourceDecrypter.decrypt(encryptedResource.GetResourceData());
var reader = new BinaryReader(new MemoryStream(decrypted));
int numAssemblies = reader.ReadInt32();
embeddedAssemblyInfos = new EmbeddedAssemblyInfo[numAssemblies];
for (int i = 0; i < numAssemblies; i++) {
string name = reader.ReadString();
var data = reader.ReadBytes(reader.ReadInt32());
var mod = ModuleDefinition.ReadModule(new MemoryStream(data));
embeddedAssemblyInfos[i] = new EmbeddedAssemblyInfo(name, DeobUtils.getExtension(mod.Kind), data);
}
}
示例9: initialize
public void initialize(ModuleDefinition module, EmbeddedResource resource)
{
var decrypted = resourceDecrypter.decrypt(resource.GetResourceData());
var reader = new BinaryReader(new MemoryStream(decrypted));
while (reader.BaseStream.Position < reader.BaseStream.Length)
offsetToString[getOffset((int)reader.BaseStream.Position)] = reader.ReadString();
}