Ignore:
Timestamp:
Dec 27, 2010, 1:21:23 PM (11 years ago)
Author:
nolte
Message:

Feature: Added a Save-Path for the csv-statistics to the Keysearcher Settings.

File:
1 edited

Legend:

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

    r2262 r2263  
    12761276                    statistic[avname] = MaschCount;
    12771277                }
    1278             }
    1279            
     1278            }         
    12801279            WriteStatistics(dataIdentifier);
    12811280            ((QuickWatch) QuickWatchPresentation).StatisticsPresentation.Statistics = statistic;
     
    12861285        internal void WriteStatistics(String dataIdentifier)
    12871286        {
    1288             using (StreamWriter sw = new StreamWriter(string.Format("{0}\\UserRanking{1}.csv", DirectoryHelper.DirectoryLocal, dataIdentifier)))
    1289             {
    1290                 sw.WriteLine("Avatarname" + ";" + "MaschineID" + ";" + "Hostname" + ";"+ "Pattern Count" + ";" + "Last Update");
    1291                 foreach (string avatar in statistic.Keys)
    1292                 {
    1293                     foreach(long mID in statistic[avatar].Keys)
    1294                     {
    1295                         sw.WriteLine(avatar + ";" + mID.ToString() + ";" + statistic[avatar][mID].Hostname + ";" + statistic[avatar][mID].Count + ";" + statistic[avatar][mID].Date);
     1287            if (settings.CsvPath == null)
     1288            {
     1289                //using the default save folder %APPDATA%\Local\Cryptool2
     1290                using (StreamWriter sw = new StreamWriter(string.Format("{0}\\UserRanking{1}.csv", DirectoryHelper.DirectoryLocal, dataIdentifier)))
     1291                {
     1292                    sw.WriteLine("Avatarname" + ";" + "MaschineID" + ";" + "Hostname" + ";" + "Pattern Count" + ";" + "Last Update");
     1293                    foreach (string avatar in statistic.Keys)
     1294                    {
     1295                        foreach (long mID in statistic[avatar].Keys)
     1296                        {
     1297                            sw.WriteLine(avatar + ";" + mID.ToString() + ";" + statistic[avatar][mID].Hostname + ";" + statistic[avatar][mID].Count + ";" + statistic[avatar][mID].Date);
     1298                        }
     1299                    }
     1300                }
     1301            }
     1302            else
     1303            {
     1304                //using the chosen csv file
     1305                using (StreamWriter sw = new StreamWriter(settings.CsvPath))
     1306                {
     1307                    sw.WriteLine("Avatarname" + ";" + "MaschineID" + ";" + "Hostname" + ";" + "Pattern Count" + ";" + "Last Update");
     1308                    foreach (string avatar in statistic.Keys)
     1309                    {
     1310                        foreach (long mID in statistic[avatar].Keys)
     1311                        {
     1312                            sw.WriteLine(avatar + ";" + mID.ToString() + ";" + statistic[avatar][mID].Hostname + ";" + statistic[avatar][mID].Count + ";" + statistic[avatar][mID].Date);
     1313                        }
    12961314                    }
    12971315                }
Note: See TracChangeset for help on using the changeset viewer.