예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <b>DialogComponentBase</b> class with default settings.
 /// </summary>
 public DialogComponentBase()
 {
     if (BaseName.EndsWith("Component"))
     {
         BaseName = ClassName.Remove(ClassName.IndexOf("Component"));
     }
     if (BaseName.EndsWith("Control"))
     {
         BaseName = ClassName.Remove(ClassName.IndexOf("Control"));
     }
 }
예제 #2
0
        private void CompareWMIClasses()
        {
            Dictionary <string, string> CatagoryPairs = new Dictionary <string, string>
            {
                { "ccm", "CCM" },
                { "cim", "CIM" },
                { "hp", "HP" },
                { "msft", "MSFT" },
                { "office2013", "Office2013" },
                { "sms", "SMS" },
                { "win32", "Win32" },
                { "win32reg", "Win32Reg" }
            };

            foreach (string ClassName in ClassNames)
            {
                int FoundClass = WMIClasses.Where(x => x.Name == ClassName).Count();

                if (FoundClass == 0)
                {
                    string category = string.Empty;
                    if (ClassName.StartsWith("_"))
                    {
                        category = "Internal";
                    }
                    else if (ClassName.Contains("perf"))
                    {
                        category = "Perf";
                    }
                    else
                    {
                        int underscore = ClassName.IndexOf('_');
                        if (underscore > 0)
                        {
                            if (CatagoryPairs.ContainsKey(ClassName.Substring(0, underscore).ToLower()))
                            {
                                category = CatagoryPairs[ClassName.Substring(0, underscore).ToLower()];
                            }
                            else
                            {
                                category = "unknown";
                            }
                        }
                    }
                    WMIClasses.Add(new WMIClass {
                        Name     = ClassName,
                        Catagory = category,
                        Status   = "Unknown"
                    });
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BandBase"/> class with default settings.
 /// </summary>
 public BandBase()
 {
     objects           = new ReportComponentCollection(this);
     guides            = new FloatCollection();
     beforeLayoutEvent = "";
     afterLayoutEvent  = "";
     outlineExpression = "";
     CanBreak          = false;
     ShiftMode         = ShiftMode.Never;
     if (BaseName.EndsWith("Band"))
     {
         BaseName = ClassName.Remove(ClassName.IndexOf("Band"));
     }
     SetFlags(Flags.CanMove | Flags.CanChangeOrder | Flags.CanChangeParent | Flags.CanCopy | Flags.CanGroup, false);
     FlagUseStartNewPage = true;
     FlagCheckFreeSpace  = true;
 }
예제 #4
0
        //解析代码
        void parse()
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            if (code_model_ == null)
            {
                throw new Exception("代码模型不能为空");
            }

            CodeElements codes = code_model_.CodeElements;

            //查找命名空间,只支持第一命名空间
            CodeNamespace codeNamespace = null;

            for (int i = 1; i <= codes.Count; i++)
            {
                if (codes.Item(i).Kind == vsCMElement.vsCMElementNamespace)
                {
                    codeNamespace = codes.Item(i) as CodeNamespace;
                    break;
                }
            }
            if (codeNamespace == null)
            {
                throw new Exception("未找到命名空间定义");
            }
            NamespaceName = codeNamespace.Name;

            //查找类或定义,只支持第一个类或接口定义
            CodeClass     codeClass     = null;
            CodeInterface codeInterface = null;

            for (int i = 1; i <= codeNamespace.Members.Count; i++)
            {
                if (codeNamespace.Members.Item(i).Kind == vsCMElement.vsCMElementClass)
                {
                    codeClass = codeNamespace.Members.Item(i) as CodeClass;
                    break;
                }
                else if (codeNamespace.Members.Item(i).Kind == vsCMElement.vsCMElementInterface)
                {
                    codeInterface = codeNamespace.Members.Item(i) as CodeInterface;
                    break;
                }
            }
            if (codeClass == null)
            {
                throw new Exception("未找到类或接口定义");
            }
            if (codeClass != null)
            {
                ShortClassName = codeClass.Name;
                ClassName      = codeClass.FullName.Replace($"{this.NamespaceName}.", "");
                IsAbstract     = codeClass.IsAbstract;
                if (ClassName.IndexOf("<") != -1)
                {
                    var s = ClassName.IndexOf("<") + 1;
                    var l = ClassName.Length - s - 1;
                    GenericTypeArguments = ClassName.Substring(s, l).Split(',').Select(it => it.Trim()).ToList();
                }
                parse_body(codeClass);
            }
            //else
            //{
            //    ClassName = codeInterface.Name;
            //    parse_body(codeInterface);
            //}
        }