mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-31 23:45:39 +00:00
NativeAPI UWP
This commit is contained in:
parent
87c5a6bad9
commit
54fcc0bc37
2 changed files with 27 additions and 7 deletions
|
|
@ -102,9 +102,9 @@
|
||||||
<AppxManifest Include="Package.appxmanifest">
|
<AppxManifest Include="Package.appxmanifest">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</AppxManifest>
|
</AppxManifest>
|
||||||
<Content Include="..\..\Data\database.db">
|
<EmbeddedResource Include="..\..\Data\database.db">
|
||||||
<Link>Assets\database.db</Link>
|
<Link>Assets\database.db</Link>
|
||||||
</Content>
|
</EmbeddedResource>
|
||||||
<None Include="AideDeJeu.UWP_TemporaryKey.pfx" />
|
<None Include="AideDeJeu.UWP_TemporaryKey.pfx" />
|
||||||
<Content Include="Assets\Fonts\LinLibertine_R.ttf" />
|
<Content Include="Assets\Fonts\LinLibertine_R.ttf" />
|
||||||
<Content Include="Assets\Fonts\LinLibertine_RB.ttf" />
|
<Content Include="Assets\Fonts\LinLibertine_RB.ttf" />
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,20 @@
|
||||||
using AideDeJeu.Tools;
|
using AideDeJeu.Tools;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using Windows.ApplicationModel;
|
||||||
|
|
||||||
[assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.Droid.Version_Android))]
|
[assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.UWP.Version_UWP))]
|
||||||
namespace AideDeJeu.Droid
|
namespace AideDeJeu.UWP
|
||||||
{
|
{
|
||||||
public class Version_Android : INativeAPI
|
public class Version_UWP : INativeAPI
|
||||||
{
|
{
|
||||||
public string GetVersion()
|
public string GetVersion()
|
||||||
{
|
{
|
||||||
return "";
|
Package package = Package.Current;
|
||||||
|
PackageId packageId = package.Id;
|
||||||
|
PackageVersion version = packageId.Version;
|
||||||
|
|
||||||
|
return string.Format("{0}.{1}", version.Major, version.Minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetBuild()
|
public int GetBuild()
|
||||||
|
|
@ -18,7 +24,21 @@ namespace AideDeJeu.Droid
|
||||||
|
|
||||||
public string GetDatabasePath(string databaseName)
|
public string GetDatabasePath(string databaseName)
|
||||||
{
|
{
|
||||||
return Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, databaseName);
|
var documentsDirectoryPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
|
||||||
|
var path = Path.Combine(documentsDirectoryPath, databaseName);
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
var assembly = typeof(Version_UWP).GetTypeInfo().Assembly;
|
||||||
|
using (var inStream = assembly.GetManifestResourceStream("AideDeJeu.UWP.Assets." + databaseName))
|
||||||
|
{
|
||||||
|
using (var outStream = new FileStream(path, FileMode.Create))
|
||||||
|
{
|
||||||
|
inStream.CopyTo(outStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue