コード例 #1
0
 private static MethodInfo GetMethodInfoFromActiveDocument(_DTE dte)
 {
     dynamic selection = dte.ActiveDocument.Selection;
     TextPoint point = selection.ActivePoint();
     CodeElement clazz = dte.ActiveDocument.ProjectItem.FileCodeModel.CodeElementFromPoint(point,
                                                                                           vsCMElement.
                                                                                               vsCMElementClass);
     CodeElement method = dte.ActiveDocument.ProjectItem.FileCodeModel.CodeElementFromPoint(point,
                                                                                            vsCMElement.
                                                                                                vsCMElementFunction);
     string fullName = dte.ActiveDocument.FullName;
     string parentPath = new DirectoryInfo(fullName).Parent.FullName;
     var info = new MethodInfo(clazz.Name, method.Name, parentPath);
     return info;
 }
コード例 #2
0
 private void ApproveResult(MethodInfo info)
 {
     if (File.Exists(info.GetApprovedFile()))
       {
     File.SetAttributes(info.GetApprovedFile(), File.GetAttributes(info.GetApprovedFile()) & ~FileAttributes.ReadOnly);
       }
     File.Replace(info.GetReceivedFile(), info.GetApprovedFile(), null, true);
 }