Example #1
0
 private static void AppendToFile(SmartDataEntry smartEntry, string path)
 {
     using (var file = new StreamWriter(File.Open(path, FileMode.Append)))
     {
         string dateString       = smartEntry.Timestamp.ToString("dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
         double gigabytesWritten = smartEntry.HostWrittenGb;
         double powerOnHours     = smartEntry.PowerOnHours;
         double wearLevelling    = smartEntry.WearLevellingCount;
         file.WriteLine($"{dateString};{powerOnHours};{wearLevelling};{(gigabytesWritten).ToString("0.##", CultureInfo.InvariantCulture)}");
     }
 }
Example #2
0
        private void LoadRawValuesCommand_Execute(object obj)
        {
            SmartDataEntry dataEntry = _drive.ReadSmartAttributes();

            _viewModel.LastRefreshed = dataEntry.Timestamp;
            _viewModel.RawValues.Clear();
            _viewModel.RawValues.Add(new GridPropertyViewModel("Total gigabytes written", $"{dataEntry.HostWrittenGb.ToString("0.##", CultureInfo.InvariantCulture)} GB"));
            _viewModel.RawValues.Add(new GridPropertyViewModel("Power on time", $"{dataEntry.PowerOnHours} hours"));
            _viewModel.RawValues.Add(new GridPropertyViewModel("Lifetime left", $"{dataEntry.PercentLifetimeLeft}%"));
            _viewModel.RawValues.Add(new GridPropertyViewModel("Power cycle count", $"{dataEntry.PowerCycleCount}"));
            _viewModel.RawValues.Add(new GridPropertyViewModel("Wear levelling", $"{dataEntry.WearLevellingCount}"));
        }
Example #3
0
        private void AppendDataEntry()
        {
            SmartDataEntry lastEntry = _realTimeData.Last();
            int            lastId    = _viewModel.DataEntries.LastOrDefault()?.EntryId ?? 0;

            _viewModel.DataEntries.Add(new EntryViewModel
            {
                EntryId             = lastId + 1,
                Timestamp           = lastEntry.Timestamp,
                HostWrittenGb       = lastEntry.HostWrittenGb,
                PowerOnHours        = lastEntry.PowerOnHours,
                WearLevelling       = lastEntry.WearLevellingCount,
                PercentLifetimeLeft = lastEntry.PercentLifetimeLeft
            });
        }
Example #4
0
        private void ReadSmartEntry()
        {
            SmartDataEntry smartEntry = _drive.ReadSmartAttributes();

            _realTimeData.Add(smartEntry);
            AppendDataEntry();

            double newValue = smartEntry.HostWrittenGb;

            if (_viewModel.StartFromZero)
            {
                newValue -= _realTimeData.First().HostWrittenGb;
            }
            _viewModel.ChartViewModel.SeriesValues.Add(newValue);
            _viewModel.ChartViewModel.Timestamps.Add(smartEntry.Timestamp.ToString("HH:mm:ss", CultureInfo.InvariantCulture));
            UpdateChartMinMax();
        }
Example #5
0
 private static void PrintToConsole(SmartDataEntry smartEntry)
 {
     System.Console.WriteLine(smartEntry.ToString());
     System.Console.WriteLine(smartEntry);
 }