public static HPatternSettings Get(KBModel model) { PatternSettings current = PatternSettings.Get(model, HPatternPattern.Definition); HPatternSettings cached = model.GetPropertyValue<HPatternSettings>(k_ModelProperty); if (cached == null || cached.VersionId != current.VersionId) { cached = new HPatternSettings(current); cached.VersionId = current.VersionId; model.SilentSetPropertyValue(k_ModelProperty, cached); } return cached; }
public override KBObjectNameKey GetParentObject(KBModel model, OldInstanceFile instanceFile) { XmlElement transactionElement = (XmlElement)instanceFile.Document.SelectSingleNode("/instance/transaction"); if (transactionElement != null) { string trnName = transactionElement.GetAttribute("name"); if (!String.IsNullOrEmpty(trnName)) { trnName = ConvertReferenceToName(trnName); return new KBObjectNameKey(model, ObjClass.Transaction, trnName); } } return null; }
private HTemplate getTemplate(WebPanel webp, KBModel model) { string chave = ""; bool expire = false; if (webp == null) { return null; } else { chave = webp.Guid.ToString(); } if (mModelCache == null || model == null || !mModelCache.Guid.Equals(model.Guid) || mModelCache.VersionId != model.VersionId || mVersionId != model.VersionId) { mVersionId = model.VersionId; mModelCache = model; mTemplates.Clear(); expire = true; } else if (!webp.IsCurrentVersion) { expire = true; } if (mTemplates.ContainsKey(chave)) { if (expire == false) { CacheVersion cv = mTemplates[chave]; if (!cv.Objeto.IsCurrentVersion) { cv.Objeto = webp; cv.Template = new HTemplate(webp.WebForm.EditableContent); } return cv.Template.Clone(); } else { mTemplates.Remove(chave); } } HTemplate template = new HTemplate(webp.WebForm.EditableContent); mTemplates.Add(chave, new CacheVersion(webp,template)); return template.Clone(); }
public HTemplate getTemplate(WebPanel webp, ObjTemplate defaultName, KBModel model) { HTemplate temp = getTemplate(webp, model); if (temp == null) { temp = getTemplate(WebPanel.Get(model, defaultName.ToString()), model); if (temp == null && defaultName == ObjTemplate.PromptTemplate) { temp = getTemplate(WebPanel.Get(model, ObjTemplate.SelectionTemplate.ToString()), model); } } if (temp == null) { throw new Artech.Packages.Patterns.PatternException("Template (" + defaultName.ToString() + ") not found!"); } return temp; }
public static void ObjectsWINWEB() { IKBService kbserv = UIServices.KB; KBModel design = kbserv.CurrentModel; SpecificationListHelper helper = new SpecificationListHelper(design.Environment.TargetModel); string title = "KBDoctor - Objects called win y web"; string outputFile = Functions.CreateOutputFile(kbserv, title); IOutputService output = CommonServices.Output; output.StartSection(title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Name", "Value", "Observation" }); foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { if (obj is Procedure || obj is Transaction) { output.AddLine("Procesing up " + obj.Name); IEnumerable <int> generatorTypes = GetObjectGenerators(obj.Key); string objNamePrior = ""; int count = 0; foreach (int genType in generatorTypes) { count += 1; } if (count > 1) { KBObjectCollection objColl = new KBObjectCollection(); string mainss = ""; output.AddLine("Procesing down " + obj.Name); foreach (EntityReference reference in obj.GetReferences()) { KBObject objRef = KBObject.Get(obj.Model, reference.To); if ((objRef != null) && (objRef is WorkPanel || objRef is WebPanel) && (reference.ReferenceType == ReferenceType.Hard)) //&& (objRef.TypeDescriptor.Name != "MasterPage") ) { if (objNamePrior != obj.Name) { string callTree = ""; mainss = MainsOf(obj, objColl, callTree); } writer.AddTableData(new string[] { Functions.linkObject(obj), Functions.linkObject(objRef), mainss }); objNamePrior = obj.Name; } } } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(title, success); }
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); }
private static void GenerateKBObjectGraph(string name, string fileName) { IKBService kbserv = UIServices.KB; KBModel model = kbserv.CurrentModel; StreamWriter scriptFile = new StreamWriter(fileName); IOutputService output = CommonServices.Output; StringCollection aristas = new StringCollection(); output.AddLine("Generating " + name); scriptFile.WriteLine("<?xml version = '1.0' encoding = 'UTF-8'?>"); scriptFile.WriteLine("<gexf xmlns='http://www.gexf.net/1.2draft' xmlns:viz='http://www.gexf.net/1.2draft/viz' "); scriptFile.WriteLine(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd' version = '1.2' > "); scriptFile.WriteLine(" <graph mode = 'static' defaultedgetype = 'directed' > "); scriptFile.WriteLine("<attributes class='node'> <attribute id='0' title = 'module' type = 'string' /> </attributes >"); scriptFile.WriteLine(" <nodes>"); string objName = ""; StringCollection nodos = new StringCollection(); foreach (KBObject obj in model.Objects.GetAll()) { if ((Functions.isRunable(obj) && ObjectsHelper.isGenerated(obj)) || (obj is Table)) { objName = NombreNodo(obj); string modulename = ModulesHelper.ObjectModuleName(obj); if (!nodos.Contains(objName)) { scriptFile.WriteLine(" <node id='" + objName + "' label='" + objName + "' >"); scriptFile.WriteLine(" <attvalues> <attvalue for='0' value = '" + modulename + "' /> </attvalues>"); scriptFile.WriteLine(" </node>"); nodos.Add(objName); } foreach (EntityReference r in obj.GetReferencesTo()) { KBObject objRef = KBObject.Get(obj.Model, r.From); if ((objRef != null) && (Functions.isRunable(objRef) || objRef is Table)) { string objRefName = NombreNodo(objRef); if (objName != objRefName) { String edge = " source='" + objRefName + "' target='" + objName + "' weight= '1.0' "; if (!aristas.Contains(edge)) { aristas.Add(edge); } } } } } } ; scriptFile.WriteLine(" </nodes>"); //Grabo las aristas scriptFile.WriteLine(" <edges>"); int i = 0; foreach (String s in aristas) { scriptFile.WriteLine(" <edge id=" + i.ToString() + s + " /> "); i += 1; } ; scriptFile.WriteLine(" </edges>"); scriptFile.WriteLine(" </graph>"); scriptFile.WriteLine("</gexf>"); scriptFile.Close(); }
/* * * Dependencias Entrantes * Dependencias Salientes * IE = Salientes / (Entrantes + Salientes) #Componentes Conexos dentro del módulo. * Tiene dependencia cíclicla ? * Largo máximo de dependencias en la que participa. * El módulo tiene objetos públicos no referenciados por externos? */ public static void ListModulesStatisticsTotal() { IKBService kbserv = UIServices.KB; IOutputService output = CommonServices.Output; KBModel kbmodel = kbserv.CurrentModel; bool success = true; int objInRoot = 0; int objInModule = 0; int tblInRoot = 0; int tblInModule = 0; int objTot = 0; int modules = 0; string title = "KBDoctor - List Modules Statistics Total"; output.StartSection(title); // string outputFile = Functions.CreateOutputFile(kbserv, title); // KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); // writer.AddHeader(title); // writer.AddTableHeader(new string[] { "Module", "Description", "Tables", "Public Tables", "Objects", "Public Obj", "Obj/Publ %", "In References", "Out References" }); foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { if (Functions.hasModule(obj)) { objTot += 1; if (obj is Table) { if (TablesHelper.TableModule(kbmodel, (Table)obj) == kbserv.CurrentModel.GetDesignModel().RootModule) { tblInRoot += 1; } else { tblInModule += 1; } } else { if (obj.Module == kbserv.CurrentModel.GetDesignModel().RootModule) { objInRoot += 1; } else { objInModule += 1; } if (obj is Module) { modules += 1; } } } } int ratio = (objInRoot == 0) ? 0 : (objInModule * 100) / objInRoot; output.AddLine("# Objects: " + objTot + " in Module: " + objInModule.ToString() + " in Root: " + objInRoot.ToString()); output.AddLine("% Modularization: " + ratio.ToString()); output.AddLine("# Tables in Module: " + tblInModule.ToString() + " in Root: " + tblInRoot.ToString()); output.EndSection(title, success); // Functions.AddLineSummary("moduleStats.txt", Resumen); }
/// <summary> /// Search and replace text in objects /// </summary> public static void SearchAndReplace() //SearchAndReplace() { IKBService kB = UIServices.KB; IOutputService output = CommonServices.Output; string mensaje = ""; string title = "Search and replace"; output.StartSection(title); if (kB != null && kB.CurrentModel != null) { PromptDescription pd; DialogResult dr; mensaje = "Find"; pd = new PromptDescription(mensaje); dr = pd.ShowDialog(); if (dr == DialogResult.OK) { string txtfind = pd.Description; mensaje = "Replace with"; pd = new PromptDescription(mensaje); dr = pd.ShowDialog(); if (dr == DialogResult.OK) { string txtreplace = pd.Description; SelectObjectOptions selectObjectOption = new SelectObjectOptions(); selectObjectOption.MultipleSelection = true; KBModel kbModel = UIServices.KB.CurrentModel; int objcambiados = 0; int objtotales = 0; //SELECCIONO OBJETOS A BUSCAR selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Procedure>()); selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Transaction>()); selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <WebPanel>()); selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <WorkPanel>()); foreach (KBObject obj in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption)) { objtotales += 1; Application.DoEvents(); if ((objtotales % 100) == 0) { output.AddLine("Searching in " + objtotales + " objects "); } StringBuilder buffer = new StringBuilder(); using (TextWriter writer = new StringWriter(buffer)) obj.Serialize(writer); string objxml = buffer.ToString(); string newobjxml = objxml.Replace(txtfind, txtreplace, StringComparison.InvariantCultureIgnoreCase); using (StringReader strReader = new StringReader(newobjxml)) using (XmlTextReader reader = new XmlTextReader(strReader)) BLServices.KnowledgeManager.ImportInObject(reader, obj); if (objxml != newobjxml) { try { obj.Save(); output.AddLine("Changed >> '" + txtfind + "' to '" + txtreplace + "' in object " + obj.Name); objcambiados += 1; } catch (Exception e) { if (e.InnerException == null) { output.AddErrorLine(e.Message); } else { output.AddErrorLine(e.Message + " - " + e.InnerException); } }; } } title = "Changed objects " + objcambiados.ToString(); output.EndSection(title, true); } } } }
internal static KBCategory MainCategory(KBModel model) { return(KBCategory.Get(model, "Main Programs")); }
private void DeleteObjectAndReferences(KBModel model, List<KBObject> parents) { parents.ForEach(p => parents.AddRange(model.Objects.GetAllChildren(p))); KBObject.Delete(parents); }
// public static void RemoveObjectsNotCalled(KBModel kbmodel, IOutputService output, out List <string[]> lineswriter) { CleanKB.RemoveObjectsNotCalled(kbmodel, output, out lineswriter); }
internal static void ModuleDependencies() { IKBService kbserv = UIServices.KB; KBModel kbModel = UIServices.KB.CurrentModel; IOutputService output = CommonServices.Output; bool success = true; int objInRoot = 0; int objSinRoot = 0; string title = "KBDoctor - Module references"; output.StartSection(title); string outputFile = Functions.CreateOutputFile(kbserv, title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Object", "Module", "Type", "Is referenced by" }); KBObjectCollection objRefCollection = new KBObjectCollection(); SelectObjectOptions selectObjectOption = new SelectObjectOptions(); selectObjectOption.MultipleSelection = false; selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>()); Module module2 = new Module(kbModel); foreach (Module module in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption)) { module2 = module; output.AddLine("Procesing " + module.Name + "...."); foreach (KBObject obj in ModuleObjects(module)) { foreach (EntityReference reference in obj.GetReferences()) { KBObject objref = KBObject.Get(obj.Model, reference.To); if (objref != null && objref.TypeDescriptor.Name != "Attribute" && objref.TypeDescriptor.Name != "MasterPage") { Module objrefModule = ((objref is Table) ? TablesHelper.TableModule(objref.Model, (Table)objref) : objref.Module); if (objrefModule != module) { if (!(objref is Domain) && !(objref is Image) && !(objref is Theme) && !(objref is ThemeClass) && !(objref is GeneratorCategory) && !(objref is KBCategory) && !(objref is SDT)) { bool contain = objRefCollection.Any(p => p.Guid == objref.Guid); if (!contain) { objRefCollection.Add(objref); } } } } } } } string listObj = ""; //Listo todos los objetos externos referenciados desde el modulo foreach (KBObject o in objRefCollection) { listObj = ""; //Armo lista de objetos de mi modulo que referencian al objeto externo foreach (EntityReference refe in o.GetReferencesTo()) { KBObject objref = KBObject.Get(o.Model, refe.From); if (objref != null) { Module objrefModule = ((objref is Table) ? TablesHelper.TableModule(objref.Model, (Table)objref) : objref.Module); if (objrefModule == module2) { listObj += " " + Functions.linkObject(objref); } } } Module oModule = ((o is Table) ? TablesHelper.TableModule(o.Model, (Table)o) : o.Module); writer.AddTableData(new string[] { Functions.linkObject(o), oModule.Name, o.TypeDescriptor.Name, listObj }); } output.AddLine(""); output.EndSection(title, success); writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); }
private static void GenerateKBModuleGraph(string name, string fileName) { IKBService kbserv = UIServices.KB; KBModel model = kbserv.CurrentModel; StreamWriter scriptFile = new StreamWriter(fileName); IOutputService output = CommonServices.Output; StringCollection aristas = new StringCollection(); output.AddLine("Generating " + name); scriptFile.WriteLine("<?xml version = '1.0' encoding = 'UTF-8'?>"); scriptFile.WriteLine("<gexf xmlns='http://www.gexf.net/1.2draft' xmlns:viz='http://www.gexf.net/1.2draft/viz' "); scriptFile.WriteLine(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd' version = '1.2' > "); scriptFile.WriteLine(" <graph mode = 'static' defaultedgetype = 'directed' > "); scriptFile.WriteLine("<attributes class='node'> <attribute id='0' title = 'module' type = 'string' /> </attributes >"); scriptFile.WriteLine(" <nodes>"); foreach (Module mdl in Module.GetAll(model)) { string modulename = mdl.Name; scriptFile.WriteLine(" <node id='" + mdl.Name + "' label='" + mdl.Description + "' >"); scriptFile.WriteLine(" <attvalues> <attvalue for='0' value = '" + mdl.Name + "' /> </attvalues>"); scriptFile.WriteLine(" </node>"); foreach (KBObject obj in mdl.GetAllMembers()) { if (obj is Procedure || obj is Table) { foreach (EntityReference r in obj.GetReferences()) { KBObject objRef = KBObject.Get(obj.Model, r.To); if ((objRef != null) && (Functions.isRunable(objRef) || objRef is Table) && modulename != ModulesHelper.ObjectModuleName(objRef)) { String edge = " <edge id='XXXX' source='" + modulename + "' target='" + ModulesHelper.ObjectModuleName(objRef) + "' /> "; if (!aristas.Contains(edge)) { aristas.Add(edge); } } } } } } scriptFile.WriteLine(" </nodes>"); //Grabo las aristas scriptFile.WriteLine(" <edges>"); int i = 0; foreach (String s in aristas) { string s2 = s.Replace("XXXX", i.ToString()); scriptFile.WriteLine(" " + s2); i += 1; } ; scriptFile.WriteLine(" </edges>"); scriptFile.WriteLine(" </graph>"); scriptFile.WriteLine("</gexf>"); scriptFile.Close(); }
internal static void ListTableInModules() { IKBService kbserv = UIServices.KB; KBModel model = kbserv.CurrentModel.GetDesignModel(); string title = "KBDoctor - List tables in modules"; IOutputService output = CommonServices.Output; output.StartSection(title); string outputFile = Functions.CreateOutputFile(kbserv, title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Name", "Description", "Visibility", "Best", "Best Module", "Modules", "Transaction", "Trn(NoGenerate)", "Referenced Modules", "Referenced" }); SelectObjectOptions selectObjectOption = new SelectObjectOptions(); selectObjectOption.MultipleSelection = true; selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>()); foreach (KBObject module in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption)) { foreach (Table t in Table.GetAll(module.Model)) { if (TablesHelper.TableModule(module.Model, t) == module) { string objNameLink = Functions.linkObject(t); output.AddLine("Processing... " + t.Name); int countAttr = 0; int countKeyAttr = 0; int widthKey = 0; int width = 0; int widthVariable = 0; int widthFixed = 0; ObjectVisibility objVisibility = TableVisibility(t); KBObject trnBest = GenexusBLServices.Tables.GetBestAssociatedTransaction(model, t.Key); Module mdlTrnBest = trnBest.Module; string trnGen = ""; string trnNoGen = ""; List <string> mdlList = new List <string>(); foreach (Transaction trn in t.AssociatedTransactions) { string trnstr = Functions.linkObject(trn) + "(" + ((trn.IsPublic) ? "Public" : "Private") + ") <br/> "; if (trn.GetPropertyValue <bool>(Properties.TRN.GenerateObject)) { trnGen += trnstr; } else { trnNoGen += trnstr; } if (!mdlList.Contains(trn.Module.Name)) { mdlList.Add(trn.Module.Name); } } IList <KBObject> objList = (from r in model.GetReferencesTo(t.Key, LinkType.UsedObject) where r.ReferenceType == ReferenceType.WeakExternal // las referencias a tablas que agrega el especificador son de este tipo //where ReferenceTypeInfo.HasUpdateAccess(r.LinkTypeInfo) select model.Objects.Get(r.From)).ToList(); IList <KBObject> objList2 = objList.Where(r => r.Module != mdlTrnBest).ToList(); string objListQNames = null; objList2.ToList().ForEach(v => objListQNames += " " + Functions.linkObject(v)); List <string> mdlReferencedList = new List <string>(); foreach (KBObject o in objList) { if (!mdlReferencedList.Contains(o.Module.Name)) { mdlReferencedList.Add(o.Module.Name); } } string mdlListstr = String.Join(" ", mdlList.ToArray()); string mdlReferencedListstr = String.Join(" ", mdlReferencedList.ToArray()); writer.AddTableData(new string[] { objNameLink, t.Description, objVisibility.ToString(), trnBest.QualifiedName.ToString(), mdlTrnBest.Name, mdlListstr, trnGen, trnNoGen, mdlReferencedListstr, objListQNames }); } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(title, success); }
private static string[] ModuleStats(Module mdl) { IOutputService output = CommonServices.Output; IKBService kbserv = UIServices.KB; KBModel kbModel = UIServices.KB.CurrentModel; string listPubObjNotReferenced = ""; string listPirvateObjReferenced = ""; string ListobjOutsideModuleAccessPrivateTable = ""; foreach (KBObject obj in mdl.GetAllMembers()) { string aux = ""; bool isReferencedFromOutside = IsReferencedFromOutside(mdl, obj, out aux); ObjectVisibility objVisibility = RecoverObjectVisibility(obj); if (objVisibility == ObjectVisibility.Public && Functions.isRunable(obj) && !(obj is Transaction)) { if (!isReferencedFromOutside) { listPubObjNotReferenced += Functions.linkObject(obj) + " "; } } // Por un error de GX, no se listan los SDT pues todos quedan como publicos aunque esten marcados como privados. if (objVisibility == ObjectVisibility.Private && isReferencedFromOutside && !(obj is SDT) && !(obj is Folder)) { listPirvateObjReferenced += Functions.linkObject(obj) + " "; } } string objOutsideModuleAccessPrivateTable = ""; string objUpdateOutsideModuleList = ""; string objToMove = ""; //Hago lo mismo para las tablas del modulo. IList <KBObject> tblList = (from r in Table.GetAll(kbModel) where TablesHelper.TableModule(kbModel, r) == mdl select kbModel.Objects.Get(r.Key)).ToList(); foreach (Table tbl in tblList) { string tableName = tbl.Name; ObjectVisibility visibility = TableVisibility(tbl); bool TableReferencedFromOutside = IsReferencedFromOutside(mdl, (KBObject)tbl, out objOutsideModuleAccessPrivateTable); if (TableReferencedFromOutside && (visibility == ObjectVisibility.Private)) { ListobjOutsideModuleAccessPrivateTable += objOutsideModuleAccessPrivateTable + "<BR>" + Environment.NewLine; } else if (!TableReferencedFromOutside && (visibility == ObjectVisibility.Public)) { listPubObjNotReferenced += Functions.linkObject((KBObject)tbl) + " "; } string objUpdateOutsideModuleListTable = ""; foreach (KBObject objUpdateOutsideModule in TablesHelper.ObjectsUpdateTableOutsideModule(kbModel, tbl)) { objUpdateOutsideModuleListTable += Functions.linkObject(objUpdateOutsideModule) + " "; } if (objUpdateOutsideModuleListTable != "") { objUpdateOutsideModuleList += tbl.Name + " (" + objUpdateOutsideModuleListTable + ")<BR>"; } //Veo los objetos que referencian alguna tabla desde fuera del modulo, si tienen alguna tabla de otro modulo //Si son todas de mi modulo, lo pongo en la lista de los objetos a mover a mi modulo. foreach (KBObject objreadOutsideModule in TablesHelper.ObjectsReadTableOutsideModule(tbl)) { if (ListModulesOfReferencedTables(objreadOutsideModule).Count == 1) { objToMove += Functions.linkObject(objreadOutsideModule) + "; "; } } } string[] mdlStats = new string[] { Functions.linkObject(mdl), listPubObjNotReferenced, listPirvateObjReferenced, ListobjOutsideModuleAccessPrivateTable, objUpdateOutsideModuleList, objToMove }; return(mdlStats); }
private static string[] ModuleStats2(Module mdl) { IOutputService output = CommonServices.Output; IKBService kbserv = UIServices.KB; KBModel kbModel = UIServices.KB.CurrentModel; /* * * Dependencias Entrantes * Dependencias Salientes * IE = Salientes / (Entrantes + Salientes) #Componentes Conexos dentro del módulo. * Tiene dependencia cíclicla ? * Largo máximo de dependencias en la que participa. * El módulo tiene objetos públicos no referenciados por externos? */ int cantobj = 0; int cantobjmain = 0; int cantobjPub = 0; int cantInRef = 0; int cantOutRef = 0; foreach (KBObject obj in mdl.GetAllMembers()) { cantobj += 1; string aux = ""; bool isReferencedFromOutside = IsReferencedFromOutside(mdl, obj, out aux); ObjectVisibility objVisibility = RecoverObjectVisibility(obj); if (Functions.isRunable(obj)) { if (objVisibility == ObjectVisibility.Public) { cantobjPub += 1; } if (!isReferencedFromOutside) { cantInRef += 1;; } } } //Hago lo mismo para las tablas del modulo. IList <KBObject> tblList = (from r in Table.GetAll(kbModel) where TablesHelper.TableModule(kbModel, r) == mdl select kbModel.Objects.Get(r.Key)).ToList(); int cntTables = 0; int cntPublicTables = 0; foreach (Table tbl in tblList) { cntTables += 1; string tableName = tbl.Name; ObjectVisibility visibility = TableVisibility(tbl); if (visibility == ObjectVisibility.Public) { cntPublicTables += 1; } string objOutsideModuleAccessPrivateTable = ""; bool TableReferencedFromOutside = IsReferencedFromOutside(mdl, (KBObject)tbl, out objOutsideModuleAccessPrivateTable); if (TableReferencedFromOutside) { cantInRef += 1;; } } int rel = (cantobj == 0 ? 0 : (cantobjPub * 100) / cantobj); string[] mdlStats = new string[] { Functions.linkObject(mdl), mdl.Description, cntTables.ToString(), cntPublicTables.ToString(), cantobj.ToString(), cantobjPub.ToString(), rel.ToString() + " %", cantInRef.ToString(), cantOutRef.ToString() }; return(mdlStats); }
// public static void RemoveAttributesWithoutTable(KBModel kbmodel, IOutputService output, out List <string[]> lineswriter) { CleanKB.RemoveAttributesWithoutTable(kbmodel, output, out lineswriter); }
internal static void RemoveObjectsNotCalled(KBModel kbmodel, IOutputService output, out List <string[]> lineswriter) { int callers; string remove = ""; bool continuar = true; lineswriter = new List <string[]>(); do { continuar = false; foreach (KBObject obj in kbmodel.Objects.GetAll()) { ICallableObject callableObject = obj as ICallableObject; if ((callableObject != null) | (obj is Artech.Genexus.Common.Objects.Attribute) | obj is Artech.Genexus.Common.Objects.Table | obj is Domain | obj is ExternalObject | obj is Image | obj is SDT) { callers = 0; foreach (EntityReference reference in obj.GetReferencesTo(LinkType.UsedObject)) { callers = callers + 1; } if (callers == 0) { if ((obj is Transaction) | obj is Table | obj is Artech.Genexus.Common.Objects.Attribute | obj is Domain | obj is Image) { remove = ""; } else { remove = "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;RemoveObject&guid=" + obj.Guid.ToString() + "\">Remove</a>"; } string objNameLink = Utility.linkObject(obj); string isMainstr = (Utility.isMain(obj) ? "Main" : string.Empty); string isGeneratedstr = (Utility.isGenerated(obj) ? "Yes" : string.Empty); if (!Utility.isMain(obj)) { if (remove != "") { try { obj.Delete(); output.AddLine("REMOVING..." + obj.Name); remove = "REMOVED!"; objNameLink = obj.Name; continuar = true; } catch (Exception e) { }; } lineswriter.Add(new string[] { obj.TypeDescriptor.Name, objNameLink, remove, isGeneratedstr, isMainstr }); } if ((obj is Transaction) && (obj.GetPropertyValue <bool>(Artech.Genexus.Common.Properties.TRN.GenerateObject))) { try { obj.SetPropertyValue(Artech.Genexus.Common.Properties.TRN.GenerateObject, false); CleanObject(obj, output); } catch (Exception e) { }; } } } } } while (continuar); }
// public static void CleanKBObjects(KBModel kbmodel, IOutputService output) { CleanKB.CleanObjects(kbmodel, output); }
private void AddFilterAttribute(FilterElement filterElement, KBModel model, string name, string description, Domain domain, string defaultValue) { FilterAttributeElement filterAttElement = filterElement.AddFilterAttribute(name); filterAttElement.Description = description; filterAttElement.Domain = domain; filterAttElement.Default = defaultValue; PropertiesObject underlying = (domain != null ? (PropertiesObject)domain : (PropertiesObject)Gx.Attribute.Get(model, name)); if (underlying != null && underlying.GetPropertyValue<int>(Properties.ATT.ControlType) == Properties.ATT.ControlType_Values.ComboBox) filterAttElement.AllValue = true; }
public static void RenameAttributesAndTables() { string message = "This option rename Objects (attributes, tables and objects) to significant name length. " + Environment.NewLine + Environment.NewLine + "Do you have KB BACKUP? "; const string caption = "ATTENTION!!"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); // If the no button was pressed ... if (result == DialogResult.Yes) { IKBService kbserv = UIServices.KB; KBModel model = kbserv.CurrentKB.DesignModel; int ATTNAME_LEN = model.GetPropertyValue <int>("ATTNAME_LEN"); int TBLNAME_LEN = model.GetPropertyValue <int>("TBLNAME_LEN"); int OBJNAME_LEN = model.GetPropertyValue <int>("OBJNAME_LEN"); string title = "KBDoctor - Rename Objects to significant name length"; string outputFile = Functions.CreateOutputFile(kbserv, title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Type", "Object", "Description" }); IOutputService output = CommonServices.Output; output.StartSection(title); foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { Boolean SaveObj = false; if ((obj is Artech.Genexus.Common.Objects.Attribute) && (obj.Name.Length > ATTNAME_LEN)) { output.AddLine("RENAMING ATTRIBUTE " + obj.Name + " to " + obj.Name.Substring(0, ATTNAME_LEN)); obj.Name = obj.Name.Substring(0, ATTNAME_LEN); SaveObj = true; } else { if (((obj is Table) || (obj is Index)) && (obj.Name.Length > TBLNAME_LEN)) { output.AddLine("RENAMING TABLE/INDEX " + obj.Name + " to " + obj.Name.Substring(0, TBLNAME_LEN)); obj.Name = obj.Name.Substring(0, TBLNAME_LEN); SaveObj = true; } else { if ((obj.Name.Length > OBJNAME_LEN) && ObjectsHelper.isGeneratedbyPattern(obj)) { output.AddLine("RENAMING OBJECT " + obj.Name + " to " + obj.Name.Substring(0, OBJNAME_LEN)); obj.Name = obj.Name.Substring(0, OBJNAME_LEN); SaveObj = true; } } } if (SaveObj) { string attNameLink = Functions.linkObject(obj); writer.AddTableData(new string[] { attNameLink, obj.Description, obj.TypeDescriptor.Name }); try { obj.Save(); } catch (Exception e) { output.AddLine("ERROR saving .. " + obj.Name + " - " + e.Message); } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(title, success); } }
public static string ResolveDescription(KBModel model, Artech.Genexus.Common.Objects.Attribute att, Domain dom, string desc) { int pigual = desc.IndexOf("="); int tipo = 0; Artech.Genexus.Common.Objects.Attribute a = null; if (att != null) { a = att; } if (pigual >= 0) { int posf = desc.IndexOf(".ContextualTitle"); if (posf >= 0) { tipo = 1; } else { posf = desc.IndexOf(".ColumnTitle"); if (posf >= 0) { tipo = 2; } else { posf = desc.IndexOf(".Title"); if (posf >= 0) { tipo = 3; } else { posf = desc.IndexOf(".Description"); if (posf >= 0) { tipo = 4; } else { } } } } if (posf >= 0) { if (a==null) { string nome = desc.Substring(pigual+1, (posf - pigual - 1)); a = Artech.Genexus.Common.Objects.Attribute.Get(model, nome); } if (a == null) { if (dom != null) { return dom.Description; } } else { switch (tipo) { case 1: return a.ContextualTitleProperty; case 2: return a.ColumnTitle; case 3: return a.Title; case 4: return a.Description; } } } } return desc; }
public static void ObjectsReferenced() { // Object with parm() rule without in: out: or inout: IKBService kbserv = UIServices.KB; IOutputService output = CommonServices.Output; string title = "KBDoctor - Object referenced by object "; output.StartSection(title); string outputFile = Functions.CreateOutputFile(kbserv, title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); SelectObjectOptions selectObjectOption = new SelectObjectOptions(); selectObjectOption.MultipleSelection = false; KBModel kbModel = UIServices.KB.CurrentModel; KBObjectCollection objRefCollection = new KBObjectCollection(); foreach (KBObject obj in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption)) { if (obj != null) { title += obj.Name + "-" + obj.Description; writer.AddHeader(title); writer.AddTableHeader(new string[] { "Object", "Description", "Commit on Exit", "Update DB?", "Commit in Source", "Do Commit", "Timestamp", "Last Update" }); MarkReachables(output, obj, objRefCollection); } } string commitOnExit = ""; string commitInSource = ""; string UpdateInsertDelete = ""; string doCommit = ""; foreach (KBObject objRef in objRefCollection) { if (objRef is Procedure) { object aux = objRef.GetPropertyValue("CommitOnExit"); if (aux != null) { commitOnExit = aux.ToString() == "Yes" ? "YES" : " "; } UpdateInsertDelete = ObjectUpdateDB(objRef)?"YES":""; Procedure prc = (Procedure)objRef; if (Functions.ExtractComments(prc.ProcedurePart.Source.ToString().ToUpper()).Contains("COMMIT")) { commitInSource = "YES"; } else { commitInSource = ""; } if (((commitOnExit == "YES") && (UpdateInsertDelete == "YES")) || (commitInSource == "YES")) { doCommit = "YES"; } else { doCommit = ""; } writer.AddTableData(new string[] { Functions.linkObject(objRef), objRef.Description, commitOnExit, UpdateInsertDelete, commitInSource, doCommit, objRef.Timestamp.ToString(), objRef.LastUpdate.ToString() }); } } writer.AddFooter(); writer.Close(); bool success = true; output.EndSection(title, success); KBDoctorHelper.ShowKBDoctorResults(outputFile); }
private static void GenerateKBObjectEdgesTxt(string name, string fileName) { IKBService kbserv = UIServices.KB; KBModel model = kbserv.CurrentModel; Graph g = new Graph(); Module rootModule = kbserv.CurrentModel.GetDesignModel().RootModule; IOutputService output = CommonServices.Output; StringCollection aristas = new StringCollection(); output.AddLine("Generating " + name); Dictionary <string, Tuple <int, string> > dictionary = new Dictionary <string, Tuple <int, string> >(); Dictionary <int, int> initialpartition = new Dictionary <int, int>(); // Dictionary<string, Tuple<int,string>> dictionary = new Dictionary<string, Tuple<int,string>>(); Dictionary <string, int> NameToId = new Dictionary <string, int>(); Dictionary <string, string> NameToModule = new Dictionary <string, string>(); Dictionary <int, string> IdToName = new Dictionary <int, string>(); Dictionary <int, string> IdToModule = new Dictionary <int, string>(); Dictionary <int, EntityKey> IdToKey = new Dictionary <int, EntityKey>(); int objId = 0; foreach (KBObject obj in model.Objects.GetAll()) { if (Functions.hasModule(obj) || (obj is Module)) { string objName = NombreNodo(obj); string modulename = ModulesHelper.ObjectModuleName(obj); try { objId += 1; NameToId.Add(objName, objId); NameToModule.Add(objName, modulename); IdToName.Add(objId, objName); IdToModule.Add(objId, modulename); IdToKey.Add(objId, obj.Key); } catch (Exception e) {// output.AddWarningLine("Can't add : " + objName + " Exception: " + e.Message + " " + e.InnerException); }; } } foreach (KBObject obj in model.Objects.GetAll()) { string objName = ""; if (Functions.hasModule(obj) || (obj is Module)) //((Functions.isRunable(obj) && ObjectsHelper.isGenerated(obj)) || (obj is Table)) { /* * objName = NombreNodo(obj); * string modulename = ModulesHelper.ObjectModuleName(obj); * * try * { * objId += 1; * NameToId.Add(objName, objId); * NameToModule.Add(objName, modulename); * IdToName.Add(objId, objName); * IdToModule.Add(objId, modulename); * IdToKey.Add(objId, obj.Key); * } * catch (Exception e) { //output.AddWarningLine("Can't add : " + objName); * }; */ //Tomo las referencias que no sean tablas. foreach (EntityReference r in obj.GetReferencesTo()) { KBObject objRef = KBObject.Get(obj.Model, r.From); if ((objRef != null) && (Functions.isRunable(objRef)) || (objRef is Table)) { string objRefName = NombreNodo(objRef); if (objName != objRefName) { int weight = ReferenceWeight(objRef, obj); String edge = objRefName + " " + objName; if (!aristas.Contains(edge)) { aristas.Add(edge); GraboArista(g, NameToId, objRefName, objName, weight); } } } } } } ; foreach (int node in g.Nodes) { string moduleName = IdToModule[node]; int moduleId = NameToId[moduleName]; initialpartition.Add(node, moduleId); } output.AddLine("Before automatic modularization. TurboMQ = " + TurboMQ(g, initialpartition).ToString()); //Empiezo modularizacion Stopwatch stopwatch = new Stopwatch(); // stopwatch.Restart(); Dictionary <int, int> partition = Community.BestPartition(g); output.AddLine("BestPartition: " + stopwatch.Elapsed); var communities = new Dictionary <int, List <int> >(); foreach (var kvp in partition) { List <int> nodeset; if (!communities.TryGetValue(kvp.Value, out nodeset)) { nodeset = communities[kvp.Value] = new List <int>(); } nodeset.Add(kvp.Key); // output.AddLine(kvp.Key.ToString() +" "+kvp.Value); } output.AddLine(communities.Count + " modules found"); Dictionary <string, int> modu = new Dictionary <string, int>(); int counter = 0; foreach (var kvp in communities) { output.AddLine(String.Format("module {0}: {1} objects", counter, kvp.Value.Count)); foreach (var objid in kvp.Value) { var objname = IdToName[objid]; int cantidad = 0; // output.AddLine("Module :" + counter.ToString() + " " + objname); string pareja = IdToModule[objid] + " " + counter.ToString(); if (modu.ContainsKey(pareja)) { modu[pareja] = modu[pareja] + 1; } else { modu.Add(pareja, 1); } } var sortedDict = from entry in modu orderby entry.Value descending select entry; //Cantidad de modulo nuevo y modulo viejo. foreach (KeyValuePair <string, int> entry in sortedDict) { // output.AddLine(entry.Key + " " + entry.Value.ToString()); Module m = new Module(model); m.Name = entry.Key.Replace(" ", "_") + string.Format("_{0:yyyy_MM_dd_hh_mm_ss}", DateTime.Now); output.AddLine(m.Name); m.Module = kbserv.CurrentModel.GetDesignModel().RootModule; m.Save(); foreach (var objid in kvp.Value) { KBObject objToChange = KBObject.Get(model, IdToKey[objid]); if (objToChange != null) { if (objToChange is Table) { try { KBObject trnBest = GenexusBLServices.Tables.GetBestAssociatedTransaction(model, objToChange.Key); trnBest.Module = m; trnBest.Save(); } catch (Exception e) { output.AddErrorLine(objToChange.Name + e.Message); } } else { try { objToChange.Module = m; objToChange.Save(); } catch (Exception e) { output.AddErrorLine(objToChange.Name + e.Message); } } } } break; } counter++; modu.Clear(); } }
public static void ReplaceNullsCompatible() { IKBService kbserv = UIServices.KB; IOutputService output = CommonServices.Output; string title = "KBDoctor - Replace attribute with Compatible with NO "; string outputFile = Functions.CreateOutputFile(kbserv, title); output.StartSection(title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Object", "Description", "Attribute", "Description", "PK / FK", "Nullable" }); SelectObjectOptions selectObjectOption = new SelectObjectOptions(); selectObjectOption.MultipleSelection = true; KBModel kbModel = UIServices.KB.CurrentModel; selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Transaction>()); foreach (KBObject obj in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption)) { bool saveObj = false; Transaction trn = (Transaction)obj; if (trn != null) { foreach (TransactionLevel LVL in trn.Structure.GetLevels()) { bool isLevelRemovable = true; Table TBL = LVL.AssociatedTable; foreach (TransactionAttribute a in LVL.Structure.GetAttributes()) { output.AddLine(a.Name); writer.AddTableData(new string[] { Functions.linkObject(trn), trn.Description, Functions.linkObject(a), a.Attribute.Description, a.IsForeignKey.ToString(), a.IsNullable.ToString() }); if (!a.IsForeignKey && !a.IsKey && (a.IsNullable == TableAttribute.IsNullableValue.Compatible || a.IsNullable == TableAttribute.IsNullableValue.True)) { a.IsNullable = TableAttribute.IsNullableValue.False; saveObj = true; } } } if (saveObj) { output.AddLine("Saving ." + trn.Name); trn.Save(); } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(title, success); }
public HPatternTemplate(KBModel model) : base(model) { base.SetPropertyValue(Artech.Genexus.Common.Properties.WBP.GenerateObject, false); }
private static void GenerateMDGGraph(string name, string fileName) { IKBService kbserv = UIServices.KB; KBModel model = kbserv.CurrentModel; StreamWriter scriptFile = new StreamWriter(fileName); IOutputService output = CommonServices.Output; StringCollection aristas = new StringCollection(); output.AddLine("Generating MDG " + name); string objName = ""; StringCollection nodos = new StringCollection(); foreach (KBObject obj in model.Objects.GetAll()) { bool includedInGraph = (Functions.isRunable(obj) && ObjectsHelper.isGenerated(obj)) || (obj is Table); if (includedInGraph) { objName = NombreNodo(obj); string modulename = ModulesHelper.ObjectModuleName(obj); if (!nodos.Contains(objName)) { scriptFile.WriteLine(" <node id='" + objName + "' label='" + objName + "' >"); scriptFile.WriteLine(" <attvalues> <attvalue for='0' value = '" + modulename + "' /> </attvalues>"); scriptFile.WriteLine(" </node>"); nodos.Add(objName); } foreach (EntityReference r in obj.GetReferencesTo()) { KBObject objRef = KBObject.Get(obj.Model, r.From); if ((objRef != null) && (Functions.isRunable(objRef) || objRef is Table)) { string objRefName = NombreNodo(objRef); if (objName != objRefName) { String edge = " source='" + objRefName + "' target='" + objName + "' weight= '1.0' "; if (!aristas.Contains(edge)) { aristas.Add(edge); } } } } } } ; scriptFile.WriteLine(" </nodes>"); //Grabo las aristas scriptFile.WriteLine(" <edges>"); int i = 0; foreach (String s in aristas) { scriptFile.WriteLine(" <edge id=" + i.ToString() + s + " /> "); i += 1; } ; scriptFile.WriteLine(" </edges>"); scriptFile.WriteLine(" </graph>"); scriptFile.WriteLine("</gexf>"); scriptFile.Close(); }
public static void GenerateGraph() { IKBService kbserv = UIServices.KB; string title = "KBDoctor - Generate Graph "; //try // { string outputFile = Functions.CreateOutputFile(kbserv, title); KBModel model = kbserv.CurrentKB.DesignModel; int ATTNAME_LEN = model.GetPropertyValue <int>("ATTNAME_LEN"); int TBLNAME_LEN = model.GetPropertyValue <int>("TBLNAME_LEN"); int OBJNAME_LEN = model.GetPropertyValue <int>("OBJNAME_LEN"); IOutputService output = CommonServices.Output; output.StartSection("KBDoctor", title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Check", "File" }); string Check = ""; string Name = ""; string FileName = ""; Check = "MDGGraph"; Name = Functions.CleanFileName(Check); FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".mdg"; GenerateMDGGraph2(Name, FileName); writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) }); Check = "MDGMinimized"; Name = Functions.CleanFileName(Check); FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".mdg"; GenerateMDGMinimized(Name, FileName); writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) }); Check = "SILFile"; Name = Functions.CleanFileName(Check); FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".sil"; GenerateSILFile(Name, FileName); writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) }); /* * * Check = "KB Table Graph"; * Name = Functions.CleanFileName(Check); * FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".gexf"; * GenerateKBTableGraph(Name, FileName); * writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) }); */ /* * Check = "KB Object Graph"; * Name = Functions.CleanFileName(Check); * FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".gexf"; * GenerateKBObjectGraph(Name, FileName); * writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) }); */ /* * Check = "KB Object Edges txt"; * Name = Functions.CleanFileName(Check); * FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".txt"; * GenerateKBObjectEdgesTxt(Name, FileName); * writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) }); */ /* * Check = "KB Module Graph"; * Name = Functions.CleanFileName(Check); * FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".gexf"; * GenerateKBModuleGraph(Name, FileName); * writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) }); */ writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; KBDoctor.KBDoctorOutput.EndSection(title, success); // } // catch // { // bool success = false; // KBDoctor.KBDoctorOutput.EndSection(title, success); // } }
internal static void ResetCache(KBModel model) { model.ResetProperty(k_ModelProperty); }
public static IEnumerable <KBObject> GetObjects(KBModel model, string objects) { Dictionary <EntityKey, bool> dictionary = new Dictionary <EntityKey, bool>(); string[] array = objects.Split(new char[] { ';' }); for (int i = 0; i < array.Length; i++) { string text = array[i]; if (text[0] == '@') { foreach (KBObject current in GetGXLObjects(model, text.Substring(1))) { if (!dictionary.ContainsKey(current.Key)) { dictionary[current.Key] = true; yield return(current); } } IEnumerator <KBObject> enumerator = null; } else { string text2 = null; string text3 = text; int num = text.IndexOf(':'); if (num > 0) { text2 = text.Substring(0, num); text3 = text.Substring(num + 1); } KBObject kBObject = null; string[] array2 = text3.Split(new char[] { ',' }); for (int j = 0; j < array2.Length; j++) { string name = array2[j]; if (text2 != null) { KBObjectDescriptor kBObjectDescriptor = KBObjectDescriptor.Get(text2); if (kBObjectDescriptor != null) { kBObject = ObjectHelperGet(model, kBObjectDescriptor.Id, name); } } else { kBObject = ObjectHelperGet(model, name); } if (kBObject != null && !dictionary.ContainsKey(kBObject.Key)) { dictionary[kBObject.Key] = true; yield return(kBObject); } } array2 = null; text2 = null; kBObject = null; } text = null; } array = null; yield break; yield break; }