Esempio n. 1
0
        public TinkerGrapĥ(string directory, FileType fileType)
        {
            if (string.IsNullOrWhiteSpace(directory))
            {
                throw new ArgumentNullException(nameof(directory));
            }

            VertexKeyIndex = new TinkerKeyIndex(typeof(TinkerVertex), this);
            EdgeKeyIndex   = new TinkerKeyIndex(typeof(TinkerEdge), this);

            _directory = directory;
            _fileType  = fileType;

            if (!Directory.Exists(_directory))
            {
                Directory.CreateDirectory(_directory);
            }
            else
            {
                var tinkerStorage = TinkerStorageFactory.GetInstance().GetTinkerStorage(fileType);
                var graph         = tinkerStorage.Load(directory);

                InnerVertices  = graph.InnerVertices;
                Edges          = graph.Edges;
                CurrentId      = graph.CurrentId;
                Indices        = graph.Indices;
                VertexKeyIndex = graph.VertexKeyIndex;
                EdgeKeyIndex   = graph.EdgeKeyIndex;
            }
        }
Esempio n. 2
0
        public void Shutdown()
        {
            if (null == _directory)
            {
                return;
            }
            var tinkerStorage = TinkerStorageFactory.GetInstance().GetTinkerStorage(_fileType);

            tinkerStorage.Save(this, _directory);
        }