当前位置: 首页>>代码示例>>C#>>正文


C# Config.GetList方法代码示例

本文整理汇总了C#中Config.GetList方法的典型用法代码示例。如果您正苦于以下问题:C# Config.GetList方法的具体用法?C# Config.GetList怎么用?C# Config.GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Config的用法示例。


在下文中一共展示了Config.GetList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNewConfig

        public void CreateNewConfig()
        {
            string filename = Path.Combine(BaseDir, @"TestData\ParserTests\testconfig.config");
            var c = new Config(filename);

            Assert.AreEqual("bar", c["foo"], "string values out of sync!");
            Assert.AreEqual(c["foo"], c["foo"], "string values out of sync!");

            Assert.AreEqual(123, c["123"], "numeric values out of sync!");
            Assert.AreEqual(c["123"], c["123"], "numeric values out of sync!");

            Assert.IsTrue(AreListsEqual(new string[] { "a", "b", "c" }, c.GetList("abc")), "array values out of sync!");
            Assert.IsTrue(AreListsEqual(c.GetList("abc"), c.GetList("abc")), "array values out of sync!");
        }
开发者ID:azavea,项目名称:acs-alchemist,代码行数:14,代码来源:ConfigTests.cs

示例2: 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++;
         }
     }
 }
开发者ID:dvgamer,项目名称:ghHelpful,代码行数:45,代码来源:DialogDownloader.cs

示例3: 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)
//.........这里部分代码省略.........
开发者ID:dvgamer,项目名称:ghHelpful,代码行数:101,代码来源:DialogDownloader.cs


注:本文中的Config.GetList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。