| 
									
										
										
										
											2018-05-13 01:10:03 +02:00
										 |  |  |  | using AideDeJeu.Tools; | 
					
						
							|  |  |  |  | using System.IO; | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  | using System.Reflection; | 
					
						
							| 
									
										
										
										
											2018-10-20 21:57:17 +02:00
										 |  |  |  | using System.Threading.Tasks; | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  | using Windows.ApplicationModel; | 
					
						
							| 
									
										
										
										
											2018-05-13 01:10:03 +02:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  | [assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.UWP.Version_UWP))] | 
					
						
							|  |  |  |  | namespace AideDeJeu.UWP | 
					
						
							| 
									
										
										
										
											2018-05-13 01:10:03 +02:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  |     public class Version_UWP : INativeAPI | 
					
						
							| 
									
										
										
										
											2018-05-13 01:10:03 +02:00
										 |  |  |  |     { | 
					
						
							|  |  |  |  |         public string GetVersion() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  |             Package package = Package.Current; | 
					
						
							|  |  |  |  |             PackageId packageId = package.Id; | 
					
						
							|  |  |  |  |             PackageVersion version = packageId.Version; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return string.Format("{0}.{1}", version.Major, version.Minor); | 
					
						
							| 
									
										
										
										
											2018-05-13 01:10:03 +02:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public int GetBuild() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return 0; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-20 21:57:17 +02:00
										 |  |  |  |         public async Task<string> GetDatabasePathAsync(string databaseName) | 
					
						
							| 
									
										
										
										
											2018-05-13 01:10:03 +02:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  |             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; | 
					
						
							| 
									
										
										
										
											2018-10-14 18:59:22 +02:00
										 |  |  |  |                 using (var inStream = assembly.GetManifestResourceStream("AideDeJeu.UWP." + databaseName)) | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  |                 { | 
					
						
							|  |  |  |  |                     using (var outStream = new FileStream(path, FileMode.Create)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2018-10-20 22:10:13 +02:00
										 |  |  |  |                         await inStream.CopyToAsync(outStream); | 
					
						
							| 
									
										
										
										
											2018-05-20 19:47:34 +02:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return path; | 
					
						
							| 
									
										
										
										
											2018-05-13 01:10:03 +02:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |