- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
private void Save(string ThreadID, string Board)
{
string pathL;
if (cbGIF.Checked)
{
pathL = String.Format(path, Board, ThreadID, "-gif");
}
else
{
pathL = String.Format(path, Board, ThreadID, "");
}
string htmlPath = String.Format(threadPath, Board, ThreadID);
WebClient wcli = new GZipWebClient();
string cThread = wcli.DownloadString(htmlPath);
var rx = new Regex(cbGIF.Checked ? regExGif : regEx);
var ms = rx.Matches(cThread);
imgSaved = 0;
imgCount = ms.Count;
saveProgress.Minimum = 0;
saveProgress.Maximum = imgCount;
saveProgress.Value = 0;
if (!Directory.Exists(pathL))
{
Directory.CreateDirectory(pathL);
}
try
{
foreach (Match m in ms)
{
WebClient ccl = new WebClient();
ccl.DownloadFileCompleted += new AsyncCompletedEventHandler(ccl_DownloadFileCompleted);
string[] v = m.Value.Split('"');
string sd = v[1].Split('/').Last();
string a = url + v[1];
string b = pathL + sd;
if (File.Exists(b))
{
imgSaved++;
saveProgress.Value = imgSaved;
lblSaveProgress.Text = imgSaved.ToString() + "/" + imgCount.ToString();
if (imgSaved == imgCount)
{
btnSave.Enabled = true;
lblSaveProgress.Text = "FUKKEN SAVED!";
}
}
else ccl.DownloadFileAsync(new Uri(a),b);
}
}
catch (WebException e)
{
MessageBox.Show(e.Message + e.StackTrace);
}
}
В пределах одного метода бросаемся из крайности в крайность в именовании переменных.
kegdan 26.07.2013 09:09 # 0
а православное
не пойдет?
Имена переменных класс - rx, ps, pms, kud-kudah...
neeedle 30.07.2013 04:43 # 0
Порадовало. :)