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_aZL.ttf" /> | ||||||
|     <AndroidAsset Include="Assets\LinLibertine_DR.ttf" /> |     <AndroidAsset Include="Assets\LinLibertine_DR.ttf" /> | ||||||
|     <AndroidAsset Include="Assets\LinLibertine_I.ttf" /> |     <AndroidAsset Include="Assets\LinLibertine_I.ttf" /> | ||||||
|     <AndroidAsset Include="..\..\Data\database.db"> |     <AndroidAsset Include="..\..\Data\library.db"> | ||||||
|       <Link>Assets\database.db</Link> |       <Link>Assets\library.db</Link> | ||||||
|     </AndroidAsset> |     </AndroidAsset> | ||||||
|     <None Include="Resources\AboutResources.txt" /> |     <None Include="Resources\AboutResources.txt" /> | ||||||
|     <None Include="Assets\AboutAssets.txt" /> |     <None Include="Assets\AboutAssets.txt" /> | ||||||
|  |  | ||||||
|  | @ -196,6 +196,9 @@ | ||||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> |     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |     <Content Include="..\..\Data\library.db"> | ||||||
|  |       <Link>library.db</Link> | ||||||
|  |     </Content> | ||||||
|     <None Include="app.config" /> |     <None Include="app.config" /> | ||||||
|     <None Include="OpenTK.dll.config" /> |     <None Include="OpenTK.dll.config" /> | ||||||
|     <None Include="packages.config" /> |     <None Include="packages.config" /> | ||||||
|  |  | ||||||
|  | @ -109,8 +109,8 @@ | ||||||
|     <AppxManifest Include="Package.appxmanifest"> |     <AppxManifest Include="Package.appxmanifest"> | ||||||
|       <SubType>Designer</SubType> |       <SubType>Designer</SubType> | ||||||
|     </AppxManifest> |     </AppxManifest> | ||||||
|     <EmbeddedResource Include="..\..\Data\database.db"> |     <EmbeddedResource Include="..\..\Data\library.db"> | ||||||
|       <Link>database.db</Link> |       <Link>library.db</Link> | ||||||
|     </EmbeddedResource> |     </EmbeddedResource> | ||||||
|     <None Include="AideDeJeu.UWP_StoreKey.pfx" /> |     <None Include="AideDeJeu.UWP_StoreKey.pfx" /> | ||||||
|     <None Include="AideDeJeu.UWP_TemporaryKey.pfx" /> |     <None Include="AideDeJeu.UWP_TemporaryKey.pfx" /> | ||||||
|  |  | ||||||
|  | @ -90,8 +90,8 @@ | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <Compile Include="Main.cs" /> |     <Compile Include="Main.cs" /> | ||||||
|     <Compile Include="AppDelegate.cs" /> |     <Compile Include="AppDelegate.cs" /> | ||||||
|     <BundleResource Include="..\..\Data\database.db"> |     <BundleResource Include="..\..\Data\library.db"> | ||||||
|       <Link>Resources\database.db</Link> |       <Link>Resources\library.db</Link> | ||||||
|     </BundleResource> |     </BundleResource> | ||||||
|     <None Include="Entitlements.plist" /> |     <None Include="Entitlements.plist" /> | ||||||
|     <None Include="Info.plist" /> |     <None Include="Info.plist" /> | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
| using System; | using System; | ||||||
| using System.IO; | using System.IO; | ||||||
| using Foundation; | using Foundation; | ||||||
|  | using System.Threading.Tasks; | ||||||
| 
 | 
 | ||||||
| [assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.Droid.Version_Android))] | [assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.Droid.Version_Android))] | ||||||
| namespace AideDeJeu.Droid | namespace AideDeJeu.Droid | ||||||
|  | @ -22,9 +23,9 @@ namespace AideDeJeu.Droid | ||||||
|             return res ? build : 0; |             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); |             //var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", databaseName); | ||||||
|             //return databasePath; |             //return databasePath; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ namespace AideDeJeu.ViewModels | ||||||
| 
 | 
 | ||||||
|         public async Task<IEnumerable<SearchedItem>> DeepSearchAllItemsAsync(string searchText) |         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. |                 var primary = await context.Items. | ||||||
|                     Where(item => item.Name.Contains(searchText)). |                     Where(item => item.Name.Contains(searchText)). | ||||||
|  |  | ||||||
|  | @ -317,7 +317,7 @@ namespace AideDeJeu.ViewModels | ||||||
|             var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? ""; |             var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? ""; | ||||||
|             var ritual = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? ""; |             var ritual = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? ""; | ||||||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).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 => |                 return context.SpellsVO.Where(spell => | ||||||
|                                         levelComparer.Compare(spell.Level, niveauMin) >= 0 && |                                         levelComparer.Compare(spell.Level, niveauMin) >= 0 && | ||||||
|  | @ -397,7 +397,7 @@ namespace AideDeJeu.ViewModels | ||||||
|             var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? ""; |             var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? ""; | ||||||
|             var ritual = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? ""; |             var ritual = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? ""; | ||||||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).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 => |                 return context.SpellsHD.Where(spell => | ||||||
|                                         levelComparer.Compare(spell.Level, niveauMin) >= 0 && |                                         levelComparer.Compare(spell.Level, niveauMin) >= 0 && | ||||||
|  | @ -658,7 +658,7 @@ namespace AideDeJeu.ViewModels | ||||||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; |             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; | ||||||
|             token.ThrowIfCancellationRequested(); |             token.ThrowIfCancellationRequested(); | ||||||
| 
 | 
 | ||||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) |             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||||
