1- using Newtonsoft . Json ;
1+ using System . Text . Json . Serialization ;
2+ // ReSharper disable ClassNeverInstantiated.Global
23
34namespace FileListSharp . Builders ;
45
5- public class FileListTorrent (
6- int id ,
7- string name ,
8- string ? imdb ,
9- bool freeleech ,
10- bool doubleup ,
11- [ JsonProperty ( "upload_date" ) ] string uploadDate ,
12- [ JsonProperty ( "download_link" ) ] string downloadLink ,
13- long size ,
14- [ JsonProperty ( "internal" ) ] int internalnum ,
15- int moderated ,
16- string category ,
17- int seeders ,
18- int leechers ,
19- [ JsonProperty ( "times_completed" ) ] int timesCompleted ,
20- int comments ,
21- int files ,
22- string description ,
23- [ JsonProperty ( "tv" ) ]
24- Dictionary < string , int ? > tv )
6+ public record FileListTorrent
257{
268 /// <summary>
279 /// The ID of the torrent
2810 /// </summary>
29- public readonly int Id = id ;
11+ [ JsonPropertyName ( "id" ) ]
12+ public required int Id { get ; init ; }
3013
3114 /// <summary>
3215 /// The full name of the torrent
3316 /// </summary>
34- public readonly string Name = name ;
17+ [ JsonPropertyName ( "name" ) ]
18+ public required string Name { get ; init ; }
3519
3620 /// <summary>
3721 /// The IMDb ID of the torrent's content
3822 /// </summary>
39- public readonly string ? Imdb = imdb ;
23+ [ JsonPropertyName ( "imdb" ) ]
24+ public string ? Imdb { get ; init ; }
4025
4126 /// <summary>
4227 /// Whether this torrent is freeleech
4328 /// </summary>
44- public readonly bool Freeleech = freeleech ;
29+ [ JsonPropertyName ( "freeleech" ) ]
30+ public required int FreeLeech { get ; init ; }
4531
4632 /// <summary>
4733 /// Whether this torrent counts as a double upload
4834 /// </summary>
49- public readonly bool Doubleup = doubleup ;
35+ [ JsonPropertyName ( "doubleup" ) ]
36+ public required int DoubleUp { get ; init ; }
5037
5138 /// <summary>
5239 /// The upload date of the torrent
5340 /// </summary>
54- public readonly string UploadDate = uploadDate ;
41+ [ JsonPropertyName ( "upload_date" ) ]
42+ public required string UploadDate { get ; init ; }
5543
5644 /// <summary>
5745 /// URL used for downloading this torrent
5846 /// </summary>
59- public readonly string DownloadLink = downloadLink ;
47+ [ JsonPropertyName ( "download_link" ) ]
48+ public required string DownloadLink { get ; init ; }
6049
6150 /// <summary>
6251 /// The size of the torrent in bytes
6352 /// </summary>
64- public readonly long Size = size ;
53+ [ JsonPropertyName ( "size" ) ]
54+ public long Size { get ; init ; }
6555
6656 /// <summary>
6757 /// Whether this torrent was uploaded by the internal FileList team
6858 /// </summary>
69- public readonly bool Internal = internalnum is 1 ;
59+ [ JsonPropertyName ( "internal" ) ]
60+ public int Internal { get ; init ; }
7061
7162 /// <summary>
7263 /// Whether this torrent is moderated
7364 /// </summary>
74- public readonly bool Moderated = moderated is 1 ;
65+ [ JsonPropertyName ( "moderated" ) ]
66+ public int Moderated { get ; init ; }
7567
7668 /// <summary>
7769 /// The category this torrent is in
7870 /// </summary>
79- public readonly string Category = category ;
71+ [ JsonPropertyName ( "category" ) ]
72+ public required string Category { get ; init ; }
8073
8174 /// <summary>
8275 /// The number of people seeding this torrent
8376 /// </summary>
84- public readonly int Seeders = seeders ;
77+ [ JsonPropertyName ( "seeders" ) ]
78+ public int Seeders { get ; init ; }
8579
8680 /// <summary>
8781 /// The number of people leeching (downloading) this torrent
8882 /// </summary>
89- public readonly int Leechers = leechers ;
83+ [ JsonPropertyName ( "leechers" ) ]
84+ public int Leechers { get ; init ; }
9085
9186 /// <summary>
9287 /// The number of times this torrent was snatched (downloaded)
9388 /// </summary>
94- public readonly int TimesCompleted = timesCompleted ;
89+ [ JsonPropertyName ( "times_completed" ) ]
90+ public int TimesCompleted { get ; init ; }
9591
9692 /// <summary>
9793 /// The number of comments left on this torrent
9894 /// </summary>
99- public readonly int Comments = comments ;
95+ [ JsonPropertyName ( "comments" ) ]
96+ public int Comments { get ; init ; }
10097
10198 /// <summary>
10299 /// The number of files this torrent contains
103100 /// </summary>
104- public readonly int Files = files ;
101+ [ JsonPropertyName ( "files" ) ]
102+ public int Files { get ; init ; }
105103
106104 /// <summary>
107105 /// A small description of the torrent
108106 /// </summary>
109- public readonly string Description = description ;
107+ public string ? Description { get ; init ; }
110108
109+ [ JsonPropertyName ( "tv" ) ] public Tv ? Tv { get ; init ; }
110+ }
111+
112+ public record Tv
113+ {
111114 /// <summary>
112115 /// The season of the TV show contained in this torrent (where applicable)
113- /// </summary>
114- public readonly int ? TvSeason = tv [ "season" ] ;
116+ /// </summary>
117+ [ JsonPropertyName ( "season" ) ]
118+ public int ? Season { get ; init ; }
115119
116120 /// <summary>
117121 /// The episode of the TV show contained in this torrent (where applicable)
118122 /// </summary>
119- public readonly int ? TvEpisode = tv [ "episode" ] ;
123+ [ JsonPropertyName ( "episode" ) ]
124+ public int ? Episode { get ; init ; }
120125}
0 commit comments