コード例 #1
0
        private T GetPropertyValue <T>(IVsSolution solutionInterface, __VSPROPID solutionProperty)
        {
            object value  = null;
            T      result = default(T);

            if (solutionInterface.GetProperty((int)solutionProperty, out value) == Microsoft.VisualStudio.VSConstants.S_OK)
            {
                result = (T)value;
            }
            return(result);
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: omgtehlion/FileOpener
        public static T GetProp <T>(this IVsSolution hierarchy, __VSPROPID propid)
        {
            object tmp;

            hierarchy.GetProperty((int)propid, out tmp);
            if (tmp != null)
            {
                return((T)tmp);
            }
            return(default(T));
        }
コード例 #3
0
        private DirectoryInfo GetPropAsDir(__VSPROPID prop)
        {
            IVsSolution solution = GetService(typeof(SVsSolution)) as IVsSolution;

            if (solution != null)
            {
                object objSolutionDir;

                solution.GetProperty((int)prop, out objSolutionDir);

                if (objSolutionDir != null)
                {
                    string solutionDir = objSolutionDir.ToString();

                    return(new DirectoryInfo(solutionDir));
                }
            }

            return(null);
        }
コード例 #4
0
 public static T GetProperty <T>(this IVsHierarchyItem item, __VSPROPID propId, T defaultValue = default(T))
 {
     return(item.GetProperty <T> ((int)propId, defaultValue));
 }
コード例 #5
0
 public static T GetProperty <T>(this IVsSolution solution, __VSPROPID propId, T defaultValue = default(T))
 {
     return(solution.GetProperty <T> ((int)propId, defaultValue));
 }