Example #1
0
        public void Save()
        {
            if (string.IsNullOrEmpty(CurrentPath))
            {
                throw new ArgumentException("Cannot save. Path is unknown");
            }

            IoUtilities.SaveToFile(CurrentPath, _graph);
        }
Example #2
0
        private void OpenGraph()
        {
            var path = GraphsDefaultPath;

            path = EditorUtility.OpenFilePanel("Open Graph", Directory.GetParent(path).FullName, "bytes");
            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            if (!File.Exists(path))
            {
                EditorUtility.DisplayDialog("File not exists",
                                            "Selected file not exists, you must select Graph binary file.", "Ok");
                return;
            }

            var graph = IoUtilities.LoadFromFile <Graph>(path, Graph.Signature);

            AddGraphContext(new GraphContext(graph)
            {
                Name        = Path.GetFileNameWithoutExtension(path),
                CurrentPath = path,
            });
        }