Beispiel #1
0
        /// <summary>
        /// Creates the file name for <see cref="ClientTestResultsBase"/>
        /// </summary>
        private string CreateClientResultsFileName(ClientTestResults results)
        {
            var hours = DateTime.Now.ToShortTimeString().Replace(':', '-');
            var date  = DateTime.Now.ToShortDateString().Replace('/', '-');

            return(results.Client.Name + "-" + results.Client.LastName + "-" + date + "-" + hours);
        }
Beispiel #2
0
        /// <summary>
        /// Writes <see cref="ClientTestResultsBase"/> to file
        /// </summary>
        public override void WriteToFile(ClientTestResults results)
        {
            // Make sure we have results to write and the writer object type is set to result
            if (results == null || ObjectType != SaveableObjects.Results)
            {
                throw new Exception("Wrong BinaryWriter usage.");
            }

            // Create the file name for this results
            var filenameFinal = CreateFinalFileName(CreateClientResultsFileName(results));

            // Try to convert the results object to binary array
            if (!DataPackageDescriptor.TryConvertToBin(out var dataBin, results))
            {
                throw new Exception("Results object is unconvertable.");
            }

            // Finally save the file
            WriteBinaryDataToFile(filenameFinal, dataBin);
        }
Beispiel #3
0
 /// <summary>
 /// Writes <see cref="ClientTestResultsBase"/> to file
 /// </summary>
 public virtual void WriteToFile(ClientTestResults ctr)
 {
 }