public static void List2(KBObject obj, string objLocation, Dictionary <string, KBObjectCollection> dic, KBDoctorXMLWriter writer) { string objMasterPage = obj.GetPropertyValueString("MasterPage"); writer.AddTableData(new string[] { obj.TypeDescriptor.Name, Functions.linkObject(obj), objLocation, objMasterPage }); if (ObjectsHelper.IsCallalable(obj)) { foreach (EntityReference reference in obj.GetReferences()) { KBObject objRef = KBObject.Get(obj.Model, reference.To); string typeDescriptor = obj.TypeDescriptor.Name; List <string> list = new List <string> { "WebPanel", "Transaction", "WorkPanel" }; if ((objRef != null) && list.Contains(typeDescriptor) && (reference.ReferenceType == ReferenceType.Hard)) { int count = 0; string locations = ""; KBObjectCollection objColl = new KBObjectCollection(); foreach (string loc in dic.Keys) { if ((loc != objLocation) && (list.Contains(objRef.TypeDescriptor.Name))) { dic.TryGetValue(loc, out objColl); if (objColl.Contains(obj)) { locations += " " + loc; count += 1; } } } if (count > 0) { string objRefMasterPage = objRef.GetPropertyValueString("MasterPage"); writer.AddTableData(new string[] { "+-----Called >>" + objRef.TypeDescriptor.Name, Functions.linkObject(objRef), count.ToString() + "-" + locations, objRefMasterPage }); } } } } }
public static string MainsOf(KBObject obj, KBObjectCollection objColl, string callTree) { string mains = ""; if (!objColl.Contains(obj)) { objColl.Add(obj); if (obj.GetPropertyValue <bool>("IsMain")) { string objAppGenerator = obj.GetPropertyValueString("AppGenerator"); if (objAppGenerator.Contains("Java Win") && callTree.Contains("HMaster")) { mains = ""; } else { mains = callTree + "/" + Functions.linkObject(obj) + "(" + objAppGenerator + ")<BR> "; } } else { callTree += obj.Name + "/"; foreach (EntityReference reference in obj.GetReferencesTo()) { KBObject objRef = KBObject.Get(obj.Model, reference.From); if ((objRef != null) && (obj.Name != objRef.Name) && (reference.ReferenceType == ReferenceType.Hard) && reference.LinkType == LinkType.UsedObject /*&& (obj.TypeDescriptor.Name != "MasterPage")*/ && !objColl.Contains(objRef)) { mains += MainsOf(objRef, objColl, callTree); } } } } return(mains); }
public static void KBInterfaces() { IKBService kbserv = UIServices.KB; KBModel design = kbserv.CurrentModel; SpecificationListHelper helper = new SpecificationListHelper(design.Environment.TargetModel); string outputFile = kbserv.CurrentKB.UserDirectory + @"\kbdoctor.KBInterfaces.html"; if (File.Exists(outputFile)) { File.Delete(outputFile); } string titulo = "KBDoctor - KB Interfaces"; IOutputService output = CommonServices.Output; output.StartSection(titulo); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(titulo); writer.AddTableHeader(new string[] { "Object", "Variable", "Type", "mains" }); foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { if (obj != null) { output.AddLine("Procesing " + obj.Name); IEnumerable <int> generatorTypes = KbStats.GetObjectGenerators(obj.Key); string objNamePrior = ""; KBObjectCollection objColl = new KBObjectCollection(); string tipo = ""; string mainss = ""; foreach (EntityReference reference in obj.GetReferences()) { KBObject objRef = KBObject.Get(obj.Model, reference.To); if (objRef != null) { if (objRef is ExternalObject) { tipo = "External Object:" + objRef.GetPropertyValueString("ExoType"); writer.AddTableData(new string[] { Functions.linkObject(obj), Functions.linkObject(objRef), tipo, mainss }); } else { if (objRef is MissingKBObject) { tipo = "Missing Object"; writer.AddTableData(new string[] { Functions.linkObject(obj), Functions.linkObject(objRef), tipo, mainss }); } } } } string sourceWOComments = Functions.ExtractComments(Functions.ObjectSourceUpper(obj)); sourceWOComments = sourceWOComments.Replace("\t", " "); AddLineKBInterfazSource(writer, obj, "SHELL ", "CMD.", sourceWOComments, mainss); AddLineKBInterfazSource(writer, obj, "JAVA ", "CMD.", sourceWOComments, mainss); AddLineKBInterfazSource(writer, obj, "CSHARP ", "CMD.", sourceWOComments, mainss); AddLineKBInterfazSource(writer, obj, "SQL ", "CMD.", sourceWOComments, mainss); ObjectsVariablesExternal(obj, writer, mainss); if (obj is Transaction || obj is WebPanel) { UserControlUsageCheck(obj, writer, mainss); } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(titulo, success); }