private void LogSuccessfulObfuscation(DatabaseImplementation anonDb, string windowsActivityTable, int res) { var logMsg = string.Format(CultureInfo.InvariantCulture, "Successfully obfucscated table '{0}' with {1} entries.", windowsActivityTable, res); anonDb.LogInfo(logMsg); Database.GetInstance().LogInfo(logMsg); }
private string RunAnonymization(string anonymizedDbFile, bool obfuscateMeetingTitles, bool obfuscateWindowTitles) { var anonDb = new DatabaseImplementation(anonymizedDbFile); anonDb.Connect(); // log info about obfuscation var msg = string.Format(CultureInfo.InvariantCulture, "Starting obfuscation for participant {0} (obfuscateMeetingTitles={1}, obfuscateWindowTitles={2}).", _participantId, obfuscateMeetingTitles, obfuscateWindowTitles); Database.GetInstance().LogInfo(msg); anonDb.LogInfo(msg); // anonymize Meeting Titles if user desires if (obfuscateMeetingTitles) { try { var query = "UPDATE " + Settings.MeetingsTable + " SET subject = hash(subject);"; var res = anonDb.ExecuteDefaultQuery(query); LogSuccessfulObfuscation(anonDb, Settings.MeetingsTable, res); } catch (Exception e) { AskToSendErrorMessage(e, "obfuscateMeetingTitles", "obfuscating the meeting titles", anonDb); } } // anonymize Window Titles if user desires if (obfuscateWindowTitles) { try { var query = "UPDATE " + Settings.WindowsActivityTable + " SET window = hash(window);"; var res = anonDb.ExecuteDefaultQuery(query); LogSuccessfulObfuscation(anonDb, Settings.WindowsActivityTable, res); } catch (Exception e) { AskToSendErrorMessage(e, "obfuscateWindowTitles", "obfuscating the window titles", anonDb); } } anonDb.Disconnect(); return(anonymizedDbFile); }