Updated History
Updated History to implement MarshalData() and JsonData() functions.
This commit is contained in:
parent
102a1d5d62
commit
679449e4ec
1 changed files with 29 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using FreeTubeSyncer.Library;
|
||||
|
||||
namespace FreeTubeSyncer.Models.DatabaseModels;
|
||||
|
||||
|
|
@ -23,4 +25,31 @@ public class History : IDataModel
|
|||
|
||||
public string Id() => _id;
|
||||
public bool EqualId(string oid) => _id == oid;
|
||||
|
||||
public void MarshalData(string id, string data)
|
||||
{
|
||||
var tobject = JsonSerializer.Deserialize<History>(data, GlobalJsonOptions.Options);
|
||||
if (tobject == null)
|
||||
return;
|
||||
this._id = id;
|
||||
this.videoId = tobject.videoId;
|
||||
this.title = tobject.title;
|
||||
this.author = tobject.author;
|
||||
this.authorId = tobject.authorId;
|
||||
this.published = tobject.published;
|
||||
this.description = tobject.description;
|
||||
this.viewCount = tobject.viewCount;
|
||||
this.lengthSeconds = tobject.lengthSeconds;
|
||||
this.watchProgress = tobject.watchProgress;
|
||||
this.timeWatched = tobject.timeWatched;
|
||||
this.isLive = tobject.isLive;
|
||||
this.type = tobject.type;
|
||||
this.lastViewedPlaylistType = tobject.lastViewedPlaylistType;
|
||||
this.lastViewedPlaylistItemId = tobject.lastViewedPlaylistItemId;
|
||||
}
|
||||
|
||||
public string JsonData()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue