本文整理汇总了C#中dnlib.DotNet.EmbeddedResource类的典型用法代码示例。如果您正苦于以下问题:C# EmbeddedResource类的具体用法?C# EmbeddedResource怎么用?C# EmbeddedResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmbeddedResource类属于dnlib.DotNet命名空间,在下文中一共展示了EmbeddedResource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Find
public void Find() {
var requiredTypes = new string[] {
"System.Reflection.Assembly",
"System.Object",
"System.Int32",
"System.String[]",
};
foreach (var type in module.Types) {
if (type.HasEvents)
continue;
if (!new FieldTypes(type).All(requiredTypes))
continue;
MethodDef regMethod, handler;
if (!BabelUtils.FindRegisterMethod(type, out regMethod, out handler))
continue;
var resource = BabelUtils.FindEmbeddedResource(module, type);
if (resource == null)
continue;
var decryptMethod = FindDecryptMethod(type);
if (decryptMethod == null)
throw new ApplicationException("Couldn't find resource type decrypt method");
resourceDecrypter.DecryptMethod = ResourceDecrypter.FindDecrypterMethod(decryptMethod);
InitXorKeys(decryptMethod);
resolverType = type;
registerMethod = regMethod;
encryptedResource = resource;
return;
}
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:33,代码来源:ResourceResolver.cs
示例2: decrypt
public byte[] decrypt(EmbeddedResource resource)
{
if (!CanDecrypt)
throw new ApplicationException("Can't decrypt resources");
var encryptedData = resource.GetResourceData();
return decrypt(encryptedData);
}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:ResourceDecrypter.cs
示例3: AssemblyInfo
public AssemblyInfo(byte[] data, EmbeddedResource resource, string asmFullName, string asmSimpleName, string extension) {
this.data = data;
this.resource = resource;
this.asmFullName = asmFullName;
this.asmSimpleName = asmSimpleName;
this.extension = extension;
}
开发者ID:GodLesZ,项目名称:de4dot,代码行数:7,代码来源:AssemblyDecrypter.cs
示例4: AssemblyInfo
public AssemblyInfo(byte[] data, string fullName, string simpleName, string extension, EmbeddedResource resource) {
this.data = data;
this.fullName = fullName;
this.simpleName = simpleName;
this.extension = extension;
this.resource = resource;
}
开发者ID:GodLesZ,项目名称:de4dot,代码行数:7,代码来源:AssemblyResolver.cs
示例5: Csvm
public Csvm(IDeobfuscatorContext deobfuscatorContext, ModuleDefMD module, Csvm oldOne) {
this.deobfuscatorContext = deobfuscatorContext;
this.module = module;
if (oldOne.resource != null)
this.resource = (EmbeddedResource)module.Resources[oldOne.module.Resources.IndexOf(oldOne.resource)];
if (oldOne.vmAssemblyRef != null)
this.vmAssemblyRef = module.ResolveAssemblyRef(oldOne.vmAssemblyRef.Rid);
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:8,代码来源:Csvm.cs
示例6: EmbeddedAssemblyInfo
public EmbeddedAssemblyInfo(EmbeddedResource resource, byte[] data, string asmFullName, ModuleKind kind) {
this.resource = resource;
this.data = data;
this.asmFullName = asmFullName;
this.asmSimpleName = Utils.GetAssemblySimpleName(asmFullName);
this.kind = kind;
this.extension = DeobUtils.GetExtension(kind);
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:8,代码来源:Unpacker.cs
示例7: GetMethodsData
public virtual byte[] GetMethodsData(EmbeddedResource resource) {
var reader = resource.Data;
reader.Position = startOffset;
if ((reader.ReadInt32() & 1) != 0)
return Decompress(reader);
else
return reader.ReadRemainingBytes();
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:8,代码来源:StaticMethodsDecrypter.cs
示例8: ResXProjectFile
public ResXProjectFile(ModuleDef module, string filename, string typeFullName, EmbeddedResource er) {
this.filename = filename;
TypeFullName = typeFullName;
embeddedResource = er;
newToOldAsm = new Dictionary<IAssembly, IAssembly>(new AssemblyNameComparer(AssemblyNameComparerFlags.All & ~AssemblyNameComparerFlags.Version));
foreach (var asmRef in module.GetAssemblyRefs())
newToOldAsm[asmRef] = asmRef;
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:ResXProjectFile.cs
示例9: Initialize
public void Initialize(ResourceDecrypter resourceDecrypter) {
if (decryptedData != null || stringDecrypterType == null)
return;
var resourceName = GetResourceName();
stringResource = DotNetUtils.GetResource(module, resourceName) as EmbeddedResource;
if (stringResource == null)
return;
Logger.v("Adding string decrypter. Resource: {0}", Utils.ToCsharpString(stringResource.Name));
decryptedData = resourceDecrypter.Decrypt(stringResource.GetResourceStream());
}
开发者ID:ximing-kooboo,项目名称:de4dot,代码行数:12,代码来源:StringDecrypter.cs
示例10: FindStringsResource
bool FindStringsResource(IDeobfuscator deob, ISimpleDeobfuscator simpleDeobfuscator, MethodDef cctor) {
if (stringsResource != null)
return true;
if (decrypterVersion <= StringDecrypterVersion.V3) {
stringsResource = DotNetUtils.GetResource(module, (module.Mvid ?? Guid.NewGuid()).ToString("B")) as EmbeddedResource;
if (stringsResource != null)
return true;
}
if (FindStringsResource2(deob, simpleDeobfuscator, cctor))
return true;
if (FindStringsResource2(deob, simpleDeobfuscator, stringDecrypterMethod))
return true;
return false;
}
开发者ID:GreenDamTan,项目名称:de4dot,代码行数:17,代码来源:StringDecrypterInfo.cs
示例11: Find
public void Find() {
foreach (var tmp in module.Resources) {
var resource = tmp as EmbeddedResource;
if (resource == null)
continue;
if (!resource.Name.String.EndsWith(".resources", StringComparison.Ordinal))
continue;
string ns, name;
SplitTypeName(resource.Name.String.Substring(0, resource.Name.String.Length - 10), out ns, out name);
var type = new TypeRefUser(module, ns, name, module).Resolve();
if (type == null)
continue;
if (!CheckDecrypterType(type))
continue;
encryptedResource = resource;
decrypterType = type;
break;
}
}
开发者ID:GodLesZ,项目名称:de4dot,代码行数:20,代码来源:DecrypterBase.cs
示例12: Execute
static void Execute(ILSpyTreeNode[] nodes)
{
if (!CanExecute(nodes))
return;
var rsrcListNode = Utils.GetResourceListTreeNode(nodes);
var module = ILSpyTreeNode.GetModule(nodes[0]);
Debug.Assert(module != null);
if (module == null)
throw new InvalidOperationException();
var dlg = new WF.OpenFileDialog {
RestoreDirectory = true,
Multiselect = true,
};
if (dlg.ShowDialog() != WF.DialogResult.OK)
return;
var fnames = dlg.FileNames;
if (fnames.Length == 0)
return;
var newNodes = new ResourceTreeNode[fnames.Length];
for (int i = 0; i < fnames.Length; i++) {
var fn = fnames[i];
try {
var rsrc = new EmbeddedResource(Path.GetFileName(fn), File.ReadAllBytes(fn), ManifestResourceAttributes.Public);
newNodes[i] = ResourceFactory.Create(module, rsrc);
}
catch (Exception ex) {
MainWindow.Instance.ShowMessageBox(string.Format("Error reading files: {0}", ex.Message));
return;
}
}
UndoCommandManager.Instance.Add(new CreateFileResourceCommand(rsrcListNode, newNodes));
}
开发者ID:gsong2014,项目名称:dnSpy,代码行数:37,代码来源:ResourceCommands.cs
示例13: 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);
}
开发者ID:GreenDamTan,项目名称:de4dot,代码行数:7,代码来源:ResolverBase.cs
示例14: TryCreateResourceElementSet
static ResourceElementSet TryCreateResourceElementSet(ModuleDef module, EmbeddedResource er) {
if (er == null)
return null;
er.Data.Position = 0;
if (!ResourceReader.CouldBeResourcesFile(er.Data))
return null;
try {
er.Data.Position = 0;
return ResourceReader.Read(module, er.Data);
}
catch {
return null;
}
}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:14,代码来源:Project.cs
示例15: CreateResXFile
ResXProjectFile CreateResXFile(ModuleDef module, EmbeddedResource er, ResourceElementSet set, string filename, string typeFullName, bool isSatellite) {
Debug.Assert(options.CreateResX);
if (!options.CreateResX)
throw new InvalidOperationException();
return new ResXProjectFile(module, filename, typeFullName, er) {
IsSatelliteFile = isSatellite,
};
}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:9,代码来源:Project.cs
示例16: CreateEmbeddedResourceFiles
IEnumerable<ProjectFile> CreateEmbeddedResourceFiles(ModuleDef module, ResourceNameCreator resourceNameCreator, EmbeddedResource er) {
if (!options.UnpackResources) {
yield return CreateRawEmbeddedResourceProjectFile(module, resourceNameCreator, er);
yield break;
}
er.Data.Position = 0;
if (ResourceReader.CouldBeResourcesFile(er.Data)) {
var files = TryCreateResourceFiles(module, resourceNameCreator, er);
if (files != null) {
foreach (var file in files)
yield return file;
yield break;
}
}
yield return CreateRawEmbeddedResourceProjectFile(module, resourceNameCreator, er);
}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:18,代码来源:Project.cs
示例17: GetAssemblyInfo
AssemblyInfo GetAssemblyInfo(byte[] decryptedData, EmbeddedResource resource) {
var asm = AssemblyDef.Load(decryptedData);
var fullName = asm.FullName;
var simpleName = asm.Name.String;
var extension = DeobUtils.GetExtension(asm.Modules[0].Kind);
return new AssemblyInfo(decryptedData, fullName, simpleName, extension, resource);
}
开发者ID:GodLesZ,项目名称:de4dot,代码行数:7,代码来源:AssemblyResolver.cs
示例18: TryCreateResourceFiles
List<ProjectFile> TryCreateResourceFiles(ModuleDef module, ResourceNameCreator resourceNameCreator, EmbeddedResource er) {
ResourceElementSet set;
try {
er.Data.Position = 0;
set = ResourceReader.Read(module, er.Data);
}
catch {
return null;
}
if (IsXamlResource(module, er.Name, set))
return CreateXamlResourceFiles(module, resourceNameCreator, set).ToList();
if (options.CreateResX) {
string typeFullName;
string filename = resourceNameCreator.GetResxFilename(er.Name, out typeFullName);
return new List<ProjectFile>() { CreateResXFile(module, er, set, filename, typeFullName, false) };
}
return null;
}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:19,代码来源:Project.cs
示例19: CreateRawEmbeddedResourceProjectFile
RawEmbeddedResourceProjectFile CreateRawEmbeddedResourceProjectFile(ModuleDef module, ResourceNameCreator resourceNameCreator, EmbeddedResource er) {
return new RawEmbeddedResourceProjectFile(resourceNameCreator.GetResourceFilename(er.Name), er);
}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:3,代码来源:Project.cs
示例20: rename
void rename(TypeDef type, EmbeddedResource resource)
{
newNames.Clear();
resource.Data.Position = 0;
var resourceSet = ResourceReader.read(module, resource.Data);
var renamed = new List<RenameInfo>();
foreach (var elem in resourceSet.ResourceElements) {
if (nameChecker.isValidResourceKeyName(elem.Name)) {
newNames.Add(elem.Name, true);
continue;
}
renamed.Add(new RenameInfo(elem, getNewName(elem)));
}
if (renamed.Count == 0)
return;
rename(type, renamed);
var outStream = new MemoryStream();
ResourceWriter.write(module, outStream, resourceSet);
var newResource = new EmbeddedResource(resource.Name, outStream.ToArray(), resource.Attributes);
int resourceIndex = module.Resources.IndexOf(resource);
if (resourceIndex < 0)
throw new ApplicationException("Could not find index of resource");
module.Resources[resourceIndex] = newResource;
}
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:28,代码来源:ResourceKeysRenamer.cs
注:本文中的dnlib.DotNet.EmbeddedResource类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论