35 lines
No EOL
1.1 KiB
C#
35 lines
No EOL
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Text.Json;
|
|
using FreeTubeSyncer.Library;
|
|
|
|
namespace FreeTubeSyncer.Models.DatabaseModels;
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
public class Profile : IDataModel
|
|
{
|
|
public string _id { get; set; } = string.Empty;
|
|
public string name { get; set; } = string.Empty;
|
|
public string bgColor { get; set; } = string.Empty;
|
|
public string textColor { get; set; } = string.Empty;
|
|
public List<Subscription> subscriptions { get; set; } = [];
|
|
|
|
public string Id() => _id;
|
|
public bool EqualId(string oid) => _id == oid;
|
|
public void MarshalData(string id, string data)
|
|
{
|
|
var tobject = JsonSerializer.Deserialize<Profile>(data, GlobalJsonOptions.Options);
|
|
if (tobject == null)
|
|
return;
|
|
this._id = tobject._id;
|
|
this.name = tobject.name;
|
|
this.bgColor = tobject.bgColor;
|
|
this.textColor = tobject.textColor;
|
|
this.subscriptions = tobject.subscriptions;
|
|
}
|
|
|
|
public string JsonData()
|
|
{
|
|
return JsonSerializer.Serialize(this);
|
|
}
|
|
} |