本文整理汇总了C#中ICSharpCode.Write方法的典型用法代码示例。如果您正苦于以下问题:C# ICSharpCode.Write方法的具体用法?C# ICSharpCode.Write怎么用?C# ICSharpCode.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode
的用法示例。
在下文中一共展示了ICSharpCode.Write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecompileMethod
public override void DecompileMethod(ilspy::Mono.Cecil.MethodDefinition method, ICSharpCode.Decompiler.ITextOutput output, DecompilationOptions options)
{
var cmethod = GetCompiledMethod(method);
if ((cmethod != null) && (cmethod.DexMethod != null))
{
try
{
var f = new MethodBodyDisassemblyFormatter(cmethod.DexMethod, MapFile);
var formatOptions = FormatOptions.EmbedSourceCode | FormatOptions.ShowJumpTargets;
if(ShowFullNames) formatOptions |= FormatOptions.FullTypeNames;
if(DebugOperandTypes) formatOptions |= FormatOptions.DebugOperandTypes;
var s = f.Format(formatOptions);
output.Write(s);
}
catch (Exception)
{
output.Write("\n\n// Formatting error. Using Fallback.\n\n");
FallbackFormatting(output, cmethod);
}
}
else
{
output.Write("Method not found in dex");
output.WriteLine();
}
}
示例2: Decompile
public override void Decompile(Language language, ICSharpCode.Decompiler.ITextOutput output, DecompilationOptions options)
{
var baml = this.DecompileBaml();
output.Write(baml);
}
示例3: AddFilesToZip
void AddFilesToZip (ITaskItem [] files, ICSharpCode.SharpZipLib.Zip.ZipOutputStream zipStream)
{
if (files == null)
return;
foreach (ITaskItem item in files) {
string target_path = item.GetMetadata ("TargetPath");
if (String.IsNullOrEmpty (target_path))
target_path = Path.GetFileName (item.ItemSpec);
zipStream.PutNextEntry (new ICSharpCode.SharpZipLib.Zip.ZipEntry (target_path));
using (FileStream inStream = File.OpenRead (item.ItemSpec)) {
int readCount;
byte[] buffer = new byte[4096];
do {
readCount = inStream.Read (buffer, 0, buffer.Length);
zipStream.Write (buffer, 0, readCount);
} while (readCount > 0);
}
}
}
示例4: DecompileMethod
public override void DecompileMethod(Mono.Cecil.MethodDefinition method, ICSharpCode.Decompiler.ITextOutput output, DecompilationOptions options)
{
var declaringType = method.DeclaringType;
var assembly = declaringType.Module.Assembly;
if ((compiler == null) || (compiler.Assembly != assembly))
{
compiler = null;
var c = new AssemblyCompiler(assembly, new NamespaceConverter("pkg.name", ""));
c.Compile();
compiler = c;
}
var cmethod = compiler.GetMethod(method);
if ((cmethod != null) && (cmethod.RLBody != null))
{
var body = cmethod.RLBody;
var basicBlocks = BasicBlock.Find(body);
foreach (var block in basicBlocks)
{
output.Write(string.Format("D_{0:X4}:", block.Entry.Index));
output.WriteLine();
output.Indent();
foreach (var ins in block.Instructions)
{
output.Write(ins.ToString());
output.WriteLine();
}
output.Unindent();
}
if (body.Exceptions.Any())
{
output.WriteLine();
output.Write("Exception handlers:");
output.WriteLine();
output.Indent();
foreach (var handler in body.Exceptions)
{
output.Write(string.Format("{0:x4}-{1:x4}", handler.TryStart.Index, handler.TryEnd.Index));
output.WriteLine();
output.Indent();
foreach (var c in handler.Catches)
{
output.Write(string.Format("{0} => {1:x4}", c.Type, c.Instruction.Index));
output.WriteLine();
}
if (handler.CatchAll != null)
{
output.Write(string.Format("{0} => {1:x4}", "<any>", handler.CatchAll.Index));
output.WriteLine();
}
output.Unindent();
}
output.Unindent();
}
}
else
{
output.Write("Method not found in dex");
output.WriteLine();
}
}