internal static DcmElement CreatePN(uint tag, PersonName[] values, Encoding encoding)
 {
     var tmp = new String[values.Length];
     for (int i = 0; i < values.Length; ++i) {
         tmp[i] = values[i].ToString();
     }
     return new PN(tag, tmp, encoding);
 }
Exemple #2
0
        public PersonName(String s)
        {
            if (s == null) {
                s = string.Empty;
            }

            int grLen = s.IndexOf('=');
            if ((grLen == - 1 ? s.Length : grLen) > 64) {
                throw new ArgumentException(s);
            }

            var stk = new Tokenizer(s, "=^");
            int field = FAMILY;
            String tk;
            while (stk.HasMoreTokens()) {
                tk = stk.NextToken();
                switch (tk[0]) {
                    case '^':
                        if (++field > SUFFIX) {
                            throw new ArgumentException(s);
                        }
                        break;

                    case '=':
                        goto WHILE_brk;

                    default:
                        components[field] = tk;
                        break;
                }
            }
            WHILE_brk:
            ;

            if (!stk.HasMoreTokens()) {
                return;
            }

            tk = stk.NextToken("=");
            if (tk[0] != '=') {
                ideographic = new PersonName(tk);
                if (stk.HasMoreTokens()) {
                    tk = stk.NextToken("=");
                }
            }
            if (!stk.HasMoreTokens()) {
                return;
            }

            tk = stk.NextToken();
            if (tk[0] == '=' || stk.HasMoreTokens()) {
                throw new ArgumentException(s);
            }

            phonetic = new PersonName(tk);
        }
 internal static DcmElement CreatePN(uint tag, PersonName value, Encoding encoding)
 {
     return new PN(tag, value.ToString(), encoding);
 }