Beispiel #1
0
        public bool TryDownloadFile(string username, string path, out string error)
        {
            var stream = _remoteStorage.DownloadSave(out var fileName, username);

            if (fileName is null)
            {
                error = "File not found!";
                return(false);
            }

            var zipFilePath = $@"{Directory.GetParent(path).FullName}\{fileName}";

            _localStorage.WriteFile(ref stream, zipFilePath);
            _localStorage.DeletePreviousSave();
            _zipService.UnZipFile(zipFilePath, path);
            _localStorage.DeleteFile(zipFilePath);

            error = null;
            return(true);
        }