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.

Location:
trunk/CrypPlugins/KeySearcher
Files:
2 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                }
  • trunk/CrypPlugins/KeySearcher/KeySearcherSettings.cs

    r2200 r2263  
    1414        private readonly KeySearcher keysearcher;
    1515        private int coresUsed;
     16        private string csvPath;
    1617        private const string GroupPeerToPeer = "Peer-to-Peer network";
    1718        private const string GroupEvaluation = "Evaluation";
    1819        private const string GroupOpenCL = "OpenCL";
    1920        private const string GroupExternalClient = "External Client";
     21        private const String GroupStatisticPath = "Statistic Save Path";
    2022
    2123        public class OpenCLDeviceSettings
     
    410412        #endregion
    411413
     414        #region csv path
     415        /// <summary>
     416        /// Getter/Setter for the csv file
     417        /// </summary>
     418        [TaskPane("Select the Comma-Seperated-Values file", "Select the folder and csv file you want to use.", GroupStatisticPath, 1, false, DisplayLevel.Beginner, ControlType.SaveFileDialog, FileExtension = "Comma Seperated Values (*.csv)|*.csv")]
     419        public string CsvPath
     420        {
     421            get { return csvPath; }
     422            set
     423            {
     424                if (value != csvPath)
     425                {
     426                    csvPath = value;
     427                    HasChanges = true;
     428                    OnPropertyChanged("CsvPath");
     429                }
     430            }
     431        }
     432
     433        /// <summary>
     434        /// Button to "reset" the csv file. That means it will not appear any more in the text field
     435        /// </summary>
     436        [TaskPane("Default file", "Use the default folder %APPDATA%\\Local\\CrypTool2", GroupStatisticPath, 2, false, DisplayLevel.Beginner, ControlType.Button)]
     437        public void DefaultPath()
     438        {
     439            csvPath = null;
     440            OnPropertyChanged("CsvPath");
     441        }
     442        #endregion
     443
    412444        private ObservableCollection<string> coresAvailable = new ObservableCollection<string>();
    413445        public ObservableCollection<string> CoresAvailable
Note: See TracChangeset for help on using the changeset viewer.