本文整理汇总了C#中Config.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Config.Close方法的具体用法?C# Config.Close怎么用?C# Config.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config.Close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoWorkInitialize
//.........这里部分代码省略.........
ResponseHTML = SplitUp.GetRight(ResponseHTML, "<p class=\"ip\">Showing");
ResponseHTML = SplitUp.GetLeft(ResponseHTML, "<table class=\"ptb\" style=\"margin:0px auto 10px\">");
foreach (String list in Regex.Split(ResponseHTML, "<a href=\"http://"))
{
String ImageUrl = SplitUp.GetLeft(list, "\"><img alt=");
if (Regex.IsMatch(ImageUrl, dnsVerify.DomainName) && !Regex.IsMatch(ImageUrl, "Images"))
{
ListImages.Add(ImageUrl.Trim());
Console.WriteLine(ImageUrl.Trim());
}
}
if (ListImages.Count < Int32.Parse(PagesManga))
{
ContentLenght = 0;
NowLenght = 0;
UpdateTexting = "[" + (iReq + 1) + "/" + RequestURL.Count + "] " + Settings.Configs.GetValue("NOW_CONNECTING")
+ " " + (PageLoop + 1) + "/" + Math.Ceiling(float.Parse(PagesManga) / 20).ToString() + " " + Settings.Configs.GetValue("NOW_PAGE");
ThreadWorker.ReportProgress(0);
Thread.Sleep(500);
dnsVerify = new SyncNet(RequestURL[iReq].ToString());
if (dnsVerify.Connected)
{
Response = dnsVerify.ResponseHeader("?p=" + PageLoop);
if (Response.ContainsKey("Content-Length")) ContentLenght = Int32.Parse(Response["Content-Length"]);
ResponseHTML = "";
ThreadWorker.ReportProgress(-3);
do
{
ResponseHTML += dnsVerify.Response(Int32.Parse(Settings.Configs.GetValue("Speed")) * 1024);
NowLenght += dnsVerify.Downloading;
UpdateTexting = "[" + (iReq + 1) + "/" + RequestURL.Count + "] " + Settings.Configs.GetValue("NOW_CONNECTING")
+ " " + (PageLoop + 1) + "/" + Math.Ceiling(float.Parse(PagesManga) / 20).ToString() + " " + Settings.Configs.GetValue("NOW_PAGE");
ThreadWorker.ReportProgress((Int32)((NowLenght * 100) / ContentLenght));
ResponseLenght += dnsVerify.Downloading;
} while (NowLenght < ContentLenght);
ThreadWorker.ReportProgress(-4);
}
}
} while (ListImages.Count < Int32.Parse(PagesManga));
NewItems = new ListViewItem(new ListViewItem.ListViewSubItem[] {
new ListViewItem.ListViewSubItem(null, (ListHentai.Items.Count+1).ToString()), // ID
new ListViewItem.ListViewSubItem(null, NameManga), // Name
new ListViewItem.ListViewSubItem(null, SizesManga), // Size
new ListViewItem.ListViewSubItem(null, PagesManga), // Page
new ListViewItem.ListViewSubItem(null, RatingManga.Trim(), Color.Maroon, Color.White, new Font("Segoe UI", 8.25F,FontStyle.Bold)), // Rating
new ListViewItem.ListViewSubItem(null, Settings.Configs.GetValue("STATUS_STOP") + " (0%)", Color.Brown, Color.White, new Font("Tahoma", 8.25F)), // Status
new ListViewItem.ListViewSubItem(null, ""), // Speed
new ListViewItem.ListViewSubItem(null, gidToken), // Index Images
new ListViewItem.ListViewSubItem(null, RequestURL[iReq].ToString())}, -1); // URL
ThreadWorker.ReportProgress(-5);
// Save To Dump Folder
String id_name = Directory.GetFiles(TempFiles).Length.ToString();
while (id_name.Length < IDMax) id_name = "0" + id_name;
Config NewList = new Config(NewItems.SubItems[1].Text + " Dump Files ",
TempFiles + id_name + "-" + NewItems.SubItems[1].Text + ".txt");
NewList.Save("URL", new String[] { NewItems.SubItems[8].Text });
NewList.Save("Key", new String[] { NewItems.ImageIndex.ToString() });
NewList.Save("Name", new String[] { NewItems.SubItems[1].Text });
NewList.Save("Sizes", new String[] { NewItems.SubItems[2].Text });
NewList.Save("Pages", new String[] { NewItems.SubItems[3].Text });
NewList.Save("Rating", new String[] { NewItems.SubItems[4].Text });
NewList.Save("Status", new String[] { NewItems.SubItems[5].Text });
NewList.Save("ID", new String[] { NewItems.SubItems[7].Text });
NewList.Save("Links", ListImages.ToArray());
NewList.Write();
NewList.Close();
}
else
{
ThreadWorker.ReportProgress(-8);
}
}
else
{
ThreadWorker.ReportProgress(-8);
}
}
else
{
ThreadWorker.ReportProgress(-8);
}
}
else
{
Console.WriteLine("DNS Error");
ThreadWorker.ReportProgress(-9);
}
iReq++;
} while (iReq < RequestURL.Count);
break;
}
}
示例2: DoWorkDownloade
public void DoWorkDownloade(object sender, DoWorkEventArgs e)
{
ImagesCurrent = 0;
Int32 FileCurrent = 0;
String[] ListFiles = Directory.GetFiles(TempFiles);
do
{
if (DownloadWorker.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
String FileName = ListFiles[FileCurrent];
Config Items = new Config("", FileName);
Items.Close();
String ImageFolder = Settings.Configs.GetValue("Folder") + Items.GetValue("Name") + "\\";
if (Items.GetValue("Key") != "2")
{
DownloadWorker.ReportProgress(-1);
CurrentItem = Items.GetValue("ID");
TotalImages = Items.GetList("Links").Count;
foreach (String url in Items.GetList("Links"))
{
Console.WriteLine("----------------------------------------------------------------");
if (DownloadWorker.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
Boolean ImageFailsLoading;
String RetryImage = "";
String URLImage = "";
Int32 ImageError = 0;
do
{
ImageFailsLoading = true;
Items = new Config(Items.HeaderTitle, FileName);
Thread.Sleep(100);
if (DownloadWorker.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
Int32 ContentLenght = 0;
Int32 NowLenght = 0;
Int32 ImageLenght = 0;
String ImageName = "";
String ResponseHTML = "";
Boolean ReceiveLink = true;
Boolean ReceiveImage = true;
Dictionary<String, String> Response;
List<String> Images = Items.GetList("Images");
Console.WriteLine("Images: " + Images.Count + " Current: " + (ImagesCurrent + 1));
if (Images.Count > ImagesCurrent)
{
String[] data = Regex.Split(Images[ImagesCurrent].Trim(), "#");
ImageName = data[0];
if (data[1] != "") ImageLenght = Int32.Parse(data[1]);
}
if (ImageLenght != 0 && File.Exists(ImageFolder + ImageName))
{ // Check Image File
Console.WriteLine("Exists Image: " + ImageName);
FileStream ImageStream = new FileStream(ImageFolder + ImageName, FileMode.Open, FileAccess.Read);
if (ImageStream.Length != ImageLenght)
{
ImageStream.Close();
File.Delete(ImageFolder + ImageName);
Console.WriteLine(" <<===== Exists: false");
}
else
{
ImagesCurrent++;
ReceiveLink = false;
ReceiveImage = false;
ImageFailsLoading = false;
Console.WriteLine(" <<===== Exists: true");
}
if (ImageStream.CanRead) ImageStream.Close();
}
if (ReceiveLink)
{ // Get Images From URL
Console.WriteLine("Geting URL...");
SyncNet DnsGetingURL = new SyncNet(url);
if (DnsGetingURL.Connected)
{
Response = DnsGetingURL.ResponseHeader(RetryImage);
// foreach (KeyValuePair<String, String> head in Response) Console.WriteLine(head.Key + ": " + head.Value);
if (Response.ContainsKey("Content-Length")) ContentLenght = Int32.Parse(Response["Content-Length"]);
if (Response["HTTP"] == "200 OK" && ContentLenght != 0)
//.........这里部分代码省略.........
示例3: toolbtnDelete_Click
private void toolbtnDelete_Click(object sender, EventArgs e)
{
if (ListHentai.Items[ItemIndexed].ImageIndex == -1 || ListHentai.Items[ItemIndexed].ImageIndex == 2 || ListHentai.Items[ItemIndexed].ImageIndex == 0)
{
Boolean IndexFound = false;
Int32 IndexItemsID = 0;
foreach (String filename in Directory.GetFiles(TempFiles))
{
Config DumpList = new Config("", filename);
if (IndexFound)
{
DumpList.Close();
File.Delete(filename);
String id_name = IndexItemsID.ToString();
while (id_name.Length < IDMax) id_name = "0" + id_name;
Config ReIndexed = new Config(DumpList.GetValue("Name") + " Dump Files ", TempFiles + id_name + "-" + DumpList.GetValue("Name") + ".txt");
ReIndexed.Save("URL", DumpList.GetList("URL").ToArray());
ReIndexed.Save("Key", DumpList.GetList("Key").ToArray());
ReIndexed.Save("Name", DumpList.GetList("Name").ToArray());
ReIndexed.Save("Sizes", DumpList.GetList("Sizes").ToArray());
ReIndexed.Save("Pages", DumpList.GetList("Pages").ToArray());
ReIndexed.Save("Rating", DumpList.GetList("Rating").ToArray());
ReIndexed.Save("Status", DumpList.GetList("Status").ToArray());
ReIndexed.Save("ID", DumpList.GetList("ID").ToArray());
ReIndexed.Save("Links", DumpList.GetList("Links").ToArray());
ReIndexed.Write();
ReIndexed.Close();
ListHentai.Items[IndexItemsID].SubItems[0].Text = (IndexItemsID + 1).ToString();
}
else
{
if (DumpList.GetValue("ID") == ListHentai.Items[ItemIndexed].SubItems[7].Text)
{
DumpList.Delete();
ListHentai.Items[ItemIndexed].Remove();
IndexFound = true;
IndexItemsID--;
if ((ListHentai.Items.Count - 1) < ItemIndexed) ItemIndexed--;
ListHentai.Items[ItemIndexed].Selected = true;
}
}
IndexItemsID++;
}
}
}
示例4: CompletedInitialize
public void CompletedInitialize(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error == null)
{
switch (Processing)
{
case Algorithm.Initialize:
if (Directory.Exists(TempFiles))
{
foreach (String filename in Directory.GetFiles(TempFiles))
{
Config DumpList = new Config("", filename);
NewItems = new ListViewItem(new ListViewItem.ListViewSubItem[] {
new ListViewItem.ListViewSubItem(null, (ListHentai.Items.Count+1).ToString()), // ID
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Name")), // Name
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Sizes")), // Size
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Pages")), // Page
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Rating"), Color.Maroon, Color.White, new Font("Segoe UI", 8.25F,FontStyle.Bold)), // Rating
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Status"), Color.Brown, Color.White, new Font("Tahoma", 8.25F)), // Status
new ListViewItem.ListViewSubItem(null, ""), // Speed
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("ID")),
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("URL"))}, DumpList.GetValue("Key")); // Index Images
ListHentai.Items.Add(NewItems);
ListHentai.Items[ListHentai.Items.Count - 1].UseItemStyleForSubItems = false;
DumpList.Close();
}
}
if (ListHentai.Items.Count != 0) toolbtnStart.Enabled = true;
toolEnabled(true);
Processing = Algorithm.Verfify;
break;
case Algorithm.Verfify:
RequestURL.Clear();
if (ListHentai.Items.Count != 0)
{
toolbtnStart.Visible = true;
toolbtnStart.Enabled = true;
}
break;
}
panelLoading.Visible = false;
}
else
{
// Error Threading
}
}