/// <summary> /// Default options are found by right-clicking ba_createData in the Project Panel, and selecting Settings /// </summary> private void LoadSavedDefaultSetting() { UseRAMOnly.Checked = Properties.Settings.Default.UseRAMOnly; UseHHDOnly.Checked = Properties.Settings.Default.UseHDDOnly; comboBox1.SelectedItem = Properties.Settings.Default.SplitOption; Properties.Settings.Default.Save(); if (Properties.Settings.Default.UseRAMOnly) { // Load files into ram SetText(MemoryDatabase.LoadDataIntoMemory() ? "Database loaded into memory" + Environment.NewLine : "Database load failed..." + Environment.NewLine); } }
public void ScanUsingBinarySearchLcpWithCashing() { ba_createData.Properties.Settings.Default.Test = false; ba_createData.Properties.Settings.Default.EncryptionLength = 32; var saveString = new StringBuilder(); // Without caching if (MemoryDatabase.SuffixArray == null) { MemoryDatabase.LoadDataIntoMemory(); } ba_createData.Properties.Settings.Default.EncryptionLength = 32; ba_createData.Properties.Settings.Default.UseSQL = false; ba_createData.Properties.Settings.Default.UseBinaryWLcp = true; ba_createData.Properties.Settings.Default.UseBinary = false; ba_createData.Properties.Settings.Default.UseRAMOnly = true; ba_createData.Properties.Settings.Default.UseHDDOnly = false; ba_createData.Properties.Settings.Default.SplitOption = 1; ba_createData.Properties.Settings.Default.UseCashing = true; var testFolderPath = Thread.GetDomain().BaseDirectory + "\\Testresults"; var fileLocation = testFolderPath + "\\binarysearchlcpwithsachingtest.txt"; saveString.Append(@"Binary Search w. LCP with cashing:".ToUpper() + Environment.NewLine + Environment.NewLine); var stopWatch = new Stopwatch(); stopWatch.Start(); var result = Scanner.ScanFile("C495AAE02CE54133A0FEFF7E488C3B96$".ToLower()); stopWatch.Stop(); // Write tesresult to file saveString.Append(@"Result: " + result + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); stopWatch.Start(); var result1 = Scanner.ScanFile("54697A0CC91DCC69E688FBF1EEE55FD0$".ToLower()); stopWatch.Stop(); saveString.Append(@"Result: " + result1 + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); stopWatch.Start(); var result2 = Scanner.ScanFile("74DFF0B6ECCEA35521A65B9A742EB735$".ToLower()); stopWatch.Stop(); saveString.Append(@"Result: " + result2 + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); stopWatch.Start(); var result3 = Scanner.ScanFile("3C9AE0FE669D6AF30B11268118C3179A$".ToLower()); stopWatch.Stop(); saveString.Append(@"Result: " + result3 + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); stopWatch.Start(); var result4 = Scanner.ScanFile("F9FDF8364F7A01247A561C67AE1A4A5B$".ToLower()); stopWatch.Stop(); saveString.Append(@"Result: " + result4 + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); stopWatch.Start(); var result5 = Scanner.ScanFile("A4C21BE59ECEC716B2F646F8D55AC622$".ToLower()); stopWatch.Stop(); saveString.Append(@"Result: " + result5 + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); stopWatch.Start(); var result6 = Scanner.ScanFile("f7198035cce341240181d005c7b022e0$".ToLower()); stopWatch.Stop(); saveString.Append(@"Result: " + result6 + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); stopWatch.Start(); var results7 = Scanner.ScanFile("2d75cc1bf8e57872781f9cd04a529256$".ToLower()); stopWatch.Stop(); saveString.Append(@"Result: " + results7 + @" - found in " + stopWatch.Elapsed + Environment.NewLine); stopWatch.Reset(); File.WriteAllText(fileLocation, saveString.ToString()); Assert.AreEqual(false, result1); Assert.AreEqual(false, result); Assert.AreEqual(false, result3); Assert.AreEqual(false, result2); Assert.AreEqual(false, result4); Assert.AreEqual(false, result5); Assert.AreEqual(true, results7); Assert.AreEqual(true, result6); }