예제 #1
0
        public void Save(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return;
            }

            Assertion.Assert(this.myPersistentCache != null, "myPersistentCache != null");
            this.myPersistentCache.Save(
                progress,
                this.myPersistentIdIndex,
                (writer, file, data) =>
                NTriplesCacheBuilder.Write(data, writer));
            this.myPersistentCache.Dispose();
            this.myPersistentCache = null;
        }
예제 #2
0
        public object Load(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return(null);
            }

            Assertion.Assert(this.myPersistentCache == null, "myPersistentCache == null");

            using (ReadLockCookie.Create())
            {
                this.myPersistentCache = new NTriplesPersistentCache <NTriplesFileCache>(
                    this.myShellLocks, Version, "NTriplesCache", this.myPsiConfiguration);
            }

            var data = new Dictionary <IPsiSourceFile, NTriplesFileCache>();

            if (this.myPersistentCache.Load(
                    progress,
                    this.myPersistentIdIndex,
                    (file, reader) =>
            {
                using (ReadLockCookie.Create())
                {
                    return(NTriplesCacheBuilder.Read(reader, file));
                }
            },
                    (projectFile, psiSymbols) =>
            {
                if (projectFile != null)
                {
                    data[projectFile] = psiSymbols;
                }
            }) != LoadResult.OK)
            {
                // clear all...
                return(null);
            }
            return(data);
        }