프로젝트

일반

사용자정보

개정판 e8557bd7

IDe8557bd7e296f242d502b9ed1a186a96a817b4cb
상위 068113d5
하위 1cea0342

김태성이(가) 약 5년 전에 추가함

빌드 수정 x86추가

Change-Id: If4d98bee9f4306a3c5c82a07038017c916d03f8f

차이점 보기:

KCOM/PageManager/PageStorage.cs
111 111

  
112 112
        public void DownloadPagesAsync(int StartPageNo, int TalkCount = 5)
113 113
        {
114
            if (StartPageNo + TalkCount > _TotalPages)
114
            try
115 115
            {
116
                TalkCount = _TotalPages - StartPageNo;
117
            }
116
                if (StartPageNo + TalkCount > _TotalPages)
117
                {
118
                    TalkCount = _TotalPages - StartPageNo;
119
                }
118 120

  
119
            if (TalkCount > 0)
120
            {
121
                for (int i = StartPageNo; i < StartPageNo + TalkCount; i++)
121
                if (TalkCount > 0)
122 122
                {
123
                    try
124
                    {
125
                        DownloadPageAsync(i).RunAndForget();
126
                    }
127
                    catch (Exception ex)
123
                    for (int i = StartPageNo; i < StartPageNo + TalkCount; i++)
128 124
                    {
129
                        System.Diagnostics.Debug.WriteLine("DownloadPagesAsync err", ex);
125
                        try
126
                        {
127
                            DownloadPageAsync(i).RunAndForget();
128
                        }
129
                        catch (Exception ex)
130
                        {
131
                            System.Diagnostics.Debug.WriteLine("DownloadPagesAsync err", ex);
132
                        }
130 133
                    }
131 134
                }
132 135
            }
136
            catch (Exception ex)
137
            {
138
                throw new Exception("DownloadPagesAsync : ", ex);
139
            }
140
            finally
141
            {
142
                GC.Collect();
143
                GC.WaitForPendingFinalizers();
144
                GC.Collect();
145
            }
133 146
        }
134 147

  
135 148
        public async Task<PageItem> DownloadPageAsync(int PageNo)
......
173 186
                        LocalFilePath = downloadFilePath
174 187
                    };
175 188

  
176
                    using (System.Net.WebClient client = new System.Net.WebClient())
177
                    {
178
                        client.UseDefaultCredentials = true;
179
                        System.Net.IWebProxy webProxy = client.Proxy;
189
                    System.Net.WebClient client = new System.Net.WebClient();
180 190

  
181
                        if (webProxy != null)
182
                        {
183
                            // Use the default credentials of the logged on user.
184
                            webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
185
                        }
191
                    client.UseDefaultCredentials = true;
192
                    System.Net.IWebProxy webProxy = client.Proxy;
186 193

  
187
                        client.DownloadFileCompleted += (snd, evt) =>
188
                        {
189
                            fileItems.Add(result);
190
                        };
194
                    if (webProxy != null)
195
                    {
196
                        // Use the default credentials of the logged on user.
197
                        webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
198
                    }
199

  
200
                    client.DownloadFileCompleted += (snd, evt) =>
201
                    {
202
                        fileItems.Add(result);
203
                        client.Dispose();
204
                    };
191 205

  
192
                        await client.DownloadFileTaskAsync(result.OriginalUri, downloadFilePath);
206
                    await client.DownloadFileTaskAsync(result.OriginalUri, downloadFilePath);
193 207

  
194
                        System.Diagnostics.Debug.WriteLine("Download : " + result.LocalFilePath);
195
                    }
208
                    System.Diagnostics.Debug.WriteLine("Download : " + result.LocalFilePath);
196 209
                }
197 210
            }
198 211
            catch (Exception ex)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)