private FstFile _GetFstFile() { FstFile result = new FstFile(); result.Lines.AddRange ( new[] { new FstLine { Tag = 200, Format = "v200" }, new FstLine { Tag = 210, Format = "v210" }, new FstLine { Tag = 215, Format = "v215" }, new FstLine { Tag = 300, Format = "(v300,/)" }, new FstLine { Tag = 900, Format = "v900" } } ); return(result); }
static void Main() { try { string recordText = File.ReadAllText ( "record.txt", IrbisEncoding.Ansi ); StringReader reader = new StringReader(recordText); MarcRecord record = PlainText.ReadRecord(reader) .ThrowIfNull("record!"); LocalFstProcessor processor = new LocalFstProcessor ( "C:\\IRBIS64", "SANDBOX" ); FstFile fstFile = processor.ReadFile("marc_irb.fst") .ThrowIfNull("fstFile!"); MarcRecord transformed = processor.TransformRecord ( record, fstFile ); string result = transformed.ToPlainText(); Console.WriteLine(result); } catch (Exception exception) { Console.WriteLine(exception); } }
public void FstProcessor_TransformRecord() { IrbisConnection connection = Connection.ThrowIfNull(); IrbisProvider provider = new ConnectedClient(connection); MarcRecord record = _GetRecord(); FstFile fstFile = _GetFstFile(); FstProcessor processor = new FstProcessor(provider, fstFile); MarcRecord transformed = processor.TransformRecord ( record, fstFile ); Write(transformed); }