123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System;
- using System.Collections.Generic;
- using System.Xml.Serialization;
- using System.Text;
- namespace COSXML.Model.Tag
- {
- [XmlRoot]
- public sealed class CORSConfiguration
- {
-
-
-
-
- [XmlElement("CORSRule")]
- public List<CORSRule> corsRules;
- public string GetInfo()
- {
- StringBuilder stringBuilder = new StringBuilder("{CORSConfiguration:\n");
- if (corsRules != null)
- {
- foreach (CORSRule corsRule in corsRules)
- {
- if (corsRule != null)
- {
- stringBuilder.Append(corsRule.GetInfo()).Append("\n");
- }
- }
- }
- stringBuilder.Append("}");
- return stringBuilder.ToString();
- }
- public sealed class CORSRule
- {
-
-
-
- [XmlElement("ID")]
- public string id;
-
-
-
- [XmlElement("AllowedOrigin")]
- public List<string> allowedOrigins;
-
-
-
- [XmlElement("AllowedMethod")]
- public List<string> allowedMethods;
-
-
-
- [XmlElement("AllowedHeader")]
- public List<string> allowedHeaders;
-
-
-
- [XmlElement("ExposeHeader")]
- public List<string> exposeHeaders;
-
-
-
- [XmlElement("MaxAgeSeconds")]
- public int maxAgeSeconds;
- public string GetInfo()
- {
- StringBuilder stringBuilder = new StringBuilder("{CORSRule:\n");
- stringBuilder.Append("ID:").Append(id).Append("\n");
- if (allowedOrigins != null)
- {
- foreach (string origin in allowedOrigins)
- {
- if (origin != null)
- {
- stringBuilder.Append("AllowedOrigin:").Append(origin).Append("\n");
- }
- }
- }
- if (allowedMethods != null)
- {
- foreach (string method in allowedMethods)
- {
- if (method != null)
- {
- stringBuilder.Append("AllowedMethod:").Append(method).Append("\n");
- }
- }
- }
- if (allowedHeaders != null)
- {
- foreach (string header in allowedHeaders)
- {
- if (header != null)
- {
- stringBuilder.Append("AllowedHeader:").Append(header).Append("\n");
- }
- }
- }
- if (exposeHeaders != null)
- {
- foreach (string exposeHeader in exposeHeaders)
- {
- if (exposeHeader != null)
- {
- stringBuilder.Append("ExposeHeader:").Append(exposeHeader).Append("\n");
- }
- }
- }
- stringBuilder.Append("MaxAgeSeconds:").Append(maxAgeSeconds).Append("\n");
- stringBuilder.Append("}");
- return stringBuilder.ToString();
- }
- }
- }
- }
|