Initial commit.

This commit is contained in:
Burak Kaan Köse
2024-04-18 01:44:37 +02:00
parent 524ea4c0e1
commit 12d3814626
671 changed files with 77295 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Reader
{
public class EditorToolbarSection
{
public EditorToolbarSectionType SectionType { get; set; }
public string Title
{
get
{
switch (SectionType)
{
case EditorToolbarSectionType.None:
return Translator.EditorToolbarOption_None;
case EditorToolbarSectionType.Format:
return Translator.EditorToolbarOption_Format;
case EditorToolbarSectionType.Insert:
return Translator.EditorToolbarOption_Insert;
case EditorToolbarSectionType.Draw:
return Translator.EditorToolbarOption_Draw;
case EditorToolbarSectionType.Options:
return Translator.EditorToolbarOption_Options;
default:
return "Unknown Editor Option";
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Reader
{
public class FilterOption
{
public FilterOptionType Type { get; set; }
public string Title { get; set; }
public FilterOption(string title, FilterOptionType type)
{
Title = title;
Type = type;
}
}
}

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using MimeKit;
namespace Wino.Core.Domain.Models.Reader
{
/// <summary>
/// Final model to be passed to renderer page.
/// Data here are created based on rendering settings.
/// </summary>
public class MailRenderModel
{
public string RenderHtml { get; }
public MailRenderingOptions MailRenderingOptions { get; }
public List<MimePart> Attachments { get; set; } = new List<MimePart>();
public string UnsubscribeLink { get; set; }
public bool CanUnsubscribe => !string.IsNullOrEmpty(UnsubscribeLink);
public MailRenderModel(string renderHtml, MailRenderingOptions mailRenderingOptions = null)
{
RenderHtml = renderHtml;
MailRenderingOptions = mailRenderingOptions;
}
}
}

View File

@@ -0,0 +1,19 @@
namespace Wino.Core.Domain.Models.Reader
{
/// <summary>
/// Rendering options for mail.
/// </summary>
public class MailRenderingOptions
{
private const bool DefaultLoadImageValue = true;
private const bool DefaultLoadStylesValue = true;
public bool LoadImages { get; set; } = DefaultLoadImageValue;
public bool LoadStyles { get; set; } = DefaultLoadStylesValue;
// HtmlDocument.Load call is redundant if all the settings are in default values.
// Therefore we will purify the HTML only if needed.
public bool IsPurifyingNeeded() => LoadImages != DefaultLoadImageValue || LoadStyles != DefaultLoadStylesValue;
}
}

View File

@@ -0,0 +1,6 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Reader
{
public record ReaderFontModel(ReaderFont Font, string FontFamilyName);
}

View File

@@ -0,0 +1,29 @@
using System.Collections.Generic;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Comparers;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Models.Reader
{
public class SortingOption
{
public SortingOptionType Type { get; set; }
public string Title { get; set; }
public IComparer<IMailItem> Comparer
{
get
{
if (Type == SortingOptionType.ReceiveDate)
return new DateComparer();
else
return new NameComparer();
}
}
public SortingOption(string title, SortingOptionType type)
{
Title = title;
Type = type;
}
}
}