Пример #1
0
        private void bExtract_Click(object sender, EventArgs e)
        {
            Dictionary <int, HitomiIndexMetadata?> map = new Dictionary <int, HitomiIndexMetadata?>();

            foreach (var tuple in metadatas)
            {
                int key = Convert.ToInt32(tuple.Item2);
                if (!map.ContainsKey(key))
                {
                    map.Add(key, tuple.Item3);
                }
                else
                {
                }
            }

            List <ListViewItem> lvil = new List <ListViewItem>();
            int i = 0;

            foreach (var h in HitomiLog.Instance.DownloadTable)
            {
                if (!map.ContainsKey(h))
                {
                    var           md      = HitomiDataAnalysis.GetMetadataFromMagic(h.ToString());
                    List <string> artists = new List <string>();
                    if (md.HasValue)
                    {
                        if (md.Value.Artists != null)
                        {
                            md.Value.Artists.ToList().ForEach(x => artists.Add(HitomiIndex.Instance.index.Artists[x]));
                        }
                    }

                    lvil.Add(new ListViewItem(new string[]
                    {
                        (i + 1).ToString(),
                        h.ToString(),
                        string.Join(",", artists)
                    }));
                    i++;
                }
            }
            listView1.Items.Clear();
            listView1.Items.AddRange(lvil.ToArray());
        }
Пример #2
0
        private void RecursiveVisit(TreeNode node, List <Regex> regex)
        {
            string match = "";

            if (regex.Any(x => {
                if (!x.Match(Path.GetFileNameWithoutExtension(node.Text)).Success)
                {
                    return(false);
                }
                match = x.Match(Path.GetFileNameWithoutExtension(node.Text)).Groups[1].Value;
                return(true);
            }))
            {
                metadatas.Add(new Tuple <string, string, HitomiIndexMetadata?>(node.FullPath, match, HitomiDataAnalysis.GetMetadataFromMagic(match)));
                available_count += 1;
                if (!search_subfiles_whenever)
                {
                    return;
                }
            }

            visit_count += 1;

            foreach (var cnode in node.Nodes.OfType <TreeNode>())
            {
                RecursiveVisit(cnode, regex);
            }
        }