/// <summary> /// Constructor /// </summary> public ADFGVXAnalyzer() { settings = new ADFGVXANalyzerSettings(); myPresentation = new ADFGVXAnalyzerPresentation(); myPresentation.getTranspositionResult += this.getTranspositionResult; Presentation = myPresentation; log = new Logger(); }
private void AlgorithmThread(object parametersObject) { try { object[] parameters = (object[])parametersObject; int i = (int)parameters[0]; String[] messages = (string[])parameters[1]; int j = (int)parameters[2]; ThreadingHelper threadingHelper = (ThreadingHelper)parameters[3]; ADFGVXANalyzerSettings settings = (ADFGVXANalyzerSettings)parameters[4]; Algorithm a = new Algorithm(i, messages, log, j, threadingHelper, settings, this); a.SANgramsIC(); } catch (ThreadAbortException) { //do nothing; analysis aborts threads to stop them :-/ } catch (Exception ex) { GuiLogMessage(string.Format(Properties.Resources.ExceptionDuringThread, ex.Message), NotificationLevel.Error); } }
public Algorithm(int keyLength, String[] messages, Logger log, int taskId, ThreadingHelper threadingHelper, ADFGVXANalyzerSettings settings, ADFGVXAnalyzer analyzer) { this.analyzer = analyzer; this.threadingHelper = threadingHelper; this.taskId = taskId; this.log = log; this.language = settings.Language; this.deviation = settings.Deviation; this.restarts = settings.Restarts; this.keyLength = keyLength; ciphers = new ADFGVXVector[messages.Length]; int totalPlainLength = 0; int maxPlainLength = 0; for (int m = 0; m < messages.Length; m++) { ciphers[m] = new ADFGVXVector(messages[m].Replace(" ", ""), false); totalPlainLength += ciphers[m].length / 2; maxPlainLength = Math.Max(maxPlainLength, ciphers[m].length / 2); } allPlain = new Alphabet36Vector(totalPlainLength, true); plain = new Alphabet36Vector(maxPlainLength, false); interimCipher = new ADFGVXVector(maxPlainLength * 2, false); }