Updated Playlist
Updated to implement MarshalData() and JsonData()
This commit is contained in:
parent
679449e4ec
commit
cce80d1d37
1 changed files with 19 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;
|
||||
|
||||
|
|
@ -15,4 +17,21 @@ public class Playlist : IDataModel
|
|||
|
||||
public string Id() => _id;
|
||||
public bool EqualId(string oid) => _id == oid;
|
||||
public void MarshalData(string id, string data)
|
||||
{
|
||||
var tobject = JsonSerializer.Deserialize<Playlist>(data, GlobalJsonOptions.Options);
|
||||
if (tobject == null)
|
||||
return;
|
||||
this._id = id;
|
||||
this.playlistName = tobject.playlistName;
|
||||
this.@protected = tobject.@protected;
|
||||
this.videos = tobject.videos;
|
||||
this.createdAt = tobject.createdAt;
|
||||
this.lastUpdatedAt = tobject.lastUpdatedAt;
|
||||
}
|
||||
|
||||
public string JsonData()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue