Exemple #1
0
        public virtual Type FindType(string clrTypeString)
        {
            var name = clrTypeString.Split(',').FirstOrDefault();

            if (name != null)
            {
                return(InvertApplication.FindType(name));
            }
            return(null);

            return(null);
        }
Exemple #2
0
 public TutorialStep SaveAndCompile(GraphNode node)
 {
     return(new TutorialStep("Save & Compile the project.", () =>
     {
         if (InvertApplication.FindType(node.FullName) == null)
         {
             return string.Format("Expected generated types are not found. Make sure that:\n\n" +
                                  "* You clicked 'Save and Compile' button\n" +
                                  "* Generation is finished\n" +
                                  "* Unity console does not contain compilation errors\n");
         }
         return null;
     }));
 }
        public void ImportData(JSONClass node)
        {
            var typeName = string.Empty;

            if (node["_CLRType"] != null)
            {
                typeName = node["_CLRType"].Value;
            }
            else if (node["Type"] != null)
            {
                typeName = node["Type"].Value;
            }
            var type = InvertApplication.FindType(typeName) ?? Type.GetType(typeName);

            if (type == null && typeName.StartsWith("ConnectionData"))
            {
                type = typeof(ConnectionData);
            }

            if (type != null)
            {
                var result = ImportType(type, node);

                if (result is IGraphData)
                {
                    var item = InvertApplication.Container.Resolve <WorkspaceService>();
                    if (item.CurrentWorkspace != null)
                    {
                        item.CurrentWorkspace.AddGraph(result as IGraphData);
                    }
                    CurrentGraph = result as InvertGraph;
                    CurrentGraph.RootFilterId = node["RootNode"]["Identifier"].Value;
                    Debug.Log("Set Root filter id to " + CurrentGraph.RootFilterId);
                }
                if (result is GraphNode)
                {
                    CurrentNode         = result as GraphNode;
                    CurrentNode.GraphId = CurrentGraph.Identifier;
                }
                if (result is DiagramNodeItem)
                {
                    ((IDiagramNodeItem)result).NodeId = CurrentNode.Identifier;
                }
                if (result is ITypedItem)
                {
                    // TODO Find type and replace it will fullname
                    ((ITypedItem)result).RelatedType = node["ItemType"].Value;
                }

                foreach (KeyValuePair <string, JSONNode> child in node)
                {
                    var array = child.Value as JSONArray;
                    if (array != null)
                    {
                        foreach (var item in array.Childs.OfType <JSONClass>())
                        {
                            ImportData(item);
                        }
                    }
                    var cls = child.Value as JSONClass;
                    if (cls != null)
                    {
                        if (child.Key == "FilterState")
                        {
                            continue;
                        }
                        if (child.Key == "Settings")
                        {
                            continue;
                        }
                        if (child.Key == "Changes")
                        {
                            continue;
                        }
                        if (child.Key == "PositionData")
                        {
                            ImportPositionData(cls);
                        }
                        else
                        {
                            if (child.Key == "RootNode")
                            {
                                InvertApplication.Log("Importing ROOT NODE");
                            }
                            ImportData(cls);
                        }
                    }
                }
            }
        }