57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using System;
|
|
|
|
namespace Txt2Bib.Records
|
|
{
|
|
public interface IBib { }
|
|
|
|
public record class ArticleBib : IBib
|
|
{
|
|
public string Type { get; init; } = "article";
|
|
public string[] Author { get; init; } = { "Gianni e Pinotto" };
|
|
public string Title { get; init; } = "";
|
|
public string Journal { get; init; } = "";
|
|
public ushort Year { get; init; } = 1950;
|
|
public ushort Volume { get; init; } = 1;
|
|
public byte Issue { get; init; } = 1;
|
|
public ushort FirstPage { get; init; } = 1;
|
|
public ushort LastPage { get; init; } = 1;
|
|
public string Doi { get; init; } = "";
|
|
public string Url { get; init; } = "";
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"@{Type}" + "{" +$"{Author[0][..5]}_{Year},\n" +
|
|
$"\ttitle = \"{Title}\",\n" +
|
|
$"\tjournal = \"{Journal}\",\n" +
|
|
$"\tyear = \"{Year}\",\n" +
|
|
$"\tvolume = \"{Volume}\",\n" +
|
|
$"\tnumber = \"{Issue}\",\n" +
|
|
$"\tpages = \"{FirstPage}--{LastPage}\",\n" +
|
|
$"\tdoi = \"{Doi}\",\n" +
|
|
$"\turl = \"{Url}\",\n" +
|
|
"}\n";
|
|
}
|
|
}
|
|
|
|
public record class BookBib : IBib
|
|
{
|
|
public string Type { get; init; } = "book";
|
|
public string[] Author { get; init; } = { "Gianni e Pinotto" };
|
|
public string Title { get; init; } = "";
|
|
public string Publisher { get; init; } = "";
|
|
public string Place { get; init; } = "";
|
|
public string Url { get; init; } = "";
|
|
public ushort Year { get; init; } = 1950;
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"@{Type}" + "{" +$"{Author[0][..5]}_{Year},\n" +
|
|
$"\ttitle = \"{Title}\",\n" +
|
|
$"\tpublisher = \"{Publisher}\",\n" +
|
|
$"\taddress = \"{Place}\",\n" +
|
|
$"\tyear = \"{Year}\",\n" +
|
|
$"\turl = \"{Url}\",\n" +
|
|
"}\n";
|
|
}
|
|
}
|
|
} |