public async Task <string> GetCsatolmanyAsync(
     Profile profile,
     string accessToken,
     Csatolmany csatolmany)
 {
     return(await this.DownloadFile(string.Format("/dokumentumok/uzenetek/{0}", (object)csatolmany.Azonosito), profile, accessToken, csatolmany));
 }
        public Task <string> FetchCsatolmany(Profile profile, Csatolmany csatolmany)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }
            TokenData tokenData = this._secureStore.GetTokenData(profile.Id);

            if (tokenData == null)
            {
                throw new UnauthorizedApiAccessException().SetErrorCode <UnauthorizedApiAccessException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/Uzenetek/PostaladaElemDataService.cs", 90);
            }
            if (this._permissionManager != null && !this._permissionManager.PermissionGranted())
            {
                this._permissionManager.RequestPermission();
            }
            return(this._dataViewer.IsFileExists(csatolmany.FajlNev) ? Task.FromResult <string>(this._dataViewer.FilePath(csatolmany.FajlNev)) : this._eugyintezesApi.GetCsatolmanyAsync(profile, tokenData.AccessToken, csatolmany));
        }
        private async Task ExecuteDownloadAttachment(Csatolmany attachment)
        {
            MessageDetailViewModel messageDetailViewModel = this;

            try
            {
                messageDetailViewModel.Busy();
                string str = await messageDetailViewModel._uzenetDataService.FetchCsatolmany(messageDetailViewModel.ActiveProfile, attachment);

                messageDetailViewModel.NotBusy();
                messageDetailViewModel._dataViewer.ShowAttachment(attachment.FajlNev);
            }
            catch (Exception ex)
            {
                CrossMobileAnalytics.Current.TrackException(ex, (IDictionary <string, string>)null, nameof(ExecuteDownloadAttachment), "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/MessageDetailViewModel.cs", (int)sbyte.MaxValue);
            }
            finally
            {
                messageDetailViewModel.NotBusy();
            }
        }
        protected async Task <string> DownloadFile(
            string relativeUri,
            Profile profile,
            string accessToken,
            Csatolmany csatolmany)
        {
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            int    num = (^ this).\u003C\u003E1__state;
            string filePath;
            string name;

            try
            {
                Uri requestUri = new Uri(new Uri(ConfigurationRepository.EnvironmentSetting.EugyintezesAPIUrl ?? ""), "/integration-kretamobile-api/v1" + relativeUri);
                filePath = this._dataViewer.FilePath(csatolmany.FajlNev);
                HttpClient httpClient = this.BuildHttpClient(profile);
                try
                {
                    HttpRequestMessage httpMessage = new HttpRequestMessage(HttpMethod.Get, requestUri);
                    try
                    {
                        httpMessage.Headers.Add("Accept", "application/json");
                        httpMessage.Headers.Add(this._deviceSpecification.AgentName, this._userAgentData.UserAgentText);
                        httpMessage.Headers.Add("Authorization", string.Format("Bearer " + accessToken));
                        TaskAwaiter <HttpResponseMessage> awaiter1 = httpClient.SendAsync(httpMessage, HttpCompletionOption.ResponseHeadersRead).GetAwaiter();
                        if (!awaiter1.IsCompleted)
                        {
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003E1__state = num = 0;
                            TaskAwaiter <HttpResponseMessage> taskAwaiter = awaiter1;
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <HttpResponseMessage>, EugyintezesApi.\u003CDownloadFile\u003Ed__12>(ref awaiter1, this);
                            return;
                        }
                        HttpResponseMessage response = awaiter1.GetResult();
                        try
                        {
                            FileStream fs = new FileStream(filePath, FileMode.CreateNew);
                            try
                            {
                                TaskAwaiter awaiter2 = response.Content.CopyToAsync((Stream)fs).GetAwaiter();
                                if (!awaiter2.IsCompleted)
                                {
                                    // ISSUE: explicit reference operation
                                    // ISSUE: reference to a compiler-generated field
                                    (^ this).\u003C\u003E1__state = num = 1;
                                    TaskAwaiter taskAwaiter = awaiter2;
                                    // ISSUE: explicit reference operation
                                    // ISSUE: reference to a compiler-generated field
                                    (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, EugyintezesApi.\u003CDownloadFile\u003Ed__12>(ref awaiter2, this);
                                    return;
                                }
                                awaiter2.GetResult();
                                name = fs.Name;
                            }
                            finally
                            {
                                if (num < 0 && fs != null)
                                {
                                    fs.Dispose();
                                }
                            }
                        }
                        finally
                        {
                            if (num < 0 && response != null)
                            {
                                response.Dispose();
                            }
                        }
                    }
                    finally
                    {
                        if (num < 0 && httpMessage != null)
                        {
                            httpMessage.Dispose();
                        }
                    }
                }
                finally
                {
                    if (num < 0 && httpClient != null)
                    {
                        httpClient.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                filePath = (string)null;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            filePath = (string)null;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult(name);
        }