コード例 #1
0
ファイル: Wiki.cs プロジェクト: zi-yu/orionsbelt
        public static Hashtable RawGetProductsFromWiki()
        {
#if WIKI
            string            topicName = "Orionsbelt.Shop";
            AbsoluteTopicName topic     = new AbsoluteTopicName(topicName);
            ContentBase       cb        = GetFederation().ContentBaseForNamespace(topic.Namespace);

            Hashtable categories = new Hashtable();
            ArrayList current    = null;
            using (TextReader sr = cb.TextReaderForTopic(topic))    {
                string line = null;
                while ((line = sr.ReadLine()) != null)
                {
                    if (line.StartsWith("!!!"))
                    {
                        current = new ArrayList();
                        string category = line.Replace("!!!", "").Trim();
                        categories.Add(category, current);
                    }
                    if (line.StartsWith("||"))
                    {
                        line = line.Replace("||", "|");
                        string[] parts = line.Split('|');
                        current.Add(new ShopItem(parts[1], parts[2], parts[3]));
                    }
                }
                return(categories);
            }
#else
            return(new Hashtable());
#endif
        }
コード例 #2
0
ファイル: Wiki.cs プロジェクト: zi-yu/orionsbelt
        public static ArrayList GetTopicSpacedLines(string topicName)
        {
#if WIKI
            AbsoluteTopicName topic = new AbsoluteTopicName(topicName);
            ContentBase       cb    = GetFederation().ContentBaseForNamespace(topic.Namespace);

            using (TextReader sr = cb.TextReaderForTopic(topic))    {
                ArrayList lines = new ArrayList();
                string    line  = null;
                while ((line = sr.ReadLine()) != null)
                {
                    if (line.StartsWith(" "))
                    {
                        lines.Add(line.Trim());
                    }
                }
                return(lines);
            }
#else
            return(new ArrayList());
#endif
        }