示例#1
0
        /// <summary>
        /// 将对象转换为其 XML 表示形式。
        /// </summary>
        /// <param name="writer">对象要序列化为的 <see cref="T:System.Xml.XmlWriter" /> 流。</param>
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString("FileName", FileName);
            writer.WriteElementString("FullName", FullName);
            writer.WriteElementString("Name", Name);
            writer.WriteElementString("Title", Title);
            writer.WriteElementString("Description", Description);
            writer.WriteElementString("Version", Version == null ? string.Empty : Version.ToString());
            writer.WriteElementString("IsExtend", IsExtend.ToString().ToLower());
            writer.WriteElementString("DisableStopAndUninstalled", DisableStopAndUninstalled.ToString().ToLower());
            writer.WriteElementString("ListOrder", ListOrder.ToString());
            writer.WriteElementString("State", State.ToString());
            writer.WriteStartElement("Reference");
            if (Reference != null)
            {
                Reference.ForEach(reference => { writer.WriteElementString("Assembly", reference); });
            }

            writer.WriteEndElement();
            writer.WriteStartElement("AbstractModules");
            if (AbstractModules != null)
            {
                AbstractModules.ForEach(module =>
                {
                    var namespaces = new XmlSerializerNamespaces();
                    namespaces.Add(string.Empty, string.Empty);
                    var xmlSerializer = new XmlSerializer(module.GetType());
                    xmlSerializer.Serialize(writer, module, namespaces);
                });
            }

            writer.WriteEndElement();
        }
示例#2
0
 /// <summary>
 /// List all events. All GET endpoints which return an object list
 /// support cursor based pagination with pagination information
 /// inside a pagination object. This means that to get all objects,
 /// you need to paginate through the results by always using the id
 /// of the last resource in the list as a starting_after parameter
 /// for the next call. To make it easier, the API will construct
 /// the next call into next_uri together with all the currently
 /// used pagination parameters. You know that you have paginated
 /// all the results when the response’s next_uri is empty.
 /// </summary>
 /// <param name="listOrder">Order of the resources in the response. desc (default), asc</param>
 /// <param name="limit">umber of results per call. Accepted values: 0 - 100. Default 25</param>
 /// <param name="startingAfter">A cursor for use in pagination. starting_after is a resource ID that defines your place in the list.</param>
 /// <param name="endingBefore">A cursor for use in pagination. ending_before is a resource ID that defines your place in the list.</param>
 public virtual Task <PagedResponse <Event> > ListEventsAsync(ListOrder?listOrder = null, int?limit = null, string startingAfter = null, string endingBefore = null, CancellationToken cancellationToken = default)
 {
     return(EventsEndpoint
            .SetQueryParam("order", listOrder?.ToString().ToLower())
            .SetQueryParam("limit", limit)
            .SetQueryParam("starting_after", startingAfter)
            .SetQueryParam("ending_before", endingBefore)
            .GetJsonAsync <PagedResponse <Event> >(cancellationToken));
 }