mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-02-17 02:51:37 -05:00
Start modernization
This commit is contained in:
@@ -1,20 +1,40 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using FeedCenter.Options;
|
||||
using Realms;
|
||||
|
||||
namespace FeedCenter
|
||||
{
|
||||
public partial class FeedItem
|
||||
public class FeedItem : RealmObject
|
||||
{
|
||||
[PrimaryKey]
|
||||
[MapTo("ID")]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[MapTo("FeedID")]
|
||||
public Guid FeedId { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
public string Link { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool BeenRead { get; set; }
|
||||
public DateTimeOffset LastFound { get; set; }
|
||||
public bool New { get; set; }
|
||||
public string Guid { get; set; }
|
||||
public int Sequence { get; set; }
|
||||
|
||||
public Feed Feed { get; set; }
|
||||
|
||||
public static FeedItem Create()
|
||||
{
|
||||
return new FeedItem { ID = System.Guid.NewGuid() };
|
||||
return new FeedItem { Id = System.Guid.NewGuid() };
|
||||
}
|
||||
|
||||
#region Methods
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string title = Title;
|
||||
var title = Title;
|
||||
|
||||
switch (Properties.Settings.Default.MultipleLineDisplay)
|
||||
{
|
||||
@@ -28,13 +48,17 @@ namespace FeedCenter
|
||||
case Options.MultipleLineDisplay.FirstLine:
|
||||
|
||||
// Find the first newline
|
||||
int newlineIndex = title.IndexOf("\n", StringComparison.Ordinal);
|
||||
var newlineIndex = title.IndexOf("\n", StringComparison.Ordinal);
|
||||
|
||||
// If a newline was found return everything before it
|
||||
if (newlineIndex > -1)
|
||||
title = title.Substring(0, newlineIndex);
|
||||
title = title[..newlineIndex];
|
||||
|
||||
break;
|
||||
case MultipleLineDisplay.Normal:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
// Condense multiple spaces to one space
|
||||
|
||||
Reference in New Issue
Block a user