public override string ToString() { return($@" Version: {Version} {Company} {Copyright} ToolKitType: {ToolKitType ?? ""} Database: {Iori?.ToString() ?? ""} Credits: {Credits} "); }
public static IThingGraph BackGraph(this IGraphSceneMesh <IVisual, IVisualEdge> mesh, Iori iori) { IThingGraph thingGraph = null; var backHandler = mesh.BackHandler <IThing, ILink> (); Func <IThingGraph, IThingGraph> register = s => { if (s == null) { return(null); } var g = backHandler.WrapGraph(s) as IThingGraph; backHandler.RegisterBackGraph(g); return(g); }; if (iori != null) { thingGraph = backHandler .BackGraphs .Select(g => new { Iori = GetIori(g), Graph = g }) .Where(i => i.Iori != null && i.Iori.ToString() == iori.ToString()) .Select(i => i.Graph as IThingGraph) .FirstOrDefault(); if (thingGraph == null) { thingGraph = register(ThingMeshHelper.OpenGraph(iori)); } } if (thingGraph == null && iori == null) { Trace.WriteLine("Warning! iori is null!"); thingGraph = register(new ThingGraph()); } return(thingGraph); }
public void Open() { if (Current != null) { Trace.WriteLine(string.Format("Provider already opened {0}", Current.Description)); var conn = Current.Data as IGatewayConnection; if (conn != null) { Trace.WriteLine(string.Format("Connection already opened {0}/{1}", conn.Gateway.IsOpen, conn.Gateway.Iori.ToFileName())); } } else { var ioManager = new ThingGraphIoManager { }; var sinkIo = ioManager.GetSinkIO(Iori, IoMode.Read) as ThingGraphIo; try { var sink = sinkIo.Open(Iori); if (sink != null) { Trace.WriteLine(string.Format("DataBase opened {0}", Iori.ToFileName())); Current = sink; var graph = new SchemaThingGraph(Current.Data); PrepareGraph(graph); _thingGraph = graph; } else { throw new Exception("Database not found: " + Iori.ToString()); } } catch (Exception e) { Trace.WriteLine(e.Message); _thingGraph = new ThingGraph(); Trace.WriteLine(string.Format("Empty Graph created {0}", Iori.ToFileName())); } } }