From a304207ad53db70e2c689d9eac735b9a4075d74a Mon Sep 17 00:00:00 2001 From: Yan Maniez Date: Mon, 22 Oct 2018 22:59:41 +0200 Subject: [PATCH] MaJ GTK --- AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj | 1 + AideDeJeu/AideDeJeu.GTK/NativeAPI.cs | 32 +++----------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj b/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj index 2131ba1c..f099d9e5 100644 --- a/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj +++ b/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj @@ -198,6 +198,7 @@ library.db + Always diff --git a/AideDeJeu/AideDeJeu.GTK/NativeAPI.cs b/AideDeJeu/AideDeJeu.GTK/NativeAPI.cs index 0f449e14..defa1afa 100644 --- a/AideDeJeu/AideDeJeu.GTK/NativeAPI.cs +++ b/AideDeJeu/AideDeJeu.GTK/NativeAPI.cs @@ -1,6 +1,7 @@ using AideDeJeu.Tools; using System; using System.IO; +using System.Reflection; using System.Threading.Tasks; [assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.GTK.Version_GTK))] @@ -31,34 +32,9 @@ namespace AideDeJeu.GTK public async Task GetDatabasePathAsync(string databaseName) { - return null; - //var documentsDirectoryPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); - //var path = Path.Combine(documentsDirectoryPath, databaseName); - - //// This is where we copy in our pre-created database - //if (!File.Exists(path)) - //{ - // using (var inStream = Android.App.Application.Context.Assets.Open(databaseName)) - // { - // using (var outStream = new FileStream(path, FileMode.Create)) - // { - // inStream.CopyTo(outStream); - // } - // } - // //using (var binaryReader = new BinaryReader(Android.App.Application.Context.Assets.Open(databaseName))) - // //{ - // // using (var binaryWriter = new BinaryWriter(new FileStream(path, FileMode.Create))) - // // { - // // byte[] buffer = new byte[2048]; - // // int length = 0; - // // while ((length = binaryReader.Read(buffer, 0, buffer.Length)) > 0) - // // { - // // binaryWriter.Write(buffer, 0, length); - // // } - // // } - // //} - //} - //return path; + var assembly = typeof(Version_GTK).GetTypeInfo().Assembly; + var path = AppDomain.CurrentDomain.BaseDirectory; // System.Reflection.Assembly.GetExecutingAssembly().CodeBase; + return Path.Combine(path, $"{databaseName}.db"); } } } \ No newline at end of file