Updated Profile

Added functions for MarshalData() and JsonData()
This commit is contained in:
Mario Steele 2025-07-24 04:26:46 -05:00
parent cce80d1d37
commit ae9a1d14bf

View file

@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using FreeTubeSyncer.Library;
namespace FreeTubeSyncer.Models.DatabaseModels;
@ -14,4 +16,22 @@ public class Profile : IDataModel
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);
}
public string IdName() => "_id";
}