HamBook – Blame information for rev 46
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
3 | office | 1 | using System; |
2 | using System.Collections.Generic; |
||
15 | office | 3 | using System.ComponentModel; |
3 | office | 4 | using System.Linq; |
5 | using System.Text; |
||
6 | using System.Threading.Tasks; |
||
7 | |||
8 | namespace HamBook.Radios.Generic |
||
9 | { |
||
46 | office | 10 | public class Phase |
3 | office | 11 | { |
46 | office | 12 | public PhaseMode Mode { get; set; } |
15 | office | 13 | |
46 | office | 14 | public Phase(string phase) : this() |
15 | office | 15 | { |
46 | office | 16 | Mode = Parse(phase); |
15 | office | 17 | } |
18 | |||
46 | office | 19 | public Phase(int phase) : this() |
15 | office | 20 | { |
46 | office | 21 | Mode = Parse(phase); |
15 | office | 22 | } |
23 | |||
46 | office | 24 | public Phase() |
16 | office | 25 | { |
26 | |||
27 | } |
||
28 | |||
46 | office | 29 | public Phase(PhaseMode mode) |
15 | office | 30 | { |
46 | office | 31 | Mode = mode; |
15 | office | 32 | } |
33 | |||
46 | office | 34 | public static PhaseMode Parse(string mode) |
15 | office | 35 | { |
36 | switch (mode) |
||
37 | { |
||
38 | case "Simplex": |
||
46 | office | 39 | return PhaseMode.Simplex; |
15 | office | 40 | case "Plus Shift": |
46 | office | 41 | return PhaseMode.PlusShift; |
15 | office | 42 | case "Minus Shift": |
46 | office | 43 | return PhaseMode.MinusShift; |
15 | office | 44 | default: |
45 | throw new ArgumentException(); |
||
46 | } |
||
47 | } |
||
48 | |||
46 | office | 49 | public static PhaseMode Parse(int phase) |
15 | office | 50 | { |
51 | switch (phase) |
||
52 | { |
||
53 | case 0: |
||
46 | office | 54 | return PhaseMode.Simplex; |
15 | office | 55 | case 1: |
46 | office | 56 | return PhaseMode.PlusShift; |
15 | office | 57 | case 2: |
46 | office | 58 | return PhaseMode.MinusShift; |
15 | office | 59 | default: |
60 | throw new ArgumentException(); |
||
61 | } |
||
62 | } |
||
63 | |||
46 | office | 64 | public static implicit operator string(Phase phase) |
15 | office | 65 | { |
46 | office | 66 | switch (phase.Mode) |
15 | office | 67 | { |
46 | office | 68 | case PhaseMode.Simplex: |
15 | office | 69 | return "Simplex"; |
46 | office | 70 | case PhaseMode.PlusShift: |
15 | office | 71 | return "Plus Shift"; |
46 | office | 72 | case PhaseMode.MinusShift: |
15 | office | 73 | return "Minus Shift"; |
74 | default: |
||
75 | throw new ArgumentException(); |
||
46 | office | 76 | |
15 | office | 77 | } |
78 | } |
||
3 | office | 79 | } |
80 | } |