chr
2026-04-05 fe750b791d5b517cc4e9bc8e99a9a75139a0cfba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* -----------------------------------------------------
 *
 * File: FormatVerbosities.cs
 * Author: sven.kopacz@keysight.com
 * Created: 21.10.2016
 *
 * -----------------------------------------------------
 * 
 * Description: See class summary
 *
 * -----------------------------------------------------
 */
 
using System;
 
namespace OpenTap
{
    /// <summary>   Indicates to what extend a formatter should be verbose. </summary>
    public enum FormatVerbosities
    {
        /// <summary>   For the unit minutes, a formatter would just return ":". </summary>
        SuperBrief,
        /// <summary>   For the unit seconds, a formatter would return "s". </summary>
        Brief,
        /// <summary>   For the unit seconds, a formatter would return "sec". </summary>
        Normal,
        /// <summary>   For the unit seconds, a formatter would return "second". </summary>
        Verbose
    }
    /// <summary>
    /// Attribute for giving directives to the TimeSpanControl provider, that shows the control provider in the GUI.
    /// </summary>
    public class TimeSpanFormatAttribute : Attribute
    {
        /// <summary>
        /// Gets or sets a value indicating whether 'None' is allowed as a textual representation of
        /// TimeSpan.Zero.
        /// </summary>
        ///
        /// <value> true if 'None' is allowed, false if not. </value>
        public bool AllowNone { get; private set; }
 
        /// <summary>
        /// Gets or sets a value indicating whether we a negative timespan is allowed. If set to false,
        /// any negative input will automatically be turned into a positive TimeSpan.
        /// </summary>
        ///
        /// <value> true if negative values are allowed, false if not. </value>
        public bool AllowNegative { get; private set; }
 
        /// <summary>
        /// Sets the preferred verbosity for formatting the TimeSpan value.
        /// </summary>
        public FormatVerbosities Verbosity { get; private set; }
 
        /// <summary>
        /// Time span format attribute.
        /// </summary>
        /// <param name="allowNone"></param>
        /// <param name="allowNegative"></param>
        /// <param name="verbosity"></param>
        public TimeSpanFormatAttribute(bool allowNone = false, bool allowNegative = false, FormatVerbosities verbosity = FormatVerbosities.Normal)
        {
            AllowNone = allowNone;
            AllowNegative = allowNegative;
            Verbosity = verbosity;
        }
    }
}