private void initializeOracle() { String basePath = getDataFileBasePath(); string pathName = basePath + "\\" + ORACLE_DATA_FILENAME; SimpleSpreadsheetReader sr = CsvExcelReader.loadSpreadsheet(pathName); //excelReader = TestExcelReader.loadSpreadsheet(pathName, password); oracle = new PuzzleOracle(sr); if (!oracle.isSourceEncrypted) { MessageBox.Show(this, "ORACLE DATA FILE IS ***UNENCRYPTED****", "WARNING WARNING WARNING"); } oracle.writeCsvFile(basePath, true); // WARNING - writeToFile(false) writes out the decrypted contents! // WARNING - do not enable this in the production build! // MessageBox.Show(this, "WRITING UNENCRYPTED DATA", "WARNING", MessageBoxButtons.OKCancel); //oracle.writeCsvFile(basePath, false); }
public void logSolveAttempt(String puzzleId, String attemptedSolution, PuzzleResponse response) { // We log the normalized attempt so that it doesn't have extraneous characters. attemptedSolution = PuzzleOracle.normalizeSolution(attemptedSolution); String responseCode = "INVALID"; switch (response.type) { case PuzzleResponse.ResponseType.AskLater: responseCode = "BLACKLISTED"; break; case PuzzleResponse.ResponseType.Correct: responseCode = "CORRECT"; break; case PuzzleResponse.ResponseType.Incorrect: responseCode = "INCORRECT"; // INCORRET means it matched a hint. break; case PuzzleResponse.ResponseType.NotFound: responseCode = "NOTFOUND"; break; default: responseCode = "UNRECOGNIZED_CODE"; break; } // Encrypt... String customizer = teamId + puzzleId; // Important - this is the customizer format used for encryption. responseCode = CryptoHelper.simpleEncryptDecrypt(LOG_PASSWORD, customizer, LOG_ENCRYPT_CHARS, responseCode, true); attemptedSolution = CryptoHelper.simpleEncryptDecrypt(LOG_PASSWORD, customizer, LOG_ENCRYPT_CHARS, attemptedSolution, true); rawLog(puzzleId, responseCode, attemptedSolution); }