本文整理汇总了C#中ICSharpCode类的典型用法代码示例。如果您正苦于以下问题:C# ICSharpCode类的具体用法?C# ICSharpCode怎么用?C# ICSharpCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICSharpCode类属于命名空间,在下文中一共展示了ICSharpCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Inject
public void Inject(ICSharpCode.ILSpy.TreeNodes.ILSpyTreeNode node, string name, IMetadataTokenProvider member)
{
//Name and namespace
var typeName = node is ModuleTreeNode ? (name.Substring(name.Contains(".") ? name.LastIndexOf('.') + 1 : 0)) : name;
var typeNamespace = node is ModuleTreeNode ? (name.Substring(0, name.Contains(".") ? name.LastIndexOf('.') : 0)) : string.Empty;
//Checks that the typename isn't empty
if (string.IsNullOrEmpty(typeName))
{
MessageBox.Show("Please, specify the name of the type", "Type name required", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
//Creates a new class definition
var c = new TypeDefinition(
typeNamespace,
typeName,
TypeAttributes.Class | TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.AutoClass | TypeAttributes.AnsiClass | TypeAttributes.Abstract
)
{
IsAnsiClass = true,
};
//Adds to the node
Helpers.Tree.AddTreeNode(node, c, null, null);
}
示例3: RetrieveRegions
void RetrieveRegions(ICompilationUnit cu, ICSharpCode.NRefactory.Parser.SpecialTracker tracker)
{
for (int i = 0; i < tracker.CurrentSpecials.Count; ++i) {
ICSharpCode.NRefactory.PreprocessingDirective directive = tracker.CurrentSpecials[i] as ICSharpCode.NRefactory.PreprocessingDirective;
if (directive != null) {
if (directive.Cmd == "#region") {
int deep = 1;
for (int j = i + 1; j < tracker.CurrentSpecials.Count; ++j) {
ICSharpCode.NRefactory.PreprocessingDirective nextDirective = tracker.CurrentSpecials[j] as ICSharpCode.NRefactory.PreprocessingDirective;
if (nextDirective != null) {
switch (nextDirective.Cmd) {
case "#region":
++deep;
break;
case "#endregion":
--deep;
if (deep == 0) {
cu.FoldingRegions.Add(new FoldingRegion(directive.Arg.Trim(), new DomRegion(directive.StartPosition, nextDirective.EndPosition)));
goto end;
}
break;
}
}
}
end: ;
}
}
}
}
示例4: ToolTipData
public ToolTipData (ICSharpCode.NRefactory.CSharp.SyntaxTree unit, ICSharpCode.NRefactory.Semantics.ResolveResult result, ICSharpCode.NRefactory.CSharp.AstNode node, CSharpAstResolver file)
{
this.Unit = unit;
this.Result = result;
this.Node = node;
this.Resolver = file;
}
示例5: ColorizeLine
protected override void ColorizeLine(ICSharpCode.AvalonEdit.Document.DocumentLine line)
{
if ((line.LineNumber == LineNumber) && IsEnabled)
{
ChangeLinePart(line.Offset, line.EndOffset, element => element.TextRunProperties.SetBackgroundBrush(Brushes.Yellow));
}
}
示例6: NRefactoryCodeAction
public NRefactoryCodeAction (string id, string title, ICSharpCode.NRefactory.CSharp.Refactoring.CodeAction act)
{
this.IdString = id;
this.Title = title;
this.act = act;
this.DocumentRegion = new Mono.TextEditor.DocumentRegion (act.Start, act.End);
}
示例7: VisitIdentifierExpression
public override object VisitIdentifierExpression(ICSharpCode.NRefactory.Ast.IdentifierExpression identifierExpression, object data)
{
if (Compare(identifierExpression)) {
identifiers.Add(identifierExpression);
}
return base.VisitIdentifierExpression(identifierExpression, data);
}
示例8: FillTree
public void FillTree (ICSharpCode.TreeView.SharpTreeView tree,Module module)
{
var root = CreateTreeItem(module);
tree.Root = root;
foreach (var ns in module.Namespaces)
{
var namespaceNode = CreateTreeItem(ns);
tree.Root.Children.Add(namespaceNode);
foreach (var type in ns.Types)
{
var typeNode = CreateTreeItem(type);
namespaceNode.Children.Add(typeNode);
foreach (var method in type.Methods)
{
var methodName = CreateTreeItem(method);
namespaceNode.Children.Add(methodName);
}
foreach (var field in type.Fields)
{
var fieldNode = CreateTreeItem(field);
namespaceNode.Children.Add(fieldNode);
}
}
}
}
示例9: VisitLocalVariableDeclaration
public override object VisitLocalVariableDeclaration (ICSharpCode.NRefactory.Ast.LocalVariableDeclaration localVariableDeclaration, object data)
{
object result = base.VisitLocalVariableDeclaration (localVariableDeclaration, data);
if (localVariableDeclaration.Variables.Count == 0)
RemoveCurrentNode ();
return result;
}
示例10: VisitVariableDeclaration
public override object VisitVariableDeclaration(ICSharpCode.NRefactory.Ast.VariableDeclaration variableDeclaration, object data)
{
if (!(variableDeclaration.Parent is LocalVariableDeclaration)) {
this.ReplaceCurrentNode(new ExpressionStatement(new AssignmentExpression(new IdentifierExpression(variableDeclaration.Name), AssignmentOperatorType.Assign, variableDeclaration.Initializer)));
}
return base.VisitVariableDeclaration(variableDeclaration, data);
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:7,代码来源:ReplaceUnnecessaryVariableDeclarationsTransformer.cs
示例11: IsValid
public bool IsValid(object owner, ICSharpCode.Core.Condition condition)
{
if (!condition.Properties.Contains(NodeTypeKey))
return false;
string nodeTypeString = condition.Properties[NodeTypeKey];
XmlEditor editor = owner as XmlEditor;
if (editor == null)
return false;
XmlViewSingleContent view = LogicalTreeHelper.FindLogicalNode(editor, "xmlView") as XmlViewSingleContent;
if (view == null || view.ActiveViewer == null)
return false;
XmlNode targetNode = view.ActiveViewer.GetCaretNode();
if (targetNode == null)
return false;
if (nodeTypeString.Equals("LeafElement"))
{
if (targetNode.NodeType == XmlNodeType.Element && targetNode.ChildNodes.Count == 1 && targetNode.FirstChild.NodeType == XmlNodeType.Text)
return true;
return false;
}
else
return targetNode.NodeType.ToString().Equals(nodeTypeString);
}
示例12: Complete
public override void Complete(ICSharpCode.AvalonEdit.Editing.TextArea textArea, ICSharpCode.AvalonEdit.Document.ISegment completionSegment, EventArgs insertionRequestEventArgs)
{
var insertion = Action == null ? this.Text : Action.Invoke();
textArea.Document.Replace(completionSegment, insertion);
if (insertion.EndsWith("("))
_parent.ShowCompletions(_control);
}
示例13: RawlyIndentLine
public void RawlyIndentLine(int tabsToInsert, ICSharpCode.AvalonEdit.Document.TextDocument document, DocumentLine line)
{
if (!_doBeginUpdateManually)
document.BeginUpdate();
/*
* 1) Remove old indentation
* 2) Insert new one
*/
// 1)
int prevInd = 0;
int curOff = line.Offset;
if (curOff < document.TextLength)
{
char curChar = '\0';
while (curOff < document.TextLength && ((curChar = document.GetCharAt(curOff)) == ' ' || curChar == '\t'))
{
prevInd++;
curOff++;
}
document.Remove(line.Offset, prevInd);
}
// 2)
string indentString = "";
for (int i = 0; i < tabsToInsert; i++)
indentString += dEditor.Editor.Options.IndentationString;
document.Insert(line.Offset, indentString);
if (!_doBeginUpdateManually)
document.EndUpdate();
}
示例14: CreateDataSection
public override void CreateDataSection (ICSharpCode.Reports.Core.BaseSection section)
{
if (section == null) {
throw new ArgumentNullException("section");
}
Size detailSize = Size.Empty;
Size itemSize = Size.Empty;
Point rowLoction = Point.Empty;
if (base.ReportModel.ReportSettings.GroupColumnsCollection.Count > 0)
{
var groupheader = base.CreateGroupHeader(new Point (GlobalValues.ControlMargins.Left,GlobalValues.ControlMargins.Top));
base.ReportModel.DetailSection.Items.Add(groupheader);
// Detail
itemSize = CreateDetail();
detailSize = new Size(Container.Size.Width,itemSize.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
// GroupFooter
var groupFooter = base.CreateFooter(new Point(GlobalValues.ControlMargins.Left,80));
base.ReportModel.DetailSection.Items.Add(groupFooter);
section.Size = new Size(section.Size.Width,125);
rowLoction = new Point (Container.Location.X,45);
}
else
{
itemSize = CreateDetail();
detailSize = new Size(Container.Size.Width,itemSize.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
section.Size = new Size(section.Size.Width,Container.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
rowLoction = new Point(Container.Location.X,GlobalValues.ControlMargins.Top);
}
base.ConfigureDetails (rowLoction,detailSize);
section.Items.Add(Container as BaseReportItem);
}
示例15: GetTypeNameForAttribute
public string GetTypeNameForAttribute(ICSharpCode.NRefactory.CSharp.Attribute attribute)
{
return attribute.Type.Annotations
.OfType<Mono.Cecil.MemberReference>()
.First()
.FullName;
}