コード例 #1
0
ファイル: Program.cs プロジェクト: fossabot/ManagedIrbis
        /*========================================================*/

        public MarcRecord Execute
        (
            IrbisConnection client,
            MarcRecord record
        )
        {
            MarcRecord result = new MarcRecord();

            foreach (FstLine fstLine in Lines)
            {
                string formatted = client.FormatRecord
                                   (
                    fstLine.Code,
                    record
                                   );
                if (!string.IsNullOrEmpty(formatted))
                {
                    formatted = formatted.Trim();
                    if (!string.IsNullOrEmpty(formatted))
                    {
                        formatted = formatted.Replace("\r", string.Empty);
                        string[] parts = formatted.Split
                                         (
                            new[] { '\n' },
                            StringSplitOptions.RemoveEmptyEntries
                                         );
                        foreach (string part in parts)
                        {
                            string trimmed = part.Trim();
                            if (!string.IsNullOrEmpty(trimmed))
                            {
                                RecordField field = RecordFieldUtility.Parse
                                                    (
                                    fstLine.Tag,
                                    trimmed
                                                    );
                                result.Fields.Add(field);
                            }
                        }
                    }
                }
            }

            return(result);
        }