|             { |             { | ||||||
|                 return context.MonstersVO.Where(monster => |                 return context.MonstersVO.Where(monster => | ||||||
|                                         monster != null && |                                         monster != null && | ||||||
|  | @ -774,7 +774,7 @@ namespace AideDeJeu.ViewModels | ||||||
|             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; |             var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? ""; | ||||||
|             token.ThrowIfCancellationRequested(); |             token.ThrowIfCancellationRequested(); | ||||||
| 
 | 
 | ||||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) |             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||||
|             { |             { | ||||||
|                 return context.MonstersHD.Where(monster => |                 return context.MonstersHD.Where(monster => | ||||||
|                                         monster != null && |                                         monster != null && | ||||||
|  | @ -907,7 +907,7 @@ namespace AideDeJeu.ViewModels | ||||||
|             var minPrice = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinPrice).SelectedKey ?? "0 pc"; |             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"; |             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 => |                 return context.Equipments.Where(equipment => | ||||||
|                     equipment.Type.ToLower().Contains(type.ToLower()) && |                     equipment.Type.ToLower().Contains(type.ToLower()) && | ||||||
|  | @ -1007,7 +1007,7 @@ namespace AideDeJeu.ViewModels | ||||||
|             var rarity = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Rarity).SelectedKey ?? ""; |             var rarity = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Rarity).SelectedKey ?? ""; | ||||||
|             var attunement = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Attunement).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 => |                 return context.MagicItems.Where(magicitem => | ||||||
|                     MatchContains(magicitem.Type, type) && |                     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); |             return new AideDeJeuContext(dbPath); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -415,7 +415,7 @@ namespace AideDeJeu.ViewModels | ||||||
|             { |             { | ||||||
|                 id += $"#{anchor}"; |                 id += $"#{anchor}"; | ||||||
|             } |             } | ||||||
|             using (var context = await GetDatabaseContextAsync()) |             using (var context = await GetLibraryContextAsync()) | ||||||
|             { |             { | ||||||
|                 return await context.Items.Where(item => item.Id == id).FirstOrDefaultAsync(); |                 return await context.Items.Where(item => item.Id == id).FirstOrDefaultAsync(); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -62,7 +62,7 @@ namespace AideDeJeu.Views | ||||||
|         async Task InitDBEngineAsync() |         async Task InitDBEngineAsync() | ||||||
|         { |         { | ||||||
|             await Task.Delay(1000).ConfigureAwait(false); |             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(); |                 var item = context.Items.FirstOrDefault(); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <Content Include="..\..\Data\database.db" Link="database.db" /> |     <None Include="..\..\Data\library.db" Link="library.db" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ namespace AideDeJeuCmd | ||||||
|                     .Build(); |                     .Build(); | ||||||
|                 //var document = Markdig.Parsers.MarkdownParser.Parse(md, pipeline); |                 //var document = Markdig.Parsers.MarkdownParser.Parse(md, pipeline); | ||||||
|                 //DumpMarkdownDocument(document); |                 //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(); |                 //document.Dump(); | ||||||
|                 Console.WriteLine("ok"); |                 Console.WriteLine("ok"); | ||||||
|                 //var md2 = monsters.ToMarkdownString(); |                 //var md2 = monsters.ToMarkdownString(); | ||||||
|  | @ -66,7 +66,7 @@ namespace AideDeJeuCmd | ||||||
| 
 | 
 | ||||||
|             var result = string.Empty; |             var result = string.Empty; | ||||||
|             var md = await LoadStringAsync(dataDir + "spells_hd.md"); |             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[] |             var classes = new string[] | ||||||
|             { |             { | ||||||
|  | @ -132,7 +132,7 @@ namespace AideDeJeuCmd | ||||||
|                 //if (name.Contains("_hd.")) |                 //if (name.Contains("_hd.")) | ||||||
|                 //{ |                 //{ | ||||||
|                     var md = await Helpers.GetResourceStringAsync(name); |                     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); |                     allitems.Add(name, item); | ||||||
|                 //} |                 //} | ||||||
|             } |             } | ||||||
|  | @ -300,7 +300,7 @@ namespace AideDeJeuCmd | ||||||
|             var store = new StoreViewModel(); |             var store = new StoreViewModel(); | ||||||
|             await store.PreloadAllItemsAsync(); |             await store.PreloadAllItemsAsync(); | ||||||
| 
 | 
 | ||||||
|             using (var context = await StoreViewModel.GetDatabaseContextAsync()) |             using (var context = await StoreViewModel.GetLibraryContextAsync()) | ||||||
|             { |             { | ||||||
|                 await context.Database.EnsureDeletedAsync(); |                 await context.Database.EnsureDeletedAsync(); | ||||||
|                 await context.Database.EnsureCreatedAsync(); |                 await context.Database.EnsureCreatedAsync(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez