Ignore:
Timestamp:
Dec 20, 2010, 2:25:52 PM (11 years ago)
Author:
nolte
Message:

Statistic update. The CSV additionally shows the name of the host and the last time this computer gained a pattern point (PP)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/KeySearcher.cs

    r2220 r2233  
    4343
    4444namespace KeySearcher
    45 {   
     45{
     46    public class Information
     47    {
     48        public int Count { get; set; }
     49        public string Hostname { get; set; }
     50        public DateTime Date { get; set; }
     51    }
     52
    4653    [Author("Sven Rech, Nils Kopal, Raoul Falk, Dennis Nolte", "rech@cryptool.org", "Uni Duisburg-Essen", "http://www.uni-due.de")]
    4754    [PluginInfo(false, "KeySearcher", "Bruteforces a decryption algorithm.", "KeySearcher/DetailedDescription/Description.xaml", "KeySearcher/Images/icon.png")]
     
    5158        /// used for creating the UserStatistics
    5259        /// </summary>
    53         private Dictionary<string, Dictionary<long, int>> statistic;
     60        private Dictionary<string, Dictionary<long, Information>> statistic;
    5461        private bool initialized;
     62
     63
    5564        /// <summary>
    5665        /// used for creating the TopList
     
    738747            valuequeue = Queue.Synchronized(new Queue());
    739748
    740             statistic = new Dictionary<string, Dictionary<long, int>>();
     749            statistic = new Dictionary<string, Dictionary<long, Information>>();
    741750            initialized = false;
    742751
     
    12151224        }
    12161225
    1217         internal void IntegrateNewResults(LinkedList<ValueKey> updatedCostList, Dictionary<string, Dictionary<long, int>> updatedStatistics, string dataIdentifier)
     1226        internal void IntegrateNewResults(LinkedList<ValueKey> updatedCostList, Dictionary<string, Dictionary<long, Information>> updatedStatistics, string dataIdentifier)
    12181227        {
    12191228            foreach (var valueKey in updatedCostList)
     
    12281237            {
    12291238                //taking the dictionary in this avatarname
    1230                 Dictionary<long, int> MaschCount = updatedStatistics[avname];
     1239                Dictionary<long, Information> MaschCount = updatedStatistics[avname];
    12311240
    12321241                //if the avatarname already exists in the statistics
     
    12361245                    {
    12371246                        //get the statistic maschcount for this avatarname
    1238                         Dictionary<long, int> statMaschCount = statistic[avname];
     1247                        Dictionary<long, Information> statMaschCount = statistic[avname];
    12391248                       
    12401249                        //if the id of the Maschine already exists for this avatarname
    12411250                        if (statMaschCount.ContainsKey(id))
    12421251                        {
    1243                             if (!initialized || ((MaschCount[id] == 1) && (MaschCount.Keys.Count == 1)))
     1252                            if (!initialized || ((MaschCount[id].Count == 1) && (MaschCount.Keys.Count == 1)))
    12441253                            {
    1245                                 statMaschCount[id] = statMaschCount[id] + MaschCount[id];
     1254                                statMaschCount[id].Count = statMaschCount[id].Count + MaschCount[id].Count;
     1255                                statMaschCount[id].Hostname = MaschCount[id].Hostname;
     1256                                statMaschCount[id].Date = MaschCount[id].Date;
    12461257                                statistic[avname] = statMaschCount;
    12471258                            }
     
    12691280            using (StreamWriter sw = new StreamWriter(string.Format("{0}\\UserRanking{1}.csv", DirectoryHelper.DirectoryLocal, dataIdentifier)))
    12701281            {
    1271                 sw.WriteLine("Avatarname" + ";" + "MaschinenID" + ";" + "Anzahl Pattern");
     1282                sw.WriteLine("Avatarname" + ";" + "MaschinenID" + ";" + "Hostname" + ";"+ "Anzahl Pattern" + ";" + "Last Update");
    12721283                foreach (string avatar in statistic.Keys)
    12731284                {
    12741285                    foreach(long mID in statistic[avatar].Keys)
    12751286                    {
    1276                         sw.WriteLine(avatar + ";" + mID.ToString() + ";" + statistic[avatar][mID].ToString());
     1287                        sw.WriteLine(avatar + ";" + mID.ToString() + ";" + statistic[avatar][mID].Hostname + ";" + statistic[avatar][mID].Count + ";" + statistic[avatar][mID].Date);
    12771288                    }
    12781289                }
Note: See TracChangeset for help on using the changeset viewer.