public static XmlDocument GetObjectNavigationXML(KBObject obj)
        {
            XmlDocument doc              = new XmlDocument();
            IKBService  kbserv           = UIServices.KB;
            string      fileWildcard     = @"" + obj.Name + ".xml";
            var         searchSubDirsArg = System.IO.SearchOption.AllDirectories;
            string      specpath         = Functions.SpcDirectory(kbserv);

            string[] xFiles = System.IO.Directory.GetFiles(specpath, fileWildcard, searchSubDirsArg);

            foreach (string x in xFiles)
            {
                if (Path.GetFileNameWithoutExtension(x).Equals(obj.Name))
                {
                    string xmlstring = NavigationHelper.AddXMLHeader(x);

                    if (!ObjectsHelper.isGeneratedbyPattern(obj))
                    {
                        doc.LoadXml(xmlstring);
                    }
                }
            }

            return(doc);
        }
Пример #2
0
        public static string GetSourceCode(KBObject obj)
        {
            string source = "";

            if (obj is Transaction || obj is WebPanel || obj is Procedure || obj is WorkPanel)
            {
                if (ObjectsHelper.isGenerated(obj) && !ObjectsHelper.isGeneratedbyPattern(obj))
                {
                    source = ObjectsHelper.ObjectSourceUpper(obj);
                    source = Functions.RemoveEmptyLines(source);
                }
            }
            return(source);
        }
Пример #3
0
        public static void ObjStats_Comments(KBObject obj, out int linesSource, out int linesComment, out float PercentComment)
        {
            linesSource    = 0;
            linesComment   = 0;
            PercentComment = 0;

            if (obj is Transaction || obj is WebPanel || obj is Procedure || obj is WorkPanel)
            {
                if (ObjectsHelper.isGenerated(obj) && !ObjectsHelper.isGeneratedbyPattern(obj))
                {
                    string sourceWOComments = ObjectsHelper.GetSourceCodeWithoutComments(obj);
                    string source           = ObjectsHelper.GetSourceCode(obj);

                    CountCommentsLines(source, sourceWOComments, out linesSource, out linesComment, out PercentComment);
                }
            }
        }
Пример #4
0
        private static void ListStats(KBObject obj, StreamWriter file)
        {
            PrintSectionHeader("QUALITIY INDICATORS", file);

            int sourceLines = ObjectsHelper.CountSourceCodeLines(obj);

            file.WriteLine("LINES of Code :   {0,-10}", sourceLines.ToString());

            float commentPct = ObjectsHelper.SourceCodeCommentPct(obj);

            file.WriteLine("COMMENTS %    :   {0,-10}", commentPct.ToString());

            int maxBlock = ObjectsHelper.MaxBlockOfCode(obj);

            file.WriteLine("MAX BLOCK     :   {0,-10}", maxBlock.ToString());

            int complexityLevel = ObjectsHelper.ComplexityLevel(obj);

            file.WriteLine("COMPLEXITY    :   {0,-10}", complexityLevel.ToString());

            int maxNest = ObjectsHelper.MaxNestLevel(obj);

            file.WriteLine("MAX NEST LEVEL:   {0,-10}", maxNest.ToString());
        }