Updated Profile
Added functions for MarshalData() and JsonData()
This commit is contained in:
parent
cce80d1d37
commit
ae9a1d14bf
1 changed files with 20 additions and 0 deletions
|
|
@ -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";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue