alvin.chen
2019-11-29 edf127edc771f715c49f86e91e768633f0a0ed93
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
namespace HalconTools
{
    public class Counter
    {
        private int all;
        private int ng;
        private int ok;
 
        public Counter()
        {
            this.Reset();
        }
 
        public string GetPercent()
        {
            if (this.all == 0)
            {
                return "100.0%";
            }
            if (this.ok == this.all)
            {
                return "100.0%";
            }
            if (this.ok == 0)
            {
                return "0.0%";
            }
            double num = (((double) this.ok) / ((double) this.all)) * 100.0;
            return (num.ToString("#0.##") + "%");
        }
 
        public string GetPercent(int alls, int ngs)
        {
            if (alls == 0)
            {
                return "100.0%";
            }
            if ((alls - ngs) == alls)
            {
                return "100.0%";
            }
            if ((alls - ngs) == 0)
            {
                return "0.0%";
            }
            double num = (((double) (alls - ngs)) / ((double) alls)) * 100.0;
            return (num.ToString("#0.##") + "%");
        }
 
        public void Reset()
        {
            this.ok = 0;
            this.ng = 0;
            this.all = 0;
        }
 
        public int All
        {
            get
            {
                return (this.ok + this.ng);
            }
        }
 
        public int NG
        {
            get
            {
                return this.ng;
            }
            set
            {
                this.ng = value;
            }
        }
 
        public int OK
        {
            get
            {
                return this.ok;
            }
            set
            {
                this.ok = value;
            }
        }
    }
}