Permalink
Browse files

No commit message

  • Loading branch information...
hhblaze committed Oct 26, 2018
1 parent ae2ef5b commit 2ba0525e158d9798fe4a94ccc1deb5bf0d359a48
@@ -475,8 +475,11 @@ public void RecreateDB()
//dDynamicDataBlocks = null;
//dDynamicDataBlocks = new Dictionary<ulong, DataIdentifier>();
if(!IsNestedTable)
if (!IsNestedTable)
{
Trie.Storage.RecreateFiles();
}
//}
//catch (System.Exception ex)
//{
@@ -92,6 +92,8 @@ public static string ReplaceMultiple(this string input, Dictionary<string, strin
if (input == null || replaceWith == null || replaceWith.Count < 1)
return input;
replaceWith = replaceWith.OrderByDescending(r => r.Key.Length).ToDictionary(r => r.Key, r => r.Value);
var regex = new System.Text.RegularExpressions.Regex(String.Join("|", replaceWith.Keys.Select(k => System.Text.RegularExpressions.Regex.Escape(k))));
return regex.Replace(input, m => replaceWith[m.Value]);
}
@@ -92,6 +92,8 @@ public static string ReplaceMultiple(this string input, Dictionary<string, strin
if (input == null || replaceWith == null || replaceWith.Count < 1)
return input;
replaceWith = replaceWith.OrderByDescending(r => r.Key.Length).ToDictionary(r => r.Key, r => r.Value);
var regex = new System.Text.RegularExpressions.Regex(String.Join("|", replaceWith.Keys.Select(k => System.Text.RegularExpressions.Regex.Escape(k))));
return regex.Replace(input, m => replaceWith[m.Value]);
}
@@ -92,6 +92,8 @@ public static string ReplaceMultiple(this string input, Dictionary<string, strin
if (input == null || replaceWith == null || replaceWith.Count < 1)
return input;
replaceWith = replaceWith.OrderByDescending(r => r.Key.Length).ToDictionary(r => r.Key, r => r.Value);
var regex = new System.Text.RegularExpressions.Regex(String.Join("|", replaceWith.Keys.Select(k => System.Text.RegularExpressions.Regex.Escape(k))));
return regex.Replace(input, m => replaceWith[m.Value]);
}
@@ -470,13 +470,17 @@ public void RecreateDB()
_nodes = new Dictionary<string, byte[]>();
//dDynamicDataBlocks.Clear();
//dDynamicDataBlocks.Clear();
//dDynamicDataBlocks = null;
//dDynamicDataBlocks = new Dictionary<ulong, DataIdentifier>();
//dDynamicDataBlocks = null;
//dDynamicDataBlocks = new Dictionary<ulong, DataIdentifier>();
if (!IsNestedTable)
{
if(!IsNestedTable)
Trie.Storage.RecreateFiles();
}
//}
//catch (System.Exception ex)
//{
@@ -864,6 +864,8 @@ public TIdentity ObjectGetNewIdentity<TIdentity>(string tableName, byte[] addres
if (seed < 1)
seed = 1;
LTrie table = GetWriteTableFromBuffer(tableName); //Reserving table for write
addressOfIdentity = addressOfIdentity ?? new byte[] { 0 };
Type td = typeof(TIdentity);
@@ -92,6 +92,8 @@ public static string ReplaceMultiple(this string input, Dictionary<string, strin
if (input == null || replaceWith == null || replaceWith.Count < 1)
return input;
replaceWith = replaceWith.OrderByDescending(r => r.Key.Length).ToDictionary(r => r.Key, r => r.Value);
System.Text.RegularExpressions.Regex regex = null;
#if NET35
//|| NETr40 //The same must be use for .NET 4.0
@@ -59,6 +59,8 @@ public static string ReplaceMultiple(this string input, Dictionary<string, strin
if (input == null || replaceWith == null || replaceWith.Count < 1)
return input;
replaceWith = replaceWith.OrderByDescending(r => r.Key.Length).ToDictionary(r => r.Key, r => r.Value);
var regex = new System.Text.RegularExpressions.Regex(String.Join("|", replaceWith.Keys.Select(k => System.Text.RegularExpressions.Regex.Escape(k))));
return regex.Replace(input, m => replaceWith[m.Value]);
}
@@ -19,6 +19,8 @@
using DBreeze;
using DBreeze.Diagnostic;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Threading;
namespace VisualTester
{
@@ -76,7 +78,7 @@ private void PrintOutDoubles(Dictionary<double, byte[]> xd)
}
}
//public class ByteListComparer : IComparer<IList<byte>>
//{
@@ -94,16 +96,98 @@ private void PrintOutDoubles(Dictionary<double, byte[]> xd)
// }
//}
private void btTest10_Click(object sender, RoutedEventArgs e)
{
Task.Run(() =>
{
using (var t = xfre.GetTransaction())
{
t.RemoveAllKeys("t1", true);
}
});
}
DBreezeEngine xfre = null;
private void btTest3_Click(object sender, RoutedEventArgs e)
{
return;
DBreeze.Diagnostic.SpeedStatistic.ToConsole = false;
if (xfre == null)
xfre = new DBreezeEngine(@"D:\temp\DBR1");
//using (var t = xfre.GetTransaction())
//{
// for (int i = 0; i < 20; i++)
// {
// t.Insert<int, int>("t1", i, i);
// }
// t.Commit();
//}
Task.Run(() =>
{
using (var t = xfre.GetTransaction())
{
foreach(var row in t.SelectForward<int,int>("t1"))
{
Console.WriteLine("Key: " + row.Key);
Thread.Sleep(500);
}
}
});
return;
using (var t = xfre.GetTransaction())
{
for(int i=0;i<20;i++)
{
t.Insert<int, int>("t1", i, i);
}
t.Commit();
}
return;
using (var t = xfre.GetTransaction())
{
t.Insert<int, string>("t1", 1, "test1");
t.Insert<int, string>("t1", 2, "test2");
t.Insert<int, string>("t1", 3, "test3");
t.Commit();
}
using (var t = xfre.GetTransaction())
{
//t.RemoveAllKeys("t1", true, () =>
//{
// t.Insert<int, string>("t1", 2, "test2");
// t.Insert<int, string>("t1", 3, "test3");
//});
t.Commit();
}
using (var t = xfre.GetTransaction())
{
foreach(var r in t.SelectBackward<int,string>("t1"))
{
Console.WriteLine(r.Key);
}
}
return;
using (var t = xfre.GetTransaction())
{
@@ -928,10 +1012,7 @@ private void btTest9_Click(object sender, RoutedEventArgs e)
//a.DoAsync();
}
private void btTest10_Click(object sender, RoutedEventArgs e)
{
}
private void btTest11_Click(object sender, RoutedEventArgs e)
{

0 comments on commit 2ba0525

Please sign in to comment.