Added serializer precompile to preload step for kdbp files
This commit is contained in:
		| @@ -15,6 +15,14 @@ namespace KeePassLib.Serialization | |||||||
| 	{ | 	{ | ||||||
| 		public const string FileNameExtension = "kdbp"; | 		public const string FileNameExtension = "kdbp"; | ||||||
|  |  | ||||||
|  | 		/// <summary> | ||||||
|  | 		/// Precompiles the serializer classes for faster first-run execution | ||||||
|  | 		/// </summary> | ||||||
|  | 		public static void PrepareSerializer() | ||||||
|  | 		{ | ||||||
|  | 			RuntimeTypeModel.Default[typeof(PwDatabaseBuffer)].CompileInPlace(); | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		/// <summary> | 		/// <summary> | ||||||
| 		/// Determines whether the database pointed to by the specified ioc should be (de)serialised in default (xml) or protocol buffers format. | 		/// Determines whether the database pointed to by the specified ioc should be (de)serialised in default (xml) or protocol buffers format. | ||||||
| 		/// </summary> | 		/// </summary> | ||||||
|   | |||||||
| @@ -375,6 +375,12 @@ namespace keepass2android | |||||||
|  |  | ||||||
| 		private MemoryStream LoadDbFile() | 		private MemoryStream LoadDbFile() | ||||||
| 		{ | 		{ | ||||||
|  | 			if (KdbpFile.GetFormatToUse(_ioConnection) == KdbxFormat.ProtocolBuffers) | ||||||
|  | 			{ | ||||||
|  | 				Kp2aLog.Log("Preparing kdbp serializer");				 | ||||||
|  | 				KdbpFile.PrepareSerializer(); | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			Kp2aLog.Log("Pre-loading database file starting"); | 			Kp2aLog.Log("Pre-loading database file starting"); | ||||||
| 			var fileStorage = App.Kp2a.GetFileStorage(_ioConnection); | 			var fileStorage = App.Kp2a.GetFileStorage(_ioConnection); | ||||||
| 			var stream = fileStorage.OpenFileForRead(_ioConnection); | 			var stream = fileStorage.OpenFileForRead(_ioConnection); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 AlexVallat
					AlexVallat