static GraphLayoutSchema() { schema = new GraphSchema("GraphLayoutSchema"); boundsProperty = schema.Properties.AddNewProperty("Bounds", typeof(System.Windows.Rect)); labelBoundsProperty = Schema.Properties.AddNewProperty("LabelBounds", typeof(System.Windows.Rect)); active = Schema.Categories.AddNewCategory("Active"); }
public void AddLink(GraphNode from, GraphCategory category, GraphNode to) { using (_gate.DisposableWait()) { _graph.Links.GetOrCreate(from, to).AddCategory(category); } }
static RoslynGraphCategories() { Schema = RoslynGraphProperties.Schema; Overrides = Schema.Categories.AddNewCategory( "Overrides", () => new GraphMetadata(GraphMetadataOptions.Sharable)); }
static LessGraphSchema() { LessFile = Schema.Categories.AddNewCategory("LessFile"); LessMixin = Schema.Categories.AddNewCategory("LessMixin"); LessMixinParent = Schema.Categories.AddNewCategory("LessMixinParent"); LessVariable = Schema.Categories.AddNewCategory("LessVariable"); LessVariableParent = Schema.Categories.AddNewCategory("LessVariableParent"); }
static CssGraphSchema() { CssAtDirectives = Schema.Categories.AddNewCategory("CssValue"); CssFile = Schema.Categories.AddNewCategory("CssFile"); CssValues = Schema.Categories.AddNewCategory("CssValues"); CssIdSelector = Schema.Categories.AddNewCategory("CssIdSelector"); CssAtDirectivesParent = Schema.Categories.AddNewCategory("CssAtDirectivesParent"); CssIdSelectorParent = Schema.Categories.AddNewCategory("CssIdSelectorParent"); CssClassSelector = Schema.Categories.AddNewCategory("CssClassSelector"); CssClassSelectorParent = Schema.Categories.AddNewCategory("CssClassSelectorParent"); }
internal static int GetDisplayIndex(GraphNode node) { GraphCategory graphCategory = node.Categories.FirstOrDefault(); if (graphCategory == null) { return(int.MaxValue); } if (graphCategory.Id == PaketCategory.Id) { return(1); } return(int.MaxValue); }
protected void CreateChild <T>(IGraphContext context, GraphNode node, GraphCategory category) where T : ParseItem { StyleSheet stylesheet = node.Id.GetNestedValueByName <StyleSheet>(CssGraphSchema.CssStyleSheet); IList <T> items = FindCssItems <T>(stylesheet); List <string> cache = new List <string>(); foreach (ParseItem item in items) { string label = GetLabel(item); if (!cache.Contains(label)) { CreateNode(context, node, item, category); cache.Add(label); } } }
public void ClickButtonGraphType(int buttonID) { selectedGraphCategory = (GraphCategory)buttonID; UpdateSpeciesTreeDataTextures(simulationManager.curSimYear); }
void Process() { GraphSchema assemblySchema = new GraphSchema("ildependsSchema"); UnresolvedCategory = assemblySchema.Categories.AddNewCategory("Unresolved"); AssemblyCategory = assemblySchema.Categories.AddNewCategory("CodeSchema_Assembly"); string windir = Environment.GetEnvironmentVariable("WINDIR"); _paths.Add(windir + @"\Microsoft.NET\Framework\v4.0.30319"); _host = new ConsoleHostEnvironment(_paths.ToArray(), true); Graph graph = new Graph(); graph.AddSchema(assemblySchema); GraphConditionalStyle errorStyle = new GraphConditionalStyle(graph); GraphCondition condition = new GraphCondition(errorStyle); condition.Expression = "HasCategory('Unresolved')"; GraphSetter setter = new GraphSetter(errorStyle, "Icon"); setter.Value = "pack://application:,,,/Microsoft.VisualStudio.Progression.GraphControl;component/Icons/kpi_red_sym2_large.png"; graph.Styles.Add(errorStyle); foreach (var dir in _directories) { foreach (var target in Directory.GetFiles(dir, "*.dll", SearchOption.AllDirectories)) { _files.Add(Path.GetFileName(target), target); } } foreach (String fileName in this._files.Values) { String fullPath = Path.GetFullPath(fileName); try { Console.WriteLine("Processing: " + fullPath); IAssembly assembly = _host.LoadUnitFrom(fileName) as IAssembly; GraphNode root = graph.Nodes.GetOrCreate(GetNodeID(assembly.AssemblyIdentity), assembly.AssemblyIdentity.Name.Value, AssemblyCategory); WalkDependencies(graph, root, assembly, new HashSet<IAssembly>()); } catch (Exception ex) { Console.WriteLine("#Error: " + ex.Message); } } graph.Save(output); }
public IXPathNavigable getGraphs(int runId, GraphCategory category) { String fileName = this.getMeasureGraphFilename(runId, category); IXPathNavigable doc = null; try { doc = this.m_model.GetOutputXml(fileName); } catch (NullReferenceException) { logger.Debug("Measure Graph output file for the Component ID " + runId + ", Graph Category " + category.ToString() + " is NULL"); doc = new XmlDocument(); } catch (FileNotFoundException) { logger.Debug("Measure Graph output file '" + fileName + "' for the Component ID " + runId + " cannot be found"); doc = new XmlDocument(); } return doc; }
private String getMeasureGraphFilename(int runId, GraphCategory category) { //Get Measures graph filename: ComponentOptions compOptions = new ComponentOptions(); compOptions.CompParams = true; compOptions.LevelDown = 2; String filename = null; if (category == GraphCategory.SINGLEMEASURE) { IXPathNavigable iNavigator = base._GetComponentAndChildren(runId, "Measure", true, compOptions); XPathNavigator navigator = iNavigator.CreateNavigator(); XPathNavigator navFilename = navigator.SelectSingleNode("/Components/Component/Component[@BaseType='Measure']/ComponentParameters/Parameter/Parameter[@displayedName='Graph Output Filename']"); if (navFilename != null) { filename = navFilename.GetAttribute("value", navFilename.NamespaceURI); } } else if (category == GraphCategory.RUNTORUN) { //TODO: add the measure Run-To-Run functionality } return filename; }
protected GraphNode CreateParentNode(IGraphContext context, GraphNodeId urlPart, string label, GraphCategory category) { GraphNodeId idPart = urlPart + GraphNodeId.GetPartial(CssGraphSchema.CssType, label); GraphNode idNode = context.Graph.Nodes.GetOrCreate(idPart, label, category); idNode[DgmlNodeProperties.Icon] = Images.Parent; return(idNode); }
protected virtual void CreateNode(IGraphContext context, GraphNode file, ParseItem item, GraphCategory category) { GraphNodeId id = file.Id + GraphNodeId.GetPartial(CssGraphSchema.CssParseItem, item); GraphNode node = context.Graph.Nodes.GetOrCreate(id, GetLabel(item), category); node[DgmlNodeProperties.Icon] = Images.Child; context.Graph.Links.GetOrCreate(file, node, null, GraphCommonSchema.Contains); context.OutputNodes.Add(node); }
public bool deleteGraphFromFile(int runId, String graphName, GraphCategory category) { try { XmlDocument doc = (XmlDocument)this.getGraphs(runId, category); if (doc == null) { logger.Debug("Measure Graph File for the Run ID " + runId + " doesn't exist"); return false; } XmlNode node = doc.SelectSingleNode( String.Format(doc.DocumentElement.Name + @"/Graph[@name='{0}']", graphName)); node.ParentNode.RemoveChild(node); doc.Save(Path.Combine(this.OutputPath, this.getMeasureGraphFilename(runId, category) + ".xml")); return true; } catch (Exception) { logger.Debug("Exception is caught trying to delete a measure graph " + graphName + "from a Graph Output File for Run ID " + runId); return false; } }
public bool addMeasureGraphToFile(int runId, XmlElement element, GraphCategory category) { XmlDocument doc = (XmlDocument)this.getGraphs(runId, category); if (doc.DocumentElement == null) { //empty document XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "UTF-8", String.Empty); doc.AppendChild(declaration); XmlElement root = null; if (category == GraphCategory.SINGLEMEASURE) { root = doc.CreateElement("MeasureGraphs"); } else if (category == GraphCategory.RUNTORUN) { //TODO: measure Run-To-Run implementation return false; } doc.AppendChild(root); } doc.DocumentElement.AppendChild(doc.ImportNode(element, true)); bool writeToDb = false; String fileName = this.getMeasureGraphFilename(runId, category); if (fileName == null || fileName.CompareTo(String.Empty) == 0) { //file doesn't exist writeToDb = true; if (category == GraphCategory.SINGLEMEASURE) { fileName = "MeasureGraph_" + DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH'-'mm'-'ss"); } else if (category == GraphCategory.RUNTORUN) { //TODO: measure Run-To-Run implementation return false; } } try { doc.Save(Path.Combine(this.OutputPath, fileName + ".xml")); } catch (Exception e) { logger.Debug(e.Message); return false; } //If the Exception was not thrown add the 'GraphFilename' parameter to this SimRun component if (writeToDb) { int measureId = this.getMeasureId(runId); if (category == GraphCategory.SINGLEMEASURE) { this.UpdateParameters(measureId, "Measure Parameters.Graph Output Filename", fileName, eParamParentType.Component); } else if (category == GraphCategory.RUNTORUN) { //TODO: measure Run-To-Run implementation return false; } } return true; }