Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
JosefNemec committed Jul 15, 2018
2 parents 9b73c37 + 8bbeaba commit 28edb3b
Show file tree
Hide file tree
Showing 122 changed files with 5,604 additions and 2,027 deletions.
Binary file modified media/icon.xcf
Binary file not shown.
Binary file added references/LiteDB.dll
Binary file not shown.
15 changes: 14 additions & 1 deletion scripts/GenerateRetroArchProfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ $ignoreList = @(
"cruzes_libretro.info",
"chaigame_libretro.info",
"chailove_libretro.info",
"freej2me_libretro.info"
"freej2me_libretro.info",
"thepowdertoy_libretro.info",
"reminiscence_libretro.info",
"mpv_libretro.info",
"cannonball_libretro.info"
)

$platformsTranslate = @{
Expand Down Expand Up @@ -163,6 +167,15 @@ foreach ($infoFile in $infoFiles)
if ($profile.supported_extensions)
{
$extensions = [System.String]::Join(", ", $profile.supported_extensions.Split("|", [System.StringSplitOptions]::RemoveEmptyEntries))
if ($extensions -notmatch "zip")
{
$extensions += ", zip"
}

if ($extensions -notmatch "7z")
{
$extensions += ", 7z"
}
}

$profileString = $profileTemplate -f $name, $infoFile.BaseName, $platforms, $extensions, $infoFile.BaseName
Expand Down
41 changes: 38 additions & 3 deletions source/Playnite.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayniteUITests", "Playnite
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayniteSDK", "PlayniteSDK\PlayniteSDK.csproj", "{19BC9097-5705-4352-90E2-99F0C63230D0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{214A3A6E-C961-405E-8F5E-96314B672CF2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbTools", "Tools\DbTools\DbTools.csproj", "{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayniteInstaller", "Tools\PlayniteInstaller\PlayniteInstaller.csproj", "{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -84,13 +87,39 @@ Global
{19BC9097-5705-4352-90E2-99F0C63230D0}.Release|x64.Build.0 = Release|Any CPU
{19BC9097-5705-4352-90E2-99F0C63230D0}.Release|x86.ActiveCfg = Release|Any CPU
{19BC9097-5705-4352-90E2-99F0C63230D0}.Release|x86.Build.0 = Release|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Debug|x64.ActiveCfg = Debug|x64
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Debug|x64.Build.0 = Debug|x64
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Debug|x86.ActiveCfg = Debug|x86
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Debug|x86.Build.0 = Debug|x86
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Release|Any CPU.Build.0 = Release|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Release|x64.ActiveCfg = Release|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Release|x64.Build.0 = Release|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Release|x86.ActiveCfg = Release|Any CPU
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248}.Release|x86.Build.0 = Release|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Debug|x64.ActiveCfg = Debug|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Debug|x64.Build.0 = Debug|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Debug|x86.ActiveCfg = Debug|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Debug|x86.Build.0 = Debug|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Release|Any CPU.Build.0 = Release|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Release|x64.ActiveCfg = Release|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Release|x64.Build.0 = Release|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Release|x86.ActiveCfg = Release|Any CPU
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3BB5A3D4-B998-4D0F-9B7A-B133905AA5C9} = {FBE3E4C8-611E-435D-B47C-FE006AAA8C4A}
{59D0C141-64A8-4D86-8156-4BEF8472CB8E} = {FBE3E4C8-611E-435D-B47C-FE006AAA8C4A}
{D5DFD7C9-E747-45F8-BE7D-E9BE3D463248} = {214A3A6E-C961-405E-8F5E-96314B672CF2}
{62DDB6BD-36D1-42C1-BA38-6C7550EA366E} = {214A3A6E-C961-405E-8F5E-96314B672CF2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3300FF38-9F6F-4C0F-87F3-776D6C64846D}
Expand All @@ -101,4 +130,10 @@ Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions source/Playnite/API/PlayniteAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public bool LoadScripts()
continue;
}

logger.Info($"Loaded script extension {path}");
script.SetVariable("PlayniteApi", this);
scripts.Add(script);
}
Expand Down Expand Up @@ -207,6 +208,7 @@ public void LoadPlugins()
continue;
}

