Source/DesignTimeDte.cs
(开头部分) 16KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Reflection;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace DevComponents.DotNetBar
{
/// <summary>
/// Summary description for DesignTimeDte.
/// </summary>
public class DesignTimeDte
{
public static string GetProjectPath(IServiceProvider service)
{
object dte=DesignTimeDte.GetDTE(service);
//EnvDTE.DTE dte=System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE") as EnvDTE.DTE;
if(dte!=null)
{
System.Array pjs=dte.GetType().InvokeMember("ActiveSolutionProjects",BindingFlags.GetProperty,null,dte, new object []{}) as System.Array;
if(pjs==null)
{
//MessageBox.Show("Failed to get ActiveSolutionProjects");
return "";
}
if(pjs.Length>0)
{
object project=pjs.GetValue(0);
//MessageBox.Show(((EnvDTE.Project)project).Properties.Item("FullPath").Value.ToString());
object properties=project.GetType().InvokeMember("Properties",BindingFlags.GetProperty,null,project, new object []{});
if(properties!=null)
{
object item=properties.GetType().InvokeMember("Item",BindingFlags.InvokeMethod,null,properties, new object []{"FullPath"});
if(item!=null)
{
object val=item.GetType().InvokeMember("Value",BindingFlags.GetProperty,null,item, new object []{});
if(val!=null && val is string)
return val.ToString();
}
//else
// MessageBox.Show("Failed to get item");
}
//else
// MessageBox.Show("Failed to get properties");
}
//else
// MessageBox.Show("PJS length is ZERO");
}
//else
// MessageBox.Show("Failed to get DTE");
return "";
}
public static string GetDefinitionPath(string definitionName, IServiceProvider service)
{
// In design-time our document has to be open for definition to be loaded
//EnvDTE.DTE dte=GetMSDEVFromGIT("VisualStudio.DTE",System.Diagnostics.Process.GetCurrentProcess().Id.ToString()) as EnvDTE.DTE;
object dte=DesignTimeDte.GetDTE(service); //GetMSDEVFromGIT("VisualStudio.DTE",System.Diagnostics.Process.GetCurrentProcess().Id.ToString());
if(dte==null)
return "";
//EnvDTE.Document doc=dte.ActiveDocument;
后面还有 367 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。