mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	database.db => library.db
This commit is contained in:
		
							parent
							
								
									851ad3e4af
								
							
						
					
					
						commit
						2230ddea79
					
				
					 12 changed files with 28 additions and 24 deletions
				
			
		|  | @ -106,8 +106,8 @@ | |||
|     <AndroidAsset Include="Assets\LinLibertine_aZL.ttf" /> | ||||
|     <AndroidAsset Include="Assets\LinLibertine_DR.ttf" /> | ||||
|     <AndroidAsset Include="Assets\LinLibertine_I.ttf" /> | ||||
|     <AndroidAsset Include="..\..\Data\database.db"> | ||||
|       <Link>Assets\database.db</Link> | ||||
|     <AndroidAsset Include="..\..\Data\library.db"> | ||||
|       <Link>Assets\library.db</Link> | ||||
|     </AndroidAsset> | ||||
|     <None Include="Resources\AboutResources.txt" /> | ||||
|     <None Include="Assets\AboutAssets.txt" /> | ||||
|  |  | |||
|  | @ -196,6 +196,9 @@ | |||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Content Include="..\..\Data\library.db"> | ||||
|       <Link>library.db</Link> | ||||
|     </Content> | ||||
|     <None Include="app.config" /> | ||||
|     <None Include="OpenTK.dll.config" /> | ||||
|     <None Include="packages.config" /> | ||||
|  |  | |||
|  | @ -109,8 +109,8 @@ | |||
|     <AppxManifest Include="Package.appxmanifest"> | ||||
|       <SubType>Designer</SubType> | ||||
|     </AppxManifest> | ||||
|     <EmbeddedResource Include="..\..\Data\database.db"> | ||||
|       <Link>database.db</Link> | ||||
|     <EmbeddedResource Include="..\..\Data\library.db"> | ||||
|       <Link>library.db</Link> | ||||
|     </EmbeddedResource> | ||||
|     <None Include="AideDeJeu.UWP_StoreKey.pfx" /> | ||||
|     <None Include="AideDeJeu.UWP_TemporaryKey.pfx" /> | ||||
|  |  | |||
|  | @ -90,8 +90,8 @@ | |||
|   <ItemGroup> | ||||
|     <Compile Include="Main.cs" /> | ||||
|     <Compile Include="AppDelegate.cs" /> | ||||
|     <BundleResource Include="..\..\Data\database.db"> | ||||
|       <Link>Resources\database.db</Link> | ||||
|     <BundleResource Include="..\..\Data\library.db"> | ||||
|       <Link>Resources\library.db</Link> | ||||
|     </BundleResource> | ||||
|     <None Include="Entitlements.plist" /> | ||||
|     <None Include="Info.plist" /> | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ | |||
| using System; | ||||
| using System.IO; | ||||
| using Foundation; | ||||
| using System.Threading.Tasks; | ||||
| 
 | ||||
| [assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.Droid.Version_Android))] | ||||
| namespace AideDeJeu.Droid | ||||
|  | @ -22,9 +23,9 @@ namespace AideDeJeu.Droid | |||
|             return res ? build : 0; | ||||
|         } | ||||
| 
 | ||||
|         public string GetDatabasePath(string databaseName) | ||||
|         public async Task<string> GetDatabasePathAsync(string databaseName) | ||||
|         { | ||||
|             return NSBundle.MainBundle.PathForResource("database", "db"); | ||||
|             return NSBundle.MainBundle.PathForResource("library", "db"); | ||||
|             //var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", databaseName); | ||||
|             //return databasePath; | ||||
|         } | ||||
|  |  | |||
|  | @ -59,7 +59,7 @@ namespace AideDeJeu.ViewModels | |||
| 
 | ||||
