Add project files.

This commit is contained in:
Jose Conde
2025-09-04 10:14:30 +02:00
parent a7a404148c
commit 94e6ef651e
54 changed files with 3134 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
using ModVersionChecker.data.model;
using ModVersionChecker.managers.interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModVersionChecker.managers.litedb
{
public class SourcesLiteDb : LiteDb, ISourcesDefManager
{
private string collection = SOURCES_DEF_COLLECTION;
public List<SourceDef> List()
{
var col = _db.GetCollection<SourceDef>(collection);
return col.FindAll().ToList();
}
public SourceDef? GetById(string id)
{
var col = _db.GetCollection<SourceDef>(collection);
return col.FindOne(x => x.Id == id);
}
public void AddSourceDef(SourceDef sourceDef)
{
var col = _db.GetCollection<SourceDef>(collection);
col.Insert(sourceDef);
}
public void RemoveSourceDef(string id)
{
var col = _db.GetCollection<SourceDef>(collection);
col.Delete(id);
}
public void Save(SourceDef sourceDef)
{
var col = _db.GetCollection<SourceDef>(collection);
col.Upsert(sourceDef);
}
}
}