public virtual void Validate(DatabaseObject obj, ValidationJar jar) { jar.ValidateBasic("test_byte", test_byte, obj["test_byte"]); jar.ValidateBasic("test_short", test_short, obj["test_short"]); jar.ValidateBasic("test_int", test_int, obj["test_int"]); jar.ValidateBasic("test_long", test_long, obj["test_long"]); jar.ValidateBasic("test_float", test_float, obj["test_float"]); jar.ValidateArray("test_byte_array", test_byte_array, (byte[])obj["test_byte_array"]); jar.ValidateArray("test_short_array", test_short_array, (short[])obj["test_short_array"]); jar.ValidateArray("test_int_array", test_int_array, (int[])obj["test_int_array"]); jar.ValidateArray("test_long_array", test_long_array, (long[])obj["test_long_array"]); jar.ValidateArray("test_float_array", test_float_array, (float[])obj["test_float_array"]); jar.ValidateBasic("test_string", test_string, obj["test_string"]); jar.ValidateArray("test_string_array", test_string_array, (string[])obj["test_string_array"]); jar.ValidateBasic("test_bool_1", test_bool_1, obj["test_bool_1"]); jar.ValidateBasic("test_bool_2", test_bool_2, obj["test_bool_2"]); jar.ValidateBasic("test_double", test_string, obj["test_string"]); jar.ValidateArray("test_double_array", test_double_array, (double[])obj["test_double_array"]); jar.ValidateBasic("test_enum", test_enum, obj["test_enum"]); }
static void Main(string[] args) { MultithreadedContentDatabaseController mt = new MultithreadedContentDatabaseController(); //Delete if (File.Exists("E:\\test.db")) { File.Delete("E:\\test.db"); } //Open var session = mt.GetDatabaseSession("E:\\test.db", 512); //Make items var commit = new WriteCommit(747669614976172074, 0xAA); Random rand = new Random(); for (int i = 0; i < 2000; i++) { TestDataset ds = new TestDataset(i); ds.Randomize(rand); WriteCommitObject obj = new WriteCommitObject((ulong)i, 123456789); ds.WriteToObject(obj); commit.CommitObject(obj); datasets.Add(ds); } session.WriteCommitAsync(commit); //Count Console.WriteLine("Count: " + session.CountAllItemsAsync().GetAwaiter().GetResult()); //Close session.CloseDatabaseAsync().GetAwaiter().GetResult(); //Open mt = new MultithreadedContentDatabaseController(); session = mt.GetDatabaseSession("E:\\test.db", 512); //Load and validate var r = session.FindAllItemsAsync().GetAwaiter().GetResult(); ValidationJar jar = new ValidationJar(); for (int i = 0; i < datasets.Count; i++) { var des = r.results[i].Deserialize(); datasets[i].Validate(des, jar); } Console.WriteLine($"Done. {jar.checked_ok} OK, {jar.checked_failed} failed"); Console.ReadLine(); }