Ejemplo n.º 1
0
        // 将一个Marc机内格式,变成一个字段数组
        // parameter:
        //		strMarc	Marc数据
        //		fields	out参数,返回字段数组
        // return:
        //		void
        /// <summary>
        /// 根据一个 MARC 机内格式字符串获得一个 字段内容的数组
        /// </summary>
        /// <param name="strMarc">MARC 机内格式字符串</param>
        /// <param name="fields">返回字符串数组。每个字符串表示一个字段</param>
        internal static void GetMarcFields(string strMarc,
                                           out List <string> fields)
        {
            fields = new List <string>();

            if (String.IsNullOrEmpty(strMarc) == true)
            {
                return;
            }

            // List<string> aField = new List<string>();
            string strText = strMarc;

            string strField = "";

            if (strText.Length < 24)
            {
                strText = strText + new string(' ', 24 - strText.Length);
            }
            strField = strText.Substring(0, 24);
            fields.Add(strField);

            strText = strText.Substring(24);

            List <string> restFields = Record.GetFields(strText);

            // 这里的预先处理头标区,说明了GetFields()函数的不合理 2009/3/5

            fields.AddRange(restFields);
        }
Ejemplo n.º 2
0
        // 根据通过的Marc字段串,给nIndex位置前新增多个字段
        // parameters:
        //		nIndex	位置
        //		strFieldMarc	marc字符串
        //		nNewFieldCount	out参数,新增了几个字段
        internal void InsertInternal(int nIndex,
                                     string strFieldsMarc,
                                     out int nNewFieldsCount)
        {
            nNewFieldsCount = 0;

            // 先找到有几个字段
            strFieldsMarc = strFieldsMarc.Replace(Record.SUBFLD, Record.KERNEL_SUBFLD);
            List <string> fields = Record.GetFields(strFieldsMarc);

            if (fields == null || fields.Count == 0)
            {
                return;
            }

            nNewFieldsCount = fields.Count;

            this.InsertInternal(nIndex, fields);
        }