Example #1
0
        public MARCField(string tagNo, string indicator1, string indicator2, Hashtable subfields)
        {
            init();
            _tag = new MARCTag(tagNo);

            if (_tag._warn != null)
            {
                _warn = "It is not a valid tag.";
            }
            else
            {
                if (isControlField())
                {
                    addControlField(subfields);
                }
                else
                {

                    _indicator1 = indicator1;
                    if (!Regex.IsMatch(indicator1, "^[0-9A-Za-z ]$"))
                    {
                        _warn = "It is not a valid indicator 1.";
                    }

                    _indicator2 = indicator2;
                    if (!Regex.IsMatch(indicator2, "^[0-9A-Za-z ]$"))
                    {
                        _warn = "It is not a valid indicator 2.";
                    }

                    addSubFields(subfields);
                }
            }
        }
Example #2
0
        public MARCField(string tagNo, int fieldLength, char[] fieldRaw)
        {
            init();

            _tag = new MARCTag(tagNo);

            string subfield;

            if (_tag._warn != null)
            {
                _warn = "It is not a valid tag.";
            }
            else
            {
                if (isControlField())
                {
                    char[] buff = new char[fieldRaw.Length -1];
                    Array.Copy(fieldRaw, buff, fieldRaw.Length-1);
                    subfield = new string(buff);

                    _data = subfield;
                }
                else
                {
                    _indicator1 = fieldRaw[0].ToString();
                    if (!Regex.IsMatch(_indicator1, "^[0-9A-Za-z ]$"))
                    {
                        _warn = "It is not a valid indicator 1.";
                    }

                    _indicator2 = fieldRaw[1].ToString();
                    if (!Regex.IsMatch(_indicator2, "^[0-9A-Za-z ]$"))
                    {
                        _warn = "It is not a valid indicator 2.";
                    }

                    _warn = divide2Subfiels(fieldLength, fieldRaw);
                }
            }
        }
Example #3
0
 private void replaceWith(MARCField field)
 {
     _data = field.data;
     _indicator1 = field.indicator1;
     _indicator2 = field.indicator2;
     _subfields = field.getSubFields();
     _tag = field.mTag;
 }