|         public async Task<IEnumerable<SearchedItem>> DeepSearchAllItemsAsync(string searchText) | ||||
|         { | ||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) | ||||
|             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||
|             { | ||||
|                 var primary = await context.Items. | ||||
|                     Where(item => item.Name.Contains(searchText)). | ||||
|  |  | |||
|  | @ -317,7 +317,7 @@ namespace AideDeJeu.ViewModels | |||
|             var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? ""; | ||||
|             var ritual = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? ""; | ||||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; | ||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) | ||||
|             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||
|             { | ||||
|                 return context.SpellsVO.Where(spell => | ||||
|                                         levelComparer.Compare(spell.Level, niveauMin) >= 0 && | ||||
|  | @ -397,7 +397,7 @@ namespace AideDeJeu.ViewModels | |||
|             var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? ""; | ||||
|             var ritual = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? ""; | ||||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; | ||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) | ||||
|             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||
|             { | ||||
|                 return context.SpellsHD.Where(spell => | ||||
|                                         levelComparer.Compare(spell.Level, niveauMin) >= 0 && | ||||
|  | @ -658,7 +658,7 @@ namespace AideDeJeu.ViewModels | |||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; | ||||
|             token.ThrowIfCancellationRequested(); | ||||
| 
 | ||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) | ||||
|             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||
|             { | ||||
|                 return context.MonstersVO.Where(monster => | ||||
|                                         monster != null && | ||||
|  | @ -774,7 +774,7 @@ namespace AideDeJeu.ViewModels | |||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; | ||||
|             token.ThrowIfCancellationRequested(); | ||||
| 
 | ||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) | ||||
|             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||
|             { | ||||
|                 return context.MonstersHD.Where(monster => | ||||
|                                         monster != null && | ||||
|  | @ -907,7 +907,7 @@ namespace AideDeJeu.ViewModels | |||
|             var minPrice = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinPrice).SelectedKey ?? "0 pc"; | ||||
|             var maxPrice = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MaxPrice).SelectedKey ?? "1 000 000 po"; | ||||
| 
 | ||||
|             using (var context = await GetDatabaseContextAsync()) | ||||
|             using (var context = await GetLibraryContextAsync()) | ||||
|             { | ||||
|                 return context.Equipments.Where(equipment => | ||||
|                     equipment.Type.ToLower().Contains(type.ToLower()) && | ||||
|  | @ -1007,7 +1007,7 @@ namespace AideDeJeu.ViewModels | |||
|             var rarity = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Rarity).SelectedKey ?? ""; | ||||
|             var attunement = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Attunement).SelectedKey ?? ""; | ||||
| 
 | ||||
|             using (var context = await GetDatabaseContextAsync()) | ||||
|             using (var context = await GetLibraryContextAsync()) | ||||
|             { | ||||
|                 return context.MagicItems.Where(magicitem => | ||||
|                     MatchContains(magicitem.Type, type) && | ||||
|  |  | |||
|  | @ -402,9 +402,9 @@ namespace AideDeJeu.ViewModels | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public static async Task<AideDeJeuContext> GetDatabaseContextAsync() | ||||
|         public static async Task<AideDeJeuContext> GetLibraryContextAsync() | ||||
|         { | ||||
|             var dbPath = await DependencyService.Get<INativeAPI>().GetDatabasePathAsync("database.db"); | ||||
|             var dbPath = await DependencyService.Get<INativeAPI>().GetDatabasePathAsync("library.db"); | ||||
|             return new AideDeJeuContext(dbPath); | ||||
|         } | ||||
| 
 | ||||
|  | @ -415,7 +415,7 @@ namespace AideDeJeu.ViewModels | |||
|             { | ||||
|                 id += $"#{anchor}"; | ||||
|             } | ||||
|             using (var context = await GetDatabaseContextAsync()) | ||||
|             using (var context = await GetLibraryContextAsync()) | ||||
|             { | ||||
|                 return await context.Items.Where(item => item.Id == id).FirstOrDefaultAsync(); | ||||
|             } | ||||
|  |  | |||
|  | @ -62,7 +62,7 @@ namespace AideDeJeu.Views | |||
|         async Task InitDBEngineAsync() | ||||
|         { | ||||
|             await Task.Delay(1000).ConfigureAwait(false); | ||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync().ConfigureAwait(false)) | ||||
|             using (var context = await StoreViewModel.GetLibraryContextAsync().ConfigureAwait(false)) | ||||
|             { | ||||
|                 var item = context.Items.FirstOrDefault(); | ||||
|             } | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
|   </PropertyGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <Content Include="..\..\Data\database.db" Link="database.db" /> | ||||
|     <None Include="..\..\Data\library.db" Link="library.db" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ namespace AideDeJeuCmd | |||
|                     .Build(); | ||||
|                 //var document = Markdig.Parsers.MarkdownParser.Parse(md, pipeline); | ||||
|                 //DumpMarkdownDocument(document); | ||||
|                 var monsters = DependencyService.Get<StoreViewModel>().ToItem(filename, md) as IEnumerable<Monster>; // document.ToMonsters<MonsterHD>(); | ||||
|                 var monsters = DependencyService.Get<StoreViewModel>().ToItem(filename, md, null) as IEnumerable<Monster>; // document.ToMonsters<MonsterHD>(); | ||||
|                 //document.Dump(); | ||||
|                 Console.WriteLine("ok"); | ||||
|                 //var md2 = monsters.ToMarkdownString(); | ||||
|  | @ -66,7 +66,7 @@ namespace AideDeJeuCmd | |||
| 
 | ||||
|             var result = string.Empty; | ||||
|             var md = await LoadStringAsync(dataDir + "spells_hd.md"); | ||||
|             var items = DependencyService.Get<StoreViewModel>().ToItem("spells_hd", md) as IEnumerable<Spell>; | ||||
|             var items = DependencyService.Get<StoreViewModel>().ToItem("spells_hd", md, null) as IEnumerable<Spell>; | ||||
| 
 | ||||
|             var classes = new string[] | ||||
|             { | ||||
|  | @ -132,7 +132,7 @@ namespace AideDeJeuCmd | |||
|                 //if (name.Contains("_hd.")) | ||||
|                 //{ | ||||
|                     var md = await Helpers.GetResourceStringAsync(name); | ||||
|                     var item = DependencyService.Get<StoreViewModel>().ToItem(name, md); | ||||
|                     var item = DependencyService.Get<StoreViewModel>().ToItem(name, md, null); | ||||
|                     allitems.Add(name, item); | ||||
|                 //} | ||||
|             } | ||||
|  | @ -300,7 +300,7 @@ namespace AideDeJeuCmd | |||
|             var store = new StoreViewModel(); | ||||
|             await store.PreloadAllItemsAsync(); | ||||
| 
 | ||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) | ||||
|             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||
|             { | ||||
|                 await context.Database.EnsureDeletedAsync(); | ||||
|                 await context.Database.EnsureCreatedAsync(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez