Esempio n. 1
0
        public async Task <IBuild?> FromBase64Async(string input)
        {
            var compressed = Convert.FromBase64String(input.Replace('-', '+').Replace('_', '/'));

            await using var ms = new MemoryStream(compressed);
            // Skip compression type header
            ms.Seek(2, SeekOrigin.Begin);
            await using var deflateStream = new DeflateStream(ms, CompressionMode.Decompress);
            var xmlBuild = await XmlSerializationUtils.DeserializeAsync <XmlPathOfBuilding>(new StreamReader(deflateStream));

            return(ConvertXmlBuild(xmlBuild));
        }
 public static Task <T> LoadXmlAsync <T>(string fileName, bool deserializeOnThreadPool = false)
 => XmlSerializationUtils.DeserializeAsync <T>(CreateResourceStreamReader(fileName), deserializeOnThreadPool);