示例#1
0
 public PagingManager(
     WikiInfo wiki, string generator, IEnumerable <PropQueryParameters> propQueryParametersCollection,
     IEnumerable <HttpQueryParameterBase> currentParameters, Dictionary <string, QueryTypeProperties> pageProperties,
     HttpQueryParameter primaryQueryContinue,
     Dictionary <string, HttpQueryParameter> secondaryQueryContinues)
 {
     m_wiki      = wiki;
     m_generator = generator;
     m_propQueryParametersCollection = propQueryParametersCollection;
     m_currentParameters             = currentParameters;
     m_pageProperties          = pageProperties;
     m_primaryQueryContinue    = primaryQueryContinue;
     m_secondaryQueryContinues = secondaryQueryContinues;
 }
示例#2
0
        /// <summary>
        /// Downloads the namespaces for a wiki.
        /// </summary>
        private static IEnumerable <Namespace> GetNamespaces(WikiInfo wiki)
        {
            var queryProcessor = new QueryProcessor <IEnumerable <Namespace> >(
                wiki,
                new QueryTypeProperties <IEnumerable <Namespace> >(
                    "siteinfo", "", QueryType.Meta, null,
                    new TupleList <string, string>
            {
                { "action", "query" }, { "meta", "siteinfo" }, { "siprop", "namespaces" }
            },
                    null, Namespace.Parse));

            return(queryProcessor.ExecuteSingle(QueryParameters.Create <IEnumerable <Namespace> >()));
        }
示例#3
0
 public PagingManager(
     WikiInfo wiki, string generator, IEnumerable<PropQueryParameters> propQueryParametersCollection,
     IEnumerable<Tuple<string, string>> currentParameters, Dictionary<string, QueryTypeProperties> pageProperties,
     Tuple<string, string> primaryQueryContinue,
     Dictionary<string, Tuple<string, string>> secondaryQueryContinues)
 {
     m_wiki = wiki;
     m_generator = generator;
     m_propQueryParametersCollection = propQueryParametersCollection;
     m_currentParameters = currentParameters;
     m_pageProperties = pageProperties;
     m_primaryQueryContinue = primaryQueryContinue;
     m_secondaryQueryContinues = secondaryQueryContinues;
 }
示例#4
0
        public ModulesSource(WikiInfo wiki, string propsDefaultsPath = null)
        {
            Dictionary<string, XElement> propsDefaults = null;
            if (propsDefaultsPath != null)
                propsDefaults =
                    XDocument.Load(propsDefaultsPath).Root.Elements().ToDictionary(e => (string)e.Attribute("name"));

            m_processor = new QueryProcessor<ParamInfo>(
                wiki,
                new QueryTypeProperties<ParamInfo>(
                    "paraminfo", "", null, null,
                    new TupleList<string, string> { { "action", "paraminfo" } },
                    null,
                    e => ParamInfo.Parse(e, propsDefaults)));
        }
示例#5
0
        public PageData(
            WikiInfo wiki, XElement element, Dictionary <string, QueryTypeProperties> pageProperties,
            PagingManager pagingManager)
        {
            m_wiki           = wiki;
            m_pageProperties = pageProperties;
            m_pagingManager  = pagingManager;

            GetOrCreateDataList("info").Add(m_pageProperties["info"].Parser(element, wiki));

            var pageIdAttribute = element.Attribute("pageid");

            if (pageIdAttribute != null)
            {
                PageId = ValueParser.ParseInt64(pageIdAttribute.Value);

                AddData(element);
            }
        }
示例#6
0
 public Downloader(WikiInfo wiki)
 {
     m_wiki = wiki;
 }
示例#7
0
 /// <summary>
 /// Parses a namespace.
 /// </summary>
 public static Namespace ParseNamespace(string value, WikiInfo wiki)
 {
     return wiki.Namespaces[ParseInt32(value)];
 }
示例#8
0
        public Wiki(string baseUri = null, string apiPath = null)
        {
            m_info = new WikiInfo(baseUri, apiPath);

            Query = new QueryAction(m_info);
        }
示例#9
0
 /// <summary>
 /// Creates a <see cref="NamespaceInfo"/> by downloading the namespace information
 /// for a wiki.
 /// </summary>
 public NamespaceInfo(WikiInfo wiki)
     : this(() => GetNamespaces(wiki))
 {
 }
示例#10
0
 public QueryProcessor(WikiInfo wiki, QueryTypeProperties <T> queryTypeProperties)
 {
     m_wiki = wiki;
     m_queryTypeProperties = queryTypeProperties;
 }
示例#11
0
 internal QueryAction(WikiInfo wiki)
 {
     m_wiki = wiki;
 }
 public QueryPageProcessor(WikiInfo wiki)
 {
     m_wiki = wiki;
 }
示例#13
0
 /// <summary>
 /// Parses a namespace.
 /// </summary>
 public static Namespace ParseNamespace(string value, WikiInfo wiki)
 {
     return(wiki.Namespaces[ParseInt32(value)]);
 }