113 {
114 char? c = null;
117 int value2;
118 if (address.Contains('-'))
119 {
120 if ((address.
Length + 1) % 3 != 0)
121 {
122 return false;
123 }
124 c = '-';
125 array =
new byte[(address.Length + 1) / 3];
126 value2 = 2;
127 }
128 else if (address.Contains(':'))
129 {
130 c = ':';
132 {
133 return false;
134 }
135 if (value2 != 2 && value2 != 4)
136 {
137 return false;
138 }
140 }
141 else if (address.Contains('.'))
142 {
143 c = '.';
145 {
146 return false;
147 }
148 if (value2 != 4)
149 {
150 return false;
151 }
153 }
154 else
155 {
156 if (address.
Length % 2 > 0)
157 {
158 return false;
159 }
161 array =
new byte[address.Length / 2];
162 }
163 int num = 0;
164 int num2 = 0;
165 for (
int i = 0;
i < address.
Length;
i++)
166 {
167 int num3 = address[
i];
168 int num4;
170 {
171 if (c == num3 && num == value2)
172 {
173 num = 0;
174 continue;
175 }
176 return false;
177 }
178 num3 = num4;
179 if (num >= value2)
180 {
181 return false;
182 }
183 if (num % 2 == 0)
184 {
185 array[num2] = (byte)(num3 << 4);
186 }
187 else
188 {
189 array[num2++] |= (byte)num3;
190 }
191 num++;
192 }
193 if (num < value2)
194 {
195 return false;
196 }
198 return true;
199 }
static int FromChar(int c)