Exemple #1
0
        private void KVHFtest()
        {
            //var r = (rap as RaptorDB.RaptorDB);
            var kv = rap.GetKVHF();

            DateTime dt = DateTime.Now;

            for (int i = 0; i < 100000; i++)
            {
                var o = CreateInvoice(i);
                kv.SetObjectHF(i.ToString(), o);// new byte[100000]);
            }
            MessageBox.Show("time = " + DateTime.Now.Subtract(dt).TotalSeconds);

            var g = kv.GetObjectHF("1009");

            for (int i = 0; i < 100000; i++)
            {
                kv.DeleteKeyHF(i.ToString());
            }

            g = kv.GetObjectHF("1009");
            MessageBox.Show("" + kv.CountHF());

            foreach (var f in Directory.GetFiles("d:\\pp", "*.*"))
            {
                kv.SetObjectHF(f, File.ReadAllBytes(f));
            }

            kv.CompactStorageHF();

            foreach (var f in Directory.GetFiles("d:\\pp", "*.*"))
            {
                var o = kv.GetObjectHF(f);
                File.WriteAllBytes(f.Replace("\\pp\\", "\\ppp\\"), o as byte[]);
            }
            bool b    = kv.ContainsHF("aa");
            var  keys = kv.GetKeysHF();
            //foreach(var o in r.KVHF.EnumerateObjects())
            //{
            //    string s = o.GetType().ToString();
            //}
        }
        private void KVHFtest()
        {
            //var r = (rap as RaptorDB.RaptorDB);
            var kv = rap.GetKVHF();

            int c = kv.CountHF();

            //if (c == 0)
            //{
            //    DateTime dt = DateTime.Now;
            //    for (int i = 0; i < 1000; i++)
            //    {
            //        var o = CreateInvoice(i);
            //        kv.SetObjectHF(i.ToString(), o);// new byte[100000]);
            //    }
            //    MessageBox.Show("time = " + DateTime.Now.Subtract(dt).TotalSeconds);
            //}
            //else
            //{
            //    for(int i = 0; i < 1000; i++)
            //    {
            //        var o = (SalesInvoice) kv.GetObjectHF("" + i);
            //        var id = o.Serial;
            //        if(id != i)
            //        {
            //            MessageBox.Show("not equal");
            //            break;
            //        }
            //    }
            //}
            if (c == 0)
            {
                kv.SetObjectHF("00", 100);
                kv.SetObjectHF("01", 101);
            }
            else
            {
                kv.SetObjectHF("00", 102);
            }

            var g = kv.GetObjectHF("00");

            //for (int i = 0; i < 100; i++)
            //kv.DeleteKeyHF(i.ToString());

            //g = kv.GetObjectHF("1009");
            //MessageBox.Show(""+kv.CountHF());

            //foreach (var f in Directory.GetFiles("d:\\pp", "*.*"))
            //{
            //kv.SetObjectHF(f, File.ReadAllBytes(f));
            //}

            //kv.CompactStorageHF();

            //foreach (var f in Directory.GetFiles("d:\\pp", "*.*"))
            //{
            //    var o = kv.GetObjectHF(f);
            //    File.WriteAllBytes(f.Replace("\\pp\\", "\\ppp\\"), o as byte[]);
            //}
            //bool b = kv.ContainsHF("aa");
            //var keys = kv.GetKeysHF();
            //foreach(var o in r.KVHF.EnumerateObjects())
            //{
            //    string s = o.GetType().ToString();
            //}
        }