Exemplo n.º 1
0
        public InfoGroup <BaseInfoType> ToInfoGroup()
        {
            InfoGroup <BaseInfoType> g = new InfoGroup <BaseInfoType>("RJOutline");

            foreach (KeyValuePair <String, String> kv in this.data)
            {
                if (LocaleTexts.IsEqual("文件容量", kv.Key))
                {
                    g.InfoList.Add(kv.Key, new LiteralText(kv.Key, kv.Value));
                    continue;
                }

                TagCollection tc = new TagCollection(kv.Key);

                if (LocaleTexts.IsEqual("分类", kv.Key))
                {
                    String[] s = kv.Value.Split(' ');
                    foreach (String ss in s)
                    {
                        tc.AddTag(new Tag(ss));
                    }
                }
                else if (LocaleTexts.IsEqual("作者", kv.Key) ||
                         LocaleTexts.IsEqual("剧情", kv.Key) ||
                         LocaleTexts.IsEqual("插画", kv.Key) ||
                         LocaleTexts.IsEqual("声优", kv.Key))
                {
                    String[] s = kv.Value.Split(new String[] { " / " }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (String ss in s)
                    {
                        tc.AddTag(new Tag(ss));
                    }
                }
                else
                {
                    tc.AddTag(new Tag(kv.Value));
                }

                g.InfoList.Add(tc.Name, tc);
            }

            return(g);
        }
Exemplo n.º 2
0
        public InfoGroup <BaseInfoType> GetAllInfos()
        {
            InfoGroup <BaseInfoType> info = new InfoGroup <BaseInfoType>(RJNum);
            RJOutline outline             = new RJOutline(html);
            Locale    l = outline.GetLocale();

            String cache = LocaleTexts.InLang("作品名", l);

            info.InfoList.Add(cache, new LiteralText(cache, GetWorkName()));

            cache = LocaleTexts.InLang("封面图", l);
            InfoGroup <Picture> pics = new InfoGroup <Picture>(cache);
            int i = 0;

            foreach (Image pic in GetImages())
            {
                pics.InfoList.Add((i).ToString(), new Picture(i.ToString(), pic));
                i++;
            }
            info.InfoList.Add(cache, pics);

            cache = LocaleTexts.InLang("社团名", l);
            TagCollection tc = new TagCollection(cache);

            tc.AddTag(new Tag(GetCircleName()));
            info.InfoList.Add(cache, tc);

            foreach (BaseInfoType inf in outline.ToInfoGroup())
            {
                info.InfoList.Add(inf.Name, inf);
            }

            cache = LocaleTexts.InLang("作品内容", l);
            info.InfoList.Add(cache, new LiteralText(cache, GetSummary()));

            cache = LocaleTexts.InLang("评价", l);
            info.InfoList.Add(cache, new LiteralText(cache, GetRating()));

            return(info);
        }
Exemplo n.º 3
0
        public Locale GetLocale()
        {
            Locale?locale = LocaleTexts.GetLanguage(data.Keys.First());

            return(locale == null ? throw new Exception("未能确定地区") : (Locale)locale);
        }