Create libraries based on external unmanaged directories (#147)

* Library management is now complete

* Library functions complete

* Added default platform support
This commit is contained in:
Michael Green
2023-10-08 18:19:59 -07:00
committed by GitHub
parent fc09db60ab
commit 1934558595
19 changed files with 709 additions and 158 deletions

View File

@@ -81,16 +81,19 @@ namespace gaseous_server.Classes
public static void DeleteRom(long RomId)
{
GameRomItem rom = GetRom(RomId);
if (File.Exists(rom.Path))
if (rom.Library.IsDefaultLibrary == true)
{
File.Delete(rom.Path);
}
if (File.Exists(rom.Path))
{
File.Delete(rom.Path);
}
Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
string sql = "DELETE FROM Games_Roms WHERE Id = @id";
Dictionary<string, object> dbDict = new Dictionary<string, object>();
dbDict.Add("id", RomId);
db.ExecuteCMD(sql, dbDict);
Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
string sql = "DELETE FROM Games_Roms WHERE Id = @id";
Dictionary<string, object> dbDict = new Dictionary<string, object>();
dbDict.Add("id", RomId);
db.ExecuteCMD(sql, dbDict);
}
}
private static GameRomItem BuildRom(DataRow romDR)
@@ -113,7 +116,8 @@ namespace gaseous_server.Classes
MediaLabel = (string)romDR["medialabel"],
Path = (string)romDR["path"],
Source = (gaseous_signature_parser.models.RomSignatureObject.RomSignatureObject.Game.Rom.SignatureSourceType)(Int32)romDR["metadatasource"],
SignatureSourceGameTitle = (string)Common.ReturnValueIfNull(romDR["MetadataGameName"], "")
SignatureSourceGameTitle = (string)Common.ReturnValueIfNull(romDR["MetadataGameName"], ""),
Library = GameLibrary.GetLibrary((int)romDR["LibraryId"])
};
// check for a web emulator and update the romItem
@@ -153,6 +157,7 @@ namespace gaseous_server.Classes
public string? Path { get; set; }
public gaseous_signature_parser.models.RomSignatureObject.RomSignatureObject.Game.Rom.SignatureSourceType Source { get; set; }
public string? SignatureSourceGameTitle { get; set;}
public GameLibrary.LibraryItem Library { get; set; }
}
}
}