HamBook – Blame information for rev 51

Subversion Repositories:
Rev:
Rev Author Line No. Line
44 office 1 using HamBook.Radios.Generic;
2 using System;
3 using System.Collections.Generic;
4 using System.Linq;
5 using System.Text;
6 using System.Threading.Tasks;
45 office 7 using System.Xml.Serialization;
44 office 8  
9 namespace HamBook.Radios.Yaesu.FT_891
10 {
46 office 11 [Radio("Yaesu FT-891")]
45 office 12 [XmlRoot(Namespace = "Yaesu FT-891")]
44 office 13 public class MemoryRadioMode : Generic.MemoryRadioMode
14 {
46 office 15 public override char Code { get; set; }
44 office 16  
46 office 17 public override string Name { get; set; }
44 office 18  
45 office 19 public MemoryRadioMode()
20 {
21  
22 }
23  
44 office 24 public MemoryRadioMode(string name)
25 {
26 Name = name;
27 Code = NameToCode(name);
28 }
29  
30 public MemoryRadioMode(char code)
31 {
32 Code = code;
33 Name = CodeToName(code);
34 }
35  
51 office 36 public static IEnumerable<char> Codes
37 {
38 get
39 {
40 foreach (var code in new[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C', 'D' })
41 {
42 yield return code;
43 }
44 }
45 }
46  
47 public static IEnumerable<string> Names
48 {
49 get
50 {
51 foreach (var name in new[] { "LSB", "USB", "CW", "FM", "AM", "RTTY-LSB", "CW-R", "DATA-LSB", "RTTY-USB", "FM-N", "DATA-USB", "AM-N" })
52 {
53 yield return name;
54 }
55 }
56 }
57  
44 office 58 public override char NameToCode(string name)
59 {
60 switch (name)
61 {
62 case "LSB":
63 return '1';
64 case "USB":
65 return '2';
66 case "CW":
67 return '3';
68 case "FM":
69 return '4';
70 case "AM":
71 return '5';
72 case "RTTY-LSB":
73 return '6';
74 case "CW-R":
75 return '7';
76 case "DATA-LSB":
77 return '8';
78 case "RTTY-USB":
79 return '9';
80 case "FM-N":
81 return 'B';
82 case "DATA-USB":
83 return 'C';
84 case "AM-N":
85 return 'D';
86 default:
87 throw new ArgumentException();
88 }
89 }
90  
91 public override string CodeToName(char code)
92 {
93 switch (code)
94 {
95 case '1':
96 return "LSB";
97 case '2':
98 return "USB";
99 case '3':
100 return "CW";
101 case '4':
102 return "FM";
103 case '5':
104 return "AM";
105 case '6':
106 return "RTTY-USB";
107 case '7':
108 return "CW-R";
109 case '8':
110 return "DATA-LSB";
111 case '9':
112 return "RTTY-USB";
113 case 'B':
114 return "FM-N";
115 case 'C':
116 return "DATA-USB";
117 case 'D':
118 return "AM-N";
119 default:
120 throw new ArgumentException();
121 }
122 }
123 }
124 }