public MainWindow() { InitializeComponent(); myDelegate = new TimeLoop(updateData); string[] ports = SerialPort.GetPortNames(); foreach (string port in ports) { cmbPorts.Items.Add(port); } foreach (string delimiter in delimitmarkup) { cmbDelimiter.Items.Add(delimiter); } cmbDelimiter.SelectedIndex = 0; testdatalst = new List <double>(); stopwatch = new Stopwatch(); serialMonitor = new SerialPort(); serialMonitor.BaudRate = 9600; serialMonitor.Handshake = System.IO.Ports.Handshake.None; serialMonitor.Parity = Parity.None; serialMonitor.DataBits = 8; serialMonitor.StopBits = StopBits.One; serialMonitor.ReadTimeout = 200; serialMonitor.WriteTimeout = 50; _microStopwatch = new MicroLibrary.MicroStopwatch(); _microTimer = new MicroLibrary.MicroTimer(); }
static void Main(string[] args) { // Redis Connection ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("K1D-REDIS-CLST.ksg.int,password=ZECjTH9cx24ukQA"); IDatabase redisDB = redis.GetDatabase(); // GraphQL Connection GraphQLClient graphQL = new GraphQLClient("https://globaldeviceservice.dev.koreone/api/v1"); // Stopwatch MicroLibrary.MicroStopwatch stopwatch = new MicroLibrary.MicroStopwatch(); // Time the query 10 times string query = "query {" + " deviceById(deviceId: 1) {" + " description" + " }" + "}" + "# Your Name Here"; redisDB.KeyDelete(query); for (int i = 0; i < 20; i++) { stopwatch.Restart(); do_query_with_caching(query, redisDB, graphQL); stopwatch.Stop(); Console.WriteLine("Execution #" + i.ToString() + ": " + stopwatch.ElapsedMicroseconds + "µs"); } }
private void FDEncryptButton_Click(object sender, EventArgs e) { MicroLibrary.MicroStopwatch utimer = new MicroLibrary.MicroStopwatch(); Image inputImage = PlainText_Image.Image; String path = OpenImageDialog.FileName; //Bitmap secretImage = ImageEncryption.ImageEncryption.GenerateSecretImage(inputImage.Size); SecretImageSelection sis = new SecretImageSelection(inputImage as Bitmap); sis.ShowDialog(); if (sis.DialogResult != System.Windows.Forms.DialogResult.OK) { return; } Bitmap secretImage = sis.SecretImage; FluidDynamicsKey fdKey = new FluidDynamicsKey(3.717, 0.55, 3.8222, 0.18, 199, 17, 32, secretImage); fd = new FluidDynamicsEncryptor((Bitmap)inputImage, fdKey); fd.Filename = path.Substring(path.LastIndexOf('\\') + 1); utimer.Start(); fd.Encrypt(); utimer.Stop(); long mem = proc.PrivateMemorySize64; EncryptionFinishedActions(fd.CiphertextImage, utimer.ElapsedMicroseconds, mem); }
private void CAEncryptButton_Click(object sender, EventArgs e) { MicroLibrary.MicroStopwatch utimer = new MicroLibrary.MicroStopwatch(); Image inputImage = PlainText_Image.Image; String path = OpenImageDialog.FileName; CellularAutomataKey caKey = new CellularAutomataKey(42, 53, 15); ca = new CellularAutomataEncryptor((Bitmap)inputImage, caKey); ca.Filename = path.Substring(path.LastIndexOf('\\') + 1); utimer.Start(); ca.Encrypt(); utimer.Stop(); long mem = proc.PrivateMemorySize64; EncryptionFinishedActions(ca.CiphertextImage, utimer.ElapsedMicroseconds, mem); }
private void BioEncryptButton_Click(object sender, EventArgs e) { MicroLibrary.MicroStopwatch utimer = new MicroLibrary.MicroStopwatch(); Image inputImage = PlainText_Image.Image; String path = OpenImageDialog.FileName; //Bitmap secretImage = ImageEncryption. // ImageEncryption.GenerateSecretImage(inputImage.Size); SecretImageSelection sis = new SecretImageSelection(inputImage as Bitmap); sis.ShowDialog(); if (sis.DialogResult != System.Windows.Forms.DialogResult.OK) { return; } Bitmap secretImage = sis.SecretImage; // Key from the paper. BioInspiredKey bioKey = new BioInspiredKey( 3.7158, 0.11, 3.89858, 0.25, 3.76158, 0.35, 3.8458, 0.552, secretImage); bio = new BioInspiredEncryptor((Bitmap)inputImage, bioKey); bio.Filename = path.Substring(path.LastIndexOf('\\') + 1); utimer.Start(); bio.Encrypt(); utimer.Stop(); long mem = proc.PrivateMemorySize64; EncryptionFinishedActions(bio.CiphertextImage, utimer.ElapsedMicroseconds, mem); }