-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNews.cs
59 lines (51 loc) · 1.59 KB
/
News.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using Newtonsoft.Json;
namespace OOP_Project
{
public class News //---- class para criar um objecto que recebe dados JSON da internet
{
public int id { get; set; }
public string title { get; set; }
public DateTime publish_date { get; set; }
public string tag { get; set; }
public string lead { get; set; }
public string image { get; set; }
public string image_16x9 { get; set; }
public string url { get; set; }
public object authors { get; set; }
public override string ToString()
{
string p1, p2, p3;
string s = "\t\tTítulo: " + title;
if (lead.Length > 93)
{
if (lead.Length > 186)
{
p1 = lead.Substring(0,93);
p2 = lead.Substring(93, 93);
p3 = lead.Substring(186);
s += "\n\t\t" + p1;
s += "\n\t\t" + p2;
s += "\n\t\t" + p3;
}
else
{
p1 = lead.Substring(0,93);
p2 = lead.Substring(93);
s += "\n\t\t" + p1;
s += "\n\t\t" + p2;
}
}
else
{
s += "\n\t\t" + lead;
}
s += "\n\t\tPublicado em: " + publish_date;
s += "\n\t\t------------";
return s;
}
}
}