logger.Info($"Loaded plugin extension {path}");
plugins.AddRange(plugin);
}

Expand All @@ -217,6 +219,7 @@ public void InvokeExtension(ExtensionFunction function)
{
try
{
logger.Debug($"Invoking extension function {function}");
function.Invoke();
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public async Task DownloadUpdate(UpdateManifest.Package package, Action<Download
var md5 = FileSystem.GetMD5(updaterPath);
if (md5 == package.Checksum)
{
logger.Info("Update already downloaded skipping download.");
return;
}
}
Expand Down
89 changes: 58 additions & 31 deletions source/Playnite/Database/GameDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Playnite.Emulators;
using System.Security.Cryptography;
using Playnite.SDK.Models;
using Playnite.Metadata;

namespace Playnite.Database
{
Expand Down Expand Up @@ -187,35 +188,6 @@ public GamesCollectionChangedEventArgs(List<Game> addedGames, List<Game> removed
}
}

public class FileDefinition
{
public string Path
{
get; set;
}

public string Name
{
get; set;
}

public byte[] Data
{
get; set;
}

public FileDefinition()
{
}

public FileDefinition(string path, string name, byte[] data)
{
Path = path;
Name = name;
Data = data;
}
}

public class GameDatabase
{
private static NLog.Logger logger = LogManager.GetCurrentClassLogger();
Expand Down Expand Up @@ -342,6 +314,50 @@ public void UpdateDatabaseSettings(DatabaseSettings settings)
}
}

public static void CloneLibrary(string dbPath, string targetPath)
{
using (var sourceDb = new LiteDatabase($"Filename={dbPath};Mode=Exclusive"))
{
using (var targetDb = new LiteDatabase($"Filename={targetPath};Mode=Exclusive"))
{
var games = sourceDb.GetCollection<Game>("games").FindAll();
var targetGames = targetDb.GetCollection<Game>("games");
foreach (var game in games)
{
targetGames.Insert(game);
}

var targetPlatforms = targetDb.GetCollection<Platform>("platforms");
foreach (var platform in sourceDb.GetCollection<Platform>("platforms").FindAll())
{
targetPlatforms.Insert(platform);
}

var targetEmulators = targetDb.GetCollection<Emulator>("emulators");
foreach (var emulator in sourceDb.GetCollection<Emulator>("emulators").FindAll())
{
targetEmulators.Insert(emulator);
}

var targetSettings = targetDb.GetCollection<DatabaseSettings>("settings");
foreach (var setting in sourceDb.GetCollection<DatabaseSettings>("settings").FindAll())
{
targetSettings.Insert(setting);
}

foreach (var file in sourceDb.FileStorage.FindAll())
{
using (var fileStream = file.OpenRead())
{
targetDb.FileStorage.Upload(file.Id, file.Filename, fileStream);
}
}

targetDb.Engine.UserVersion = sourceDb.Engine.UserVersion;
}
}
}

public static void MigrateDatabase(string path)
{
using (var db = new LiteDatabase(path))
Expand Down Expand Up @@ -613,6 +629,17 @@ public LiteDatabase OpenDatabase(string path)
return OpenDatabase();
}

public LiteDatabase OpenDatabase(MemoryStream stream)
{
Database = new LiteDatabase(stream);
GamesCollection = Database.GetCollection<Game>("games");
PlatformsCollection = Database.GetCollection<Platform>("platforms");
EmulatorsCollection = Database.GetCollection<Emulator>("emulators");
ActiveControllersCollection = Database.GetCollection<ActiveController>("controllers");
IsOpen = true;
return Database;
}

public LiteDatabase OpenDatabase()
{
if (string.IsNullOrEmpty(Path))
Expand Down Expand Up @@ -1083,9 +1110,9 @@ public List<Emulator> GetEmulators()
return EmulatorsCollection.FindAll().ToList();
}

public string AddFileNoDuplicate(FileDefinition file)
public string AddFileNoDuplicate(MetadataFile file)
{
return AddFileNoDuplicate(file.Path, file.Name, file.Data);
return AddFileNoDuplicate(file.FileId, file.FileName, file.Content);
}

public string AddFileNoDuplicate(string id, string name, byte[] data)
Expand Down
Loading

0 comments on commit 28edb3b

Please sign in to comment.