コード例 #1
0
 // Token: 0x0600001B RID: 27 RVA: 0x0000220C File Offset: 0x0000040C
 public string ObjectToXml(object obj, out Exception ex)
 {
     ex = null;
     if (obj == null)
     {
         return(null);
     }
     try
     {
         using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
         {
             XmlSerializer xmlSerializer = new SafeXmlSerializer(obj.GetType());
             xmlSerializer.Serialize(stringWriter, obj);
             return(stringWriter.ToString());
         }
     }
     catch (InvalidOperationException ex2)
     {
         ex = ex2;
     }
     catch (IOException ex3)
     {
         ex = ex3;
     }
     return(null);
 }
コード例 #2
0
            public override void GenerateRequest(string url, string emailAddress, Stream requestStream)
            {
                SafeXmlSerializer      safeXmlSerializer = new SafeXmlSerializer(typeof(AutoDiscoverRequestXML));
                AutoDiscoverRequestXML o = AutoDiscoverRequestXML.NewRequest(emailAddress);

                safeXmlSerializer.Serialize(requestStream, o);
            }
コード例 #3
0
        // Token: 0x060009BF RID: 2495 RVA: 0x00025E50 File Offset: 0x00024050
        internal string Serialize()
        {
            if (this.ImageBase64 == null)
            {
                this.ImageBase64 = string.Empty;
            }
            if (this.EmailText == null)
            {
                this.EmailText = string.Empty;
            }
            if (this.PortalText == null)
            {
                this.PortalText = string.Empty;
            }
            if (this.DisclaimerText == null)
            {
                this.DisclaimerText = string.Empty;
            }
            string result;

            using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
            {
                SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(base.GetType());
                safeXmlSerializer.Serialize(stringWriter, this);
                stringWriter.Flush();
                result = stringWriter.ToString();
            }
            return(result);
        }
コード例 #4
0
        private HttpWebRequest SendRequest(ICredentials credentials)
        {
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(this.url);

            AutoDiscoverClient.AddOutlook14Cookie(httpWebRequest);
            httpWebRequest.Method          = "POST";
            httpWebRequest.ContentType     = "text/xml; charset=utf-8";
            httpWebRequest.Credentials     = credentials;
            httpWebRequest.PreAuthenticate = true;
            httpWebRequest.Headers.Set(HttpRequestHeader.Pragma, "no-cache");
            foreach (string text in this.additionalHeaders.Keys)
            {
                httpWebRequest.Headers.Add(text, this.additionalHeaders[text]);
            }
            httpWebRequest.UserAgent = string.Format("{0}/{1}/{2}", Environment.MachineName, this.componentId, this.emailAddress);
            CertificateValidationManager.SetComponentId(httpWebRequest, this.componentId);
            this.TraceHeaders(httpWebRequest.Headers);
            using (Stream requestStream = httpWebRequest.GetRequestStream())
            {
                SafeXmlSerializer      safeXmlSerializer = new SafeXmlSerializer(typeof(AutoDiscoverRequestXML));
                AutoDiscoverRequestXML o = AutoDiscoverRequestXML.NewRequest(this.emailAddress);
                safeXmlSerializer.Serialize(requestStream, o);
            }
            return(httpWebRequest);
        }
コード例 #5
0
        public XmlElement SerializeToXmlElement()
        {
            XmlDocument xmlDocument = new SafeXmlDocument();

            using (MemoryStream memoryStream = new MemoryStream())
            {
                SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(SharedFolderData));
                safeXmlSerializer.Serialize(memoryStream, this);
                memoryStream.Seek(0L, SeekOrigin.Begin);
                xmlDocument.Load(memoryStream);
            }
            return(xmlDocument.DocumentElement);
        }
コード例 #6
0
        // Token: 0x060001D5 RID: 469 RVA: 0x0000BCF4 File Offset: 0x00009EF4
        public static string ToString <T>(object data)
        {
            XmlWriterSettings settings = new XmlWriterSettings
            {
                Indent             = true,
                OmitXmlDeclaration = true,
                CheckCharacters    = false
            };
            StringBuilder stringBuilder = new StringBuilder();

            using (XmlWriter xmlWriter = XmlWriter.Create(stringBuilder, settings))
            {
                SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(T));
                safeXmlSerializer.Serialize(xmlWriter, data);
            }
            return(stringBuilder.ToString());
        }
コード例 #7
0
        private void OnSerializeCustomSoapHeaders(XmlWriter writer)
        {
            object obj = null;

            if (this.logonType != null)
            {
                obj = EwsHelper.CreateSpecialLogonAuthenticationHeader(this.Mailbox, this.logonType.Value, this.budgetType, this.RequiredServerVersion);
            }
            else if (this.securityAccessToken != null)
            {
                obj = EwsHelper.CreateSerializedSecurityContext(this.Mailbox, this.securityAccessToken);
            }
            if (obj != null)
            {
                SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(obj.GetType());
                safeXmlSerializer.Serialize(writer, obj);
            }
        }
コード例 #8
0
        public override string ToString()
        {
            List <MailboxLocatorType> list = new List <MailboxLocatorType>(this.SlaveMailboxes.Count);

            foreach (IMailboxLocator locator in this.SlaveMailboxes)
            {
                list.Add(EwsAssociationDataConverter.Convert(locator));
            }
            SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(list.GetType());
            string            result;

            using (StringWriter stringWriter = new StringWriter())
            {
                safeXmlSerializer.Serialize(stringWriter, list);
                result = stringWriter.ToString();
            }
            return(result);
        }
コード例 #9
0
        // Token: 0x060001A1 RID: 417 RVA: 0x0000B7BC File Offset: 0x000099BC
        private static void Serialize(Type type, object content, XmlWriter writer)
        {
            SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(type);

            safeXmlSerializer.Serialize(writer, content);
        }