Esempio n. 1
0
        public void RefactTest()
        {
            IdentityFileStore fStore = new IdentityFileStore(localFile);

            Console.WriteLine("重置索引大小:{0}", fStore.RefactHeadIndex(0));
            fStore.Dispose();
        }
Esempio n. 2
0
        public void ReadSummary()
        {
            IdentityFileStore fStore = new IdentityFileStore(localFile);

            Console.WriteLine("Ver:{0}", fStore.GetStoreVersion());
            Console.WriteLine("IDX Size:{0}", fStore.GetIndexSize());
            Console.WriteLine("Dat Offset:{0}", fStore.GetDataReadOffset());
            Console.WriteLine("Index Write Offset:{0}", fStore.GetNextIndexWriteOffset());
            Console.WriteLine("HEAD:{0}", fStore.GetHeadVersion());
            Console.WriteLine("FOOT:{0}", fStore.GetFootVersion());

            fStore.Dispose();
        }
Esempio n. 3
0
        public void GetAllVersion()
        {
            IdentityFileStore fStore = new IdentityFileStore(localFile);

            VersionSnippet[] vers = fStore.GetAllVersions();
            foreach (VersionSnippet spt in vers)
            {
                Console.WriteLine("版本:{0}", spt.Version);
                Console.WriteLine("时间:{0}", spt.CreateTimeUTC.ToLocalTime());
                Console.WriteLine("索引:{0}", spt.StoreIndex);
                Console.WriteLine("长度:{0}", spt.FileLength);
                Console.WriteLine();
            }
            fStore.Dispose();
        }
Esempio n. 4
0
        public void SimpleWrite()
        {
            Dictionary <string, List <string> > dbDict = new Dictionary <string, List <string> >(StringComparer.InvariantCultureIgnoreCase);

            dbDict.Add("/", new List <string> {
                "test", "test.html", "js", "css", "index.html"
            });

            IdentityFileStore fStore = new IdentityFileStore(localFile);

            uint version = fStore.GetHeadVersion() + 1;  //max:4294967295

            byte[] fileBytes = Utility.FileWrapHelper.GetBytes(dbDict);
            fStore.WriteReversion(version, fileBytes);

            fStore.Dispose();
        }
Esempio n. 5
0
        public void SimpleGet()
        {
            /*
             *  版本:1
             *  索引:2048
             *  长度:2107
             *
             *
             *  版本:3
             *  索引:4155
             *  长度:2107
             *
             *
             *  版本:45
             *  索引:6262
             *  长度:2107
             *
             *
             *  版本:99
             *  索引:8369
             *  长度:2107
             *
             *
             *  版本:102
             *  索引:10476
             *  长度:2107
             *
             *
             *  版本:105
             *  索引:12583
             *  长度:2107
             */
            IdentityFileStore fStore = new IdentityFileStore(localFile);

            byte[] fData = fStore.ReadReversion(106);
            File.WriteAllBytes(localFile.Replace("fsvn.dat", "dump.dat"), fData);
            fStore.Dispose();
        }